added getnewfsid: global fsid allocator.
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Wed, 3 Jun 1992 15:15:32 +0000 (07:15 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Wed, 3 Jun 1992 15:15:32 +0000 (07:15 -0800)
SCCS-vsn: sys/kern/vfs_subr.c 7.78

usr/src/sys/kern/vfs_subr.c

index 47dd11a..aea0a38 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vfs_subr.c  7.77 (Berkeley) %G%
+ *     @(#)vfs_subr.c  7.78 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -12,6 +12,7 @@
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/mount.h>
 #include <sys/time.h>
 #include <sys/proc.h>
 #include <sys/mount.h>
 #include <sys/time.h>
@@ -139,6 +140,31 @@ getvfs(fsid)
        return ((struct mount *)0);
 }
 
        return ((struct mount *)0);
 }
 
+/*
+ * Get a new unique fsid
+ */
+void
+getnewfsid(mp, mtype)
+       struct mount *mp;
+       int mtype;
+{
+static u_short xxxfs_mntid;
+
+       fsid_t tfsid;
+
+       mp->mnt_stat.f_fsid.val[0] = makedev(nblkdev + 11, 0);  /* XXX */
+       mp->mnt_stat.f_fsid.val[1] = mtype;
+       if (xxxfs_mntid == 0)
+               ++xxxfs_mntid;
+       tfsid.val[0] = makedev(nblkdev, xxxfs_mntid);
+       tfsid.val[1] = mtype;
+       while (getvfs(&tfsid)) {
+               tfsid.val[0]++;
+               xxxfs_mntid++;
+       }
+       mp->mnt_stat.f_fsid.val[0] = tfsid.val[0];
+}
+
 /*
  * Set vnode attributes to VNOVAL
  */
 /*
  * Set vnode attributes to VNOVAL
  */