--- kern/vfs_init.c.sav 2011-06-11 18:58:33.000000000 -0400 +++ kern/vfs_init.c 2011-08-20 20:01:31.000000000 -0400 @@ -54,9 +54,38 @@ static int vfs_unregister(struct vfsconf MALLOC_DEFINE(M_VNODE, "vnodes", "Dynamically allocated vnodes"); /* + * This table assigns static vfc_typenum values for file systems that + * are well known to the system. This avoids the problem of a file system's + * fsid and, therefore, its NFS file handle, from changing based on + * when the file system is loaded into the kernel. + * File system types not in this list will be assigned values based + * on maxvfsconf. + */ +static struct vfstypenums { + char *typename; + int typenum; +} vfstypenums[] = { + { "cd9660", 1 }, + { "ufs", 2 }, + { "procfs", 3 }, + { "devfs", 4 }, + { "msdosfs", 5 }, + { "nfs", 6 }, + { "zfs", 7 }, + { "reiserfs", 8 }, + { "tmpfs", 9 }, + { "hpfs", 10 }, + { "ntfs", 11 }, + { "ext2fs", 12 }, + { "udf", 13 }, + { "xfs", 14 }, + { "", 0 } /* Must be last. */ +}; + +/* * The highest defined VFS number. */ -int maxvfsconf = VFS_GENERIC + 1; +int maxvfsconf = sizeof(vfstypenums) / sizeof(struct vfstypenums); /* * Single-linked list of configured VFSes. @@ -138,6 +167,7 @@ vfs_register(struct vfsconf *vfc) struct sysctl_oid *oidp; struct vfsops *vfsops; static int once; + int i; if (!once) { vattr_null(&va_null); @@ -152,7 +182,18 @@ vfs_register(struct vfsconf *vfc) if (vfs_byname(vfc->vfc_name) != NULL) return EEXIST; - vfc->vfc_typenum = maxvfsconf++; + /* First, search for a match in vfstypenums[]. */ + for (i = 0; vfstypenums[i].typenum != 0; i++) { + if (strncmp(vfstypenums[i].typename, vfc->vfc_name, MFSNAMELEN) + == 0) { + vfc->vfc_typenum = vfstypenums[i].typenum; +printf("fnd %s, %d\n",vfc->vfc_name,vfc->vfc_typenum); + break; + } + } + if (vfstypenums[i].typenum == 0) + /* Not found, so assign it dynamically. */ + vfc->vfc_typenum = maxvfsconf++; TAILQ_INSERT_TAIL(&vfsconf, vfc, vfc_list); /*