diff options
author | 2018-09-17 14:56:37 +0000 | |
---|---|---|
committer | 2018-09-17 14:56:37 +0000 | |
commit | 2a8e6c51f70d8aea8ab0b5351f5054af434ce93b (patch) | |
tree | d26aadee843495d1fd844e1e13c1e30b0fdecbeb /sys/kern/vfs_subr.c | |
parent | unveil(2) "path" (/dev/audioctl0 by default, or changed via args) with rw (diff) | |
download | wireguard-openbsd-2a8e6c51f70d8aea8ab0b5351f5054af434ce93b.tar.xz wireguard-openbsd-2a8e6c51f70d8aea8ab0b5351f5054af434ce93b.zip |
Simplify VFS initialization.
Because loadable kernel modules are no longer, there is no need to
register or unregister filesystem implementations at runtime. Remove
vfs_register() and vfs_unregister(), and make vfsinit() call vfs_init
routines directly. Replace the linked list of vfsconf structs with
the vfsconflist[] array.
OK mpi@ bluhm@
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 69 |
1 files changed, 1 insertions, 68 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 997b636d009..1e1ed6e6ace 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.278 2018/09/16 11:41:44 visa Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.279 2018/09/17 14:56:37 visa Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1329,7 +1329,6 @@ vfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, tmpvfsp = malloc(sizeof(*tmpvfsp), M_TEMP, M_WAITOK|M_ZERO); memcpy(tmpvfsp, vfsp, sizeof(*tmpvfsp)); tmpvfsp->vfc_vfsops = NULL; - tmpvfsp->vfc_next = NULL; ret = sysctl_rdstruct(oldp, oldlenp, newp, tmpvfsp, sizeof(struct vfsconf)); @@ -2112,72 +2111,6 @@ reassignbuf(struct buf *bp) bufinsvn(bp, listheadp); } -int -vfs_register(struct vfsconf *vfs) -{ - struct vfsconf *vfsp; - struct vfsconf **vfspp; - -#ifdef DIAGNOSTIC - /* Paranoia? */ - if (vfs->vfc_refcount != 0) - printf("vfs_register called with vfc_refcount > 0\n"); -#endif - - /* Check if filesystem already known */ - for (vfspp = &vfsconf, vfsp = vfsconf; vfsp; - vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next) - if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0) - return (EEXIST); - - if (vfs->vfc_typenum > maxvfsconf) - maxvfsconf = vfs->vfc_typenum; - - vfs->vfc_next = NULL; - - /* Add to the end of the list */ - *vfspp = vfs; - - /* Call vfs_init() */ - if (vfs->vfc_vfsops->vfs_init) - (*(vfs->vfc_vfsops->vfs_init))(vfs); - - return 0; -} - -int -vfs_unregister(struct vfsconf *vfs) -{ - struct vfsconf *vfsp; - struct vfsconf **vfspp; - int maxtypenum; - - /* Find our vfsconf struct */ - for (vfspp = &vfsconf, vfsp = vfsconf; vfsp; - vfspp = &vfsp->vfc_next, vfsp = vfsp->vfc_next) { - if (strcmp(vfsp->vfc_name, vfs->vfc_name) == 0) - break; - } - - if (!vfsp) /* Not found */ - return (ENOENT); - - if (vfsp->vfc_refcount) /* In use */ - return (EBUSY); - - /* Remove from list and free */ - *vfspp = vfsp->vfc_next; - - maxtypenum = 0; - - for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next) - if (vfsp->vfc_typenum > maxtypenum) - maxtypenum = vfsp->vfc_typenum; - - maxvfsconf = maxtypenum; - return 0; -} - /* * Check if vnode represents a disk device */ |