From 54fb9dc27a79ed42e64b297c7d22267b518cfcf9 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sat, 5 May 1990 03:57:15 -0800 Subject: [PATCH] mount structure prefixes go from m_ to mnt_ and M_ to MNT_ SCCS-vsn: sys/nfs/nfs_vnops.c 7.37 SCCS-vsn: sys/nfs/nfs_node.c 7.25 SCCS-vsn: sys/nfs/nfs_serv.c 7.18 SCCS-vsn: sys/nfs/nfs_socket.c 7.11 SCCS-vsn: sys/nfs/nfs_subs.c 7.22 SCCS-vsn: sys/nfs/nfs_vfsops.c 7.20 SCCS-vsn: sys/nfs/nfs_syscalls.c 7.13 SCCS-vsn: sys/nfs/nfsmount.h 7.4 SCCS-vsn: sys/sys/mount.h 7.13 SCCS-vsn: sys/kern/kern_acct.c 7.9 SCCS-vsn: sys/kern/kern_exec.c 7.22 SCCS-vsn: sys/miscfs/specfs/spec_vnops.c 7.26 SCCS-vsn: sys/kern/vfs_bio.c 7.27 SCCS-vsn: sys/kern/vfs_cluster.c 7.27 SCCS-vsn: sys/kern/vfs_lookup.c 7.21 SCCS-vsn: sys/kern/vfs_subr.c 7.42 SCCS-vsn: sys/kern/vfs_syscalls.c 7.46 SCCS-vsn: sys/kern/vfs_vnops.c 7.20 SCCS-vsn: sys/deprecated/kdb/kdb_print.c 7.18 --- usr/src/sys/deprecated/kdb/kdb_print.c | 6 +- usr/src/sys/kern/kern_acct.c | 4 +- usr/src/sys/kern/kern_exec.c | 6 +- usr/src/sys/kern/vfs_bio.c | 10 +-- usr/src/sys/kern/vfs_cluster.c | 10 +-- usr/src/sys/kern/vfs_lookup.c | 18 ++-- usr/src/sys/kern/vfs_subr.c | 78 ++++++++--------- usr/src/sys/kern/vfs_syscalls.c | 111 +++++++++++++------------ usr/src/sys/kern/vfs_vnops.c | 4 +- usr/src/sys/miscfs/specfs/spec_vnops.c | 4 +- usr/src/sys/nfs/nfs_node.c | 13 +-- usr/src/sys/nfs/nfs_serv.c | 16 ++-- usr/src/sys/nfs/nfs_socket.c | 14 ++-- usr/src/sys/nfs/nfs_subs.c | 24 +++--- usr/src/sys/nfs/nfs_syscalls.c | 4 +- usr/src/sys/nfs/nfs_vfsops.c | 24 +++--- usr/src/sys/nfs/nfs_vnops.c | 20 ++--- usr/src/sys/nfs/nfsmount.h | 9 +- usr/src/sys/sys/mount.h | 72 ++++++++-------- 19 files changed, 222 insertions(+), 225 deletions(-) diff --git a/usr/src/sys/deprecated/kdb/kdb_print.c b/usr/src/sys/deprecated/kdb/kdb_print.c index 8bb218ba26..e4df5f42d0 100644 --- a/usr/src/sys/deprecated/kdb/kdb_print.c +++ b/usr/src/sys/deprecated/kdb/kdb_print.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kdb_print.c 7.17 (Berkeley) %G% + * @(#)kdb_print.c 7.18 (Berkeley) %G% */ #include "machine/mtpr.h" @@ -235,10 +235,10 @@ kdbprinttrace(modif) kdbprintf("Locked vnodes\n"); mp = rootfs; do { - for (vp = mp->m_mounth; vp; vp = vp->v_mountf) + for (vp = mp->mnt_mounth; vp; vp = vp->v_mountf) if (VOP_ISLOCKED(vp)) vprint((char *)0, vp); - mp = mp->m_next; + mp = mp->mnt_next; } while (mp != rootfs); break; } diff --git a/usr/src/sys/kern/kern_acct.c b/usr/src/sys/kern/kern_acct.c index 02a563289e..f9d376d6c0 100644 --- a/usr/src/sys/kern/kern_acct.c +++ b/usr/src/sys/kern/kern_acct.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)kern_acct.c 7.8 (Berkeley) %G% + * @(#)kern_acct.c 7.9 (Berkeley) %G% */ #include "param.h" @@ -72,7 +72,7 @@ sysacct() vrele(vp); return; } - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { u.u_error = EROFS; vrele(vp); return; diff --git a/usr/src/sys/kern/kern_exec.c b/usr/src/sys/kern/kern_exec.c index 5afa0616ba..8077694d63 100644 --- a/usr/src/sys/kern/kern_exec.c +++ b/usr/src/sys/kern/kern_exec.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)kern_exec.c 7.21 (Berkeley) %G% + * @(#)kern_exec.c 7.22 (Berkeley) %G% */ #include "param.h" @@ -97,11 +97,11 @@ execve() gid = u.u_cred->cr_gid; if (u.u_error = VOP_GETATTR(vp, &vattr, u.u_cred)) goto bad; - if (vp->v_mount->m_flag & M_NOEXEC) { + if (vp->v_mount->mnt_flag & MNT_NOEXEC) { u.u_error = EACCES; goto bad; } - if ((vp->v_mount->m_flag & M_NOSUID) == 0) { + if ((vp->v_mount->mnt_flag & MNT_NOSUID) == 0) { if (vattr.va_mode & VSUID) uid = vattr.va_uid; if (vattr.va_mode & VSGID) diff --git a/usr/src/sys/kern/vfs_bio.c b/usr/src/sys/kern/vfs_bio.c index d748ec8fa4..ffb0a5774d 100644 --- a/usr/src/sys/kern/vfs_bio.c +++ b/usr/src/sys/kern/vfs_bio.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_bio.c 7.26 (Berkeley) %G% + * @(#)vfs_bio.c 7.27 (Berkeley) %G% */ #include "param.h" @@ -573,10 +573,10 @@ mntflushbuf(mountp, flags) register struct vnode *vp; struct vnode *nvp; - if ((mountp->m_flag & M_MPBUSY) == 0) + if ((mountp->mnt_flag & MNT_MPBUSY) == 0) panic("mntflushbuf: not busy"); loop: - for (vp = mountp->m_mounth; vp; vp = nvp) { + for (vp = mountp->mnt_mounth; vp; vp = nvp) { nvp = vp->v_mountf; if (vget(vp)) goto loop; @@ -652,10 +652,10 @@ mntinvalbuf(mountp) struct vnode *nvp; int dirty = 0; - if ((mountp->m_flag & M_MPBUSY) == 0) + if ((mountp->mnt_flag & MNT_MPBUSY) == 0) panic("mntinvalbuf: not busy"); loop: - for (vp = mountp->m_mounth; vp; vp = nvp) { + for (vp = mountp->mnt_mounth; vp; vp = nvp) { nvp = vp->v_mountf; if (vget(vp)) goto loop; diff --git a/usr/src/sys/kern/vfs_cluster.c b/usr/src/sys/kern/vfs_cluster.c index 3c48beb299..d9e6ff160e 100644 --- a/usr/src/sys/kern/vfs_cluster.c +++ b/usr/src/sys/kern/vfs_cluster.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_cluster.c 7.26 (Berkeley) %G% + * @(#)vfs_cluster.c 7.27 (Berkeley) %G% */ #include "param.h" @@ -573,10 +573,10 @@ mntflushbuf(mountp, flags) register struct vnode *vp; struct vnode *nvp; - if ((mountp->m_flag & M_MPBUSY) == 0) + if ((mountp->mnt_flag & MNT_MPBUSY) == 0) panic("mntflushbuf: not busy"); loop: - for (vp = mountp->m_mounth; vp; vp = nvp) { + for (vp = mountp->mnt_mounth; vp; vp = nvp) { nvp = vp->v_mountf; if (vget(vp)) goto loop; @@ -652,10 +652,10 @@ mntinvalbuf(mountp) struct vnode *nvp; int dirty = 0; - if ((mountp->m_flag & M_MPBUSY) == 0) + if ((mountp->mnt_flag & MNT_MPBUSY) == 0) panic("mntinvalbuf: not busy"); loop: - for (vp = mountp->m_mounth; vp; vp = nvp) { + for (vp = mountp->mnt_mounth; vp; vp = nvp) { nvp = vp->v_mountf; if (vget(vp)) goto loop; diff --git a/usr/src/sys/kern/vfs_lookup.c b/usr/src/sys/kern/vfs_lookup.c index 852a839778..ec47d44dd3 100644 --- a/usr/src/sys/kern/vfs_lookup.c +++ b/usr/src/sys/kern/vfs_lookup.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_lookup.c 7.20 (Berkeley) %G% + * @(#)vfs_lookup.c 7.21 (Berkeley) %G% */ #include "param.h" @@ -98,9 +98,9 @@ namei(ndp) getbuf = (ndp->ni_nameiop & HASBUF) ^ HASBUF; if (flag == DELETE || wantparent) docache = 0; - rdonly = M_RDONLY; + rdonly = MNT_RDONLY; if (ndp->ni_nameiop & REMOTE) - rdonly |= M_EXRDONLY; + rdonly |= MNT_EXRDONLY; /* * Get a buffer for the name to be translated, and copy the * name into the buffer. @@ -231,7 +231,7 @@ dirloop: (ndp->ni_nameiop & NOCROSSMOUNT)) break; tdp = dp; - dp = dp->v_mount->m_vnodecovered; + dp = dp->v_mount->mnt_vnodecovered; vput(tdp); VREF(dp); VOP_LOCK(dp); @@ -254,7 +254,7 @@ dirloop: * If creating and at end of pathname, then can consider * allowing file to be created. */ - if (ndp->ni_dvp->v_mount->m_flag & rdonly) { + if (ndp->ni_dvp->v_mount->mnt_flag & rdonly) { error = EROFS; goto bad; } @@ -333,8 +333,8 @@ dirloop: mntloop: while (dp->v_type == VDIR && (mp = dp->v_mountedhere) && (ndp->ni_nameiop & NOCROSSMOUNT) == 0) { - while(mp->m_flag & M_MLOCK) { - mp->m_flag |= M_MWAIT; + while(mp->mnt_flag & MNT_MLOCK) { + mp->mnt_flag |= MNT_MWAIT; sleep((caddr_t)mp, PVFS); goto mntloop; } @@ -367,8 +367,8 @@ nextname: * Disallow directory write attempts on read-only * file systems. */ - if ((dp->v_mount->m_flag & rdonly) || - (wantparent && (ndp->ni_dvp->v_mount->m_flag & rdonly))) { + if ((dp->v_mount->mnt_flag & rdonly) || + (wantparent && (ndp->ni_dvp->v_mount->mnt_flag & rdonly))) { error = EROFS; goto bad2; } diff --git a/usr/src/sys/kern/vfs_subr.c b/usr/src/sys/kern/vfs_subr.c index 0a19b593bf..a0036938a8 100644 --- a/usr/src/sys/kern/vfs_subr.c +++ b/usr/src/sys/kern/vfs_subr.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_subr.c 7.41 (Berkeley) %G% + * @(#)vfs_subr.c 7.42 (Berkeley) %G% */ /* @@ -42,9 +42,9 @@ vfs_remove(mp) if (mp == rootfs) panic("vfs_remove: unmounting root"); - mp->m_prev->m_next = mp->m_next; - mp->m_next->m_prev = mp->m_prev; - mp->m_vnodecovered->v_mountedhere = (struct mount *)0; + mp->mnt_prev->mnt_next = mp->mnt_next; + mp->mnt_next->mnt_prev = mp->mnt_prev; + mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0; vfs_unlock(mp); } @@ -56,11 +56,11 @@ vfs_lock(mp) register struct mount *mp; { - while(mp->m_flag & M_MLOCK) { - mp->m_flag |= M_MWAIT; + while(mp->mnt_flag & MNT_MLOCK) { + mp->mnt_flag |= MNT_MWAIT; sleep((caddr_t)mp, PVFS); } - mp->m_flag |= M_MLOCK; + mp->mnt_flag |= MNT_MLOCK; return (0); } @@ -73,11 +73,11 @@ vfs_unlock(mp) register struct mount *mp; { - if ((mp->m_flag & M_MLOCK) == 0) + if ((mp->mnt_flag & MNT_MLOCK) == 0) panic("vfs_unlock: not locked"); - mp->m_flag &= ~M_MLOCK; - if (mp->m_flag & M_MWAIT) { - mp->m_flag &= ~M_MWAIT; + mp->mnt_flag &= ~MNT_MLOCK; + if (mp->mnt_flag & MNT_MWAIT) { + mp->mnt_flag &= ~MNT_MWAIT; wakeup((caddr_t)mp); } } @@ -90,13 +90,13 @@ vfs_busy(mp) register struct mount *mp; { - if (mp->m_flag & M_UNMOUNT) + if (mp->mnt_flag & MNT_UNMOUNT) return (1); - while(mp->m_flag & M_MPBUSY) { - mp->m_flag |= M_MPWANT; - sleep((caddr_t)&mp->m_flag, PVFS); + while(mp->mnt_flag & MNT_MPBUSY) { + mp->mnt_flag |= MNT_MPWANT; + sleep((caddr_t)&mp->mnt_flag, PVFS); } - mp->m_flag |= M_MPBUSY; + mp->mnt_flag |= MNT_MPBUSY; return (0); } @@ -109,12 +109,12 @@ vfs_unbusy(mp) register struct mount *mp; { - if ((mp->m_flag & M_MPBUSY) == 0) + if ((mp->mnt_flag & MNT_MPBUSY) == 0) panic("vfs_unbusy: not busy"); - mp->m_flag &= ~M_MPBUSY; - if (mp->m_flag & M_MPWANT) { - mp->m_flag &= ~M_MPWANT; - wakeup((caddr_t)&mp->m_flag); + mp->mnt_flag &= ~MNT_MPBUSY; + if (mp->mnt_flag & MNT_MPWANT) { + mp->mnt_flag &= ~MNT_MPWANT; + wakeup((caddr_t)&mp->mnt_flag); } } @@ -129,11 +129,11 @@ getvfs(fsid) mp = rootfs; do { - if (mp->m_stat.f_fsid.val[0] == fsid->val[0] && - mp->m_stat.f_fsid.val[1] == fsid->val[1]) { + if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] && + mp->mnt_stat.f_fsid.val[1] == fsid->val[1]) { return (mp); } - mp = mp->m_next; + mp = mp->mnt_next; } while (mp != rootfs); return ((struct mount *)0); } @@ -306,14 +306,14 @@ insmntque(vp, mp) vp->v_mountb = NULL; return; } - if (mp->m_mounth) { - vp->v_mountf = mp->m_mounth; - vp->v_mountb = &mp->m_mounth; - mp->m_mounth->v_mountb = &vp->v_mountf; - mp->m_mounth = vp; + if (mp->mnt_mounth) { + vp->v_mountf = mp->mnt_mounth; + vp->v_mountb = &mp->mnt_mounth; + mp->mnt_mounth->v_mountb = &vp->v_mountf; + mp->mnt_mounth = vp; } else { - mp->m_mounth = vp; - vp->v_mountb = &mp->m_mounth; + mp->mnt_mounth = vp; + vp->v_mountb = &mp->mnt_mounth; vp->v_mountf = NULL; } } @@ -364,7 +364,7 @@ checkalias(nvp, nvp_rdev, mp) struct vnode **vpp; if (nvp->v_type != VBLK && nvp->v_type != VCHR) - return ((struct vnode *)0); + return (NULLVP); vpp = &speclisth[SPECHASH(nvp_rdev)]; loop: @@ -394,7 +394,7 @@ loop: vp->v_flag |= VALIASED; vput(vp); } - return ((struct vnode *)0); + return (NULLVP); } VOP_UNLOCK(vp); vclean(vp, 0); @@ -472,7 +472,7 @@ void vrele(vp) vprint("vrele: bad ref count", vp); if (vp->v_usecount > 0) return; - if (vfreeh == (struct vnode *)0) { + if (vfreeh == NULLVP) { /* * insert into empty list */ @@ -530,9 +530,9 @@ vflush(mp, skipvp, flags) register struct vnode *vp, *nvp; int busy = 0; - if ((mp->m_flag & M_MPBUSY) == 0) + if ((mp->mnt_flag & MNT_MPBUSY) == 0) panic("vflush: not busy"); - for (vp = mp->m_mounth; vp; vp = nvp) { + for (vp = mp->mnt_mounth; vp; vp = nvp) { nvp = vp->v_mountf; /* * Skip over a selected vnode. @@ -891,7 +891,7 @@ kinfo_vnode(op, where, acopysize, arg, aneeded) #define RETRY bp = savebp ; goto again do { if (vfs_busy(mp)) { - mp = mp->m_next; + mp = mp->mnt_next; continue; } /* @@ -904,7 +904,7 @@ kinfo_vnode(op, where, acopysize, arg, aneeded) */ savebp = bp; again: - nextvp = mp->m_mounth; + nextvp = mp->mnt_mounth; while (vp = nextvp) { if (vget(vp)) { if (kinfo_vdebug) @@ -930,7 +930,7 @@ again: vput(vp); } omp = mp; - mp = mp->m_next; + mp = mp->mnt_next; vfs_unbusy(omp); } while (mp != rootfs); diff --git a/usr/src/sys/kern/vfs_syscalls.c b/usr/src/sys/kern/vfs_syscalls.c index bd2df24013..f8dc2f51f8 100644 --- a/usr/src/sys/kern/vfs_syscalls.c +++ b/usr/src/sys/kern/vfs_syscalls.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_syscalls.c 7.45 (Berkeley) %G% + * @(#)vfs_syscalls.c 7.46 (Berkeley) %G% */ #include "param.h" @@ -67,7 +67,7 @@ mount(scp) if (error = namei(ndp)) RETURN (error); vp = ndp->ni_vp; - if (uap->flags & M_UPDATE) { + if (uap->flags & MNT_UPDATE) { if ((vp->v_flag & VROOT) == 0) { vput(vp); RETURN (EINVAL); @@ -77,13 +77,13 @@ mount(scp) * We allow going from read-only to read-write, * but not from read-write to read-only. */ - if ((mp->m_flag & M_RDONLY) == 0 && - (uap->flags & M_RDONLY) != 0) { + if ((mp->mnt_flag & MNT_RDONLY) == 0 && + (uap->flags & MNT_RDONLY) != 0) { vput(vp); RETURN (EOPNOTSUPP); /* Needs translation */ } - flag = mp->m_flag; - mp->m_flag |= M_UPDATE; + flag = mp->mnt_flag; + mp->mnt_flag |= MNT_UPDATE; VOP_UNLOCK(vp); goto update; } @@ -107,10 +107,10 @@ mount(scp) */ mp = (struct mount *)malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); - mp->m_op = vfssw[uap->type]; - mp->m_flag = 0; - mp->m_exroot = 0; - mp->m_mounth = (struct vnode *)0; + mp->mnt_op = vfssw[uap->type]; + mp->mnt_flag = 0; + mp->mnt_exroot = 0; + mp->mnt_mounth = NULLVP; if (error = vfs_lock(mp)) { free((caddr_t)mp, M_MOUNT); vput(vp); @@ -123,49 +123,49 @@ mount(scp) RETURN (EBUSY); } vp->v_mountedhere = mp; - mp->m_vnodecovered = vp; + mp->mnt_vnodecovered = vp; update: /* * Set the mount level flags. */ - if (uap->flags & M_RDONLY) - mp->m_flag |= M_RDONLY; + if (uap->flags & MNT_RDONLY) + mp->mnt_flag |= MNT_RDONLY; else - mp->m_flag &= ~M_RDONLY; - if (uap->flags & M_NOSUID) - mp->m_flag |= M_NOSUID; + mp->mnt_flag &= ~MNT_RDONLY; + if (uap->flags & MNT_NOSUID) + mp->mnt_flag |= MNT_NOSUID; else - mp->m_flag &= ~M_NOSUID; - if (uap->flags & M_NOEXEC) - mp->m_flag |= M_NOEXEC; + mp->mnt_flag &= ~MNT_NOSUID; + if (uap->flags & MNT_NOEXEC) + mp->mnt_flag |= MNT_NOEXEC; else - mp->m_flag &= ~M_NOEXEC; - if (uap->flags & M_NODEV) - mp->m_flag |= M_NODEV; + mp->mnt_flag &= ~MNT_NOEXEC; + if (uap->flags & MNT_NODEV) + mp->mnt_flag |= MNT_NODEV; else - mp->m_flag &= ~M_NODEV; - if (uap->flags & M_SYNCHRONOUS) - mp->m_flag |= M_SYNCHRONOUS; + mp->mnt_flag &= ~MNT_NODEV; + if (uap->flags & MNT_SYNCHRONOUS) + mp->mnt_flag |= MNT_SYNCHRONOUS; else - mp->m_flag &= ~M_SYNCHRONOUS; + mp->mnt_flag &= ~MNT_SYNCHRONOUS; /* * Mount the filesystem. */ error = VFS_MOUNT(mp, uap->dir, uap->data, ndp); - if (mp->m_flag & M_UPDATE) { - mp->m_flag &= ~M_UPDATE; + if (mp->mnt_flag & MNT_UPDATE) { + mp->mnt_flag &= ~MNT_UPDATE; vrele(vp); if (error) - mp->m_flag = flag; + mp->mnt_flag = flag; RETURN (error); } /* * Put the new filesystem on the mount list after root. */ - mp->m_next = rootfs->m_next; - mp->m_prev = rootfs; - rootfs->m_next = mp; - mp->m_next->m_prev = mp; + mp->mnt_next = rootfs->mnt_next; + mp->mnt_prev = rootfs; + rootfs->mnt_next = mp; + mp->mnt_next->mnt_prev = mp; cache_purge(vp); if (!error) { VOP_UNLOCK(vp); @@ -231,10 +231,10 @@ dounmount(mp, flags) struct vnode *coveredvp; int error; - coveredvp = mp->m_vnodecovered; + coveredvp = mp->mnt_vnodecovered; if (vfs_busy(mp)) return (EBUSY); - mp->m_flag |= M_UNMOUNT; + mp->mnt_flag |= MNT_UNMOUNT; if (error = vfs_lock(mp)) return (error); @@ -243,7 +243,7 @@ dounmount(mp, flags) VFS_SYNC(mp, MNT_WAIT); error = VFS_UNMOUNT(mp, flags); - mp->m_flag &= ~M_UNMOUNT; + mp->mnt_flag &= ~MNT_UNMOUNT; vfs_unbusy(mp); if (error) { vfs_unlock(mp); @@ -272,14 +272,14 @@ sync(scp) * The lock check below is to avoid races with mount * and unmount. */ - if ((mp->m_flag & (M_MLOCK|M_RDONLY|M_MPBUSY)) == 0 && + if ((mp->mnt_flag & (MNT_MLOCK|MNT_RDONLY|MNT_MPBUSY)) == 0 && !vfs_busy(mp)) { VFS_SYNC(mp, MNT_NOWAIT); omp = mp; - mp = mp->m_next; + mp = mp->mnt_next; vfs_unbusy(omp); } else - mp = mp->m_next; + mp = mp->mnt_next; } while (mp != rootfs); } @@ -330,11 +330,11 @@ statfs(scp) if (error = namei(ndp)) RETURN (error); mp = ndp->ni_vp->v_mount; - sp = &mp->m_stat; + sp = &mp->mnt_stat; vrele(ndp->ni_vp); if (error = VFS_STATFS(mp, sp)) RETURN (error); - sp->f_flags = mp->m_flag & M_VISFLAGMASK; + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; RETURN (copyout((caddr_t)sp, (caddr_t)uap->buf, sizeof(*sp))); } @@ -353,10 +353,10 @@ fstatfs(scp) if (error = getvnode(scp->sc_ofile, uap->fd, &fp)) RETURN (error); mp = ((struct vnode *)fp->f_data)->v_mount; - sp = &mp->m_stat; + sp = &mp->mnt_stat; if (error = VFS_STATFS(mp, sp)) RETURN (error); - sp->f_flags = mp->m_flag & M_VISFLAGMASK; + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; RETURN (copyout((caddr_t)sp, (caddr_t)uap->buf, sizeof(*sp))); } @@ -381,8 +381,9 @@ getfsstat(scp) mp = rootfs; count = 0; do { - if (sfsp && count < maxcount && ((mp->m_flag & M_MLOCK) == 0)) { - sp = &mp->m_stat; + if (sfsp && count < maxcount && + ((mp->mnt_flag & MNT_MLOCK) == 0)) { + sp = &mp->mnt_stat; /* * If MNT_NOWAIT is specified, do not refresh the * fsstat cache. MNT_WAIT overrides MNT_NOWAIT. @@ -390,16 +391,16 @@ getfsstat(scp) if (((uap->flags & MNT_NOWAIT) == 0 || (uap->flags & MNT_WAIT)) && (error = VFS_STATFS(mp, sp))) { - mp = mp->m_prev; + mp = mp->mnt_prev; continue; } - sp->f_flags = mp->m_flag & M_VISFLAGMASK; + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; if (error = copyout((caddr_t)sp, sfsp, sizeof(*sp))) RETURN (error); sfsp += sizeof(*sp); } count++; - mp = mp->m_prev; + mp = mp->mnt_prev; } while (mp != rootfs); if (sfsp && count > maxcount) scp->sc_retval1 = maxcount; @@ -998,7 +999,7 @@ chflags(scp) if (error = namei(ndp)) RETURN (error); vp = ndp->ni_vp; - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1029,7 +1030,7 @@ fchflags(scp) vattr.va_flags = uap->flags; vp = (struct vnode *)fp->f_data; VOP_LOCK(vp); - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1062,7 +1063,7 @@ chmod(scp) if (error = namei(ndp)) RETURN (error); vp = ndp->ni_vp; - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1093,7 +1094,7 @@ fchmod(scp) vattr.va_mode = uap->fmode & 07777; vp = (struct vnode *)fp->f_data; VOP_LOCK(vp); - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1128,7 +1129,7 @@ chown(scp) if (error = namei(ndp)) RETURN (error); vp = ndp->ni_vp; - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1161,7 +1162,7 @@ fchown(scp) vattr.va_gid = uap->gid; vp = (struct vnode *)fp->f_data; VOP_LOCK(vp); - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } @@ -1195,7 +1196,7 @@ utimes(scp) if (error = namei(ndp)) RETURN (error); vp = ndp->ni_vp; - if (vp->v_mount->m_flag & M_RDONLY) { + if (vp->v_mount->mnt_flag & MNT_RDONLY) { error = EROFS; goto out; } diff --git a/usr/src/sys/kern/vfs_vnops.c b/usr/src/sys/kern/vfs_vnops.c index e746eb1bc1..2662c2eec7 100644 --- a/usr/src/sys/kern/vfs_vnops.c +++ b/usr/src/sys/kern/vfs_vnops.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)vfs_vnops.c 7.19 (Berkeley) %G% + * @(#)vfs_vnops.c 7.20 (Berkeley) %G% */ #include "param.h" @@ -133,7 +133,7 @@ vn_writechk(vp) * unless the file is a socket or a block or character * device resident on the file system. */ - if ((vp->v_mount->m_flag & M_RDONLY) && vp->v_type != VCHR && + if ((vp->v_mount->mnt_flag & MNT_RDONLY) && vp->v_type != VCHR && vp->v_type != VBLK && vp->v_type != VSOCK) return (EROFS); /* diff --git a/usr/src/sys/miscfs/specfs/spec_vnops.c b/usr/src/sys/miscfs/specfs/spec_vnops.c index 6d361b65b6..e0cce0285a 100644 --- a/usr/src/sys/miscfs/specfs/spec_vnops.c +++ b/usr/src/sys/miscfs/specfs/spec_vnops.c @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)spec_vnops.c 7.25 (Berkeley) %G% + * @(#)spec_vnops.c 7.26 (Berkeley) %G% */ #include "param.h" @@ -120,7 +120,7 @@ spec_open(vp, mode, cred) register int maj = major(dev); int error; - if (vp->v_mount && (vp->v_mount->m_flag & M_NODEV)) + if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV)) return (ENXIO); switch (vp->v_type) { diff --git a/usr/src/sys/nfs/nfs_node.c b/usr/src/sys/nfs/nfs_node.c index ad4d3a3abf..0486e85080 100644 --- a/usr/src/sys/nfs/nfs_node.c +++ b/usr/src/sys/nfs/nfs_node.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_node.c 7.24 (Berkeley) %G% + * @(#)nfs_node.c 7.25 (Berkeley) %G% */ #include "param.h" @@ -304,14 +304,3 @@ nfs_abortop(ndp) vrele(ndp->ni_vp); } } - -/* - * This is silly, but if you use a macro and try and use it in a file - * that has mbuf.h included, m_data --> m_hdr.mh_data and this is not - * a good thing - */ -struct nfsmount *vfs_to_nfs(mp) - struct mount *mp; -{ - return ((struct nfsmount *)mp->m_data); -} diff --git a/usr/src/sys/nfs/nfs_serv.c b/usr/src/sys/nfs/nfs_serv.c index 17a523825b..21580bbc96 100644 --- a/usr/src/sys/nfs/nfs_serv.c +++ b/usr/src/sys/nfs/nfs_serv.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_serv.c 7.17 (Berkeley) %G% + * @(#)nfs_serv.c 7.18 (Berkeley) %G% */ /* @@ -207,7 +207,7 @@ nfsrv_lookup(mrep, md, dpos, cred, xid, mrq, repstat) nfsm_reply(0); vp = ndp->ni_vp; bzero((caddr_t)fhp, sizeof(nfh)); - fhp->fh_fsid = vp->v_mount->m_stat.f_fsid; + fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) { vput(vp); nfsm_reply(0); @@ -565,14 +565,14 @@ nfsrv_create(mrep, md, dpos, cred, xid, mrq, repstat) vp = ndp->ni_vp; } else { vp = ndp->ni_vp; - ndp->ni_vp = (struct vnode *)0; + ndp->ni_vp = NULLVP; VOP_ABORTOP(ndp); vap->va_size = 0; if (error = VOP_SETATTR(vp, vap, cred)) nfsm_reply(0); } bzero((caddr_t)fhp, sizeof(nfh)); - fhp->fh_fsid = vp->v_mount->m_stat.f_fsid; + fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) { vput(vp); nfsm_reply(0); @@ -900,7 +900,7 @@ nfsrv_mkdir(mrep, md, dpos, cred, xid, mrq, repstat) nfsm_reply(0); vp = ndp->ni_vp; bzero((caddr_t)fhp, sizeof(nfh)); - fhp->fh_fsid = vp->v_mount->m_stat.f_fsid; + fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) { vput(vp); nfsm_reply(0); @@ -1271,7 +1271,7 @@ nfsrv_noop(mrep, md, dpos, cred, xid, mrq, repstat) * Perform access checking for vnodes obtained from file handles that would * refer to files already opened by a Unix client. You cannot just use * vn_writechk() and VOP_ACCESS() for two reasons. - * 1 - You must check for M_EXRDONLY as well as M_RDONLY for the write case + * 1 - You must check for MNT_EXRDONLY as well as MNT_RDONLY for the write case * 2 - The owner is to be given access irrespective of mode bits so that * processes that chmod after opening a file don't break. I don't like * this because it opens a security hole, but since the nfs server opens @@ -1285,13 +1285,13 @@ nfsrv_access(vp, flags, cred) struct vattr vattr; int error; if (flags & VWRITE) { - /* Just vn_writechk() changed to check M_EXRDONLY */ + /* Just vn_writechk() changed to check MNT_EXRDONLY */ /* * Disallow write attempts on read-only file systems; * unless the file is a socket or a block or character * device resident on the file system. */ - if ((vp->v_mount->m_flag & (M_RDONLY | M_EXRDONLY)) && + if ((vp->v_mount->mnt_flag & (MNT_RDONLY | MNT_EXRDONLY)) && vp->v_type != VCHR && vp->v_type != VBLK && vp->v_type != VSOCK) diff --git a/usr/src/sys/nfs/nfs_socket.c b/usr/src/sys/nfs/nfs_socket.c index 7a32f039e6..1e0b52cb65 100644 --- a/usr/src/sys/nfs/nfs_socket.c +++ b/usr/src/sys/nfs/nfs_socket.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_socket.c 7.10 (Berkeley) %G% + * @(#)nfs_socket.c 7.11 (Berkeley) %G% */ /* @@ -458,7 +458,7 @@ giveup: } if (mntp->nm_rexmit >= nfsrexmtthresh && logged++ == 0) uprintf("NFS server %s not responding, retrying\n", - mntp->nm_mountp->m_stat.f_mntfromname); + mntp->nm_mountp->mnt_stat.f_mntfromname); sbunlock(&so->so_rcv); nfs_sbwait(&so->so_rcv); splx(s); @@ -550,8 +550,8 @@ giveup: } if (rep == myrep) { /* This is success */ if (logged) - uprintf("NFS server %s responded\n", - mntp->nm_mountp->m_stat.f_mntfromname); + uprintf("NFS server %s responded\n", + mntp->nm_mountp->mnt_stat.f_mntfromname); goto release; } /* Else wake up other sleeper and wait for next */ @@ -610,7 +610,7 @@ nfs_request(vp, mreq, xid, idem, mp, mrp, mdp, dposp) int s; int error; - mntp = vfs_to_nfs(mp); + mntp = VFSTONFS(mp); m = mreq; MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, M_WAITOK); rep->r_xid = xid; @@ -1013,7 +1013,7 @@ nfs_updatetimer(mntp) if (mntp->nm_rexmit || nfshp->nh_currexmit) { if (nfshp->nh_currexmit >= nfsrexmtthresh) nfs_log("NFS server %s OK\n", - mntp->nm_mountp->m_stat.f_mntfromname); + mntp->nm_mountp->mnt_stat.f_mntfromname); mntp->nm_rexmit = nfshp->nh_currexmit = 0; return; } @@ -1079,7 +1079,7 @@ nfs_backofftimer(mntp) if (nfshp->nh_currexmit >= nfsrexmtthresh) { if (nfshp->nh_currexmit == nfsrexmtthresh) { nfs_log("NFS server %s not responding\n", - mntp->nm_mountp->m_stat.f_mntfromname); + mntp->nm_mountp->mnt_stat.f_mntfromname); mntp->nm_rttvar += (mntp->nm_srtt >> 2); mntp->nm_srtt = 0; } diff --git a/usr/src/sys/nfs/nfs_subs.c b/usr/src/sys/nfs/nfs_subs.c index b03f5d32c4..dcb1b18add 100644 --- a/usr/src/sys/nfs/nfs_subs.c +++ b/usr/src/sys/nfs/nfs_subs.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_subs.c 7.21 (Berkeley) %G% + * @(#)nfs_subs.c 7.22 (Berkeley) %G% */ /* @@ -662,7 +662,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_rdev = rdev; vap->va_bytes = fxdr_unsigned(long, fp->fa_blocks) * vap->va_blocksize; vap->va_bytes_rsv = 0; - vap->va_fsid = vp->v_mount->m_stat.f_fsid.val[0]; + vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; vap->va_fileid = fxdr_unsigned(long, fp->fa_fileid); vap->va_atime.tv_sec = fxdr_unsigned(long, fp->fa_atime.tv_sec); vap->va_atime.tv_usec = 0; @@ -722,14 +722,14 @@ nfs_namei(ndp, fhp, len, mdp, dposp) register int i, rem; register struct mbuf *md; register char *cp; - struct vnode *dp = (struct vnode *)0; + struct vnode *dp = NULLVP; int flag; int docache; int wantparent; int lockparent; int error = 0; - ndp->ni_vp = ndp->ni_dvp = (struct vnode *)0; + ndp->ni_vp = ndp->ni_dvp = NULLVP; flag = ndp->ni_nameiop & OPFLAG; wantparent = ndp->ni_nameiop & (LOCKPARENT | WANTPARENT); lockparent = ndp->ni_nameiop & LOCKPARENT; @@ -792,7 +792,7 @@ nfs_namei(ndp, fhp, len, mdp, dposp) * called from rename() */ ndp->ni_cdir = dp; - ndp->ni_rdir = (struct vnode *)0; + ndp->ni_rdir = NULLVP; /* * Handle "..": @@ -816,7 +816,7 @@ nfs_namei(ndp, fhp, len, mdp, dposp) * If creating and at end of pathname, then can consider * allowing file to be created. */ - if (ndp->ni_dvp->v_mount->m_flag & (M_RDONLY | M_EXRDONLY)) + if (ndp->ni_dvp->v_mount->mnt_flag & (MNT_RDONLY|MNT_EXRDONLY)) error = EROFS; if (flag == LOOKUP || flag == DELETE || error != ENOENT) goto bad; @@ -840,8 +840,10 @@ nextname: * Disallow directory write attempts on read-only * file systems. */ - if ((dp->v_mount->m_flag & (M_RDONLY|M_EXRDONLY)) || - (wantparent && (ndp->ni_dvp->v_mount->m_flag & (M_RDONLY|M_EXRDONLY)))) { + if ((dp->v_mount->mnt_flag & (MNT_RDONLY|MNT_EXRDONLY)) || + (wantparent && + (ndp->ni_dvp->v_mount->mnt_flag & + (MNT_RDONLY|MNT_EXRDONLY)))) { error = EROFS; goto bad2; } @@ -931,7 +933,7 @@ nfsm_adj(mp, len, nul) * - check that it is exported * - get vp by calling VFS_FHTOVP() macro * - if not lockflag unlock it with VOP_UNLOCK() - * - if cred->cr_uid == 0 set it to m_exroot + * - if cred->cr_uid == 0 set it to mnt_exroot */ nfsrv_fhtovp(fhp, lockflag, vpp, cred) fhandle_t *fhp; @@ -943,12 +945,12 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred) if ((mp = getvfs(&fhp->fh_fsid)) == NULL) return (ESTALE); - if ((mp->m_flag & M_EXPORTED) == 0) + if ((mp->mnt_flag & MNT_EXPORTED) == 0) return (EACCES); if (VFS_FHTOVP(mp, &fhp->fh_fid, vpp)) return (ESTALE); if (cred->cr_uid == 0) - cred->cr_uid = mp->m_exroot; + cred->cr_uid = mp->mnt_exroot; if (!lockflag) VOP_UNLOCK(*vpp); return (0); diff --git a/usr/src/sys/nfs/nfs_syscalls.c b/usr/src/sys/nfs/nfs_syscalls.c index 095a18e3c8..e5100f16e4 100644 --- a/usr/src/sys/nfs/nfs_syscalls.c +++ b/usr/src/sys/nfs/nfs_syscalls.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_syscalls.c 7.12 (Berkeley) %G% + * @(#)nfs_syscalls.c 7.13 (Berkeley) %G% */ #include "param.h" @@ -82,7 +82,7 @@ getfh() RETURN (error); vp = ndp->ni_vp; bzero((caddr_t)&fh, sizeof(fh)); - fh.fh_fsid = vp->v_mount->m_stat.f_fsid; + fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(vp, &fh.fh_fid); vput(vp); if (error) diff --git a/usr/src/sys/nfs/nfs_vfsops.c b/usr/src/sys/nfs/nfs_vfsops.c index aaff09839a..fb15caee8e 100644 --- a/usr/src/sys/nfs/nfs_vfsops.c +++ b/usr/src/sys/nfs/nfs_vfsops.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_vfsops.c 7.19 (Berkeley) %G% + * @(#)nfs_vfsops.c 7.20 (Berkeley) %G% */ #include "param.h" @@ -29,7 +29,6 @@ #include "errno.h" #include "buf.h" #include "mbuf.h" -#undef m_data #include "socket.h" #include "systm.h" #include "nfsv2.h" @@ -98,7 +97,7 @@ nfs_mount(mp, path, data, ndp) int len; nfsv2fh_t nfh; - if (mp->m_flag & M_UPDATE) + if (mp->mnt_flag & MNT_UPDATE) return (0); if (error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args))) return (error); @@ -135,7 +134,7 @@ mountnfs(argp, mp, saddr, pth, hst) MALLOC(nmp, struct nfsmount *, sizeof *nmp, M_NFSMNT, M_WAITOK); bzero((caddr_t)nmp, sizeof *nmp); - mp->m_data = (qaddr_t)nmp; + mp->mnt_data = (qaddr_t)nmp; /* * Generate a unique nfs mount id. The problem is that a dev number * is not unique across multiple systems. The techique is as follows: @@ -150,8 +149,8 @@ mountnfs(argp, mp, saddr, pth, hst) * simply makes the major dev number tick up. The upper bound is * set to major dev 127 to avoid any sign extention problems */ - mp->m_stat.f_fsid.val[0] = makedev(nblkdev, 0); - mp->m_stat.f_fsid.val[1] = MOUNT_NFS; + mp->mnt_stat.f_fsid.val[0] = makedev(nblkdev, 0); + mp->mnt_stat.f_fsid.val[1] = MOUNT_NFS; if (++nfs_mntid == 0) ++nfs_mntid; tfsid.val[0] = makedev(nblkdev, nfs_mntid); @@ -165,7 +164,7 @@ mountnfs(argp, mp, saddr, pth, hst) m_freem(saddr); goto bad; } - mp->m_stat.f_fsid.val[0] = tfsid.val[0]; + mp->mnt_stat.f_fsid.val[0] = tfsid.val[0]; nmp->nm_mountp = mp; nmp->nm_flag = argp->flags; nmp->nm_rto = NFS_TIMEO; @@ -175,8 +174,9 @@ mountnfs(argp, mp, saddr, pth, hst) nmp->nm_wsize = NFS_WSIZE; nmp->nm_rsize = NFS_RSIZE; bcopy((caddr_t)argp->fh, (caddr_t)&nmp->nm_fh, sizeof(nfsv2fh_t)); - bcopy(hst, mp->m_stat.f_mntfromname, MNAMELEN); - bcopy(pth, mp->m_stat.f_mntonname, MNAMELEN); + mp->mnt_stat.f_type = MOUNT_NFS; + bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); + bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) { nmp->nm_rto = argp->timeo; @@ -220,7 +220,7 @@ mountnfs(argp, mp, saddr, pth, hst) goto bad; } - if (error = nfs_statfs(mp, &mp->m_stat)) + if (error = nfs_statfs(mp, &mp->mnt_stat)) goto bad; /* * A reference count is needed on the nfsnode representing the @@ -264,7 +264,7 @@ nfs_unmount(mp, mntflags) return (EINVAL); if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - nmp = vfs_to_nfs(mp); + nmp = VFSTONFS(mp); /* * Clear out the buffer cache */ @@ -318,7 +318,7 @@ nfs_root(mp, vpp) struct nfsnode *np; int error; - nmp = vfs_to_nfs(mp); + nmp = VFSTONFS(mp); if (error = nfs_nget(mp, &nmp->nm_fh, &np)) return (error); vp = NFSTOV(np); diff --git a/usr/src/sys/nfs/nfs_vnops.c b/usr/src/sys/nfs/nfs_vnops.c index 5eb2920d4f..8c07224edd 100644 --- a/usr/src/sys/nfs/nfs_vnops.c +++ b/usr/src/sys/nfs/nfs_vnops.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfs_vnops.c 7.36 (Berkeley) %G% + * @(#)nfs_vnops.c 7.37 (Berkeley) %G% */ /* @@ -479,7 +479,7 @@ nfs_lookup(vp, ndp) nfs_nput(vdp); } } - ndp->ni_vp = (struct vnode *)0; + ndp->ni_vp = NULLVP; } else nfs_unlock(vp); error = 0; @@ -644,7 +644,7 @@ nfs_readrpc(vp, uiop, cred) struct nfsmount *nmp; long len, retlen, tsiz; - nmp = vfs_to_nfs(vp->v_mount); + nmp = VFSTONFS(vp->v_mount); tsiz = uiop->uio_resid; while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; @@ -687,7 +687,7 @@ nfs_writerpc(vp, uiop, cred) struct nfsmount *nmp; long len, tsiz; - nmp = vfs_to_nfs(vp->v_mount); + nmp = VFSTONFS(vp->v_mount); tsiz = uiop->uio_resid; while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; @@ -1130,7 +1130,7 @@ nfs_readdir(vp, uiop, cred, eofflagp) return (0); } - nmp = vfs_to_nfs(vp->v_mount); + nmp = VFSTONFS(vp->v_mount); tresid = uiop->uio_resid; /* * Loop around doing readdir rpc's of size uio_resid or nm_rsize, @@ -1254,7 +1254,7 @@ nfs_statfs(mp, sbp) struct ucred *cred; struct nfsnode *np; - nmp = vfs_to_nfs(mp); + nmp = VFSTONFS(mp); if (error = nfs_nget(mp, &nmp->nm_fh, &np)) return (error); vp = NFSTOV(np); @@ -1274,9 +1274,9 @@ nfs_statfs(mp, sbp) sbp->f_bavail = fxdr_unsigned(long, sfp->sf_bavail); sbp->f_files = 0; sbp->f_ffree = 0; - if (sbp != &mp->m_stat) { - bcopy(mp->m_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); - bcopy(mp->m_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); + if (sbp != &mp->mnt_stat) { + bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); + bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); } nfsm_reqdone; nfs_nput(vp); @@ -1398,7 +1398,7 @@ nfs_bmap(vp, bn, vpp, bnp) if (vpp != NULL) *vpp = vp; if (bnp != NULL) - *bnp = bn * btodb(vp->v_mount->m_stat.f_bsize); + *bnp = bn * btodb(vp->v_mount->mnt_stat.f_bsize); return (0); } diff --git a/usr/src/sys/nfs/nfsmount.h b/usr/src/sys/nfs/nfsmount.h index 72a362c128..3a6c46709a 100644 --- a/usr/src/sys/nfs/nfsmount.h +++ b/usr/src/sys/nfs/nfsmount.h @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)nfsmount.h 7.3 (Berkeley) %G% + * @(#)nfsmount.h 7.4 (Berkeley) %G% */ /* @@ -60,4 +60,9 @@ struct nfshost { struct mbuf *nh_sockaddr; /* Address of server */ }; -struct nfsmount *vfs_to_nfs(); +#ifdef KERNEL +/* + * Convert mount ptr to nfsmount ptr. + */ +#define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) +#endif /* KERNEL */ diff --git a/usr/src/sys/sys/mount.h b/usr/src/sys/sys/mount.h index 1463f41ccb..00eaaddc04 100644 --- a/usr/src/sys/sys/mount.h +++ b/usr/src/sys/sys/mount.h @@ -14,7 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#)mount.h 7.12 (Berkeley) %G% + * @(#)mount.h 7.13 (Berkeley) %G% */ typedef quad fsid_t; /* file system id type */ @@ -69,52 +69,52 @@ struct statfs { * The file systems are put on a doubly linked list. */ struct mount { - struct mount *m_next; /* next in mount list */ - struct mount *m_prev; /* prev in mount list */ - struct vfsops *m_op; /* operations on fs */ - struct vnode *m_vnodecovered; /* vnode we mounted on */ - struct vnode *m_mounth; /* list of vnodes this mount */ - int m_flag; /* flags */ - uid_t m_exroot; /* exported mapping for uid 0 */ - struct statfs m_stat; /* cache of filesystem stats */ - qaddr_t m_data; /* private data */ + struct mount *mnt_next; /* next in mount list */ + struct mount *mnt_prev; /* prev in mount list */ + struct vfsops *mnt_op; /* operations on fs */ + struct vnode *mnt_vnodecovered; /* vnode we mounted on */ + struct vnode *mnt_mounth; /* list of vnodes this mount */ + int mnt_flag; /* flags */ + uid_t mnt_exroot; /* exported mapping for uid 0 */ + struct statfs mnt_stat; /* cache of filesystem stats */ + qaddr_t mnt_data; /* private data */ }; /* * Mount flags. */ -#define M_RDONLY 0x00000001 /* read only filesystem */ -#define M_SYNCHRONOUS 0x00000002 /* file system written synchronously */ -#define M_NOEXEC 0x00000004 /* can't exec from filesystem */ -#define M_NOSUID 0x00000008 /* don't honor setuid bits on fs */ -#define M_NODEV 0x00000010 /* don't interpret special files */ +#define MNT_RDONLY 0x00000001 /* read only filesystem */ +#define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ +#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ +#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ +#define MNT_NODEV 0x00000010 /* don't interpret special files */ /* * exported mount flags. */ -#define M_EXPORTED 0x00000100 /* file system is exported */ -#define M_EXRDONLY 0x00000200 /* exported read only */ +#define MNT_EXPORTED 0x00000100 /* file system is exported */ +#define MNT_EXRDONLY 0x00000200 /* exported read only */ /* * Flags set by internal operations. */ -#define M_LOCAL 0x00001000 /* filesystem is stored locally */ -#define M_QUOTA 0x00002000 /* quotas are enabled on filesystem */ +#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ +#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ /* * Mask of flags that are visible to statfs() */ -#define M_VISFLAGMASK 0x0000ffff +#define MNT_VISFLAGMASK 0x0000ffff /* * filesystem control flags. * - * M_MLOCK lock the mount entry so that name lookup cannot proceed + * MNT_MLOCK lock the mount entry so that name lookup cannot proceed * past the mount point. This keeps the subtree stable during mounts * and unmounts. */ -#define M_UPDATE 0x00010000 /* not a real mount, just an update */ -#define M_MLOCK 0x00100000 /* lock so that subtree is stable */ -#define M_MWAIT 0x00200000 /* someone is waiting for lock */ -#define M_MPBUSY 0x00400000 /* scan of mount point in progress */ -#define M_MPWANT 0x00800000 /* waiting for mount point */ -#define M_UNMOUNT 0x01000000 /* unmount in progress */ +#define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ +#define MNT_MLOCK 0x00100000 /* lock so that subtree is stable */ +#define MNT_MWAIT 0x00200000 /* someone is waiting for lock */ +#define MNT_MPBUSY 0x00400000 /* scan of mount point in progress */ +#define MNT_MPWANT 0x00800000 /* waiting for mount point */ +#define MNT_UNMOUNT 0x01000000 /* unmount in progress */ /* * Operations supported on mounted file system. @@ -133,15 +133,15 @@ struct vfsops { }; #define VFS_MOUNT(MP, PATH, DATA, NDP) \ - (*(MP)->m_op->vfs_mount)(MP, PATH, DATA, NDP) -#define VFS_START(MP, FLAGS) (*(MP)->m_op->vfs_start)(MP, FLAGS) -#define VFS_UNMOUNT(MP, FORCIBLY) (*(MP)->m_op->vfs_unmount)(MP, FORCIBLY) -#define VFS_ROOT(MP, VPP) (*(MP)->m_op->vfs_root)(MP, VPP) -#define VFS_QUOTACTL(MP, C, U, A) (*(MP)->m_op->vfs_quotactl)(MP, C, U, A) -#define VFS_STATFS(MP, SBP) (*(MP)->m_op->vfs_statfs)(MP, SBP) -#define VFS_SYNC(MP, WAITFOR) (*(MP)->m_op->vfs_sync)(MP, WAITFOR) -#define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->m_op->vfs_fhtovp)(MP, FIDP, VPP) -#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->m_op->vfs_vptofh)(VP, FIDP) + (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP) +#define VFS_START(MP, FLAGS) (*(MP)->mnt_op->vfs_start)(MP, FLAGS) +#define VFS_UNMOUNT(MP, FORCIBLY) (*(MP)->mnt_op->vfs_unmount)(MP, FORCIBLY) +#define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP) +#define VFS_QUOTACTL(MP, C, U, A) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A) +#define VFS_STATFS(MP, SBP) (*(MP)->mnt_op->vfs_statfs)(MP, SBP) +#define VFS_SYNC(MP, WAITFOR) (*(MP)->mnt_op->vfs_sync)(MP, WAITFOR) +#define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP) +#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) /* * Flags for various system call interfaces. -- 2.20.1