Subject: changing vfs_getnewfsid?
To: None <tech-kern@netbsd.org>
From: Assar Westerlund <assar@sics.se>
List: tech-kern
Date: 06/10/2000 09:28:32
Morning, tech-kern.

I would like to change the type of `vfs_getnewfsid' from the current:

void	vfs_getnewfsid __P((struct mount *, char *));

To

void	vfs_getnewfsid __P((struct mount *));

since everywhere where it's called it's always passed
`mp->mnt_op->vfs_name' as the second argument.  Full patch included at
the end.  Any objects/comments/X?

/assar

Index: kern/vfs_subr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/vfs_subr.c,v
retrieving revision 1.126
diff -u -w -r1.126 vfs_subr.c
--- vfs_subr.c	2000/05/28 04:13:56	1.126
+++ vfs_subr.c	2000/06/10 07:18:23
@@ -326,16 +326,15 @@
  * Get a new unique fsid
  */
 void
-vfs_getnewfsid(mp, fstypename)
+vfs_getnewfsid(mp)
 	struct mount *mp;
-	char *fstypename;
 {
 	static u_short xxxfs_mntid;
 	fsid_t tfsid;
 	int mtype;
 
 	simple_lock(&mntid_slock);
-	mtype = makefstype(fstypename);
+	mtype = makefstype(mp->mnt_op->vfs_name);
 	mp->mnt_stat.f_fsid.val[0] = makedev(nblkdev + mtype, 0);
 	mp->mnt_stat.f_fsid.val[1] = mtype;
 	if (xxxfs_mntid == 0)
@@ -357,7 +356,7 @@
  */
 long
 makefstype(type)
-	char *type;
+	const char *type;
 {
 	long rv;
 
Index: miscfs/fdesc/fdesc_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/fdesc/fdesc_vfsops.c,v
retrieving revision 1.30
diff -u -w -r1.30 fdesc_vfsops.c
--- fdesc_vfsops.c	2000/03/30 02:16:22	1.30
+++ fdesc_vfsops.c	2000/06/10 07:18:24
@@ -110,7 +110,7 @@
 	fmp->f_root = rvp;
 	mp->mnt_flag |= MNT_LOCAL;
 	mp->mnt_data = (qaddr_t)fmp;
-	vfs_getnewfsid(mp, MOUNT_FDESC);
+	vfs_getnewfsid(mp);
 
 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
 	memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
Index: miscfs/kernfs/kernfs_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/kernfs/kernfs_vfsops.c,v
retrieving revision 1.36
diff -u -w -r1.36 kernfs_vfsops.c
--- kernfs_vfsops.c	2000/03/16 18:08:25	1.36
+++ kernfs_vfsops.c	2000/06/10 07:18:24
@@ -154,7 +154,7 @@
 	fmp->kf_root = rvp;
 	mp->mnt_flag |= MNT_LOCAL;
 	mp->mnt_data = (qaddr_t)fmp;
-	vfs_getnewfsid(mp, MOUNT_KERNFS);
+	vfs_getnewfsid(mp);
 
 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
 	memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
Index: miscfs/nullfs/null_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/nullfs/null_vfsops.c,v
retrieving revision 1.26
diff -u -w -r1.26 null_vfsops.c
--- null_vfsops.c	2000/03/16 19:00:26	1.26
+++ null_vfsops.c	2000/06/10 07:18:25
@@ -168,7 +168,7 @@
 	 * Make sure that the mount point is sufficiently initialized
 	 * that the node create call will work.
 	 */
-	vfs_getnewfsid(mp, MOUNT_NULL);
+	vfs_getnewfsid(mp);
 
 	nmp->nullm_size = sizeof (struct null_node);
 	nmp->nullm_tag = VT_NULL;
Index: miscfs/overlay/overlay_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/overlay/overlay_vfsops.c,v
retrieving revision 1.3
diff -u -w -r1.3 overlay_vfsops.c
--- overlay_vfsops.c	2000/03/16 18:08:25	1.3
+++ overlay_vfsops.c	2000/06/10 07:18:25
@@ -159,7 +159,7 @@
 	 * Make sure that the mount point is sufficiently initialized
 	 * that the node create call will work.
 	 */
-	vfs_getnewfsid(mp, MOUNT_OVERLAY);
+	vfs_getnewfsid(mp);
 
 	nmp->ovm_size = sizeof (struct overlay_node);
 	nmp->ovm_tag = VT_OVERLAY;
Index: miscfs/portal/portal_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/portal/portal_vfsops.c,v
retrieving revision 1.23
diff -u -w -r1.23 portal_vfsops.c
--- portal_vfsops.c	2000/03/16 18:08:25	1.23
+++ portal_vfsops.c	2000/06/10 07:18:25
@@ -150,7 +150,7 @@
 
 	mp->mnt_flag |= MNT_LOCAL;
 	mp->mnt_data = (qaddr_t)fmp;
-	vfs_getnewfsid(mp, MOUNT_PORTAL);
+	vfs_getnewfsid(mp);
 
 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
 	memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
Index: miscfs/procfs/procfs_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/procfs/procfs_vfsops.c,v
retrieving revision 1.33
diff -u -w -r1.33 procfs_vfsops.c
--- procfs_vfsops.c	2000/03/16 18:08:27	1.33
+++ procfs_vfsops.c	2000/06/10 07:18:25
@@ -108,7 +108,7 @@
 	    M_UFSMNT, M_WAITOK);   /* XXX need new malloc type */
 
 	mp->mnt_data = (qaddr_t)pmnt;
-	vfs_getnewfsid(mp, MOUNT_PROCFS);
+	vfs_getnewfsid(mp);
 
 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN, &size);
 	memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
