Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Replace macro v_specmountpoint with two functions spec_n...



details:   https://anonhg.NetBSD.org/src/rev/c39ffc9282d4
branches:  trunk
changeset: 790271:c39ffc9282d4
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Sep 30 18:57:59 2013 +0000

description:
Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland%netbsd.org@localhost>

diffstat:

 sys/fs/adosfs/advfsops.c            |   6 +++---
 sys/fs/cd9660/cd9660_vfsops.c       |   8 ++++----
 sys/fs/filecorefs/filecore_vfsops.c |   6 +++---
 sys/fs/msdosfs/msdosfs_vfsops.c     |   8 ++++----
 sys/fs/nilfs/nilfs_vfsops.c         |  14 +++++++-------
 sys/fs/ntfs/ntfs_vfsops.c           |  10 +++++-----
 sys/fs/udf/udf_vfsops.c             |  11 ++++-------
 sys/kern/vfs_bio.c                  |   8 ++++----
 sys/kern/vfs_mount.c                |   8 ++++----
 sys/kern/vfs_subr.c                 |   6 +++---
 sys/kern/vfs_trans.c                |   6 +++---
 sys/miscfs/specfs/spec_vnops.c      |  35 +++++++++++++++++++++++++++++++----
 sys/miscfs/specfs/specdev.h         |   5 +++--
 sys/sys/param.h                     |   4 ++--
 sys/sys/wapbl.h                     |   4 ++--
 sys/ufs/chfs/chfs_vfsops.c          |   6 +++---
 sys/ufs/ext2fs/ext2fs_vfsops.c      |   8 ++++----
 sys/ufs/ffs/ffs_alloc.c             |   8 ++++----
 sys/ufs/ffs/ffs_snapshot.c          |  12 ++++++------
 sys/ufs/ffs/ffs_vfsops.c            |  14 +++++++-------
 sys/ufs/lfs/lfs_vfsops.c            |   8 ++++----
 21 files changed, 110 insertions(+), 85 deletions(-)

diffs (truncated from 766 to 300 lines):

diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/adosfs/advfsops.c
--- a/sys/fs/adosfs/advfsops.c  Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/adosfs/advfsops.c  Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advfsops.c,v 1.66 2012/12/20 08:03:41 hannken Exp $    */
+/*     $NetBSD: advfsops.c,v 1.67 2013/09/30 18:57:59 hannken Exp $    */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.66 2012/12/20 08:03:41 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.67 2013/09/30 18:57:59 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -319,7 +319,7 @@
                return (error);
        amp = VFSTOADOSFS(mp);
        if (amp->devvp->v_type != VBAD)
-               amp->devvp->v_specmountpoint = NULL;
+               spec_node_setmountedfs(amp->devvp, NULL);
        vn_lock(amp->devvp, LK_EXCLUSIVE | LK_RETRY);
        error = VOP_CLOSE(amp->devvp, FREAD, NOCRED);
        vput(amp->devvp);
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/cd9660/cd9660_vfsops.c
--- a/sys/fs/cd9660/cd9660_vfsops.c     Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/cd9660/cd9660_vfsops.c     Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.78 2013/06/23 07:28:36 dholland Exp $      */
+/*     $NetBSD: cd9660_vfsops.c,v 1.79 2013/09/30 18:57:59 hannken Exp $       */
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.78 2013/06/23 07:28:36 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.79 2013/09/30 18:57:59 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -523,7 +523,7 @@
                supbp = NULL;
        }
 
-       devvp->v_specmountpoint = mp;
+       spec_node_setmountedfs(devvp, mp);
 
        return 0;
 out:
@@ -568,7 +568,7 @@
        isomp = VFSTOISOFS(mp);
 
        if (isomp->im_devvp->v_type != VBAD)
-               isomp->im_devvp->v_specmountpoint = NULL;
+               spec_node_setmountedfs(isomp->im_devvp, NULL);
 
        vn_lock(isomp->im_devvp, LK_EXCLUSIVE | LK_RETRY);
        error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED);
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/filecorefs/filecore_vfsops.c
--- a/sys/fs/filecorefs/filecore_vfsops.c       Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/filecorefs/filecore_vfsops.c       Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vfsops.c,v 1.70 2012/12/20 08:03:42 hannken Exp $     */
+/*     $NetBSD: filecore_vfsops.c,v 1.71 2013/09/30 18:57:59 hannken Exp $     */
 
 /*-
  * Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.70 2012/12/20 08:03:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.71 2013/09/30 18:57:59 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -456,7 +456,7 @@
        fcmp = VFSTOFILECORE(mp);
 
        if (fcmp->fc_devvp->v_type != VBAD)
-               fcmp->fc_devvp->v_specmountpoint = NULL;
+               spec_node_setmountedfs(fcmp->fc_devvp, NULL);
        vn_lock(fcmp->fc_devvp, LK_EXCLUSIVE | LK_RETRY);
        error = VOP_CLOSE(fcmp->fc_devvp, FREAD, NOCRED);
        vput(fcmp->fc_devvp);
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.101 2013/04/15 14:10:59 jakllsch Exp $    */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.102 2013/09/30 18:57:59 hannken Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.101 2013/04/15 14:10:59 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.102 2013/09/30 18:57:59 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -836,7 +836,7 @@
         * in the directory entry where we could put uid's and gid's.
         */
 
-       devvp->v_specmountpoint = mp;
+       spec_node_setmountedfs(devvp, mp);
 
        return (0);
 
@@ -876,7 +876,7 @@
                return (error);
        pmp = VFSTOMSDOSFS(mp);
        if (pmp->pm_devvp->v_type != VBAD)
