if (astatus->Mask & AFS_SETMODE) {
avc->f.m.Mode = astatus->UnixModeBits;
-#if 0 /* XXX: Leaving this out, so it doesn't mess up the file type flag.*/
-
- if (vType(avc) == VREG) {
- avc->f.m.Mode |= S_IFREG;
- } else if (vType(avc) == VDIR) {
- avc->f.m.Mode |= S_IFDIR;
- } else if (vType(avc) == VLNK) {
- avc->f.m.Mode |= S_IFLNK;
- if ((avc->f.m.Mode & 0111) == 0)
- avc->mvstat = AFS_MVSTAT_MTPT;
- }
-#endif
flags |= VDisconSetMode;
} /* if(astatus.Mask & AFS_SETMODE) */
return code;
}
-#if 0
-/*
- * afs_StuffVcache
- *
- * Description:
- * Stuff some information into the vcache for the given file.
- *
- * Parameters:
- * afid : File in question.
- * OutStatus : Fetch status on the file.
- * CallBack : Callback info.
- * tc : RPC connection involved.
- * areq : vrequest involved.
- *
- * Environment:
- * Nothing interesting.
- */
-void
-afs_StuffVcache(struct VenusFid *afid,
- struct AFSFetchStatus *OutStatus,
- struct AFSCallBack *CallBack, struct afs_conn *tc,
- struct vrequest *areq)
-{
- afs_int32 code, i, newvcache = 0;
- struct vcache *tvc;
- struct AFSVolSync tsync;
- struct volume *tvp;
- struct axscache *ac;
- afs_int32 retry;
-
- AFS_STATCNT(afs_StuffVcache);
-#ifdef IFS_VCACHECOUNT
- ifs_gvcachecall++;
-#endif
-
- loop:
- ObtainSharedLock(&afs_xvcache, 8);
-
- tvc = afs_FindVCache(afid, &retry, DO_VLRU| IS_SLOCK /* no stats */ );
- if (tvc && retry) {
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- ReleaseSharedLock(&afs_xvcache);
- spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
- goto loop;
-#endif
- }
-
- if (!tvc) {
- /* no cache entry, better grab one */
- UpgradeSToWLock(&afs_xvcache, 25);
- tvc = afs_NewVCache(afid, NULL);
- newvcache = 1;
- ConvertWToSLock(&afs_xvcache);
- if (!tvc)
- {
- ReleaseSharedLock(&afs_xvcache);
- return NULL;
- }
- }
-
- ReleaseSharedLock(&afs_xvcache);
- ObtainWriteLock(&tvc->lock, 58);
-
- afs_StaleVCacheFlags(tvc, AFS_STALEVC_NOCB, 0);
-
- /* Is it always appropriate to throw away all the access rights? */
- afs_FreeAllAxs(&(tvc->Access));
-
- /*Copy useful per-volume info */
- tvp = afs_GetVolume(afid, areq, READ_LOCK);
- if (tvp) {
- if (newvcache && (tvp->states & VForeign))
- tvc->f.states |= CForeign;
- 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 == AFS_MVSTAT_ROOT && tvp->dotdot.Fid.Volume != 0) {
- if (!tvc->mvid.parent)
- tvc->mvid.parent = (struct VenusFid *)
- osi_AllocSmallSpace(sizeof(struct VenusFid));
- *tvc->mvid.parent = tvp->dotdot;
- }
- }
- /* store the stat on the file */
- afs_RemoveVCB(afid);
- afs_ProcessFS(tvc, OutStatus, areq);
- tvc->callback = tc->srvr->server;
-
- /* we use osi_Time twice below. Ideally, we would use the time at which
- * the FetchStatus call began, instead, but we don't have it here. So we
- * make do with "now". In the CRO case, it doesn't really matter. In
- * the other case, we hope that the difference between "now" and when the
- * call actually began execution on the server won't be larger than the
- * padding which the server keeps. Subtract 1 second anyway, to be on
- * the safe side. Can't subtract more because we don't know how big
- * ExpirationTime is. Possible consistency problems may arise if the call
- * timeout period becomes longer than the server's expiration padding. */
- ObtainWriteLock(&afs_xcbhash, 470);
- if (CallBack->ExpirationTime != 0) {
- tvc->cbExpires = CallBack->ExpirationTime + osi_Time() - 1;
- tvc->f.states |= CStatd;
- tvc->f.states &= ~CBulkFetching;
- afs_QueueCallback(tvc, CBHash(CallBack->ExpirationTime), tvp);
- } else if (tvc->f.states & CRO) {
- /* old-fashioned AFS 3.2 style */
- tvc->cbExpires = 3600 + osi_Time();
- /*XXX*/ tvc->f.states |= CStatd;
- tvc->f.states &= ~CBulkFetching;
- afs_QueueCallback(tvc, CBHash(3600), tvp);
- } else {
- afs_StaleVCacheFlags(tvc, AFS_STALEVC_CBLOCKED | AFS_STALEVC_CLEARCB,
- CUnique);
- }
- ReleaseWriteLock(&afs_xcbhash);
- if (tvp)
- afs_PutVolume(tvp, READ_LOCK);
-
- /* look in per-pag cache */
- if (tvc->Access && (ac = afs_FindAxs(tvc->Access, areq->uid)))
- ac->axess = OutStatus->CallerAccess; /* substitute pags */
- else /* not found, add a new one if possible */
- afs_AddAxs(tvc->Access, areq->uid, OutStatus->CallerAccess);
-
- ReleaseWriteLock(&tvc->lock);
- afs_Trace4(afs_iclSetp, CM_TRACE_STUFFVCACHE, ICL_TYPE_POINTER, tvc,
- ICL_TYPE_POINTER, tvc->callback, ICL_TYPE_INT32,
- tvc->cbExpires, ICL_TYPE_INT32, tvc->cbExpires - osi_Time());
- /*
- * Release ref count... hope this guy stays around...
- */
- afs_PutVCache(tvc);
-} /*afs_StuffVcache */
-#endif
-
/*!
* Decrements the reference count on a cache entry.
*