#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#endif /* !DJGPP */
#include <stddef.h>
#include <malloc.h>
#include <string.h>
}
#ifdef AFSIFS
- /* for the IFS version, we bulkstat the dirents because this
- routine is used in place of smb_ReceiveCoreSearchDir. our
- other option is to modify smb_ReceiveCoreSearchDir itself,
- but this seems to be the proper use for cm_ApplyDir. */
+ /* for the IFS version, we bulkstat the dirents because this
+ routine is used in place of smb_ReceiveCoreSearchDir. our
+ other option is to modify smb_ReceiveCoreSearchDir itself,
+ but this seems to be the proper use for cm_ApplyDir. */
lock_ObtainMutex(&scp->mx);
if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0
&& (scp->bulkStatProgress.QuadPart <= thyper.QuadPart))
return CM_ERROR_NOSUCHVOLUME;
rock.fid = dscp->dotdotFid;
goto haveFid;
+ } else if (strcmp(namep, ".") == 0) {
+ rock.fid = dscp->fid;
+ goto haveFid;
}
memset(&rock, 0, sizeof(rock));
long code;
char tname[256];
int sysNameIndex = 0;
- cm_scache_t *scp = 0;
+ cm_scache_t *scp = NULL;
if ( stricmp(namep,SMB_IOCTL_FILENAME_NOSLASH) == 0 ) {
if (flags & CM_FLAG_CHECKPATH)
}
if (scp) {
cm_ReleaseSCache(scp);
- scp = 0;
+ scp = NULL;
}
} else {
return cm_LookupInternal(dscp, namep, flags, userp, reqp, outpScpp);
tscp = rootSCachep;
cm_HoldSCache(tscp);
symlinkCount = 0;
- dirScp = 0;
+ dirScp = NULL;
while (1) {
tc = *tp++;
* is a symlink, we have more to do.
*/
*cp++ = 0; /* add null termination */
- extraFlag = 0;
- if ((flags & CM_FLAG_DIRSEARCH) && tc == 0)
- extraFlag = CM_FLAG_NOMOUNTCHASE;
- code = cm_Lookup(tscp, component,
- flags | extraFlag,
- userp, reqp, &nscp);
- if (code) {
- cm_ReleaseSCache(tscp);
- if (dirScp)
+ if (!strcmp(".",component)) {
+ code = 0;
+ if (dirScp) {
cm_ReleaseSCache(dirScp);
- if (psp)
- cm_FreeSpace(psp);
- if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK)
- return CM_ERROR_NOSUCHPATH;
- else
- return code;
- }
- haveComponent = 0; /* component done */
- if (dirScp)
- cm_ReleaseSCache(dirScp);
- dirScp = tscp; /* for some symlinks */
- tscp = nscp; /* already held */
- nscp = 0;
- if (tc == 0 && !(flags & CM_FLAG_FOLLOW) && phase == 2) {
+ dirScp = NULL;
+ }
+ break;
+ }
+ extraFlag = 0;
+ if ((flags & CM_FLAG_DIRSEARCH) && tc == 0)
+ extraFlag = CM_FLAG_NOMOUNTCHASE;
+ code = cm_Lookup(tscp, component,
+ flags | extraFlag,
+ userp, reqp, &nscp);
+ if (code) {
+ cm_ReleaseSCache(tscp);
+ if (dirScp)
+ cm_ReleaseSCache(dirScp);
+ if (psp)
+ cm_FreeSpace(psp);
+ if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK)
+ return CM_ERROR_NOSUCHPATH;
+ else
+ return code;
+ }
+ haveComponent = 0; /* component done */
+ if (dirScp)
+ cm_ReleaseSCache(dirScp);
+ dirScp = tscp; /* for some symlinks */
+ tscp = nscp; /* already held */
+ nscp = NULL;
+ if (tc == 0 && !(flags & CM_FLAG_FOLLOW) && phase == 2) {
code = 0;
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
break;
}
if (code) {
lock_ReleaseMutex(&tscp->mx);
cm_ReleaseSCache(tscp);
- tscp = 0;
+ tscp = NULL;
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
break;
}
lock_ReleaseMutex(&tscp->mx);
if (symlinkCount++ >= MAX_SYMLINK_COUNT) {
cm_ReleaseSCache(tscp);
- tscp = 0;
+ tscp = NULL;
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
if (psp)
cm_FreeSpace(psp);
if (code) {
/* something went wrong */
cm_ReleaseSCache(tscp);
- tscp = 0;
+ tscp = NULL;
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
break;
}
tp = psp->data;
cm_ReleaseSCache(tscp);
tscp = linkScp;
- linkScp = 0;
+ linkScp = NULL;
/* already held
* by AssembleLink
* now, if linkScp is null, that's
*/
if (tscp == NULL) {
tscp = dirScp;
- dirScp = 0;
+ dirScp = NULL;
}
} else {
/* not a symlink, we may be done */
}
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
code = 0;
break;
}
if (dirScp) {
cm_ReleaseSCache(dirScp);
- dirScp = 0;
+ dirScp = NULL;
}
} /* end of a component */
else
if (tscp) {
if (lock_TryMutex(&tscp->mx)) {
/* we have an entry that we can look at */
- if (cm_HaveCallback(tscp)) {
+ if (!(tscp->flags & CM_SCACHEFLAG_EACCESS) && cm_HaveCallback(tscp)) {
/* we have a callback on it. Don't bother
* fetching this stat entry, since we're happy
* with the info we have.
* Right now, be pretty conservative: if there's a
* callback or a pending call, skip it.
*/
- if (scp->cbServerp == NULL
+ if ((scp->cbServerp == NULL || (scp->flags & CM_SCACHEFLAG_EACCESS))
&& !(scp->flags &
(CM_SCACHEFLAG_FETCHING
| CM_SCACHEFLAG_STORING