Index: kern/vfs_subr.c =================================================================== --- kern/vfs_subr.c (revision 196616) +++ kern/vfs_subr.c (working copy) @@ -112,9 +112,18 @@ static void vfs_knlunlock(void *arg); static void vfs_knl_assert_locked(void *arg); static void vfs_knl_assert_unlocked(void *arg); +static int vfs_modload(module_t mod, int cmd, void *arg); static void destroy_vpollinfo(struct vpollinfo *vi); /* + * VFS module handling methods. + */ +static moduledata_t vfs_moduledata = { "vfs", vfs_modload, NULL }; + +DECLARE_MODULE(vfs, vfs_moduledata, SI_SUB_VFS, SI_ORDER_FIRST); +MODULE_VERSION(vfs, 1); + +/* * Number of vnodes in existence. Increased whenever getnewvnode() * allocates a new vnode, decreased on vdestroy() called on VI_DOOMed * vnode. @@ -283,7 +292,7 @@ #define MAXVNODES_MAX 100000 #endif static void -vntblinit(void *dummy __unused) +vntblinit(void) { /* @@ -320,9 +329,28 @@ mtx_init(&sync_mtx, "Syncer mtx", NULL, MTX_DEF); cv_init(&sync_wakeup, "syncer"); } -SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, vntblinit, NULL); +static int +vfs_modload(module_t mod, int cmd, void *arg) +{ + int error; + error = 0; + switch (cmd) { + case MOD_LOAD: + vntblinit(); + break; + case MOD_UNLOAD: + case MOD_SHUTDOWN: + case MOD_QUIESCE: + error = EOPNOTSUPP; + break; + default: + error = EINVAL; + } + return (error); +} + /* * Mark a mount point as busy. Used to synchronize access and to delay * unmounting. Eventually, mountlist_mtx is not released on failure.