mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
window-afsifs-20050617
Updates to the afsifs-20050615 DELTA. * Fix the build system * Reformat the code * Update docs
This commit is contained in:
parent
ff8554593f
commit
329a792344
17
README-NT
17
README-NT
@ -71,7 +71,7 @@ The following Microsoft SDK is required:
|
||||
|
||||
The following Microsoft DDK is required:
|
||||
|
||||
Microsoft Windows Server 2003 DDK
|
||||
Microsoft Windows Server 2003 SP1 DDK
|
||||
available via a MSDN subscription or via free CD
|
||||
http://www.microsoft.com/whdc/devtools/ddk/orderddkcd.mspx
|
||||
|
||||
@ -180,6 +180,11 @@ These files come from the following Microsoft DDKs/SDKs:
|
||||
netcfgn.h, netcfgx.h:
|
||||
Windows XP/2003 DDK - inc/wxp/
|
||||
|
||||
If you are interested in experimenting with the IFS you must purchase from
|
||||
Microsoft a copy of the Windows 2003 SP1 IFS Kit.
|
||||
|
||||
http://www.microsoft.com/whdc/devtools/ifskit/default.mspx
|
||||
|
||||
|
||||
STEP D. Configure NTBUILD.BAT.
|
||||
|
||||
@ -200,7 +205,8 @@ must be defined to match your configuration:
|
||||
|
||||
NTDDKDIR: Set the short name of the directory containing the npapi.h file
|
||||
|
||||
AFSROOT: Set to the short name of the OpenAFS Base directory
|
||||
AFSROOT: Set to the short name of the OpenAFS Base directory. This
|
||||
cannot be set to a UNC path.
|
||||
|
||||
|
||||
STEP E. Set version and installation options (optional)
|
||||
@ -211,7 +217,7 @@ from:
|
||||
http://grand.central.org/dl/cellservdb/CellServDB
|
||||
then copy it to %AFSROOT%\src\WINNT\install\NSIS and name it afsdcell.ini
|
||||
|
||||
Edit file %AFSROOT%\src\config\NTMakefile.i386_nt40
|
||||
Edit file %AFSROOT%\src\config\NTMakefile.i386_w2k
|
||||
AFSPRODUCT_VER_MAJOR - Version Major Number
|
||||
AFSPRODUCT_VER_MINOR - Version Minor Number
|
||||
AFSPRODUCT_VER_PATCH - Version Patch Number
|
||||
@ -284,7 +290,7 @@ STEP F. Begin the build
|
||||
|
||||
nmake /f NTMakefile clean
|
||||
|
||||
(5) Build the complete Windows NT/2000 development environment.
|
||||
(5) Build the complete Windows 2000/XP/2003 development environment.
|
||||
|
||||
nmake /f NTMakefile install
|
||||
|
||||
@ -293,6 +299,9 @@ behavior is normal; the build process is successful as long as the build
|
||||
process doesn't terminate with an error ("nmake.exe return code 0x2")
|
||||
and it displays 'Build Finished Successfully'.
|
||||
|
||||
(6) [IFS only] Open a DDK/IFS Build Environment command window, change
|
||||
to the src\WINNT\afsrdr directory, and execute the "build" command.
|
||||
|
||||
|
||||
STEP G. Install NSIS 2.0 (optional).
|
||||
|
||||
|
@ -1,3 +1,17 @@
|
||||
Since 1.3.84:
|
||||
* Eric William's IFS redirector has been checked into the source
|
||||
tree. This code is experimental at the current time and is not
|
||||
being incorporated into binary releases. Instructions for building
|
||||
from sources are found in the top-level README-NT file.
|
||||
|
||||
* Modify integrated login so that it does not enter an infinite
|
||||
loop if the service is not set to auto start.
|
||||
|
||||
* Added asetkey.exe used to set a Kerberos 5 key for use by the
|
||||
AFS server daemons
|
||||
|
||||
* Added uninstall.exe to Wix installation
|
||||
|
||||
Since 1.3.83:
|
||||
|
||||
* Changes to the algorithms used to wake threads when they are
|
||||
|
@ -640,7 +640,7 @@ OpenAFS for Windows
|
||||
Registry : 'reg_freekey5'
|
||||
Root : 2
|
||||
Key : 'SOFTWARE\OpenAFS\Client\Freelance\Symlinks'
|
||||
Name : '0'
|
||||
Name : '1'
|
||||
Value : '.athena:.athena.mit.edu.'
|
||||
Component : 'rcm_FreelanceKeys'
|
||||
|
||||
|
@ -449,20 +449,20 @@ static void MountGlobalDrives(void)
|
||||
|
||||
#ifndef AFSIFS
|
||||
for ( ; dwRetry < MAX_RETRIES; dwRetry++)
|
||||
{
|
||||
NETRESOURCE nr;
|
||||
memset (&nr, 0x00, sizeof(NETRESOURCE));
|
||||
|
||||
sprintf(szAfsPath,"\\\\%s\\%s",cm_NetbiosName,szSubMount);
|
||||
|
||||
nr.dwScope = RESOURCE_GLOBALNET; /* ignored parameter */
|
||||
nr.dwType=RESOURCETYPE_DISK;
|
||||
nr.lpLocalName=szDriveToMapTo;
|
||||
nr.lpRemoteName=szAfsPath;
|
||||
nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; /* ignored parameter */
|
||||
nr.dwUsage = RESOURCEUSAGE_CONNECTABLE; /* ignored parameter */
|
||||
{
|
||||
NETRESOURCE nr;
|
||||
memset (&nr, 0x00, sizeof(NETRESOURCE));
|
||||
|
||||
dwResult = WNetAddConnection2(&nr,NULL,NULL,0);
|
||||
sprintf(szAfsPath,"\\\\%s\\%s",cm_NetbiosName,szSubMount);
|
||||
|
||||
nr.dwScope = RESOURCE_GLOBALNET; /* ignored parameter */
|
||||
nr.dwType=RESOURCETYPE_DISK;
|
||||
nr.lpLocalName=szDriveToMapTo;
|
||||
nr.lpRemoteName=szAfsPath;
|
||||
nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; /* ignored parameter */
|
||||
nr.dwUsage = RESOURCEUSAGE_CONNECTABLE; /* ignored parameter */
|
||||
|
||||
dwResult = WNetAddConnection2(&nr,NULL,NULL,0);
|
||||
afsi_log("GlobalAutoMap of %s to %s %s (%d)", szDriveToMapTo, szSubMount,
|
||||
(dwResult == NO_ERROR) ? "succeeded" : "failed", dwResult);
|
||||
if (dwResult == NO_ERROR) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -92,9 +92,9 @@ void cm_RecordRacingRevoke(cm_fid_t *fidp, long cancelFlags)
|
||||
}
|
||||
|
||||
#ifdef AFSIFS
|
||||
#define BUF_FILEHASH(fidp) ((((fidp)->vnode+((fidp)->unique << 13) + ((fidp)->unique >> (32-13)) \
|
||||
+(fidp)->volume+(fidp)->cell) \
|
||||
/*& 0xffffffff*/))
|
||||
#define BUF_FILEHASH(fidp) ((((fidp)->vnode+((fidp)->unique << 13) + ((fidp)->unique >> (32-13)) \
|
||||
+(fidp)->volume+(fidp)->cell) \
|
||||
/*& 0xffffffff*/))
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -135,7 +135,7 @@ void cm_CallbackNotifyChange(cm_scache_t *scp)
|
||||
FILE_NOTIFY_GENERIC_DIRECTORY_FILTER,
|
||||
scp, NULL, NULL, TRUE);
|
||||
#else
|
||||
dc_break_callback(BUF_FILEHASH(&scp->fid));
|
||||
dc_break_callback(BUF_FILEHASH(&scp->fid));
|
||||
#endif
|
||||
} else {
|
||||
cm_fid_t tfid;
|
||||
@ -153,8 +153,8 @@ void cm_CallbackNotifyChange(cm_scache_t *scp)
|
||||
FILE_NOTIFY_GENERIC_FILE_FILTER,
|
||||
dscp, NULL, NULL, TRUE);
|
||||
#else
|
||||
if (dscp)
|
||||
dc_break_callback(BUF_FILEHASH(&dscp->fid));
|
||||
if (dscp)
|
||||
dc_break_callback(BUF_FILEHASH(&dscp->fid));
|
||||
#endif
|
||||
if (dscp)
|
||||
cm_ReleaseSCache(dscp);
|
||||
|
@ -159,46 +159,47 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
|
||||
TranslateExtendedChars(relativePath);
|
||||
|
||||
#ifdef AFSIFS
|
||||
/* we have passed the whole path, including the afs prefix (pioctl_nt.c modified) */
|
||||
/*_asm int 3;
|
||||
sprintf(absRoot, "%c:", relativePath[0]);
|
||||
rootDir = CreateFile(absRoot, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
if (!DeviceIoControl(rootDir, IOCTL_AFSRDR_GET_PATH, NULL, 0, absRoot_w, 100*sizeof(wchar_t), &length, NULL))
|
||||
{
|
||||
CloseHandle(rootDir);
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
}
|
||||
CloseHandle(rootDir);
|
||||
|
||||
ifs_ConvertFileName(absRoot_w, length/sizeof(wchar_t), absRoot, 100);*/
|
||||
|
||||
/* we have passed the whole path, including the afs prefix (pioctl_nt.c modified) */
|
||||
#if 0
|
||||
switch (relativePath[0]) /* FIXFIX */
|
||||
{
|
||||
case 'y':
|
||||
case 'Y':
|
||||
absRoot = "\\ericjw\\test"; /* should use drivemap */
|
||||
}
|
||||
/*_asm int 3; */
|
||||
sprintf(absRoot, "%c:", relativePath[0]);
|
||||
rootDir = CreateFile(absRoot, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
if (!DeviceIoControl(rootDir, IOCTL_AFSRDR_GET_PATH, NULL, 0, absRoot_w, 100*sizeof(wchar_t), &length, NULL))
|
||||
{
|
||||
CloseHandle(rootDir);
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
}
|
||||
CloseHandle(rootDir);
|
||||
|
||||
ifs_ConvertFileName(absRoot_w, length/sizeof(wchar_t), absRoot, 100);
|
||||
#endif
|
||||
code = cm_NameI(cm_data.rootSCachep, relativePath,
|
||||
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
|
||||
userp, ""/*absRoot*//*ioctlp->tidPathp*/, reqp, scpp);
|
||||
#if 0
|
||||
switch (relativePath[0]) /* FIXFIX */
|
||||
{
|
||||
case 'y':
|
||||
case 'Y':
|
||||
absRoot = "\\ericjw\\test"; /* should use drivemap */
|
||||
}
|
||||
#endif
|
||||
code = cm_NameI(cm_data.rootSCachep, relativePath,
|
||||
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
|
||||
userp, ""/*absRoot*//*ioctlp->tidPathp*/, reqp, scpp);
|
||||
|
||||
if (code)
|
||||
return code;
|
||||
if (code)
|
||||
return code;
|
||||
|
||||
/* # of bytes of path */
|
||||
/* # of bytes of path */
|
||||
code = strlen(ioctlp->inDatap) + 1;
|
||||
ioctlp->inDatap += code;
|
||||
|
||||
/* This is usually nothing, but for StatMountPoint it is the file name. */
|
||||
TranslateExtendedChars(ioctlp->inDatap);
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
#endif /* AFSIFS */
|
||||
|
||||
if (relativePath[0] == relativePath[1] &&
|
||||
if (relativePath[0] == relativePath[1] &&
|
||||
relativePath[1] == '\\' &&
|
||||
!_strnicmp(cm_NetbiosName,relativePath+2,strlen(cm_NetbiosName)))
|
||||
{
|
||||
@ -1832,7 +1833,7 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
|
||||
tp += strlen(tp) + 1;
|
||||
|
||||
#ifndef AFSIFS /* no SMB username */
|
||||
if (flags & PIOCTL_LOGON) {
|
||||
if (flags & PIOCTL_LOGON) {
|
||||
/* SMB user name with which to associate tokens */
|
||||
smbname = tp;
|
||||
osi_Log2(smb_logp,"cm_IoctlSetToken for user [%s] smbname [%s]",
|
||||
|
@ -546,19 +546,20 @@ long cm_ApplyDir(cm_scache_t *scp, cm_DirFuncp_t funcp, void *parmp,
|
||||
}
|
||||
|
||||
#ifdef AFSIFS
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0
|
||||
&& (scp->bulkStatProgress.QuadPart <= thyper.QuadPart))
|
||||
{
|
||||
scp->flags |= CM_SCACHEFLAG_BULKSTATTING;
|
||||
cm_TryBulkStat(scp, &thyper, userp, reqp);
|
||||
scp->flags &= ~CM_SCACHEFLAG_BULKSTATTING;
|
||||
scp->bulkStatProgress = thyper;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
/* Why was this added for IFS? - jaltman 06/18/2006 */
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0
|
||||
&& (scp->bulkStatProgress.QuadPart <= thyper.QuadPart))
|
||||
{
|
||||
scp->flags |= CM_SCACHEFLAG_BULKSTATTING;
|
||||
cm_TryBulkStat(scp, &thyper, userp, reqp);
|
||||
scp->flags &= ~CM_SCACHEFLAG_BULKSTATTING;
|
||||
scp->bulkStatProgress = thyper;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
#endif
|
||||
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
bufferOffset = thyper;
|
||||
|
||||
/* now get the data in the cache */
|
||||
|
@ -16,349 +16,356 @@
|
||||
long buf_bufferSize = CM_BUF_SIZE;
|
||||
|
||||
long ReadData(cm_scache_t *scp, osi_hyper_t offset, long count, char *op,
|
||||
cm_user_t *userp, long *readp)
|
||||
cm_user_t *userp, long *readp)
|
||||
{
|
||||
//osi_hyper_t offset;
|
||||
long code;
|
||||
cm_buf_t *bufferp;
|
||||
osi_hyper_t fileLength;
|
||||
osi_hyper_t thyper;
|
||||
osi_hyper_t lastByte;
|
||||
osi_hyper_t bufferOffset;
|
||||
long bufIndex, nbytes;
|
||||
int sequential = 0;
|
||||
cm_req_t req;
|
||||
//osi_hyper_t offset;
|
||||
long code;
|
||||
cm_buf_t *bufferp;
|
||||
osi_hyper_t fileLength;
|
||||
osi_hyper_t thyper;
|
||||
osi_hyper_t lastByte;
|
||||
osi_hyper_t bufferOffset;
|
||||
long bufIndex, nbytes;
|
||||
int sequential = 0;
|
||||
cm_req_t req;
|
||||
|
||||
cm_InitReq(&req);
|
||||
cm_InitReq(&req);
|
||||
|
||||
bufferp = NULL;
|
||||
bufferp = NULL;
|
||||
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
|
||||
/* start by looking up the file's end */
|
||||
code = cm_SyncOp(scp, NULL, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
|
||||
if (code) goto done;
|
||||
/* start by looking up the file's end */
|
||||
code = cm_SyncOp(scp, NULL, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
/* now we have the entry locked, look up the length */
|
||||
fileLength = scp->length;
|
||||
/* now we have the entry locked, look up the length */
|
||||
fileLength = scp->length;
|
||||
|
||||
/* adjust count down so that it won't go past EOF */
|
||||
thyper.LowPart = count;
|
||||
thyper.HighPart = 0;
|
||||
thyper = LargeIntegerAdd(offset, thyper); /* where read should end */
|
||||
lastByte = thyper;
|
||||
if (LargeIntegerGreaterThan(thyper, fileLength)) {
|
||||
/* we'd read past EOF, so just stop at fileLength bytes.
|
||||
* Start by computing how many bytes remain in the file.
|
||||
*/
|
||||
thyper = LargeIntegerSubtract(fileLength, offset);
|
||||
/* adjust count down so that it won't go past EOF */
|
||||
thyper.LowPart = count;
|
||||
thyper.HighPart = 0;
|
||||
thyper = LargeIntegerAdd(offset, thyper); /* where read should end */
|
||||
lastByte = thyper;
|
||||
if (LargeIntegerGreaterThan(thyper, fileLength)) {
|
||||
/* we'd read past EOF, so just stop at fileLength bytes.
|
||||
* Start by computing how many bytes remain in the file.
|
||||
*/
|
||||
thyper = LargeIntegerSubtract(fileLength, offset);
|
||||
|
||||
/* if we are past EOF, read 0 bytes */
|
||||
if (LargeIntegerLessThanZero(thyper))
|
||||
count = 0;
|
||||
else
|
||||
count = thyper.LowPart;
|
||||
}
|
||||
/* if we are past EOF, read 0 bytes */
|
||||
if (LargeIntegerLessThanZero(thyper))
|
||||
count = 0;
|
||||
else
|
||||
count = thyper.LowPart;
|
||||
}
|
||||
|
||||
*readp = count;
|
||||
*readp = count;
|
||||
|
||||
/* now, copy the data one buffer at a time,
|
||||
* until we've filled the request packet
|
||||
*/
|
||||
while (1) {
|
||||
/* if we've copied all the data requested, we're done */
|
||||
if (count <= 0) break;
|
||||
/* now, copy the data one buffer at a time,
|
||||
* until we've filled the request packet
|
||||
*/
|
||||
while (1) {
|
||||
/* if we've copied all the data requested, we're done */
|
||||
if (count <= 0) break;
|
||||
|
||||
/* otherwise, load up a buffer of data */
|
||||
thyper.HighPart = offset.HighPart;
|
||||
thyper.LowPart = offset.LowPart & ~(buf_bufferSize-1);
|
||||
if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) {
|
||||
/* wrong buffer */
|
||||
if (bufferp) {
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
/* otherwise, load up a buffer of data */
|
||||
thyper.HighPart = offset.HighPart;
|
||||
thyper.LowPart = offset.LowPart & ~(buf_bufferSize-1);
|
||||
if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) {
|
||||
/* wrong buffer */
|
||||
if (bufferp) {
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
|
||||
lock_ObtainRead(&scp->bufCreateLock);
|
||||
code = buf_Get(scp, &thyper, &bufferp);
|
||||
lock_ReleaseRead(&scp->bufCreateLock);
|
||||
lock_ObtainRead(&scp->bufCreateLock);
|
||||
code = buf_Get(scp, &thyper, &bufferp);
|
||||
lock_ReleaseRead(&scp->bufCreateLock);
|
||||
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code) goto done;
|
||||
bufferOffset = thyper;
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code) goto done;
|
||||
bufferOffset = thyper;
|
||||
|
||||
/* now get the data in the cache */
|
||||
while (1) {
|
||||
code = cm_SyncOp(scp, bufferp, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_READ);
|
||||
if (code) goto done;
|
||||
/* now get the data in the cache */
|
||||
while (1) {
|
||||
code = cm_SyncOp(scp, bufferp, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_READ);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
if (cm_HaveBuffer(scp, bufferp, 0)) break;
|
||||
if (cm_HaveBuffer(scp, bufferp, 0)) break;
|
||||
|
||||
/* otherwise, load the buffer and try again */
|
||||
code = cm_GetBuffer(scp, bufferp, NULL, userp, &req);
|
||||
if (code) break;
|
||||
}
|
||||
if (code) {
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
goto done;
|
||||
}
|
||||
} /* if (wrong buffer) ... */
|
||||
/* otherwise, load the buffer and try again */
|
||||
code = cm_GetBuffer(scp, bufferp, NULL, userp, &req);
|
||||
if (code) break;
|
||||
}
|
||||
if (code) {
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
goto done;
|
||||
}
|
||||
} /* if (wrong buffer) ... */
|
||||
|
||||
/* now we have the right buffer loaded. Copy out the
|
||||
* data from here to the user's buffer.
|
||||
*/
|
||||
bufIndex = offset.LowPart & (buf_bufferSize - 1);
|
||||
/* now we have the right buffer loaded. Copy out the
|
||||
* data from here to the user's buffer.
|
||||
*/
|
||||
bufIndex = offset.LowPart & (buf_bufferSize - 1);
|
||||
|
||||
/* and figure out how many bytes we want from this buffer */
|
||||
nbytes = buf_bufferSize - bufIndex; /* what remains in buffer */
|
||||
if (nbytes > count) nbytes = count; /* don't go past EOF */
|
||||
/* and figure out how many bytes we want from this buffer */
|
||||
nbytes = buf_bufferSize - bufIndex; /* what remains in buffer */
|
||||
if (nbytes > count) nbytes = count; /* don't go past EOF */
|
||||
|
||||
/* now copy the data */
|
||||
memcpy(op, bufferp->datap + bufIndex, nbytes);
|
||||
/* now copy the data */
|
||||
memcpy(op, bufferp->datap + bufIndex, nbytes);
|
||||
|
||||
/* adjust counters, pointers, etc. */
|
||||
op += nbytes;
|
||||
count -= nbytes;
|
||||
thyper.LowPart = nbytes;
|
||||
thyper.HighPart = 0;
|
||||
offset = LargeIntegerAdd(thyper, offset);
|
||||
} /* while 1 */
|
||||
/* adjust counters, pointers, etc. */
|
||||
op += nbytes;
|
||||
count -= nbytes;
|
||||
thyper.LowPart = nbytes;
|
||||
thyper.HighPart = 0;
|
||||
offset = LargeIntegerAdd(thyper, offset);
|
||||
} /* while 1 */
|
||||
|
||||
done:
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
//lock_ReleaseMutex(&fidp->mx);
|
||||
if (bufferp) buf_Release(bufferp);
|
||||
done:
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
//lock_ReleaseMutex(&fidp->mx);
|
||||
if (bufferp)
|
||||
buf_Release(bufferp);
|
||||
|
||||
if (code == 0 && sequential)
|
||||
cm_ConsiderPrefetch(scp, &lastByte, userp, &req);
|
||||
if (code == 0 && sequential)
|
||||
cm_ConsiderPrefetch(scp, &lastByte, userp, &req);
|
||||
|
||||
return code;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
long WriteData(cm_scache_t *scp, osi_hyper_t offset, long count, char *op,
|
||||
cm_user_t *userp, long *writtenp)
|
||||
cm_user_t *userp, long *writtenp)
|
||||
{
|
||||
long code = 0;
|
||||
long written = 0;
|
||||
//cm_scache_t *scp;
|
||||
osi_hyper_t fileLength; /* file's length at start of write */
|
||||
osi_hyper_t minLength; /* don't read past this */
|
||||
long nbytes; /* # of bytes to transfer this iteration */
|
||||
cm_buf_t *bufferp;
|
||||
osi_hyper_t thyper; /* hyper tmp variable */
|
||||
osi_hyper_t bufferOffset;
|
||||
long bufIndex; /* index in buffer where our data is */
|
||||
int doWriteBack;
|
||||
osi_hyper_t writeBackOffset; /* offset of region to write back when
|
||||
* I/O is done */
|
||||
DWORD filter = 0;
|
||||
cm_req_t req;
|
||||
long code = 0;
|
||||
long written = 0;
|
||||
osi_hyper_t fileLength; /* file's length at start of write */
|
||||
osi_hyper_t minLength; /* don't read past this */
|
||||
long nbytes; /* # of bytes to transfer this iteration */
|
||||
cm_buf_t *bufferp;
|
||||
osi_hyper_t thyper; /* hyper tmp variable */
|
||||
osi_hyper_t bufferOffset;
|
||||
long bufIndex; /* index in buffer where our data is */
|
||||
int doWriteBack;
|
||||
osi_hyper_t writeBackOffset; /* offset of region to write back when
|
||||
* I/O is done */
|
||||
DWORD filter = 0;
|
||||
cm_req_t req;
|
||||
|
||||
cm_InitReq(&req);
|
||||
cm_InitReq(&req);
|
||||
|
||||
bufferp = NULL;
|
||||
doWriteBack = 0;
|
||||
bufferp = NULL;
|
||||
doWriteBack = 0;
|
||||
|
||||
//scp = fidp->scp;
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
|
||||
/* start by looking up the file's end */
|
||||
code = cm_SyncOp(scp, NULL, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_SETSTATUS
|
||||
| CM_SCACHESYNC_GETSTATUS);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
/* make sure we have a writable FD */
|
||||
/*if (!(fidp->flags & SMB_FID_OPENWRITE)) {
|
||||
code = CM_ERROR_BADFDOP;
|
||||
goto done;
|
||||
} */
|
||||
/* start by looking up the file's end */
|
||||
code = cm_SyncOp(scp, NULL, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_SETSTATUS
|
||||
| CM_SCACHESYNC_GETSTATUS);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
#if 0
|
||||
/* make sure we have a writable FD */
|
||||
if (!(fidp->flags & SMB_FID_OPENWRITE)) {
|
||||
code = CM_ERROR_BADFDOP;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* now we have the entry locked, look up the length */
|
||||
fileLength = scp->length;
|
||||
minLength = fileLength;
|
||||
if (LargeIntegerGreaterThan(minLength, scp->serverLength))
|
||||
minLength = scp->serverLength;
|
||||
/* now we have the entry locked, look up the length */
|
||||
fileLength = scp->length;
|
||||
minLength = fileLength;
|
||||
if (LargeIntegerGreaterThan(minLength, scp->serverLength))
|
||||
minLength = scp->serverLength;
|
||||
|
||||
/* adjust file length if we extend past EOF */
|
||||
thyper.LowPart = count;
|
||||
thyper.HighPart = 0;
|
||||
thyper = LargeIntegerAdd(offset, thyper); /* where write should end */
|
||||
if (LargeIntegerGreaterThan(thyper, fileLength)) {
|
||||
/* we'd write past EOF, so extend the file */
|
||||
scp->mask |= CM_SCACHEMASK_LENGTH;
|
||||
scp->length = thyper;
|
||||
filter |= (FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE);
|
||||
} else
|
||||
filter |= FILE_NOTIFY_CHANGE_LAST_WRITE;
|
||||
|
||||
/* now, if the new position (thyper) and the old (offset) are in
|
||||
* different storeback windows, remember to store back the previous
|
||||
* storeback window when we're done with the write.
|
||||
*/
|
||||
if ((thyper.LowPart & (-cm_chunkSize)) !=
|
||||
(offset.LowPart & (-cm_chunkSize))) {
|
||||
/* they're different */
|
||||
doWriteBack = 1;
|
||||
writeBackOffset.HighPart = offset.HighPart;
|
||||
writeBackOffset.LowPart = offset.LowPart & (-cm_chunkSize);
|
||||
}
|
||||
|
||||
*writtenp = count;
|
||||
/* adjust file length if we extend past EOF */
|
||||
thyper.LowPart = count;
|
||||
thyper.HighPart = 0;
|
||||
thyper = LargeIntegerAdd(offset, thyper); /* where write should end */
|
||||
if (LargeIntegerGreaterThan(thyper, fileLength)) {
|
||||
/* we'd write past EOF, so extend the file */
|
||||
scp->mask |= CM_SCACHEMASK_LENGTH;
|
||||
scp->length = thyper;
|
||||
filter |= (FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE);
|
||||
} else
|
||||
filter |= FILE_NOTIFY_CHANGE_LAST_WRITE;
|
||||
|
||||
/* now, copy the data one buffer at a time, until we've filled the
|
||||
* request packet */
|
||||
while (1) {
|
||||
/* if we've copied all the data requested, we're done */
|
||||
if (count <= 0) break;
|
||||
/* now, if the new position (thyper) and the old (offset) are in
|
||||
* different storeback windows, remember to store back the previous
|
||||
* storeback window when we're done with the write.
|
||||
*/
|
||||
if ((thyper.LowPart & (-cm_chunkSize)) !=
|
||||
(offset.LowPart & (-cm_chunkSize))) {
|
||||
/* they're different */
|
||||
doWriteBack = 1;
|
||||
writeBackOffset.HighPart = offset.HighPart;
|
||||
writeBackOffset.LowPart = offset.LowPart & (-cm_chunkSize);
|
||||
}
|
||||
|
||||
/* handle over quota or out of space */
|
||||
if (scp->flags & (CM_SCACHEFLAG_OVERQUOTA | CM_SCACHEFLAG_OUTOFSPACE)) {
|
||||
*writtenp = written;
|
||||
break;
|
||||
}
|
||||
|
||||
/* otherwise, load up a buffer of data */
|
||||
thyper.HighPart = offset.HighPart;
|
||||
thyper.LowPart = offset.LowPart & ~(buf_bufferSize-1);
|
||||
if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) {
|
||||
/* wrong buffer */
|
||||
if (bufferp) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
*writtenp = count;
|
||||
|
||||
lock_ObtainRead(&scp->bufCreateLock);
|
||||
code = buf_Get(scp, &thyper, &bufferp);
|
||||
lock_ReleaseRead(&scp->bufCreateLock);
|
||||
/* now, copy the data one buffer at a time, until we've filled the
|
||||
* request packet */
|
||||
while (1) {
|
||||
/* if we've copied all the data requested, we're done */
|
||||
if (count <= 0) break;
|
||||
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code) goto done;
|
||||
/* handle over quota or out of space */
|
||||
if (scp->flags & (CM_SCACHEFLAG_OVERQUOTA | CM_SCACHEFLAG_OUTOFSPACE)) {
|
||||
*writtenp = written;
|
||||
break;
|
||||
}
|
||||
|
||||
bufferOffset = thyper;
|
||||
/* otherwise, load up a buffer of data */
|
||||
thyper.HighPart = offset.HighPart;
|
||||
thyper.LowPart = offset.LowPart & ~(buf_bufferSize-1);
|
||||
if (!bufferp || !LargeIntegerEqualTo(thyper, bufferOffset)) {
|
||||
/* wrong buffer */
|
||||
if (bufferp) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
|
||||
/* now get the data in the cache */
|
||||
while (1) {
|
||||
code = cm_SyncOp(scp, bufferp, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_WRITE
|
||||
| CM_SCACHESYNC_BUFLOCKED);
|
||||
if (code)
|
||||
goto done;
|
||||
lock_ObtainRead(&scp->bufCreateLock);
|
||||
code = buf_Get(scp, &thyper, &bufferp);
|
||||
lock_ReleaseRead(&scp->bufCreateLock);
|
||||
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
bufferOffset = thyper;
|
||||
|
||||
/* now get the data in the cache */
|
||||
while (1) {
|
||||
code = cm_SyncOp(scp, bufferp, userp, &req, 0,
|
||||
CM_SCACHESYNC_NEEDCALLBACK
|
||||
| CM_SCACHESYNC_WRITE
|
||||
| CM_SCACHESYNC_BUFLOCKED);
|
||||
if (code)
|
||||
goto done;
|
||||
|
||||
/* If we're overwriting the entire buffer, or
|
||||
* if we're writing at or past EOF, mark the
|
||||
* buffer as current so we don't call
|
||||
* cm_GetBuffer. This skips the fetch from the
|
||||
* server in those cases where we're going to
|
||||
* obliterate all the data in the buffer anyway,
|
||||
* or in those cases where there is no useful
|
||||
* data at the server to start with.
|
||||
*
|
||||
* Use minLength instead of scp->length, since
|
||||
* the latter has already been updated by this
|
||||
* call.
|
||||
*/
|
||||
if (LargeIntegerGreaterThanOrEqualTo(bufferp->offset, minLength) ||
|
||||
LargeIntegerEqualTo(offset, bufferp->offset) &&
|
||||
(count >= buf_bufferSize ||
|
||||
LargeIntegerGreaterThanOrEqualTo(LargeIntegerAdd(offset, ConvertLongToLargeInteger(count)), minLength))) {
|
||||
if (count < buf_bufferSize
|
||||
&& bufferp->dataVersion == -1)
|
||||
memset(bufferp->datap, 0,
|
||||
buf_bufferSize);
|
||||
bufferp->dataVersion = scp->dataVersion;
|
||||
}
|
||||
/* If we're overwriting the entire buffer, or
|
||||
* if we're writing at or past EOF, mark the
|
||||
* buffer as current so we don't call
|
||||
* cm_GetBuffer. This skips the fetch from the
|
||||
* server in those cases where we're going to
|
||||
* obliterate all the data in the buffer anyway,
|
||||
* or in those cases where there is no useful
|
||||
* data at the server to start with.
|
||||
*
|
||||
* Use minLength instead of scp->length, since
|
||||
* the latter has already been updated by this
|
||||
* call.
|
||||
*/
|
||||
if (LargeIntegerGreaterThanOrEqualTo(bufferp->offset, minLength) ||
|
||||
LargeIntegerEqualTo(offset, bufferp->offset) &&
|
||||
(count >= buf_bufferSize ||
|
||||
LargeIntegerGreaterThanOrEqualTo(LargeIntegerAdd(offset, ConvertLongToLargeInteger(count)), minLength))) {
|
||||
if (count < buf_bufferSize
|
||||
&& bufferp->dataVersion == -1)
|
||||
memset(bufferp->datap, 0,
|
||||
buf_bufferSize);
|
||||
bufferp->dataVersion = scp->dataVersion;
|
||||
}
|
||||
|
||||
if (cm_HaveBuffer(scp, bufferp, 1)) break;
|
||||
if (cm_HaveBuffer(scp, bufferp, 1)) break;
|
||||
|
||||
/* otherwise, load the buffer and try again */
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
code = cm_GetBuffer(scp, bufferp, NULL, userp,
|
||||
&req);
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code) break;
|
||||
}
|
||||
if (code) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
goto done;
|
||||
}
|
||||
} /* if (wrong buffer) ... */
|
||||
|
||||
/* now we have the right buffer loaded. Copy out the
|
||||
* data from here to the user's buffer.
|
||||
*/
|
||||
bufIndex = offset.LowPart & (buf_bufferSize - 1);
|
||||
/* otherwise, load the buffer and try again */
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
code = cm_GetBuffer(scp, bufferp, NULL, userp,
|
||||
&req);
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
lock_ObtainMutex(&bufferp->mx);
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
if (code)
|
||||
break;
|
||||
}
|
||||
if (code) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
bufferp = NULL;
|
||||
goto done;
|
||||
}
|
||||
} /* if (wrong buffer) ... */
|
||||
|
||||
/* and figure out how many bytes we want from this buffer */
|
||||
nbytes = buf_bufferSize - bufIndex; /* what remains in buffer */
|
||||
if (nbytes > count)
|
||||
nbytes = count; /* don't go past end of request */
|
||||
|
||||
/* now copy the data */
|
||||
/* now we have the right buffer loaded. Copy out the
|
||||
* data from here to the user's buffer.
|
||||
*/
|
||||
bufIndex = offset.LowPart & (buf_bufferSize - 1);
|
||||
|
||||
/* and figure out how many bytes we want from this buffer */
|
||||
nbytes = buf_bufferSize - bufIndex; /* what remains in buffer */
|
||||
if (nbytes > count)
|
||||
nbytes = count; /* don't go past end of request */
|
||||
|
||||
/* now copy the data */
|
||||
#ifdef DJGPP
|
||||
if (dosflag)
|
||||
dosmemget((dos_ptr)op, nbytes, bufferp->datap + bufIndex);
|
||||
else
|
||||
if (dosflag)
|
||||
dosmemget((dos_ptr)op, nbytes, bufferp->datap + bufIndex);
|
||||
else
|
||||
#endif /* DJGPP */
|
||||
memcpy(bufferp->datap + bufIndex, op, nbytes);
|
||||
buf_SetDirty(bufferp);
|
||||
memcpy(bufferp->datap + bufIndex, op, nbytes);
|
||||
buf_SetDirty(bufferp);
|
||||
|
||||
/* and record the last writer */
|
||||
if (bufferp->userp != userp) {
|
||||
cm_HoldUser(userp);
|
||||
if (bufferp->userp)
|
||||
/* and record the last writer */
|
||||
if (bufferp->userp != userp) {
|
||||
cm_HoldUser(userp);
|
||||
if (bufferp->userp)
|
||||
cm_ReleaseUser(bufferp->userp);
|
||||
bufferp->userp = userp;
|
||||
}
|
||||
|
||||
/* adjust counters, pointers, etc. */
|
||||
op += nbytes;
|
||||
count -= nbytes;
|
||||
written += nbytes;
|
||||
thyper.LowPart = nbytes;
|
||||
thyper.HighPart = 0;
|
||||
offset = LargeIntegerAdd(thyper, offset);
|
||||
} /* while 1 */
|
||||
bufferp->userp = userp;
|
||||
}
|
||||
|
||||
/* adjust counters, pointers, etc. */
|
||||
op += nbytes;
|
||||
count -= nbytes;
|
||||
written += nbytes;
|
||||
thyper.LowPart = nbytes;
|
||||
thyper.HighPart = 0;
|
||||
offset = LargeIntegerAdd(thyper, offset);
|
||||
} /* while 1 */
|
||||
|
||||
done:
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
if (bufferp) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
}
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
if (bufferp) {
|
||||
lock_ReleaseMutex(&bufferp->mx);
|
||||
buf_Release(bufferp);
|
||||
}
|
||||
|
||||
if (code == 0 /* && filter != 0 && (fidp->flags & SMB_FID_NTOPEN)
|
||||
&& (fidp->NTopen_dscp->flags & CM_SCACHEFLAG_ANYWATCH)*/) {
|
||||
/*smb_NotifyChange(FILE_ACTION_MODIFIED, filter,
|
||||
fidp->NTopen_dscp, fidp->NTopen_pathp,
|
||||
NULL, TRUE);*/
|
||||
}
|
||||
#if 0
|
||||
if (code == 0 /* && filter != 0 && (fidp->flags & SMB_FID_NTOPEN)
|
||||
&& (fidp->NTopen_dscp->flags & CM_SCACHEFLAG_ANYWATCH)*/) {
|
||||
smb_NotifyChange(FILE_ACTION_MODIFIED, filter,
|
||||
fidp->NTopen_dscp, fidp->NTopen_pathp,
|
||||
NULL, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (code == 0 && doWriteBack) {
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE);
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
cm_QueueBKGRequest(scp, cm_BkgStore, writeBackOffset.LowPart,
|
||||
writeBackOffset.HighPart, cm_chunkSize, 0, userp);
|
||||
}
|
||||
if (code == 0 && doWriteBack) {
|
||||
lock_ObtainMutex(&scp->mx);
|
||||
cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE);
|
||||
lock_ReleaseMutex(&scp->mx);
|
||||
cm_QueueBKGRequest(scp, cm_BkgStore, writeBackOffset.LowPart,
|
||||
writeBackOffset.HighPart, cm_chunkSize, 0, userp);
|
||||
}
|
||||
|
||||
return code;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -38,29 +38,29 @@
|
||||
#endif
|
||||
|
||||
/* upcalls */
|
||||
#define RPC_NAMEI 0x10
|
||||
#define RPC_NAMEI 0x10
|
||||
#define RPC_CHECK_ACCESS 0x11
|
||||
#define RPC_CREATE 0x12
|
||||
#define RPC_STAT 0x13
|
||||
#define RPC_READ 0x14
|
||||
#define RPC_WRITE 0x15
|
||||
#define RPC_TRUNC 0x16
|
||||
#define RPC_SETINFO 0x17
|
||||
#define RPC_READDIR 0x18
|
||||
#define RPC_CLOSE 0x19
|
||||
#define RPC_UNLINK 0x1A
|
||||
#define RPC_CREATE 0x12
|
||||
#define RPC_STAT 0x13
|
||||
#define RPC_READ 0x14
|
||||
#define RPC_WRITE 0x15
|
||||
#define RPC_TRUNC 0x16
|
||||
#define RPC_SETINFO 0x17
|
||||
#define RPC_READDIR 0x18
|
||||
#define RPC_CLOSE 0x19
|
||||
#define RPC_UNLINK 0x1A
|
||||
#define RPC_IOCTL_WRITE 0x1B
|
||||
#define RPC_IOCTL_READ 0x1C
|
||||
#define RPC_RENAME 0x1D
|
||||
#define RPC_RENAME 0x1D
|
||||
#define RPC_READ_BULK 0x1E
|
||||
#define RPC_WRITE_BULK 0x1F
|
||||
|
||||
/* downcalls */
|
||||
#define RPC_BREAK_CALLBACK 0x80
|
||||
|
||||
#define TRANSFER_CHUNK_SIZE (1024*1024)
|
||||
#define RPC_TIMEOUT_SHORT 0
|
||||
#define RPC_TIMEOUT_LONG 1
|
||||
#define TRANSFER_CHUNK_SIZE (1024*1024)
|
||||
#define RPC_TIMEOUT_SHORT 0
|
||||
#define RPC_TIMEOUT_LONG 1
|
||||
|
||||
/* internal data struct for both client and server */
|
||||
struct rpc
|
||||
|
@ -57,11 +57,11 @@
|
||||
#define IFSL_NOT_EMPTY (IFSL_FAIL_BASE + 22)
|
||||
#define IFSL_RPC_TIMEOUT (IFSL_FAIL_BASE + 23)
|
||||
#define IFSL_OVERQUOTA (IFSL_FAIL_BASE + 24)
|
||||
#define IFSL_UNSPEC (IFSL_FAIL_BASE + 25)
|
||||
#define IFSL_UNSPEC (IFSL_FAIL_BASE + 25)
|
||||
|
||||
|
||||
/* ioctl codes */
|
||||
#define IOCTL_AFSRDR_IOCTL CTL_CODE(IOCTL_DISK_BASE, 0x007, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFSRDR_IOCTL CTL_CODE(IOCTL_DISK_BASE, 0x007, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFSRDR_DOWNCALL CTL_CODE(IOCTL_DISK_BASE, 0x008, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFSRDR_GET_PATH CTL_CODE(IOCTL_DISK_BASE, 0x009, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
/* copyright (c) 2005
|
||||
/* AFSIFS portions copyright (c) 2005
|
||||
* the regents of the university of michigan
|
||||
* all rights reserved
|
||||
*
|
||||
@ -339,24 +339,26 @@ BOOL SubmountToPath (PDRIVEMAPLIST pList, LPTSTR pszPath, LPTSTR pszSubmount, BO
|
||||
// Otherwise, look up our list of submounts.
|
||||
//
|
||||
#ifdef AFSIFS
|
||||
AdjustAfsPath (pszPath, pszSubmount, TRUE, TRUE);
|
||||
AdjustAfsPath (pszPath, pszSubmount, TRUE, TRUE);
|
||||
#endif
|
||||
for (size_t ii = 0; ii < pList->cSubmounts; ++ii)
|
||||
{
|
||||
for (size_t ii = 0; ii < pList->cSubmounts; ++ii)
|
||||
{
|
||||
BOOL b;
|
||||
#ifndef AFSIFS
|
||||
if (!lstrcmpi (pList->aSubmounts[ii].szSubmount, pszSubmount))
|
||||
b = !lstrcmpi (pList->aSubmounts[ii].szSubmount, pszSubmount);
|
||||
#else
|
||||
if (!lstrcmpi (pList->aSubmounts[ii].szMapping, pszPath))
|
||||
b = !lstrcmpi (pList->aSubmounts[ii].szMapping, pszPath);
|
||||
#endif
|
||||
{
|
||||
if (fMarkInUse)
|
||||
pList->aSubmounts[ii].fInUse = TRUE;
|
||||
AdjustAfsPath (pszPath, pList->aSubmounts[ii].szMapping, TRUE, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (b)
|
||||
{
|
||||
if (fMarkInUse)
|
||||
pList->aSubmounts[ii].fInUse = TRUE;
|
||||
AdjustAfsPath (pszPath, pList->aSubmounts[ii].szMapping, TRUE, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -846,17 +848,18 @@ BOOL ActivateDriveMap (TCHAR chDrive, LPTSTR pszMapping, LPTSTR pszSubmountReq,
|
||||
}
|
||||
|
||||
// We now have a submount name and drive letter--map the network drive.
|
||||
DWORD rc;
|
||||
#ifndef AFSIFS
|
||||
DWORD rc=MountDOSDrive(chDrive,szSubmount,fPersistent,NULL);
|
||||
rc=MountDOSDrive(chDrive,szSubmount,fPersistent,NULL);
|
||||
#else
|
||||
DWORD rc=MountDOSDrive(chDrive,/*szSubmount*/pszMapping,fPersistent,NULL);
|
||||
rc=MountDOSDrive(chDrive,/*szSubmount*/pszMapping,fPersistent,NULL);
|
||||
#endif
|
||||
if (rc == NO_ERROR)
|
||||
return TRUE;
|
||||
if (rc == NO_ERROR)
|
||||
return TRUE;
|
||||
|
||||
if (pdwStatus)
|
||||
*pdwStatus = rc;
|
||||
return FALSE;
|
||||
if (pdwStatus)
|
||||
*pdwStatus = rc;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -966,12 +969,14 @@ BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow)
|
||||
// <AuthID>: Authentication ID, 16 char hex.
|
||||
// <netbiosname>: Netbios name of server
|
||||
//
|
||||
BOOL b;
|
||||
#ifndef AFSIFS
|
||||
if (_tcsnicmp(szMapping, cszLANMANDEVICE, _tcslen(cszLANMANDEVICE)))
|
||||
b = _tcsnicmp(szMapping, cszLANMANDEVICE, _tcslen(cszLANMANDEVICE));
|
||||
#else
|
||||
const TCHAR ker_sub_path[] = "\\Device\\afsrdr\\";
|
||||
if (_tcsnicmp(szMapping, ker_sub_path, _tcslen(ker_sub_path)))
|
||||
const TCHAR ker_sub_path[] = "\\Device\\afsrdr\\";
|
||||
b = _tcsnicmp(szMapping, ker_sub_path, _tcslen(ker_sub_path));
|
||||
#endif
|
||||
if (b)
|
||||
return FALSE;
|
||||
#ifndef AFSIFS
|
||||
pszSubmount = &szMapping[ _tcslen(cszLANMANDEVICE) ];
|
||||
@ -980,17 +985,17 @@ BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow)
|
||||
#endif
|
||||
|
||||
#ifdef AFSIFS
|
||||
if (*(pszSubmount) < '0' ||
|
||||
*(pszSubmount) > '9')
|
||||
return FALSE;
|
||||
++pszSubmount;
|
||||
#else
|
||||
if (*(pszSubmount) < '0' ||
|
||||
*(pszSubmount) > '9')
|
||||
return FALSE;
|
||||
++pszSubmount;
|
||||
#else
|
||||
if (IsWindows2000())
|
||||
{
|
||||
{
|
||||
if (*(pszSubmount) != TEXT(';'))
|
||||
return FALSE;
|
||||
} else
|
||||
--pszSubmount;
|
||||
} else
|
||||
--pszSubmount;
|
||||
|
||||
if (toupper(*(++pszSubmount)) != chDrive)
|
||||
return FALSE;
|
||||
@ -1421,36 +1426,34 @@ DWORD MountDOSDrive(char chDrive,const char *szSubmount,BOOL bPersistent,const c
|
||||
TCHAR szDrive[3] = TEXT("?:");
|
||||
|
||||
#ifdef AFSIFS
|
||||
int pathCount, currPos, lastPos, x;
|
||||
int pathCount, currPos, lastPos, x;
|
||||
|
||||
pathCount = 0;
|
||||
pathCount = 0;
|
||||
|
||||
pathCount = 0;
|
||||
strcpy(szTokens, szSubmount);
|
||||
tok = strtok(szTokens, "/\\");
|
||||
strcpy(szPath, "");
|
||||
while (tok)
|
||||
{
|
||||
if (pathCount || stricmp(tok, "afs"))
|
||||
{
|
||||
strcat(szPath, "\\");
|
||||
strcat(szPath, tok);
|
||||
pathCount++;
|
||||
}
|
||||
tok = strtok(NULL, "/\\");
|
||||
}
|
||||
pathCount = 0;
|
||||
strcpy(szTokens, szSubmount);
|
||||
tok = strtok(szTokens, "/\\");
|
||||
strcpy(szPath, "");
|
||||
while (tok)
|
||||
{
|
||||
if (pathCount || stricmp(tok, "afs"))
|
||||
{
|
||||
strcat(szPath, "\\");
|
||||
strcat(szPath, tok);
|
||||
pathCount++;
|
||||
}
|
||||
tok = strtok(NULL, "/\\");
|
||||
}
|
||||
|
||||
sprintf(szDrive,"%c:",chDrive);
|
||||
strcpy(szTokens, szPath);
|
||||
sprintf(szPath,"\\Device\\afsrdr\\%d%s",pathCount,szTokens);
|
||||
//succ = DefineDosDevice(DDD_RAW_TARGET_PATH, "J:", "\\Device\\afsrdr\\2\\ericjw\\test");
|
||||
succ = DefineDosDevice(DDD_RAW_TARGET_PATH, szDrive, szPath);
|
||||
err = GetLastError();
|
||||
|
||||
return succ ? NO_ERROR : ERROR_DEVICE_IN_USE;
|
||||
sprintf(szDrive,"%c:",chDrive);
|
||||
strcpy(szTokens, szPath);
|
||||
sprintf(szPath,"\\Device\\afsrdr\\%d%s",pathCount,szTokens);
|
||||
//succ = DefineDosDevice(DDD_RAW_TARGET_PATH, "J:", "\\Device\\afsrdr\\2\\ericjw\\test");
|
||||
succ = DefineDosDevice(DDD_RAW_TARGET_PATH, szDrive, szPath);
|
||||
err = GetLastError();
|
||||
|
||||
return succ ? NO_ERROR : ERROR_DEVICE_IN_USE;
|
||||
#else
|
||||
|
||||
sprintf(szDrive,"%c:",chDrive);
|
||||
GetClientNetbiosName (szClient);
|
||||
sprintf(szPath,"\\\\%s\\%s",szClient,szSubmount);
|
||||
@ -1474,9 +1477,9 @@ DWORD DisMountDOSDriveFull(const char *szPath,BOOL bForce)
|
||||
DWORD res=WNetCancelConnection(szPath,bForce);
|
||||
#else
|
||||
DWORD res;
|
||||
res = ERROR_DEVICE_IN_USE;
|
||||
// must handle drive letters and afs paths
|
||||
//DDD_REMOVE_DEFINITION
|
||||
res = ERROR_DEVICE_IN_USE;
|
||||
// must handle drive letters and afs paths
|
||||
// DDD_REMOVE_DEFINITION
|
||||
#endif
|
||||
DEBUG_EVENT3("AFS DriveMap","%sDismount Remote[%s]=%x",
|
||||
bForce ? "Forced " : "",szPath,res);
|
||||
@ -1496,12 +1499,12 @@ DWORD DisMountDOSDrive(const char *pSubmount,BOOL bForce)
|
||||
DWORD DisMountDOSDrive(const char chDrive,BOOL bForce)
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
DWORD succ;
|
||||
DWORD succ;
|
||||
|
||||
sprintf(szPath,"%c:",chDrive);
|
||||
sprintf(szPath,"%c:",chDrive);
|
||||
#ifdef AFSIFS
|
||||
succ = DefineDosDevice(DDD_REMOVE_DEFINITION, szPath, NULL);
|
||||
return (!succ) ? GetLastError() : 0;
|
||||
succ = DefineDosDevice(DDD_REMOVE_DEFINITION, szPath, NULL);
|
||||
return (!succ) ? GetLastError() : 0;
|
||||
#else
|
||||
return DisMountDOSDriveFull(szPath,bForce);
|
||||
#endif
|
||||
|
@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
|
||||
#define used in WinNT/2000 installation and program version display
|
||||
AFSPRODUCT_VER_MAJOR=1
|
||||
AFSPRODUCT_VER_MINOR=3
|
||||
AFSPRODUCT_VER_PATCH=8400
|
||||
AFSPRODUCT_VER_PATCH=8401
|
||||
AFSPRODUCT_VER_BUILD=0
|
||||
|
||||
# For MSI installer, each major release should have a different GUID
|
||||
@ -251,13 +251,17 @@ afscflags = $(afscflags) /GX
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSVER_CL)"!="1200")
|
||||
afscdefs = $(afscdefs) /GT /GS
|
||||
afscflags = $(afscflags) /GT /GS
|
||||
#/Wp64
|
||||
!IF ("$(AFSVER_CL)"!="1400")
|
||||
afscdefs = $(afscdefs) /G7
|
||||
afscflags = $(afscflags) /G7
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSIFS)" == "TRUE")
|
||||
afscdefs = $(afscdefs) -DAFSIFS
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
|
||||
|
||||
afscflags = $(afscflags) /Ox /Zi
|
||||
|
@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
|
||||
#define used in WinNT/2000 installation and program version display
|
||||
AFSPRODUCT_VER_MAJOR=1
|
||||
AFSPRODUCT_VER_MINOR=3
|
||||
AFSPRODUCT_VER_PATCH=8400
|
||||
AFSPRODUCT_VER_PATCH=8401
|
||||
AFSPRODUCT_VER_BUILD=0
|
||||
|
||||
# For MSI installer, each major release should have a different GUID
|
||||
@ -257,9 +257,7 @@ afscdefs = $(afscdefs) /G7
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSIFS)" == "TRUE")
|
||||
dafsifs = "-DAFSIFS"
|
||||
!ELSE
|
||||
dafsifs = ""
|
||||
afscdefs = $(afscdefs) -DAFSIFS
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
|
||||
@ -273,13 +271,15 @@ NODEBUG=1
|
||||
cdebug = $(cdebug:-Z7=-Zi) # avoid annoying override warning (D4025)
|
||||
|
||||
!IF ("$(AFSVER_CL)"=="1200")
|
||||
afscdefs = $(afscdefs) -DDEBUG /GZ
|
||||
afscdefs = $(afscdefs) -DDEBUG
|
||||
afscflags = $(afscflags) /GZ
|
||||
!ELSE
|
||||
afscdefs = $(afscdefs) -DDEBUG /RTCs /RTCu
|
||||
afscdefs = $(afscdefs) -DDEBUG
|
||||
afscflags = $(afscflags) /RTCs /RTCu
|
||||
!ENDIF
|
||||
|
||||
!IFDEF _CRTDBG_MAP_ALLOC
|
||||
afscflags = $(afscflags) -D_DEBUG -D_CRTDBG_MAP_ALLOC
|
||||
afscdefs = $(afscdefs) -D_DEBUG -D_CRTDBG_MAP_ALLOC
|
||||
!ENDIF
|
||||
|
||||
!UNDEF NODEBUG
|
||||
|
@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB)
|
||||
#define used in WinNT/2000 installation and program version display
|
||||
AFSPRODUCT_VER_MAJOR=1
|
||||
AFSPRODUCT_VER_MINOR=3
|
||||
AFSPRODUCT_VER_PATCH=8400
|
||||
AFSPRODUCT_VER_PATCH=8401
|
||||
AFSPRODUCT_VER_BUILD=0
|
||||
|
||||
# For MSI installer, each major release should have a different GUID
|
||||
@ -249,13 +249,17 @@ afscflags = $(afscflags) /GX
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSVER_CL)"!="1200")
|
||||
afscdefs = $(afscdefs) /GT /GS
|
||||
afscflags = $(afscflags) /GT /GS
|
||||
#/Wp64
|
||||
!IF ("$(AFSVER_CL)"!="1400")
|
||||
afscdefs = $(afscdefs) /G7
|
||||
afscflags = $(afscflags) /G7
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSIFS)" == "TRUE")
|
||||
afscdefs = $(afscdefs) -DAFSIFS
|
||||
!ENDIF
|
||||
|
||||
!IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
|
||||
|
||||
afscflags = $(afscflags) /Ox /Zi
|
||||
|
@ -6,7 +6,7 @@
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
/* copyright (c) 2005
|
||||
/* AFSIFS portions copyright (c) 2005
|
||||
* the regents of the university of michigan
|
||||
* all rights reserved
|
||||
*
|
||||
@ -391,8 +391,8 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
|
||||
lana_GetNetbiosName(netbiosName,LANA_NETBIOS_NAME_FULL);
|
||||
sprintf(tbuffer,"\\\\%s\\all%s",netbiosName,SMB_IOCTL_FILENAME);
|
||||
}
|
||||
#else
|
||||
sprintf(tbuffer,"\\\\.\\afscom\\ioctl");
|
||||
#else
|
||||
sprintf(tbuffer,"\\\\.\\afscom\\ioctl");
|
||||
#endif
|
||||
|
||||
fflush(stdout);
|
||||
@ -404,9 +404,9 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef AFSIFS
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
return -1;
|
||||
}
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
@ -640,7 +640,7 @@ Transceive(HANDLE handle, fs_ioctlRequest_t * reqp)
|
||||
}
|
||||
|
||||
#ifndef AFSIFS
|
||||
if (!WriteFile(handle, reqp->data, rcount, &ioCount, NULL)) {
|
||||
if (!WriteFile(handle, reqp->data, rcount, &ioCount, NULL)) {
|
||||
/* failed to write */
|
||||
gle = GetLastError();
|
||||
|
||||
@ -658,15 +658,15 @@ Transceive(HANDLE handle, fs_ioctlRequest_t * reqp)
|
||||
return gle;
|
||||
}
|
||||
#else
|
||||
/* ioctl completes as one operation, so copy input to a new buffer, and use as output buffer */
|
||||
data = malloc(rcount);
|
||||
memcpy(data, reqp->data, rcount);
|
||||
if (!DeviceIoControl(handle, IOCTL_AFSRDR_IOCTL, data, rcount, reqp->data, sizeof(reqp->data), &ioCount, NULL))
|
||||
{
|
||||
free(data);
|
||||
return GetLastError();
|
||||
}
|
||||
free(data);
|
||||
/* ioctl completes as one operation, so copy input to a new buffer, and use as output buffer */
|
||||
data = malloc(rcount);
|
||||
memcpy(data, reqp->data, rcount);
|
||||
if (!DeviceIoControl(handle, IOCTL_AFSRDR_IOCTL, data, rcount, reqp->data, sizeof(reqp->data), &ioCount, NULL))
|
||||
{
|
||||
free(data);
|
||||
return GetLastError();
|
||||
}
|
||||
free(data);
|
||||
#endif
|
||||
|
||||
reqp->nbytes = ioCount; /* set # of bytes available */
|
||||
@ -746,30 +746,29 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
|
||||
unsigned long length;
|
||||
|
||||
#ifdef AFSIFS
|
||||
if (!pathp)
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
if (!pathp)
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
|
||||
//sprintf(tpath, "%c:\\", pathp[0]);
|
||||
rootDir = CreateFile(pathp, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (rootDir == INVALID_HANDLE_VALUE)
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
//sprintf(tpath, "%c:\\", pathp[0]);
|
||||
rootDir = CreateFile(pathp, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (rootDir == INVALID_HANDLE_VALUE)
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
|
||||
wpath = tpath;
|
||||
length = 0;
|
||||
if (!DeviceIoControl(rootDir, IOCTL_AFSRDR_GET_PATH, NULL, 0, wpath, 1000, &length, NULL))
|
||||
{
|
||||
CloseHandle(rootDir);
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
}
|
||||
CloseHandle(rootDir);
|
||||
wpath = tpath;
|
||||
length = 0;
|
||||
if (!DeviceIoControl(rootDir, IOCTL_AFSRDR_GET_PATH, NULL, 0, wpath, 1000, &length, NULL))
|
||||
{
|
||||
CloseHandle(rootDir);
|
||||
return CM_ERROR_NOSUCHPATH;
|
||||
}
|
||||
CloseHandle(rootDir);
|
||||
|
||||
code = WideCharToMultiByte(CP_UTF8, 0/*WC_NO_BEST_FIT_CHARS*/, wpath, length/sizeof(wchar_t), outPathp, outSize/sizeof(wchar_t), NULL, NULL);
|
||||
code = WideCharToMultiByte(CP_UTF8, 0/*WC_NO_BEST_FIT_CHARS*/, wpath, length/sizeof(wchar_t), outPathp, outSize/sizeof(wchar_t), NULL, NULL);
|
||||
|
||||
// strcpy(outPathp, tpath);
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
|
||||
if (pathp[0] != 0 && pathp[1] == ':') {
|
||||
/* there's a drive letter there */
|
||||
firstp = pathp + 2;
|
||||
|
Loading…
Reference in New Issue
Block a user