-               pmp->pm_devvp->v_specmountpoint = NULL;
+               spec_node_setmountedfs(pmp->pm_devvp, NULL);
 #ifdef MSDOSFS_DEBUG
        {
                struct vnode *vp = pmp->pm_devvp;
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/nilfs/nilfs_vfsops.c
--- a/sys/fs/nilfs/nilfs_vfsops.c       Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/nilfs/nilfs_vfsops.c       Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vfsops.c,v 1.10 2012/12/20 08:03:43 hannken Exp $ */
+/* $NetBSD: nilfs_vfsops.c,v 1.11 2013/09/30 18:57:59 hannken Exp $ */
 
 /*
  * Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.10 2012/12/20 08:03:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.11 2013/09/30 18:57:59 hannken Exp $");
 #endif /* not lint */
 
 
@@ -506,7 +506,7 @@
        DPRINTF(VOLUMES, ("closing device\n"));
 
        /* remove our mount reference before closing device */
-       nilfsdev->devvp->v_specmountpoint = NULL;
+       spec_node_setmountedfs(nilfsdev->devvp, NULL);
 
        /* devvp is still locked by us */
        vn_lock(nilfsdev->devvp, LK_EXCLUSIVE | LK_RETRY);
@@ -895,12 +895,12 @@
 #endif
 
        /* DONT register our nilfs mountpoint on our vfs mountpoint */
-       devvp->v_specmountpoint = NULL;
+       spec_node_setmountedfs(devvp, NULL);
 #if 0
-       if (devvp->v_specmountpoint == NULL)
-               devvp->v_specmountpoint = mp;
+       if (spec_node_getmountedfs(devvp) == NULL)
+               spec_node_setmountedfs(devvp, mp);
        if ((mp->mnt_flag & MNT_RDONLY) == 0)
-               devvp->v_specmountpoint = mp;
+               spec_node_setmountedfs(devvp, mp);
 #endif
 
        /* add our mountpoint */
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/ntfs/ntfs_vfsops.c
--- a/sys/fs/ntfs/ntfs_vfsops.c Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/ntfs/ntfs_vfsops.c Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntfs_vfsops.c,v 1.87 2011/11/14 18:35:13 hannken Exp $ */
+/*     $NetBSD: ntfs_vfsops.c,v 1.88 2013/09/30 18:58:00 hannken Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.87 2011/11/14 18:35:13 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.88 2013/09/30 18:58:00 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -455,7 +455,7 @@
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
        mp->mnt_stat.f_namemax = NTFS_MAXFILENAME;
        mp->mnt_flag |= MNT_LOCAL;
-       devvp->v_specmountpoint = mp;
+       spec_node_setmountedfs(devvp, mp);
        return (0);
 
 out1:
@@ -466,7 +466,7 @@
                dprintf(("ntfs_mountfs: vflush failed\n"));
        }
 out:
-       devvp->v_specmountpoint = NULL;
+       spec_node_setmountedfs(devvp, NULL);
        if (bp)
                brelse(bp, 0);
 
@@ -532,7 +532,7 @@
         * field is NULL and touching it causes null pointer derefercence.
         */
        if (ntmp->ntm_devvp->v_type != VBAD)
-               ntmp->ntm_devvp->v_specmountpoint = NULL;
+               spec_node_setmountedfs(ntmp->ntm_devvp, NULL);
 
        vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, l, 0, 0);
 
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/fs/udf/udf_vfsops.c
--- a/sys/fs/udf/udf_vfsops.c   Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/fs/udf/udf_vfsops.c   Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.63 2012/03/13 18:40:51 elad Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.64 2013/09/30 18:58:00 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.63 2012/03/13 18:40:51 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.64 2013/09/30 18:58:00 hannken Exp $");
 #endif /* not lint */
 
 
@@ -419,7 +419,7 @@
        }
 
        /* register our mountpoint being on this device */
-       devvp->v_specmountpoint = mp;
+       spec_node_setmountedfs(devvp, mp);
 
        /* successfully mounted */
        DPRINTF(VOLUMES, ("udf_mount() successfull\n"));
@@ -541,7 +541,7 @@
        DPRINTF(VOLUMES, ("device close ok\n"));
 
        /* clear our mount reference and release device node */
-       ump->devvp->v_specmountpoint = NULL;
+       spec_node_setmountedfs(ump->devvp, NULL);
        vput(ump->devvp);
 
        /* free our ump */
@@ -729,9 +729,6 @@
                return error;
        }
 
-       /* do we have to set this? */
-       devvp->v_specmountpoint = mp;
-
        /* success! */
        return 0;
 }
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/kern/vfs_bio.c        Mon Sep 30 18:57:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.246 2013/09/15 15:57:26 martin Exp $     */
+/*     $NetBSD: vfs_bio.c,v 1.247 2013/09/30 18:58:00 hannken Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.246 2013/09/15 15:57:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.247 2013/09/30 18:58:00 hannken Exp $");
 
 #include "opt_bufcache.h"
 
@@ -693,7 +693,7 @@
                brelse(bp, 0);
 
        if (vp->v_type == VBLK)
-               mp = vp->v_specmountpoint;
+               mp = spec_node_getmountedfs(vp);
        else
                mp = vp->v_mount;
 
@@ -800,7 +800,7 @@
        if (vp != NULL) {
                KASSERT(bp->b_objlock == vp->v_interlock);
                if (vp->v_type == VBLK)
-                       mp = vp->v_specmountpoint;
+                       mp = spec_node_getmountedfs(vp);
                else
                        mp = vp->v_mount;
        } else {
diff -r 8a7cf633a335 -r c39ffc9282d4 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Mon Sep 30 16:16:31 2013 +0000
+++ b/sys/kern/vfs_mount.c      Mon Sep 30 18:57:59 2013 +0000



Home | Main Index | Thread Index | Old Index