Index: miscfs/umapfs/umap_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/umapfs/umap_vfsops.c,v
retrieving revision 1.24
diff -u -w -r1.24 umap_vfsops.c
--- umap_vfsops.c	2000/03/16 19:00:26	1.24
+++ umap_vfsops.c	2000/06/10 07:18:25
@@ -181,7 +181,7 @@
 	 * Make sure the mount point's sufficiently initialized
 	 * that the node create call will work.
 	 */
-	vfs_getnewfsid(mp, MOUNT_UMAP);
+	vfs_getnewfsid(mp);
 	amp->umapm_size = sizeof(struct umap_node);
 	amp->umapm_tag = VT_UMAP;
 	amp->umapm_bypass = umap_bypass;
Index: miscfs/union/union_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/union/union_vfsops.c,v
retrieving revision 1.24
diff -u -w -r1.24 union_vfsops.c
--- union_vfsops.c	2000/03/16 18:08:27	1.24
+++ union_vfsops.c	2000/06/10 07:18:26
@@ -216,7 +216,7 @@
 	mp->mnt_flag |= (um->um_uppervp->v_mount->mnt_flag & MNT_RDONLY);
 
 	mp->mnt_data = (qaddr_t)um;
-	vfs_getnewfsid(mp, MOUNT_UNION);
+	vfs_getnewfsid(mp);
 
 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
 	memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
Index: nfs/nfs_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.90
diff -u -w -r1.90 nfs_vfsops.c
--- nfs_vfsops.c	2000/05/07 01:38:36	1.90
+++ nfs_vfsops.c	2000/06/10 07:18:26
@@ -636,7 +636,7 @@
 		TAILQ_INIT(&nmp->nm_uidlruhead);
 		TAILQ_INIT(&nmp->nm_bufq);
 	}
-	vfs_getnewfsid(mp, MOUNT_NFS);
+	vfs_getnewfsid(mp);
 	nmp->nm_mountp = mp;
 
 	if (argp->flags & NFSMNT_NQNFS)
Index: sys/mount.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/mount.h,v
retrieving revision 1.83
diff -u -w -r1.83 mount.h
--- mount.h	2000/05/03 14:53:15	1.83
+++ mount.h	2000/06/10 07:18:26
@@ -438,7 +438,7 @@
 extern	struct nfs_public nfs_pub;
 extern	struct simplelock mountlist_slock;
 extern	struct simplelock spechash_slock;
-long	makefstype __P((char *));
+long	makefstype __P((const char *));
 int	dounmount __P((struct mount *, int, struct proc *));
 void	vfsinit __P((void));
 void	vfs_opv_init __P((struct vnodeopv_desc **));
Index: sys/vnode.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/vnode.h,v
retrieving revision 1.76
diff -u -w -r1.76 vnode.h
--- vnode.h	2000/05/28 04:13:57	1.76
+++ vnode.h	2000/06/10 07:18:27
@@ -488,7 +488,7 @@
 int 	getnewvnode __P((enum vtagtype tag, struct mount *mp,
 			 int (**vops) __P((void *)), struct vnode **vpp));
 int	getvnode __P((struct filedesc *fdp, int fd, struct file **fpp));
-void	vfs_getnewfsid __P((struct mount *, char *));
+void	vfs_getnewfsid __P((struct mount *));
 int	speedup_syncer __P((void));
 void 	vattr_null __P((struct vattr *vap));
 int 	vcount __P((struct vnode *vp));