From 65cffcadb96389ff3e794eb822d2231220c71160 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 13 Feb 2015 17:31:37 -0600 Subject: [PATCH] afs: Use named constants for mvstat Currently the vcache 'mvstat' field is assigned three magic values: 0 for normal files and directories, 1 for mountpoint objects, and 2 for volume root dirs. These values are clearly defined in comments, but everywhere we actually assign or compare these values, we use the bare numbers. Stop this nonsense and use named constants, to make the code less inscrutable. Change-Id: Ic1b133109d619b70317141431f163e552bafd109 Reviewed-on: http://gerrit.openafs.org/11747 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Perry Ruiter --- src/afs/DARWIN/osi_misc.c | 2 +- src/afs/DARWIN/osi_vnodeops.c | 8 ++++---- src/afs/LINUX/osi_export.c | 10 +++++----- src/afs/LINUX/osi_vnodeops.c | 16 ++++++++-------- src/afs/SOLARIS/osi_vnodeops.c | 6 +++--- src/afs/VNOPS/afs_vnop_access.c | 4 ++-- src/afs/VNOPS/afs_vnop_attrs.c | 6 +++--- src/afs/VNOPS/afs_vnop_lookup.c | 24 ++++++++++++------------ src/afs/VNOPS/afs_vnop_readdir.c | 8 ++++---- src/afs/afs.h | 7 ++++++- src/afs/afs_disconnected.c | 2 +- src/afs/afs_pioctl.c | 6 +++--- src/afs/afs_vcache.c | 24 ++++++++++++------------ 13 files changed, 64 insertions(+), 59 deletions(-) diff --git a/src/afs/DARWIN/osi_misc.c b/src/afs/DARWIN/osi_misc.c index e0de03700..22dcfb047 100644 --- a/src/afs/DARWIN/osi_misc.c +++ b/src/afs/DARWIN/osi_misc.c @@ -67,7 +67,7 @@ loop: if (afs_IsDynrootFid(&tvc->f.fid)) continue; /* no fake fsevents on mount point sources. leaks refs */ - if (tvc->mvstat == 1) + if (tvc->mvstat == AFS_MVSTAT_MTPT) continue; /* if it's being reclaimed, just pass */ if (vnode_get(vp)) diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index f0cb97d31..4afb678cd 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -294,7 +294,7 @@ afs_vop_lookup(ap) */ if (ap->a_context == afs_osi_ctxtp) return ENOENT; - if (vcp->mvstat != 1) { + if (vcp->mvstat != AFS_MVSTAT_MTPT) { error = cache_lookup(ap->a_dvp, ap->a_vpp, ap->a_cnp); if (error == -1) return 0; @@ -579,7 +579,7 @@ afs_vop_access(ap) code = afs_CheckCode(code, &treq, 56); goto out; } - if (afs_fakestat_enable && tvc->mvstat && !(tvc->f.states & CStatd)) { + if (afs_fakestat_enable && tvc->mvstat != AFS_MVSTAT_FILE && !(tvc->f.states & CStatd)) { code = 0; goto out; } @@ -700,7 +700,7 @@ afs_vop_getattr(ap) if (!isglock) AFS_GLOCK(); /* do minimal work to return fake result for fsevents */ - if (afs_fakestat_enable && VTOAFS(ap->a_vp)->mvstat == 1) { + if (afs_fakestat_enable && VTOAFS(ap->a_vp)->mvstat == AFS_MVSTAT_MTPT) { struct afs_fakestat_state fakestat; struct vrequest treq; @@ -1490,7 +1490,7 @@ afs_vop_rename(ap) tvc = VTOAFS(tdvp); /* unrewritten mount point? */ - if (tvc->mvstat == 1) { + if (tvc->mvstat == AFS_MVSTAT_MTPT) { if (tvc->mvid && (tvc->f.states & CMValid)) { struct vrequest treq; diff --git a/src/afs/LINUX/osi_export.c b/src/afs/LINUX/osi_export.c index 57c7f4549..15a3d9529 100644 --- a/src/afs/LINUX/osi_export.c +++ b/src/afs/LINUX/osi_export.c @@ -408,7 +408,7 @@ static int UnEvalFakeStat(struct vrequest *areq, struct vcache **vcpp) if (!afs_fakestat_enable) return 0; - if (*vcpp == afs_globalVp || vType(*vcpp) != VDIR || (*vcpp)->mvstat != 2) + if (*vcpp == afs_globalVp || vType(*vcpp) != VDIR || (*vcpp)->mvstat != AFS_MVSTAT_ROOT) return 0; /* Figure out what FID to look for */ @@ -505,7 +505,7 @@ static struct dentry *get_dentry_from_fid(cred_t *credp, struct VenusFid *afid) * at parentVnode on directories, except for VIOCGETVCXSTATUS. * So, if this fails, we don't really care very much. */ - if (vType(vcp) == VDIR && vcp->mvstat != 2 && !vcp->f.parent.vnode) + if (vType(vcp) == VDIR && vcp->mvstat != AFS_MVSTAT_ROOT && !vcp->f.parent.vnode) update_dir_parent(treq, vcp); /* @@ -642,7 +642,7 @@ static int afs_export_get_name(struct dentry *parent, char *name, } /* Figure out what FID to look for */ - if (vcp->mvstat == 2) { /* volume root */ + if (vcp->mvstat == AFS_MVSTAT_ROOT) { /* volume root */ tvp = afs_GetVolume(&vcp->f.fid, 0, READ_LOCK); if (!tvp) { #ifdef OSI_EXPORT_DEBUG @@ -869,7 +869,7 @@ static struct dentry *afs_export_get_parent(struct dentry *child) /* a mount point in the dynmount directory */ afs_GetDynrootMountFid(&tfid); - } else if (vcp->mvstat == 2) { + } else if (vcp->mvstat == AFS_MVSTAT_ROOT) { /* volume root */ ObtainReadLock(&vcp->lock); if (vcp->mvid && vcp->mvid->Fid.Volume) { @@ -898,7 +898,7 @@ static struct dentry *afs_export_get_parent(struct dentry *child) } else { /* any other vnode */ - if (vType(vcp) == VDIR && !vcp->f.parent.vnode && vcp->mvstat != 1) { + if (vType(vcp) == VDIR && !vcp->f.parent.vnode && vcp->mvstat != AFS_MVSTAT_MTPT) { code = afs_CreateReq(&treq, credp); if (code) { #ifdef OSI_EXPORT_DEBUG diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 6efc0863f..1655f244e 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -425,7 +425,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) if ((avc->f.states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) { type = DT_DIR; } else if ((tvc = afs_FindVCache(&afid, 0, 0))) { - if (tvc->mvstat) { + if (tvc->mvstat != AFS_MVSTAT_FILE) { type = DT_DIR; } else if (((tvc->f.states) & (CStatd | CTruth))) { /* CTruth will be set if the object has @@ -959,7 +959,7 @@ afs_linux_revalidate(struct dentry *dp) * changes in afs_getattr that don't get replicated here! */ if (vcp->f.states & CStatd && - (!afs_fakestat_enable || vcp->mvstat != 1) && + (!afs_fakestat_enable || vcp->mvstat != AFS_MVSTAT_MTPT) && !afs_nfsexporter && (vType(vcp) == VDIR || vType(vcp) == VLNK)) { code = afs_CopyOutAttrs(vcp, vattr); @@ -1100,7 +1100,7 @@ parent_vcache_dv(struct inode *inode, cred_t *credp) * us. The fake entry is the one with the useful DataVersion. */ pvcp = VTOAFS(inode); - if (pvcp->mvstat == 1 && afs_fakestat_enable) { + if (pvcp->mvstat == AFS_MVSTAT_MTPT && afs_fakestat_enable) { struct vrequest treq; struct afs_fakestat_state fakestate; @@ -1166,15 +1166,15 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) parent = dget_parent(dp); pvcp = VTOAFS(parent->d_inode); - if ((vcp->mvstat == 1) || (vcp->mvstat == 2) || - (pvcp->mvstat == 1 && afs_fakestat_enable)) { /* need to lock */ + if ((vcp->mvstat != AFS_MVSTAT_FILE) || + (pvcp->mvstat == AFS_MVSTAT_MTPT && afs_fakestat_enable)) { /* need to lock */ credp = crref(); AFS_GLOCK(); locked = 1; } if (locked) { - if (vcp->mvstat == 1) { /* mount point */ + if (vcp->mvstat == AFS_MVSTAT_MTPT) { if (vcp->mvid && (vcp->f.states & CMValid)) { int tryEvalOnly = 0; int code = 0; @@ -1193,13 +1193,13 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) else code = afs_EvalFakeStat(&vcp, &fakestate, treq); afs_DestroyReq(treq); - if ((tryEvalOnly && vcp->mvstat == 1) || code) { + if ((tryEvalOnly && vcp->mvstat == AFS_MVSTAT_MTPT) || code) { /* a mount point, not yet replaced by its directory */ dput(parent); goto bad_dentry; } } - } else if (vcp->mvstat == 2 && *dp->d_name.name != '/') { + } else if (vcp->mvstat == AFS_MVSTAT_ROOT && *dp->d_name.name != '/') { osi_Assert(vcp->mvid != NULL); } } diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 93d717afe..8e24abdfd 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -1685,11 +1685,11 @@ afs_inactive(struct vcache *avc, afs_ucred_t *acred) * Solaris calls VOP_OPEN on exec, but doesn't call VOP_CLOSE when * the executable exits. So we clean up the open count here. * - * Only do this for mvstat 0 vnodes: when using fakestat, we can't - * lose the open count for volume roots (mvstat 2), even though they + * Only do this for AFS_MVSTAT_FILE vnodes: when using fakestat, we can't + * lose the open count for volume roots (AFS_MVSTAT_ROOT), even though they * will get VOP_INACTIVE'd when released by afs_PutFakeStat(). */ - if (avc->opens > 0 && avc->mvstat == 0 && !(avc->f.states & CCore)) + if (avc->opens > 0 && avc->mvstat == AFS_MVSTAT_FILE && !(avc->f.states & CCore)) avc->opens = avc->execsOrWriters = 0; #endif diff --git a/src/afs/VNOPS/afs_vnop_access.c b/src/afs/VNOPS/afs_vnop_access.c index 518cb8642..149dae9b8 100644 --- a/src/afs/VNOPS/afs_vnop_access.c +++ b/src/afs/VNOPS/afs_vnop_access.c @@ -214,9 +214,9 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode, AFS_DISCON_LOCK(); - if (afs_fakestat_enable && avc->mvstat == 1) { + if (afs_fakestat_enable && avc->mvstat == AFS_MVSTAT_MTPT) { code = afs_TryEvalFakeStat(&avc, &fakestate, treq); - if (code == 0 && avc->mvstat == 1) { + if (code == 0 && avc->mvstat == AFS_MVSTAT_MTPT) { afs_PutFakeStat(&fakestate); AFS_DISCON_UNLOCK(); afs_DestroyReq(treq); diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 5603a7b5c..7e580c5a0 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -53,7 +53,7 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs) int fakedir = 0; AFS_STATCNT(afs_CopyOutAttrs); - if (afs_fakestat_enable && avc->mvstat == 1) + if (afs_fakestat_enable && avc->mvstat == AFS_MVSTAT_MTPT) fakedir = 1; attrs->va_type = fakedir ? VDIR : vType(avc); #if defined(AFS_SGI_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) @@ -101,7 +101,7 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs) #else /* ! AFS_DARWIN_ENV */ attrs->va_fsid = 1; #endif - if (avc->mvstat == 2) { + if (avc->mvstat == AFS_MVSTAT_ROOT) { tvp = afs_GetVolume(&avc->f.fid, 0, READ_LOCK); /* The mount point's vnode. */ if (tvp) { @@ -205,7 +205,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred) afs_Trace2(afs_iclSetp, CM_TRACE_GETATTR, ICL_TYPE_POINTER, avc, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length)); - if (afs_fakestat_enable && avc->mvstat == 1) { + if (afs_fakestat_enable && avc->mvstat == AFS_MVSTAT_MTPT) { struct afs_fakestat_state fakestat; struct vrequest *ureq = NULL; diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 11713d1aa..4692674e5 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -373,7 +373,7 @@ afs_EvalFakeStat_int(struct vcache **avcp, struct afs_fakestat_state *state, state->did_eval = 1; tvc = *avcp; - if (tvc->mvstat != 1) + if (tvc->mvstat != AFS_MVSTAT_MTPT) return 0; if (canblock) { @@ -1168,7 +1168,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) } /* now copy ".." entry back out of volume structure, if necessary */ - if (tvcp->mvstat == 2 && (dotdot.Fid.Volume != 0)) { + if (tvcp->mvstat == AFS_MVSTAT_ROOT && (dotdot.Fid.Volume != 0)) { if (!tvcp->mvid) tvcp->mvid = osi_AllocSmallSpace(sizeof(struct VenusFid)); *tvcp->mvid = dotdot; @@ -1397,7 +1397,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr if ((code = afs_CreateReq(&treq, acred))) goto done; - if (afs_fakestat_enable && adp->mvstat == 1) { + if (afs_fakestat_enable && adp->mvstat == AFS_MVSTAT_MTPT) { if (strcmp(aname, ".directory") == 0) tryEvalOnly = 1; } @@ -1406,13 +1406,13 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr /* Workaround for MacOSX Finder, which tries to look for * .DS_Store and Contents under every directory. */ - if (afs_fakestat_enable && adp->mvstat == 1) { + if (afs_fakestat_enable && adp->mvstat == AFS_MVSTAT_MTPT) { if (strcmp(aname, ".DS_Store") == 0) tryEvalOnly = 1; if (strcmp(aname, "Contents") == 0) tryEvalOnly = 1; } - if (afs_fakestat_enable && adp->mvstat == 2) { + if (afs_fakestat_enable && adp->mvstat == AFS_MVSTAT_ROOT) { if (strncmp(aname, "._", 2) == 0) tryEvalOnly = 1; } @@ -1425,7 +1425,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr /*printf("Code is %d\n", code);*/ - if (tryEvalOnly && adp->mvstat == 1) + if (tryEvalOnly && adp->mvstat == AFS_MVSTAT_MTPT) code = ENOENT; if (code) goto done; @@ -1444,7 +1444,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr code = 0; /* watch for ".." in a volume root */ - if (adp->mvstat == 2 && aname[0] == '.' && aname[1] == '.' && !aname[2]) { + if (adp->mvstat == AFS_MVSTAT_ROOT && aname[0] == '.' && aname[1] == '.' && !aname[2]) { /* looking up ".." in root via special hacks */ if (adp->mvid == (struct VenusFid *)0 || adp->mvid->Fid.Volume == 0) { code = ENODEV; @@ -1592,7 +1592,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr goto done; } #ifdef AFS_LINUX22_ENV - if (tvc->mvstat == 2) { /* we don't trust the dnlc for root vcaches */ + if (tvc->mvstat == AFS_MVSTAT_ROOT) { /* we don't trust the dnlc for root vcaches */ AFS_RELE(AFSTOV(tvc)); *avcp = 0; } else { @@ -1789,7 +1789,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr tvc->f.parent.unique = adp->f.fid.Fid.Unique; tvc->f.states &= ~CBulkStat; - if (afs_fakestat_enable == 2 && tvc->mvstat == 1) { + if (afs_fakestat_enable == 2 && tvc->mvstat == AFS_MVSTAT_MTPT) { ObtainSharedLock(&tvc->lock, 680); if (!tvc->linkData) { UpgradeSToWLock(&tvc->lock, 681); @@ -1803,14 +1803,14 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr force_eval = 1; ReleaseReadLock(&tvc->lock); } - if (tvc->mvstat == 1 && (tvc->f.states & CMValid) && tvc->mvid != NULL) + if (tvc->mvstat == AFS_MVSTAT_MTPT && (tvc->f.states & CMValid) && tvc->mvid != NULL) force_eval = 1; /* This is now almost for free, get it correct */ #if defined(UKERNEL) if (!(flags & AFS_LOOKUP_NOEVAL)) /* don't eval mount points */ #endif /* UKERNEL */ - if (tvc->mvstat == 1 && force_eval) { + if (tvc->mvstat == AFS_MVSTAT_MTPT && force_eval) { /* a mt point, possibly unevaluated */ struct volume *tvolp; @@ -1924,7 +1924,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr * volume) rather than the vc of the mount point itself. We can * still find the mount point's vc in the vcache by its fid. */ #endif /* UKERNEL */ - if (!hit && (force_eval || tvc->mvstat != 1)) { + if (!hit && (force_eval || tvc->mvstat != AFS_MVSTAT_MTPT)) { osi_dnlc_enter(adp, aname, tvc, &versionNo); } else { #ifdef AFS_LINUX20_ENV diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 774da5546..e05b50bf2 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -249,7 +249,7 @@ afs_readdir_type(struct vcache *avc, struct DirEntry *ade) ObtainReadLock(&afs_xvcache); if ((tvc = afs_FindVCache(&tfid, 0, 0))) { ReleaseReadLock(&afs_xvcache); - if (tvc->mvstat) { + if (tvc->mvstat != AFS_MVSTAT_FILE) { afs_PutVCache(tvc); return DT_DIR; } else if (((tvc->f.states) & (CStatd | CTruth))) { @@ -262,7 +262,7 @@ afs_readdir_type(struct vcache *avc, struct DirEntry *ade) else if (vtype == VREG) return DT_REG; /* Don't do this until we're sure it can't be a mtpt */ - /* if we're CStatd and CTruth and mvstat==0, it's a link */ + /* if we're CStatd and CTruth and mvstat==AFS_MVSTAT_FILE, it's a link */ else if (vtype == VLNK) return DT_LNK; /* what other types does AFS support? */ @@ -319,7 +319,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, if (!FidCmp(&afs_rootFid, &vc->f.fid)) { Volume = 0; Vnode = 2; - } else if (vc->mvstat == 2) { + } else if (vc->mvstat == AFS_MVSTAT_ROOT) { tvp = afs_GetVolume(&vc->f.fid, 0, READ_LOCK); if (tvp) { Volume = tvp->mtpoint.Fid.Volume; @@ -337,7 +337,7 @@ afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio, /* We are the root of the AFS root, and thus our own parent */ Volume = 0; Vnode = 2; - } else if (vc->mvstat == 2) { + } else if (vc->mvstat == AFS_MVSTAT_ROOT) { /* We are a volume root, which means our parent is in another * volume. Luckily, we should have his fid cached... */ if (vc->mvid) { diff --git a/src/afs/afs.h b/src/afs/afs.h index 49dee4322..4a6a13fb5 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -803,6 +803,11 @@ struct fvcache { struct afs_vnuniq oldParent; }; +/* Values for 'mvstat' in struct vcache */ +#define AFS_MVSTAT_FILE (0x0) /* regular file or directory */ +#define AFS_MVSTAT_MTPT (0x1) /* mountpoint */ +#define AFS_MVSTAT_ROOT (0x2) /* volume root dir */ + #ifdef AFS_SUN5_ENV /* * This is for the multiPage field in struct vcache. Each one of these @@ -894,7 +899,7 @@ struct vcache { short execsOrWriters; /* The number of execs (if < 0) or writers (if > 0) of * this file. */ short flockCount; /* count of flock readers, or -1 if writer */ - char mvstat; /* 0->normal, 1->mt pt, 2->root. */ + char mvstat; /* see the AFS_MVSTAT_* constants */ char cachingStates; /* Caching policies for this file */ afs_uint32 cachingTransitions; /* # of times file has flopped between caching and not */ diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 4f4ce8099..e948cf92c 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -1535,7 +1535,7 @@ afs_GenDisconStatus(struct vcache *adp, struct vcache *avc, vSetType(avc, VLNK); avc->f.m.Mode |= S_IFLNK; if ((avc->f.m.Mode & 0111) == 0) - avc->mvstat = 1; + avc->mvstat = AFS_MVSTAT_MTPT; avc->f.parent.vnode = adp->f.fid.Fid.Vnode; avc->f.parent.unique = adp->f.fid.Fid.Unique; break; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 917296aba..1a7ac5082 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -2235,7 +2235,7 @@ DECL_PIOCTL(PNewStatMount) code = ENOENT; goto out; } - if (tvc->mvstat != 1) { + if (tvc->mvstat != AFS_MVSTAT_MTPT) { afs_PutVCache(tvc); code = EINVAL; goto out; @@ -3299,7 +3299,7 @@ DECL_PIOCTL(PRemoveMount) afs_PutDCache(tdc); goto out; } - if (tvc->mvstat != 1) { + if (tvc->mvstat != AFS_MVSTAT_MTPT) { afs_PutDCache(tdc); afs_PutVCache(tvc); code = EINVAL; @@ -4849,7 +4849,7 @@ DECL_PIOCTL(PFlushMount) code = ENOENT; goto out; } - if (tvc->mvstat != 1) { + if (tvc->mvstat != AFS_MVSTAT_MTPT) { afs_PutVCache(tvc); code = EINVAL; goto out; diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 03dffd2d4..0e7d13c6e 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -708,9 +708,9 @@ afs_PostPopulateVCache(struct vcache *avc, struct VenusFid *afid, int seq) /* * The proper value for mvstat (for root fids) is setup by the caller. */ - avc->mvstat = 0; + avc->mvstat = AFS_MVSTAT_FILE; if (afid->Fid.Vnode == 1 && afid->Fid.Unique == 1) - avc->mvstat = 2; + avc->mvstat = AFS_MVSTAT_ROOT; if (afs_globalVFS == 0) osi_Panic("afs globalvfs"); @@ -1294,7 +1294,7 @@ afs_SimpleVStat(struct vcache *avc, } else if (vType(avc) == VLNK) { avc->f.m.Mode |= S_IFLNK; if ((avc->f.m.Mode & 0111) == 0) - avc->mvstat = 1; + avc->mvstat = AFS_MVSTAT_MTPT; } if (avc->f.states & CForeign) { struct axscache *ac; @@ -1446,7 +1446,7 @@ afs_WriteVCacheDiscon(struct vcache *avc, } else if (vType(avc) == VLNK) { avc->f.m.Mode |= S_IFLNK; if ((avc->f.m.Mode & 0111) == 0) - avc->mvstat = 1; + avc->mvstat = AFS_MVSTAT_MTPT; } #endif flags |= VDisconSetMode; @@ -1536,7 +1536,7 @@ afs_ProcessFS(struct vcache *avc, avc->f.m.Mode |= S_IFLNK; } if ((avc->f.m.Mode & 0111) == 0) { - avc->mvstat = 1; + avc->mvstat = AFS_MVSTAT_MTPT; } } avc->f.anyAccess = astat->AnonymousAccess; @@ -1813,7 +1813,7 @@ afs_GetVCache(struct VenusFid *afid, struct vrequest *areq, tvc->f.states |= CForeign; if (newvcache && (tvp->rootVnode == afid->Fid.Vnode) && (tvp->rootUnique == afid->Fid.Unique)) { - tvc->mvstat = 2; + tvc->mvstat = AFS_MVSTAT_ROOT; } } if (tvp->states & VRO) @@ -1821,7 +1821,7 @@ afs_GetVCache(struct VenusFid *afid, struct vrequest *areq, if (tvp->states & VBackup) tvc->f.states |= CBackup; /* now copy ".." entry back out of volume structure, if necessary */ - if (tvc->mvstat == 2 && tvp->dotdot.Fid.Volume != 0) { + if (tvc->mvstat == AFS_MVSTAT_ROOT && tvp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) tvc->mvid = (struct VenusFid *) osi_AllocSmallSpace(sizeof(struct VenusFid)); @@ -2001,14 +2001,14 @@ afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, tvc->f.states |= CForeign; if (newvcache && (tvp->rootVnode == afid->Fid.Vnode) && (tvp->rootUnique == afid->Fid.Unique)) - tvc->mvstat = 2; + tvc->mvstat = AFS_MVSTAT_ROOT; } if (tvp->states & VRO) tvc->f.states |= CRO; if (tvp->states & VBackup) tvc->f.states |= CBackup; /* now copy ".." entry back out of volume structure, if necessary */ - if (tvc->mvstat == 2 && tvp->dotdot.Fid.Volume != 0) { + if (tvc->mvstat == AFS_MVSTAT_ROOT && tvp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) tvc->mvid = (struct VenusFid *) osi_AllocSmallSpace(sizeof(struct VenusFid)); @@ -2231,9 +2231,9 @@ afs_GetRootVCache(struct VenusFid *afid, struct vrequest *areq, /* now copy ".." entry back out of volume structure, if necessary */ if (newvcache && (tvolp->rootVnode == afid->Fid.Vnode) && (tvolp->rootUnique == afid->Fid.Unique)) { - tvc->mvstat = 2; + tvc->mvstat = AFS_MVSTAT_ROOT; } - if (tvc->mvstat == 2 && tvolp->dotdot.Fid.Volume != 0) { + if (tvc->mvstat == AFS_MVSTAT_ROOT && tvolp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) tvc->mvid = (struct VenusFid *) osi_AllocSmallSpace(sizeof(struct VenusFid)); @@ -2543,7 +2543,7 @@ afs_StuffVcache(struct VenusFid *afid, * Now, copy ".." entry back out of volume structure, if * necessary */ - if (tvc->mvstat == 2 && tvp->dotdot.Fid.Volume != 0) { + if (tvc->mvstat == AFS_MVSTAT_ROOT && tvp->dotdot.Fid.Volume != 0) { if (!tvc->mvid) tvc->mvid = (struct VenusFid *) osi_AllocSmallSpace(sizeof(struct VenusFid)); -- 2.39.5