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))
*/
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;
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;
}
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;
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;
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 */
* 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);
/*
}
/* 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
/* 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) {
} 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
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
* 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);
* 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;
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;
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);
}
}
* 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
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);
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)
#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) {
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;
state->did_eval = 1;
tvc = *avcp;
- if (tvc->mvstat != 1)
+ if (tvc->mvstat != AFS_MVSTAT_MTPT)
return 0;
if (canblock) {
}
/* 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;
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;
}
/* 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;
}
/*printf("Code is %d\n", code);*/
- if (tryEvalOnly && adp->mvstat == 1)
+ if (tryEvalOnly && adp->mvstat == AFS_MVSTAT_MTPT)
code = ENOENT;
if (code)
goto done;
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;
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 {
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);
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;
* 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
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))) {
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? */
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;
/* 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) {
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
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 */
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;
code = ENOENT;
goto out;
}
- if (tvc->mvstat != 1) {
+ if (tvc->mvstat != AFS_MVSTAT_MTPT) {
afs_PutVCache(tvc);
code = EINVAL;
goto out;
afs_PutDCache(tdc);
goto out;
}
- if (tvc->mvstat != 1) {
+ if (tvc->mvstat != AFS_MVSTAT_MTPT) {
afs_PutDCache(tdc);
afs_PutVCache(tvc);
code = EINVAL;
code = ENOENT;
goto out;
}
- if (tvc->mvstat != 1) {
+ if (tvc->mvstat != AFS_MVSTAT_MTPT) {
afs_PutVCache(tvc);
code = EINVAL;
goto out;
/*
* 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");
} 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;
} 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;
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;
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)
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));
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));
/* 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));
* 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));