From 27df97742b396c7dfbf32b2f72a9d1b02de91ce8 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Thu, 24 Aug 1995 10:17:39 +0000 Subject: [PATCH] Add support for amd direct maps. Reviewed by: Thomas Graichen --- sys/kern/vfs_lookup.c | 37 +++++++++++++++++++------------------ sys/nfs/nfs_bio.c | 4 ++-- sys/nfs/nfs_common.c | 4 ++-- sys/nfs/nfs_subs.c | 4 ++-- sys/nfs/nfs_vfsops.c | 10 ++++++++-- sys/nfsclient/nfs_bio.c | 4 ++-- sys/nfsclient/nfs_subs.c | 4 ++-- sys/nfsclient/nfs_vfsops.c | 10 ++++++++-- sys/nfsserver/nfs_srvsubs.c | 4 ++-- 9 files changed, 47 insertions(+), 34 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index e3c7654c3cea..35a7a691d184 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 - * $Id: vfs_lookup.c,v 1.7 1995/05/30 08:06:33 rgrimes Exp $ + * $Id: vfs_lookup.c,v 1.8 1995/07/31 00:35:46 bde Exp $ */ #include @@ -458,23 +458,6 @@ unionlookup: } dp = ndp->ni_vp; - /* - * Check for symbolic link - */ - if ((dp->v_type == VLNK) && - ((cnp->cn_flags & FOLLOW) || trailing_slash || - *ndp->ni_next == '/')) { - cnp->cn_flags |= ISSYMLINK; - return (0); - } - - /* - * Check for bogus trailing slashes. - */ - if (trailing_slash && dp->v_type != VDIR) { - error = ENOTDIR; - goto bad2; - } /* * Check to see if the vnode has been mounted on; @@ -494,6 +477,24 @@ unionlookup: ndp->ni_vp = dp = tdp; } + /* + * Check for symbolic link + */ + if ((dp->v_type == VLNK) && + ((cnp->cn_flags & FOLLOW) || trailing_slash || + *ndp->ni_next == '/')) { + cnp->cn_flags |= ISSYMLINK; + return (0); + } + + /* + * Check for bogus trailing slashes. + */ + if (trailing_slash && dp->v_type != VDIR) { + error = ENOTDIR; + goto bad2; + } + nextname: /* * Not a symbolic link. If more pathname, diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 85077838bb17..d48a0208aa7c 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94 - * $Id: nfs_bio.c,v 1.15 1995/06/27 11:06:34 dfr Exp $ + * $Id: nfs_bio.c,v 1.16 1995/07/07 11:01:30 dfr Exp $ */ #include @@ -125,7 +125,7 @@ nfs_bioread(vp, uio, ioflag, cred) * attributes this could be forced by setting n_attrstamp to 0 before * the VOP_GETATTR() call. */ - if ((nmp->nm_flag & NFSMNT_NQNFS) == 0 && vp->v_type != VLNK) { + if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) { if (np->n_flag & NMODIFIED) { if (vp->v_type != VREG) { if (vp->v_type != VDIR) diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index 4c6d4bbc56bf..5bdda4ac63f6 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.21 1995/07/20 09:43:12 davidg Exp $ + * $Id: nfs_subs.c,v 1.22 1995/07/29 11:42:22 bde Exp $ */ /* @@ -1243,7 +1243,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) * information. */ np = VTONFS(vp); - if (vp->v_type == VNON) { + if (vp->v_type != vtyp) { /* * If we had a lock and it turns out that the vnode * is an object which we don't want to lock (e.g. VDIR) diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 4c6d4bbc56bf..5bdda4ac63f6 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.21 1995/07/20 09:43:12 davidg Exp $ + * $Id: nfs_subs.c,v 1.22 1995/07/29 11:42:22 bde Exp $ */ /* @@ -1243,7 +1243,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) * information. */ np = VTONFS(vp); - if (vp->v_type == VNON) { + if (vp->v_type != vtyp) { /* * If we had a lock and it turns out that the vnode * is an object which we don't want to lock (e.g. VDIR) diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index cc140931db29..2f940276363e 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.17 1995/07/07 11:01:31 dfr Exp $ + * $Id: nfs_vfsops.c,v 1.18 1995/08/11 11:31:12 davidg Exp $ */ #include @@ -538,6 +538,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp) register struct nfsmount *nmp; struct nfsnode *np; int error, maxio; + struct vattr attrs; if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); @@ -688,6 +689,12 @@ mountnfs(argp, mp, nam, pth, hst, vpp) goto bad; *vpp = NFSTOV(np); + /* + * Get file attributes for the mountpoint. This has the side + * effect of filling in (*vpp)->v_type with the correct value. + */ + VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc); + /* * Lose the lock but keep the ref. */ @@ -797,7 +804,6 @@ nfs_root(mp, vpp) return (error); vp = NFSTOV(np); VOP_UNLOCK(vp); - vp->v_type = VDIR; vp->v_flag = VROOT; *vpp = vp; return (0); diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 85077838bb17..d48a0208aa7c 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94 - * $Id: nfs_bio.c,v 1.15 1995/06/27 11:06:34 dfr Exp $ + * $Id: nfs_bio.c,v 1.16 1995/07/07 11:01:30 dfr Exp $ */ #include @@ -125,7 +125,7 @@ nfs_bioread(vp, uio, ioflag, cred) * attributes this could be forced by setting n_attrstamp to 0 before * the VOP_GETATTR() call. */ - if ((nmp->nm_flag & NFSMNT_NQNFS) == 0 && vp->v_type != VLNK) { + if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) { if (np->n_flag & NMODIFIED) { if (vp->v_type != VREG) { if (vp->v_type != VDIR) diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index 4c6d4bbc56bf..5bdda4ac63f6 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.21 1995/07/20 09:43:12 davidg Exp $ + * $Id: nfs_subs.c,v 1.22 1995/07/29 11:42:22 bde Exp $ */ /* @@ -1243,7 +1243,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) * information. */ np = VTONFS(vp); - if (vp->v_type == VNON) { + if (vp->v_type != vtyp) { /* * If we had a lock and it turns out that the vnode * is an object which we don't want to lock (e.g. VDIR) diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index cc140931db29..2f940276363e 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.17 1995/07/07 11:01:31 dfr Exp $ + * $Id: nfs_vfsops.c,v 1.18 1995/08/11 11:31:12 davidg Exp $ */ #include @@ -538,6 +538,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp) register struct nfsmount *nmp; struct nfsnode *np; int error, maxio; + struct vattr attrs; if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); @@ -688,6 +689,12 @@ mountnfs(argp, mp, nam, pth, hst, vpp) goto bad; *vpp = NFSTOV(np); + /* + * Get file attributes for the mountpoint. This has the side + * effect of filling in (*vpp)->v_type with the correct value. + */ + VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc); + /* * Lose the lock but keep the ref. */ @@ -797,7 +804,6 @@ nfs_root(mp, vpp) return (error); vp = NFSTOV(np); VOP_UNLOCK(vp); - vp->v_type = VDIR; vp->v_flag = VROOT; *vpp = vp; return (0); diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 4c6d4bbc56bf..5bdda4ac63f6 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.21 1995/07/20 09:43:12 davidg Exp $ + * $Id: nfs_subs.c,v 1.22 1995/07/29 11:42:22 bde Exp $ */ /* @@ -1243,7 +1243,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) * information. */ np = VTONFS(vp); - if (vp->v_type == VNON) { + if (vp->v_type != vtyp) { /* * If we had a lock and it turns out that the vnode * is an object which we don't want to lock (e.g. VDIR)