aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1994-09-21 03:47:43 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1994-09-21 03:47:43 +0000
commitc901836c143aeb5695c20bb3a7c28d297e5829d3 (patch)
tree1c73df5527fa425afd9acc6b6f44948163165c7b /sys/kern
parent84cc2dc3328a37262a2dcd994aab6c0f479a1dc3 (diff)
downloadsrc-c901836c143aeb5695c20bb3a7c28d297e5829d3.tar.gz
src-c901836c143aeb5695c20bb3a7c28d297e5829d3.zip
Implemented loadable VFS modules, and made most existing filesystems
loadable. (NFS is a notable exception.)
Notes
Notes: svn path=/head/; revision=2946
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_lkm.c65
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/vfs_conf.c218
-rw-r--r--sys/kern/vfs_extattr.c7
-rw-r--r--sys/kern/vfs_init.c103
-rw-r--r--sys/kern/vfs_mount.c218
-rw-r--r--sys/kern/vfs_syscalls.c7
7 files changed, 143 insertions, 479 deletions
diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c
index aa00040f6c90..5b48196cb58e 100644
--- a/sys/kern/kern_lkm.c
+++ b/sys/kern/kern_lkm.c
@@ -561,65 +561,74 @@ _lkm_vfs(lkmtp, cmd)
int cmd;
{
struct lkm_vfs *args = lkmtp->private.lkm_vfs;
+ struct vfsconf *vfc = args->lkm_vfsconf;
+ extern struct vfsconf void_vfsconf;
int i;
int err = 0;
-#if 0
switch(cmd) {
case LKM_E_LOAD:
/* don't load twice! */
if (lkmexists(lkmtp))
return(EEXIST);
- /* make sure there's no VFS in the table with this name */
- for (i = 0; i < nvfssw; i++)
- if (vfssw[i] != (struct vfsops *)0 &&
- strncmp(vfssw[i]->vfs_name,
- args->lkm_vfsops->vfs_name, MFSNAMELEN) == 0)
- return (EEXIST);
-
- /* pick the last available empty slot */
- for (i = nvfssw - 1; i >= 0; i--)
- if (vfssw[i] == (struct vfsops *)0)
- break;
- if (i == -1) { /* or if none, punt */
- err = EINVAL;
- break;
+ for(i = 0; i < MOUNT_MAXTYPE; i++) {
+ if(!strcmp(vfc->vfc_name, vfsconf[i]->vfc_name)) {
+ return EEXIST;
+ }
}
- /*
- * Set up file system
- */
- vfssw[i] = args->lkm_vfsops;
+ if (args->lkm_offset != vfc->vfc_index)
+ return EINVAL;
+
+ i = args->lkm_offset;
+ if (!args->lkm_offset) {
+ for (i = MOUNT_MAXTYPE - 1; i >= 0; i--) {
+ if(vfsconf[i] == &void_vfsconf)
+ break;
+ }
+ }
+ if (i < 0) {
+ return EINVAL;
+ }
+ args->lkm_offset = vfc->vfc_index = i;
+ vfsconf[i] = vfc;
+ vfssw[i] = vfc->vfc_vfsops;
+
+ /* like in vfs_op_init */
+ for(i = 0; args->lkm_vnodeops->ls_items[i]; i++) {
+ struct vnodeopv_desc *opv =
+ (struct vnodeopv_desc *)args->lkm_vnodeops->ls_items[i];
+ *(opv->opv_desc_vector_p) = NULL;
+ }
+ vfs_opv_init((struct vnodeopv_desc **)args->lkm_vnodeops->ls_items);
/*
* Call init function for this VFS...
*/
- (*(vfssw[i]->vfs_init))();
+ (*(vfssw[vfc->vfc_index]->vfs_init))();
/* done! */
args->lkm_offset = i; /* slot in vfssw[] */
break;
case LKM_E_UNLOAD:
-#ifdef notyet
/* current slot... */
i = args->lkm_offset;
+ if (vfsconf[i]->vfc_refcount) {
+ return EBUSY;
+ }
+
/* replace current slot contents with old contents */
vfssw[i] = (struct vfsops *)0;
-#else
- /* it's not safe to remove a vfs */
- err = EBUSY;
-#endif
+ vfsconf[i] = &void_vfsconf;
+
break;
case LKM_E_STAT: /* no special handling... */
break;
}
-#else
- err = EINVAL;
-#endif
return(err);
}
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 305aa24c92bc..3be84d85a26e 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
- * $Id: kern_sysctl.c,v 1.12 1994/09/18 20:39:48 wollman Exp $
+ * $Id: kern_sysctl.c,v 1.13 1994/09/19 21:07:00 ache Exp $
*/
/*
@@ -120,11 +120,9 @@ __sysctl(p, uap, retval)
case CTL_NET:
fn = net_sysctl;
break;
-#ifdef notyet
case CTL_FS:
fn = fs_sysctl;
break;
-#endif
case CTL_MACHDEP:
fn = cpu_sysctl;
break;
diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c
index 34803332363e..6e1eb1d7ec1f 100644
--- a/sys/kern/vfs_conf.c
+++ b/sys/kern/vfs_conf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.3 1994/08/20 16:03:12 davidg Exp $
+ * $Id: vfs_conf.c,v 1.4 1994/09/19 15:41:13 dfr Exp $
*/
#include <sys/param.h>
@@ -50,219 +50,3 @@ int (*mountroot)() = ffs_mountroot;
struct vnode *rootvnode;
-/*
- * Set up the filesystem operations for vnodes.
- * The types are defined in mount.h.
- */
-#ifdef FFS
-extern struct vfsops ufs_vfsops;
-#define UFS_VFSOPS &ufs_vfsops
-#else
-#define UFS_VFSOPS NULL
-#endif
-
-#ifdef LFS
-extern struct vfsops lfs_vfsops;
-#define LFS_VFSOPS &lfs_vfsops
-#else
-#define LFS_VFSOPS NULL
-#endif
-
-#ifdef MFS
-extern struct vfsops mfs_vfsops;
-#define MFS_VFSOPS &mfs_vfsops
-#else
-#define MFS_VFSOPS NULL
-#endif
-
-#ifdef NFS
-extern struct vfsops nfs_vfsops;
-#define NFS_VFSOPS &nfs_vfsops
-#else
-#define NFS_VFSOPS NULL
-#endif
-
-#ifdef FDESC
-extern struct vfsops fdesc_vfsops;
-#define FDESC_VFSOPS &fdesc_vfsops
-#else
-#define FDESC_VFSOPS NULL
-#endif
-
-#ifdef PORTAL
-extern struct vfsops portal_vfsops;
-#define PORTAL_VFSOPS &portal_vfsops
-#else
-#define PORTAL_VFSOPS NULL
-#endif
-
-#ifdef NULLFS
-extern struct vfsops null_vfsops;
-#define NULL_VFSOPS &null_vfsops
-#else
-#define NULL_VFSOPS NULL
-#endif
-
-#ifdef UMAPFS
-extern struct vfsops umap_vfsops;
-#define UMAP_VFSOPS &umap_vfsops
-#else
-#define UMAP_VFSOPS NULL
-#endif
-
-#ifdef KERNFS
-extern struct vfsops kernfs_vfsops;
-#define KERNFS_VFSOPS &kernfs_vfsops
-#else
-#define KERNFS_VFSOPS NULL
-#endif
-
-#ifdef PROCFS
-extern struct vfsops procfs_vfsops;
-#define PROCFS_VFSOPS &procfs_vfsops
-#else
-#define PROCFS_VFSOPS NULL
-#endif
-
-#ifdef AFS
-extern struct vfsops afs_vfsops;
-#define AFS_VFSOPS &afs_vfsops
-#else
-#define AFS_VFSOPS NULL
-#endif
-
-#ifdef CD9660
-extern struct vfsops cd9660_vfsops;
-#define CD9660_VFSOPS &cd9660_vfsops
-#else
-#define CD9660_VFSOPS NULL
-#endif
-
-#ifdef MSDOSFS
-extern struct vfsops msdosfs_vfsops;
-#define MSDOSFS_VFSOPS &msdosfs_vfsops
-#else
-#define MSDOSFS_VFSOPS NULL
-#endif
-
-#ifdef UNION
-extern struct vfsops union_vfsops;
-#define UNION_VFSOPS &union_vfsops
-#else
-#define UNION_VFSOPS NULL
-#endif
-
-struct vfsops *vfssw[] = {
- NULL, /* 0 = MOUNT_NONE */
- UFS_VFSOPS, /* 1 = MOUNT_UFS */
- NFS_VFSOPS, /* 2 = MOUNT_NFS */
- MFS_VFSOPS, /* 3 = MOUNT_MFS */
- MSDOSFS_VFSOPS, /* 4 = MOUNT_MSDOS */
- LFS_VFSOPS, /* 5 = MOUNT_LFS */
- NULL, /* 6 = MOUNT_LOFS */
- FDESC_VFSOPS, /* 7 = MOUNT_FDESC */
- PORTAL_VFSOPS, /* 8 = MOUNT_PORTAL */
- NULL_VFSOPS, /* 9 = MOUNT_NULL */
- UMAP_VFSOPS, /* 10 = MOUNT_UMAP */
- KERNFS_VFSOPS, /* 11 = MOUNT_KERNFS */
- PROCFS_VFSOPS, /* 12 = MOUNT_PROCFS */
- AFS_VFSOPS, /* 13 = MOUNT_AFS */
- CD9660_VFSOPS, /* 14 = MOUNT_CD9660 */
- UNION_VFSOPS, /* 15 = MOUNT_UNION */
- 0
-};
-
-
-/*
- *
- * vfs_opv_descs enumerates the list of vnode classes, each with it's own
- * vnode operation vector. It is consulted at system boot to build operation
- * vectors. It is NULL terminated.
- *
- */
-extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
-extern struct vnodeopv_desc ffs_specop_opv_desc;
-extern struct vnodeopv_desc ffs_fifoop_opv_desc;
-extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc lfs_specop_opv_desc;
-extern struct vnodeopv_desc lfs_fifoop_opv_desc;
-extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc dead_vnodeop_opv_desc;
-extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
-extern struct vnodeopv_desc spec_vnodeop_opv_desc;
-extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
-extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
-extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
-extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
-extern struct vnodeopv_desc portal_vnodeop_opv_desc;
-extern struct vnodeopv_desc null_vnodeop_opv_desc;
-extern struct vnodeopv_desc umap_vnodeop_opv_desc;
-extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
-extern struct vnodeopv_desc cd9660_specop_opv_desc;
-extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
-extern struct vnodeopv_desc msdosfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc union_vnodeop_opv_desc;
-
-struct vnodeopv_desc *vfs_opv_descs[] = {
- &ffs_vnodeop_opv_desc,
- &ffs_specop_opv_desc,
-#ifdef FIFO
- &ffs_fifoop_opv_desc,
-#endif
- &dead_vnodeop_opv_desc,
-#ifdef FIFO
- &fifo_vnodeop_opv_desc,
-#endif
- &spec_vnodeop_opv_desc,
-#ifdef LFS
- &lfs_vnodeop_opv_desc,
- &lfs_specop_opv_desc,
-#ifdef FIFO
- &lfs_fifoop_opv_desc,
-#endif
-#endif
-#ifdef MFS
- &mfs_vnodeop_opv_desc,
-#endif
-#ifdef NFS
- &nfsv2_vnodeop_opv_desc,
- &spec_nfsv2nodeop_opv_desc,
-#ifdef FIFO
- &fifo_nfsv2nodeop_opv_desc,
-#endif
-#endif
-#ifdef FDESC
- &fdesc_vnodeop_opv_desc,
-#endif
-#ifdef PORTAL
- &portal_vnodeop_opv_desc,
-#endif
-#ifdef NULLFS
- &null_vnodeop_opv_desc,
-#endif
-#ifdef UMAPFS
- &umap_vnodeop_opv_desc,
-#endif
-#ifdef KERNFS
- &kernfs_vnodeop_opv_desc,
-#endif
-#ifdef PROCFS
- &procfs_vnodeop_opv_desc,
-#endif
-#ifdef CD9660
- &cd9660_vnodeop_opv_desc,
- &cd9660_specop_opv_desc,
-#ifdef FIFO
- &cd9660_fifoop_opv_desc,
-#endif
-#endif
-#ifdef MSDOSFS
- &msdosfs_vnodeop_opv_desc,
-#endif
-#ifdef UNION
- &union_vnodeop_opv_desc,
-#endif
- NULL
-};
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 6f4d9b0c87b7..93b01911585b 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.5 1994/09/02 04:14:44 davidg Exp $
+ * $Id: vfs_syscalls.c,v 1.6 1994/09/02 10:23:43 davidg Exp $
*/
#include <sys/param.h>
@@ -135,6 +135,7 @@ mount(p, uap, retval)
M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));
mp->mnt_op = vfssw[uap->type];
+ mp->mnt_vfc = vfsconf[uap->type];
if (error = vfs_lock(mp)) {
free((caddr_t)mp, M_MOUNT);
vput(vp);
@@ -148,6 +149,8 @@ mount(p, uap, retval)
}
vp->v_mountedhere = mp;
mp->mnt_vnodecovered = vp;
+ vfsconf[uap->type]->vfc_refcount++;
+
update:
/*
* Set the mount level flags.
@@ -188,6 +191,7 @@ update:
vfs_unlock(mp);
free((caddr_t)mp, M_MOUNT);
vput(vp);
+ vfsconf[uap->type]->vfc_refcount--;
}
return (error);
}
@@ -282,6 +286,7 @@ dounmount(mp, flags, p)
TAILQ_REMOVE(&mountlist, mp, mnt_list);
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
+ mp->mnt_vfc->vfc_refcount--;
if (mp->mnt_vnodelist.lh_first != NULL)
panic("unmount: dangling vnode");
free((caddr_t)mp, M_MOUNT);
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 48aac34dc148..656ae4e67ab6 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -36,12 +36,13 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
- * $Id: vfs_init.c,v 1.3 1994/08/02 07:43:22 davidg Exp $
+ * $Id: vfs_init.c,v 1.4 1994/08/18 22:35:08 wollman Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/mount.h>
#include <sys/time.h>
#include <sys/vnode.h>
@@ -51,6 +52,9 @@
#include <sys/buf.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <vm/vm.h>
+#include <sys/sysctl.h>
/*
* Sigh, such primitive tools are these...
@@ -61,8 +65,15 @@
#define DODEBUG(A)
#endif
-extern struct vnodeopv_desc *vfs_opv_descs[];
- /* a list of lists of vnodeops defns */
+struct vfsconf void_vfsconf;
+
+extern struct linker_set vfs_opv_descs_;
+#define vfs_opv_descs ((struct vnodeopv_desc **)vfs_opv_descs_.ls_items)
+
+extern struct linker_set vfs_set;
+struct vfsops *vfssw[MOUNT_MAXTYPE + 1];
+struct vfsconf *vfsconf[MOUNT_MAXTYPE + 1];
+
extern struct vnodeop_desc *vfs_op_descs[];
/* and the operations they perform */
/*
@@ -73,7 +84,7 @@ extern struct vnodeop_desc *vfs_op_descs[];
*/
int vfs_opv_numops;
-typedef (*PFI)(); /* the standard Pointer to a Function returning an Int */
+typedef int (*PFI)(); /* the standard Pointer to a Function returning an Int */
/*
* A miscellaneous routine.
@@ -103,7 +114,7 @@ vn_default_error()
* that is a(whole)nother story.) This is a feature.
*/
void
-vfs_opv_init()
+vfs_opv_init(struct vnodeopv_desc **them)
{
int i, j, k;
int (***opv_desc_vector_p)();
@@ -113,8 +124,8 @@ vfs_opv_init()
/*
* Allocate the dynamic vectors and fill them in.
*/
- for (i=0; vfs_opv_descs[i]; i++) {
- opv_desc_vector_p = vfs_opv_descs[i]->opv_desc_vector_p;
+ for (i=0; them[i]; i++) {
+ opv_desc_vector_p = them[i]->opv_desc_vector_p;
/*
* Allocate and init the vector, if it needs it.
* Also handle backwards compatibility.
@@ -128,8 +139,8 @@ vfs_opv_init()
opv_desc_vector_p));
}
opv_desc_vector = *opv_desc_vector_p;
- for (j=0; vfs_opv_descs[i]->opv_desc_ops[j].opve_op; j++) {
- opve_descp = &(vfs_opv_descs[i]->opv_desc_ops[j]);
+ for (j=0; them[i]->opv_desc_ops[j].opve_op; j++) {
+ opve_descp = &(them[i]->opv_desc_ops[j]);
/*
* Sanity check: is this operation listed
@@ -168,8 +179,8 @@ vfs_opv_init()
* with their default. (Sigh, an O(n^3) algorithm. I
* could make it better, but that'd be work, and n is small.)
*/
- for (i = 0; vfs_opv_descs[i]; i++) {
- opv_desc_vector = *(vfs_opv_descs[i]->opv_desc_vector_p);
+ for (i = 0; them[i]; i++) {
+ opv_desc_vector = *(them[i]->opv_desc_vector_p);
/*
* Force every operations vector to have a default routine.
*/
@@ -223,8 +234,24 @@ void
vfsinit()
{
struct vfsops **vfsp;
+ struct vfsconf **vfc;
+ int i;
/*
+ * Initialize the VFS switch table
+ */
+ for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
+ vfsconf[i] = &void_vfsconf;
+ }
+
+ vfc = (struct vfsconf **)vfs_set.ls_items;
+ while(*vfc) {
+ vfssw[(**vfc).vfc_index] = (**vfc).vfc_vfsops;
+ vfsconf[(**vfc).vfc_index] = *vfc;
+ vfc++;
+ }
+
+ /*
* Initialize the vnode table
*/
vntblinit();
@@ -236,7 +263,7 @@ vfsinit()
* Build vnode operation vectors.
*/
vfs_op_init();
- vfs_opv_init(); /* finish the job */
+ vfs_opv_init(vfs_opv_descs); /* finish the job */
/*
* Initialize each file system type.
*/
@@ -247,3 +274,55 @@ vfsinit()
(*(*vfsp)->vfs_init)();
}
}
+
+/*
+ * kernel related system variables.
+ */
+int
+fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
+ int *name;
+ u_int namelen;
+ void *oldp;
+ size_t *oldlenp;
+ void *newp;
+ size_t newlen;
+ struct proc *p;
+{
+ int i;
+ int error;
+ int buflen = *oldlenp;
+ caddr_t where = newp, start = newp;
+
+ switch (name[0]) {
+ case FS_VFSCONF:
+ if (namelen != 1) return ENOTDIR;
+
+ if (oldp == NULL) {
+ *oldlenp = (MOUNT_MAXTYPE+1) * sizeof(struct vfsconf);
+ return 0;
+ }
+ if (newp) {
+ return EINVAL;
+ }
+
+ for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
+ if(buflen < sizeof *vfsconf[i]) {
+ *oldlenp = where - start;
+ return ENOMEM;
+ }
+
+ if(error = copyout(vfsconf[i], where,
+ sizeof *vfsconf[i]))
+ return error;
+ where += sizeof *vfsconf[i];
+ buflen -= sizeof *vfsconf[i];
+ }
+ *oldlenp = where - start;
+ return 0;
+
+ default:
+ return (EOPNOTSUPP);
+ }
+ /* NOTREACHED */
+}
+
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 34803332363e..6e1eb1d7ec1f 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.3 1994/08/20 16:03:12 davidg Exp $
+ * $Id: vfs_conf.c,v 1.4 1994/09/19 15:41:13 dfr Exp $
*/
#include <sys/param.h>
@@ -50,219 +50,3 @@ int (*mountroot)() = ffs_mountroot;
struct vnode *rootvnode;
-/*
- * Set up the filesystem operations for vnodes.
- * The types are defined in mount.h.
- */
-#ifdef FFS
-extern struct vfsops ufs_vfsops;
-#define UFS_VFSOPS &ufs_vfsops
-#else
-#define UFS_VFSOPS NULL
-#endif
-
-#ifdef LFS
-extern struct vfsops lfs_vfsops;
-#define LFS_VFSOPS &lfs_vfsops
-#else
-#define LFS_VFSOPS NULL
-#endif
-
-#ifdef MFS
-extern struct vfsops mfs_vfsops;
-#define MFS_VFSOPS &mfs_vfsops
-#else
-#define MFS_VFSOPS NULL
-#endif
-
-#ifdef NFS
-extern struct vfsops nfs_vfsops;
-#define NFS_VFSOPS &nfs_vfsops
-#else
-#define NFS_VFSOPS NULL
-#endif
-
-#ifdef FDESC
-extern struct vfsops fdesc_vfsops;
-#define FDESC_VFSOPS &fdesc_vfsops
-#else
-#define FDESC_VFSOPS NULL
-#endif
-
-#ifdef PORTAL
-extern struct vfsops portal_vfsops;
-#define PORTAL_VFSOPS &portal_vfsops
-#else
-#define PORTAL_VFSOPS NULL
-#endif
-
-#ifdef NULLFS
-extern struct vfsops null_vfsops;
-#define NULL_VFSOPS &null_vfsops
-#else
-#define NULL_VFSOPS NULL
-#endif
-
-#ifdef UMAPFS
-extern struct vfsops umap_vfsops;
-#define UMAP_VFSOPS &umap_vfsops
-#else
-#define UMAP_VFSOPS NULL
-#endif
-
-#ifdef KERNFS
-extern struct vfsops kernfs_vfsops;
-#define KERNFS_VFSOPS &kernfs_vfsops
-#else
-#define KERNFS_VFSOPS NULL
-#endif
-
-#ifdef PROCFS
-extern struct vfsops procfs_vfsops;
-#define PROCFS_VFSOPS &procfs_vfsops
-#else
-#define PROCFS_VFSOPS NULL
-#endif
-
-#ifdef AFS
-extern struct vfsops afs_vfsops;
-#define AFS_VFSOPS &afs_vfsops
-#else
-#define AFS_VFSOPS NULL
-#endif
-
-#ifdef CD9660
-extern struct vfsops cd9660_vfsops;
-#define CD9660_VFSOPS &cd9660_vfsops
-#else
-#define CD9660_VFSOPS NULL
-#endif
-
-#ifdef MSDOSFS
-extern struct vfsops msdosfs_vfsops;
-#define MSDOSFS_VFSOPS &msdosfs_vfsops
-#else
-#define MSDOSFS_VFSOPS NULL
-#endif
-
-#ifdef UNION
-extern struct vfsops union_vfsops;
-#define UNION_VFSOPS &union_vfsops
-#else
-#define UNION_VFSOPS NULL
-#endif
-
-struct vfsops *vfssw[] = {
- NULL, /* 0 = MOUNT_NONE */
- UFS_VFSOPS, /* 1 = MOUNT_UFS */
- NFS_VFSOPS, /* 2 = MOUNT_NFS */
- MFS_VFSOPS, /* 3 = MOUNT_MFS */
- MSDOSFS_VFSOPS, /* 4 = MOUNT_MSDOS */
- LFS_VFSOPS, /* 5 = MOUNT_LFS */
- NULL, /* 6 = MOUNT_LOFS */
- FDESC_VFSOPS, /* 7 = MOUNT_FDESC */
- PORTAL_VFSOPS, /* 8 = MOUNT_PORTAL */
- NULL_VFSOPS, /* 9 = MOUNT_NULL */
- UMAP_VFSOPS, /* 10 = MOUNT_UMAP */
- KERNFS_VFSOPS, /* 11 = MOUNT_KERNFS */
- PROCFS_VFSOPS, /* 12 = MOUNT_PROCFS */
- AFS_VFSOPS, /* 13 = MOUNT_AFS */
- CD9660_VFSOPS, /* 14 = MOUNT_CD9660 */
- UNION_VFSOPS, /* 15 = MOUNT_UNION */
- 0
-};
-
-
-/*
- *
- * vfs_opv_descs enumerates the list of vnode classes, each with it's own
- * vnode operation vector. It is consulted at system boot to build operation
- * vectors. It is NULL terminated.
- *
- */
-extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
-extern struct vnodeopv_desc ffs_specop_opv_desc;
-extern struct vnodeopv_desc ffs_fifoop_opv_desc;
-extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc lfs_specop_opv_desc;
-extern struct vnodeopv_desc lfs_fifoop_opv_desc;
-extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc dead_vnodeop_opv_desc;
-extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
-extern struct vnodeopv_desc spec_vnodeop_opv_desc;
-extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
-extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
-extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
-extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
-extern struct vnodeopv_desc portal_vnodeop_opv_desc;
-extern struct vnodeopv_desc null_vnodeop_opv_desc;
-extern struct vnodeopv_desc umap_vnodeop_opv_desc;
-extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
-extern struct vnodeopv_desc cd9660_specop_opv_desc;
-extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
-extern struct vnodeopv_desc msdosfs_vnodeop_opv_desc;
-extern struct vnodeopv_desc union_vnodeop_opv_desc;
-
-struct vnodeopv_desc *vfs_opv_descs[] = {
- &ffs_vnodeop_opv_desc,
- &ffs_specop_opv_desc,
-#ifdef FIFO
- &ffs_fifoop_opv_desc,
-#endif
- &dead_vnodeop_opv_desc,
-#ifdef FIFO
- &fifo_vnodeop_opv_desc,
-#endif
- &spec_vnodeop_opv_desc,
-#ifdef LFS
- &lfs_vnodeop_opv_desc,
- &lfs_specop_opv_desc,
-#ifdef FIFO
- &lfs_fifoop_opv_desc,
-#endif
-#endif
-#ifdef MFS
- &mfs_vnodeop_opv_desc,
-#endif
-#ifdef NFS
- &nfsv2_vnodeop_opv_desc,
- &spec_nfsv2nodeop_opv_desc,
-#ifdef FIFO
- &fifo_nfsv2nodeop_opv_desc,
-#endif
-#endif
-#ifdef FDESC
- &fdesc_vnodeop_opv_desc,
-#endif
-#ifdef PORTAL
- &portal_vnodeop_opv_desc,
-#endif
-#ifdef NULLFS
- &null_vnodeop_opv_desc,
-#endif
-#ifdef UMAPFS
- &umap_vnodeop_opv_desc,
-#endif
-#ifdef KERNFS
- &kernfs_vnodeop_opv_desc,
-#endif
-#ifdef PROCFS
- &procfs_vnodeop_opv_desc,
-#endif
-#ifdef CD9660
- &cd9660_vnodeop_opv_desc,
- &cd9660_specop_opv_desc,
-#ifdef FIFO
- &cd9660_fifoop_opv_desc,
-#endif
-#endif
-#ifdef MSDOSFS
- &msdosfs_vnodeop_opv_desc,
-#endif
-#ifdef UNION
- &union_vnodeop_opv_desc,
-#endif
- NULL
-};
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 6f4d9b0c87b7..93b01911585b 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.5 1994/09/02 04:14:44 davidg Exp $
+ * $Id: vfs_syscalls.c,v 1.6 1994/09/02 10:23:43 davidg Exp $
*/
#include <sys/param.h>
@@ -135,6 +135,7 @@ mount(p, uap, retval)
M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));
mp->mnt_op = vfssw[uap->type];
+ mp->mnt_vfc = vfsconf[uap->type];
if (error = vfs_lock(mp)) {
free((caddr_t)mp, M_MOUNT);
vput(vp);
@@ -148,6 +149,8 @@ mount(p, uap, retval)
}
vp->v_mountedhere = mp;
mp->mnt_vnodecovered = vp;
+ vfsconf[uap->type]->vfc_refcount++;
+
update:
/*
* Set the mount level flags.
@@ -188,6 +191,7 @@ update:
vfs_unlock(mp);
free((caddr_t)mp, M_MOUNT);
vput(vp);
+ vfsconf[uap->type]->vfc_refcount--;
}
return (error);
}
@@ -282,6 +286,7 @@ dounmount(mp, flags, p)
TAILQ_REMOVE(&mountlist, mp, mnt_list);
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
+ mp->mnt_vfc->vfc_refcount--;
if (mp->mnt_vnodelist.lh_first != NULL)
panic("unmount: dangling vnode");
free((caddr_t)mp, M_MOUNT);