]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Use named constants for mvstat
authorAndrew Deason <adeason@sinenomine.net>
Fri, 13 Feb 2015 23:31:37 +0000 (17:31 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 21 Aug 2015 22:52:48 +0000 (18:52 -0400)
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 <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
13 files changed:
src/afs/DARWIN/osi_misc.c
src/afs/DARWIN/osi_vnodeops.c
src/afs/LINUX/osi_export.c
src/afs/LINUX/osi_vnodeops.c
src/afs/SOLARIS/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_access.c
src/afs/VNOPS/afs_vnop_attrs.c
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/VNOPS/afs_vnop_readdir.c
src/afs/afs.h
src/afs/afs_disconnected.c
src/afs/afs_pioctl.c
src/afs/afs_vcache.c

index e0de03700ae63de0522f2172ce4c04fd69cc7e9d..22dcfb047ac35752396b387449f10e99226f88dd 100644 (file)
@@ -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))
index f0cb97d31499b40c3c2d81328b1267a1abd599db..4afb678cd7b70bb478c2e8effdf936227feffb21 100644 (file)
@@ -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;
 
index 57c7f454955c8fb0d3c8679893dc948d7a2bfc25..15a3d9529d4cdc974037104246f274f82245b5f4 100644 (file)
@@ -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
index 6efc0863f68aab311372ef343e3a55443b79b7ea..1655f244e6c1c496c1608267eeba4a02bf931ff5 100644 (file)
@@ -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);
            }
        }
index 93d717afed571f131826bb08b33fe31e6c9644ef..8e24abdfde1cf4d3fcc6eab278f26bb2186cafb8 100644 (file)
@@ -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
 
index 518cb8642589a96b1ad7e0e0835af6607552ac54..149dae9b8636d6e18b332f7cb0a3a67fbfd2fa41 100644 (file)
@@ -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);
index 5603a7b5c8a7048ca08f4c95b1dc3cdcf4f012b3..7e580c5a0525f71d4272707f32f656f3992866ac 100644 (file)
@@ -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;
 
index 11713d1aae1367ab5a291b108eea69723be21ea2..4692674e52ec0ac75a8338da74423284217736c1 100644 (file)
@@ -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
index 774da5546bdd3c9183f7ceaceb95132a017af39d..e05b50bf2ecf074c45db7bc00f37880cc0c0c6b8 100644 (file)
@@ -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) {
index 49dee4322f23f18bc834c2c027ea78e49f2c39fe..4a6a13fb568d0f29aea4807abdb74435a12da5a1 100644 (file)
@@ -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 */
index 4f4ce8099057be12398d8b7133db97a2422bd697..e948cf92cff8cce7faa1a1a1888c5a45d2014aaa 100644 (file)
@@ -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;
index 917296abaa4899eb503bd95b14136a02c8f0a31c..1a7ac50820e33daa10d9a4e49244337a32ae4c84 100644 (file)
@@ -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;
index 03dffd2d423082a02bc20920bd8b620a3839b1b8..0e7d13c6ebf3b91e1023e33746c280dd50586e0d 100644 (file)
@@ -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));