From 0e8e8c988950b94ae71d815817b1474d0c4ddab1 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 26 Oct 2004 02:53:40 +0000 Subject: [PATCH] windows-misc-20041025 * fix loading of SysName from the registry * reformat cm_scache; change flags to unsigned ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== * fix loading of SysName from the registry * broken patch to tab_drives.cpp - this will be pulled --- src/WINNT/afsd/afsd_init.c | 2 +- src/WINNT/afsd/cm_ioctl.c | 3 +- src/WINNT/afsd/cm_scache.c | 1364 ++++++++++++------------ src/WINNT/afsd/cm_scache.h | 12 +- src/WINNT/client_config/config.cpp | 96 +- src/WINNT/client_config/tab_drives.cpp | 21 +- 6 files changed, 748 insertions(+), 750 deletions(-) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index a11118b94..1b3a06f02 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -651,7 +651,7 @@ int afsd_InitCM(char **reasonP) char * p, *q; afsi_log("Sys name %s", buf); - for (p = q = buf; p < cm_sysName + dummyLen; p++) + for (p = q = buf; p < buf + dummyLen; p++) { if (*p == '\0' || isspace(*p)) { memcpy(cm_sysNameList[cm_sysNameCount],q,p-q); diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 13bd7a48f..b63c379ea 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -1213,6 +1213,7 @@ long cm_IoctlSysName(struct smb_ioctl *ioctlp, struct cm_user *userp) * do lookups of @sys entries and thinks it can trust them */ /* privs ok, store the entry, ... */ strcpy(cm_sysName, inname); + strcpy(cm_sysNameList[0], inname); if (setSysName > 1) { /* ... or list */ cp = ioctlp->inDatap; for (count = 1; count < setSysName; ++count) { @@ -1220,7 +1221,7 @@ long cm_IoctlSysName(struct smb_ioctl *ioctlp, struct cm_user *userp) osi_panic("cm_IoctlSysName: no cm_sysNameList entry to write\n", __FILE__, __LINE__); t = strlen(cp); - memcpy(cm_sysNameList[count], cp, t + 1); /* include null */ + strcpy(cm_sysNameList[count], cp); cp += t + 1; } } diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index b1d29854c..89eb79959 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -52,10 +52,10 @@ extern osi_mutex_t cm_Freelance_Lock; /* must be called with cm_scacheLock write-locked! */ void cm_AdjustLRU(cm_scache_t *scp) { - if (scp == cm_scacheLRULastp) - cm_scacheLRULastp = (cm_scache_t *) osi_QPrev(&scp->q); - osi_QRemove((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); - osi_QAdd((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); + if (scp == cm_scacheLRULastp) + cm_scacheLRULastp = (cm_scache_t *) osi_QPrev(&scp->q); + osi_QRemove((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); + osi_QAdd((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); if (!cm_scacheLRULastp) cm_scacheLRULastp = scp; } @@ -65,118 +65,118 @@ void cm_AdjustLRU(cm_scache_t *scp) */ cm_scache_t *cm_GetNewSCache(void) { - cm_scache_t *scp; - int i; - cm_scache_t **lscpp; - cm_scache_t *tscp; - - if (cm_currentSCaches >= cm_maxSCaches) { - for (scp = cm_scacheLRULastp; - scp; - scp = (cm_scache_t *) osi_QPrev(&scp->q)) { + cm_scache_t *scp; + int i; + cm_scache_t **lscpp; + cm_scache_t *tscp; + + if (cm_currentSCaches >= cm_maxSCaches) { + for (scp = cm_scacheLRULastp; + scp; + scp = (cm_scache_t *) osi_QPrev(&scp->q)) { if (scp->refCount == 0) break; - } + } - if (scp) { - /* we found an entry, so return it */ - if (scp->flags & CM_SCACHEFLAG_INHASH) { - /* hash it out first */ - i = CM_SCACHE_HASH(&scp->fid); - lscpp = &cm_hashTablep[i]; - for (tscp = *lscpp; - tscp; - lscpp = &tscp->nextp, tscp = *lscpp) { + if (scp) { + /* we found an entry, so return it */ + if (scp->flags & CM_SCACHEFLAG_INHASH) { + /* hash it out first */ + i = CM_SCACHE_HASH(&scp->fid); + lscpp = &cm_hashTablep[i]; + for (tscp = *lscpp; + tscp; + lscpp = &tscp->nextp, tscp = *lscpp) { if (tscp == scp) break; - } - osi_assertx(tscp, "afsd: scache hash screwup"); - *lscpp = scp->nextp; - scp->flags &= ~CM_SCACHEFLAG_INHASH; - } - - /* look for things that shouldn't still be set */ - osi_assert(scp->bufWritesp == NULL); - osi_assert(scp->bufReadsp == NULL); - - /* invalidate so next merge works fine; - * also initialize some flags */ - scp->flags &= ~(CM_SCACHEFLAG_STATD - | CM_SCACHEFLAG_RO - | CM_SCACHEFLAG_PURERO - | CM_SCACHEFLAG_OVERQUOTA - | CM_SCACHEFLAG_OUTOFSPACE); - scp->serverModTime = 0; - scp->dataVersion = 0; - scp->bulkStatProgress = hzero; - - /* discard callback */ + } + osi_assertx(tscp, "afsd: scache hash screwup"); + *lscpp = scp->nextp; + scp->flags &= ~CM_SCACHEFLAG_INHASH; + } + + /* look for things that shouldn't still be set */ + osi_assert(scp->bufWritesp == NULL); + osi_assert(scp->bufReadsp == NULL); + + /* invalidate so next merge works fine; + * also initialize some flags */ + scp->flags &= ~(CM_SCACHEFLAG_STATD + | CM_SCACHEFLAG_RO + | CM_SCACHEFLAG_PURERO + | CM_SCACHEFLAG_OVERQUOTA + | CM_SCACHEFLAG_OUTOFSPACE); + scp->serverModTime = 0; + scp->dataVersion = 0; + scp->bulkStatProgress = hzero; + + /* discard callback */ if (scp->cbServerp) { cm_PutServer(scp->cbServerp); - scp->cbServerp = NULL; + scp->cbServerp = NULL; } - scp->cbExpires = 0; - - /* remove from dnlc */ - cm_dnlcPurgedp(scp); - cm_dnlcPurgevp(scp); - - /* discard cached status; if non-zero, Close - * tried to store this to server but failed */ - scp->mask = 0; - - /* drop held volume ref */ - if (scp->volp) { - cm_PutVolume(scp->volp); - scp->volp = NULL; - } - - /* discard symlink info */ - if (scp->mountPointStringp) { - free(scp->mountPointStringp); - scp->mountPointStringp = NULL; - } - if (scp->mountRootFidp) { - free(scp->mountRootFidp); - scp->mountRootFidp = NULL; - } - if (scp->dotdotFidp) { - free(scp->dotdotFidp); - scp->dotdotFidp = NULL; - } - - /* not locked, but there can be no references to this guy - * while we hold the global refcount lock. - */ - cm_FreeAllACLEnts(scp); - - /* now remove from the LRU queue and put it back at the - * head of the LRU queue. - */ - cm_AdjustLRU(scp); - - /* and we're done */ - return scp; - } - } + scp->cbExpires = 0; + + /* remove from dnlc */ + cm_dnlcPurgedp(scp); + cm_dnlcPurgevp(scp); + + /* discard cached status; if non-zero, Close + * tried to store this to server but failed */ + scp->mask = 0; + + /* drop held volume ref */ + if (scp->volp) { + cm_PutVolume(scp->volp); + scp->volp = NULL; + } + + /* discard symlink info */ + if (scp->mountPointStringp) { + free(scp->mountPointStringp); + scp->mountPointStringp = NULL; + } + if (scp->mountRootFidp) { + free(scp->mountRootFidp); + scp->mountRootFidp = NULL; + } + if (scp->dotdotFidp) { + free(scp->dotdotFidp); + scp->dotdotFidp = NULL; + } + + /* not locked, but there can be no references to this guy + * while we hold the global refcount lock. + */ + cm_FreeAllACLEnts(scp); + + /* now remove from the LRU queue and put it back at the + * head of the LRU queue. + */ + cm_AdjustLRU(scp); + + /* and we're done */ + return scp; + } + } - /* if we get here, we should allocate a new scache entry. We either are below - * quota or we have a leak and need to allocate a new one to avoid panicing. - */ - scp = malloc(sizeof(*scp)); - memset(scp, 0, sizeof(*scp)); - lock_InitializeMutex(&scp->mx, "cm_scache_t mutex"); - lock_InitializeRWLock(&scp->bufCreateLock, "cm_scache_t bufCreateLock"); - - /* and put it in the LRU queue */ - osi_QAdd((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); + /* if we get here, we should allocate a new scache entry. We either are below + * quota or we have a leak and need to allocate a new one to avoid panicing. + */ + scp = malloc(sizeof(*scp)); + memset(scp, 0, sizeof(*scp)); + lock_InitializeMutex(&scp->mx, "cm_scache_t mutex"); + lock_InitializeRWLock(&scp->bufCreateLock, "cm_scache_t bufCreateLock"); + + /* and put it in the LRU queue */ + osi_QAdd((osi_queue_t **) &cm_scacheLRUFirstp, &scp->q); if (!cm_scacheLRULastp) cm_scacheLRULastp = scp; - cm_currentSCaches++; - cm_dnlcPurgedp(scp); /* make doubly sure that this is not in dnlc */ - cm_dnlcPurgevp(scp); - return scp; -} + cm_currentSCaches++; + cm_dnlcPurgedp(scp); /* make doubly sure that this is not in dnlc */ + cm_dnlcPurgevp(scp); + return scp; +} /* like strcmp, only for fids */ int cm_FidCmp(cm_fid_t *ap, cm_fid_t *bp) @@ -189,78 +189,78 @@ int cm_FidCmp(cm_fid_t *ap, cm_fid_t *bp) return 1; if (ap->cell != bp->cell) return 1; - return 0; + return 0; } void cm_fakeSCacheInit() { - memset(&cm_fakeSCache, 0, sizeof(cm_fakeSCache)); - lock_InitializeMutex(&cm_fakeSCache.mx, "cm_scache_t mutex"); - cm_fakeSCache.cbServerp = (struct cm_server *)(-1); - /* can leave clientModTime at 0 */ - cm_fakeSCache.fileType = CM_SCACHETYPE_FILE; - cm_fakeSCache.unixModeBits = 0777; - cm_fakeSCache.length.LowPart = 1000; - cm_fakeSCache.linkCount = 1; -} + memset(&cm_fakeSCache, 0, sizeof(cm_fakeSCache)); + lock_InitializeMutex(&cm_fakeSCache.mx, "cm_scache_t mutex"); + cm_fakeSCache.cbServerp = (struct cm_server *)(-1); + /* can leave clientModTime at 0 */ + cm_fakeSCache.fileType = CM_SCACHETYPE_FILE; + cm_fakeSCache.unixModeBits = 0777; + cm_fakeSCache.length.LowPart = 1000; + cm_fakeSCache.linkCount = 1; +} void cm_InitSCache(long maxSCaches) { - static osi_once_t once; + static osi_once_t once; - if (osi_Once(&once)) { - lock_InitializeRWLock(&cm_scacheLock, "cm_scacheLock"); - cm_hashTableSize = maxSCaches / 2; - cm_hashTablep = malloc(sizeof(cm_scache_t *) * cm_hashTableSize); - memset(cm_hashTablep, 0, sizeof(cm_scache_t *) * cm_hashTableSize); - cm_allFileLocks = NULL; - cm_currentSCaches = 0; - cm_maxSCaches = maxSCaches; - cm_fakeSCacheInit(); - cm_dnlcInit(); - osi_EndOnce(&once); - } + if (osi_Once(&once)) { + lock_InitializeRWLock(&cm_scacheLock, "cm_scacheLock"); + cm_hashTableSize = maxSCaches / 2; + cm_hashTablep = malloc(sizeof(cm_scache_t *) * cm_hashTableSize); + memset(cm_hashTablep, 0, sizeof(cm_scache_t *) * cm_hashTableSize); + cm_allFileLocks = NULL; + cm_currentSCaches = 0; + cm_maxSCaches = maxSCaches; + cm_fakeSCacheInit(); + cm_dnlcInit(); + osi_EndOnce(&once); + } } /* version that doesn't bother creating the entry if we don't find it */ cm_scache_t *cm_FindSCache(cm_fid_t *fidp) { - long hash; - cm_scache_t *scp; - - hash = CM_SCACHE_HASH(fidp); + long hash; + cm_scache_t *scp; + + hash = CM_SCACHE_HASH(fidp); - osi_assert(fidp->cell != 0); + osi_assert(fidp->cell != 0); - lock_ObtainWrite(&cm_scacheLock); - for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { - if (cm_FidCmp(fidp, &scp->fid) == 0) { - scp->refCount++; - cm_AdjustLRU(scp); - lock_ReleaseWrite(&cm_scacheLock); - return scp; - } + lock_ObtainWrite(&cm_scacheLock); + for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { + if (cm_FidCmp(fidp, &scp->fid) == 0) { + scp->refCount++; + cm_AdjustLRU(scp); + lock_ReleaseWrite(&cm_scacheLock); + return scp; } - lock_ReleaseWrite(&cm_scacheLock); - return NULL; + } + lock_ReleaseWrite(&cm_scacheLock); + return NULL; } long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, - cm_req_t *reqp) + cm_req_t *reqp) { - long hash; + long hash; cm_scache_t *scp; long code; cm_volume_t *volp = 0; cm_cell_t *cellp; char* mp = 0; - int special; // yj: boolean variable to test if file is on root.afs - int isRoot; + int special; // yj: boolean variable to test if file is on root.afs + int isRoot; extern cm_fid_t cm_rootFid; hash = CM_SCACHE_HASH(fidp); - osi_assert(fidp->cell != 0); + osi_assert(fidp->cell != 0); if (fidp->cell== cm_rootFid.cell && fidp->volume==cm_rootFid.volume && @@ -269,92 +269,92 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, osi_Log0(afsd_logp,"cm_getSCache called with root cell/volume and vnode=0 and unique=0"); } - // yj: check if we have the scp, if so, we don't need - // to do anything else + // yj: check if we have the scp, if so, we don't need + // to do anything else lock_ObtainWrite(&cm_scacheLock); - for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { - if (cm_FidCmp(fidp, &scp->fid) == 0) { - scp->refCount++; + for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { + if (cm_FidCmp(fidp, &scp->fid) == 0) { + scp->refCount++; *outScpp = scp; cm_AdjustLRU(scp); lock_ReleaseWrite(&cm_scacheLock); - return 0; + return 0; } } - // yj: when we get here, it means we don't have an scp - // so we need to either load it or fake it, depending - // on whether the file is "special", see below. - - // yj: if we're trying to get an scp for a file that's - // on root.afs of homecell, we want to handle it specially - // because we have to fill in the status stuff 'coz we - // don't want trybulkstat to fill it in for us + // yj: when we get here, it means we don't have an scp + // so we need to either load it or fake it, depending + // on whether the file is "special", see below. + + // yj: if we're trying to get an scp for a file that's + // on root.afs of homecell, we want to handle it specially + // because we have to fill in the status stuff 'coz we + // don't want trybulkstat to fill it in for us #ifdef AFS_FREELANCE_CLIENT - special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && + special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && fidp->volume==AFS_FAKE_ROOT_VOL_ID && - !(fidp->vnode==0x1 && fidp->unique==0x1)); - isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && + !(fidp->vnode==0x1 && fidp->unique==0x1)); + isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && fidp->volume==AFS_FAKE_ROOT_VOL_ID && - fidp->vnode==0x1 && fidp->unique==0x1); - if (cm_freelanceEnabled && isRoot) { - osi_Log0(afsd_logp,"cm_getSCache Freelance and isRoot"); - /* freelance: if we are trying to get the root scp for the first + fidp->vnode==0x1 && fidp->unique==0x1); + if (cm_freelanceEnabled && isRoot) { + osi_Log0(afsd_logp,"cm_getSCache Freelance and isRoot"); + /* freelance: if we are trying to get the root scp for the first * time, we will just put in a place holder entry. */ - volp = NULL; - } + volp = NULL; + } - if (cm_freelanceEnabled && special) { - osi_Log0(afsd_logp,"cm_getSCache Freelance and special"); + if (cm_freelanceEnabled && special) { + osi_Log0(afsd_logp,"cm_getSCache Freelance and special"); if (fidp->vnode > 1) { lock_ObtainMutex(&cm_Freelance_Lock); - mp =(cm_localMountPoints+fidp->vnode-2)->mountPointStringp; - lock_ReleaseMutex(&cm_Freelance_Lock); + mp =(cm_localMountPoints+fidp->vnode-2)->mountPointStringp; + lock_ReleaseMutex(&cm_Freelance_Lock); } else { mp = ""; } - scp = cm_GetNewSCache(); + scp = cm_GetNewSCache(); - scp->fid = *fidp; - scp->volp = cm_rootSCachep->volp; - if (scp->dotdotFidp == (cm_fid_t *) NULL) - scp->dotdotFidp = (cm_fid_t *) malloc (sizeof(cm_fid_t)); - scp->dotdotFidp->cell=AFS_FAKE_ROOT_CELL_ID; - scp->dotdotFidp->volume=AFS_FAKE_ROOT_VOL_ID; - scp->dotdotFidp->unique=1; - scp->dotdotFidp->vnode=1; - scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO); - scp->nextp=cm_hashTablep[hash]; - cm_hashTablep[hash]=scp; - scp->flags |= CM_SCACHEFLAG_INHASH; - scp->refCount = 1; - scp->fileType = CM_SCACHETYPE_MOUNTPOINT; - - lock_ObtainMutex(&cm_Freelance_Lock); - scp->length.LowPart = strlen(mp)+4; - scp->mountPointStringp=malloc(strlen(mp)+1); - strcpy(scp->mountPointStringp,mp); - lock_ReleaseMutex(&cm_Freelance_Lock); - - scp->owner=0x0; - scp->unixModeBits=0x1ff; - scp->clientModTime=FakeFreelanceModTime; - scp->serverModTime=FakeFreelanceModTime; - scp->parentUnique = 0x1; - scp->parentVnode=0x1; - scp->group=0; - scp->dataVersion=0x8; - *outScpp = scp; - lock_ReleaseWrite(&cm_scacheLock); - /*afsi_log(" getscache done");*/ - return 0; - } - // end of yj code + scp->fid = *fidp; + scp->volp = cm_rootSCachep->volp; + if (scp->dotdotFidp == (cm_fid_t *) NULL) + scp->dotdotFidp = (cm_fid_t *) malloc (sizeof(cm_fid_t)); + scp->dotdotFidp->cell=AFS_FAKE_ROOT_CELL_ID; + scp->dotdotFidp->volume=AFS_FAKE_ROOT_VOL_ID; + scp->dotdotFidp->unique=1; + scp->dotdotFidp->vnode=1; + scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO); + scp->nextp=cm_hashTablep[hash]; + cm_hashTablep[hash]=scp; + scp->flags |= CM_SCACHEFLAG_INHASH; + scp->refCount = 1; + scp->fileType = CM_SCACHETYPE_MOUNTPOINT; + + lock_ObtainMutex(&cm_Freelance_Lock); + scp->length.LowPart = strlen(mp)+4; + scp->mountPointStringp=malloc(strlen(mp)+1); + strcpy(scp->mountPointStringp,mp); + lock_ReleaseMutex(&cm_Freelance_Lock); + + scp->owner=0x0; + scp->unixModeBits=0x1ff; + scp->clientModTime=FakeFreelanceModTime; + scp->serverModTime=FakeFreelanceModTime; + scp->parentUnique = 0x1; + scp->parentVnode=0x1; + scp->group=0; + scp->dataVersion=0x8; + *outScpp = scp; + lock_ReleaseWrite(&cm_scacheLock); + /*afsi_log(" getscache done");*/ + return 0; + } + // end of yj code #endif /* AFS_FREELANCE_CLIENT */ /* otherwise, we need to find the volume */ - if (!cm_freelanceEnabled || !isRoot) { + if (!cm_freelanceEnabled || !isRoot) { lock_ReleaseWrite(&cm_scacheLock); /* for perf. reasons */ cellp = cm_FindCellByID(fidp->cell); if (!cellp) @@ -364,56 +364,56 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, if (code) return code; lock_ObtainWrite(&cm_scacheLock); - } + } - /* otherwise, we have the volume, now reverify that the scp doesn't - * exist, and proceed. - */ - for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { - if (cm_FidCmp(fidp, &scp->fid) == 0) { - scp->refCount++; + /* otherwise, we have the volume, now reverify that the scp doesn't + * exist, and proceed. + */ + for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { + if (cm_FidCmp(fidp, &scp->fid) == 0) { + scp->refCount++; cm_AdjustLRU(scp); lock_ReleaseWrite(&cm_scacheLock); if (volp) - cm_PutVolume(volp); + cm_PutVolume(volp); *outScpp = scp; - return 0; + return 0; } } /* now, if we don't have the fid, recycle something */ - scp = cm_GetNewSCache(); - osi_assert(!(scp->flags & CM_SCACHEFLAG_INHASH)); - scp->fid = *fidp; - scp->volp = volp; /* a held reference */ - - if (!cm_freelanceEnabled || !isRoot) { - /* if this scache entry represents a volume root then we need - * to copy the dotdotFipd from the volume structure where the - * "master" copy is stored (defect 11489) - */ - if(scp->fid.vnode == 1 && scp->fid.unique == 1 && volp->dotdotFidp) { + scp = cm_GetNewSCache(); + osi_assert(!(scp->flags & CM_SCACHEFLAG_INHASH)); + scp->fid = *fidp; + scp->volp = volp; /* a held reference */ + + if (!cm_freelanceEnabled || !isRoot) { + /* if this scache entry represents a volume root then we need + * to copy the dotdotFipd from the volume structure where the + * "master" copy is stored (defect 11489) + */ + if (scp->fid.vnode == 1 && scp->fid.unique == 1 && volp->dotdotFidp) { if (scp->dotdotFidp == (cm_fid_t *) NULL) - scp->dotdotFidp = (cm_fid_t *) malloc(sizeof(cm_fid_t)); + scp->dotdotFidp = (cm_fid_t *) malloc(sizeof(cm_fid_t)); *(scp->dotdotFidp) = *volp->dotdotFidp; - } + } - if (volp->roID == fidp->volume) + if (volp->roID == fidp->volume) scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO); - else if (volp->bkID == fidp->volume) + else if (volp->bkID == fidp->volume) scp->flags |= CM_SCACHEFLAG_RO; - } - scp->nextp = cm_hashTablep[hash]; - cm_hashTablep[hash] = scp; + } + scp->nextp = cm_hashTablep[hash]; + cm_hashTablep[hash] = scp; scp->flags |= CM_SCACHEFLAG_INHASH; - scp->refCount = 1; - - /* XXX - The following fields in the cm_scache are - * uninitialized: - * fileType - * parentVnode - * parentUnique - */ + scp->refCount = 1; + + /* XXX - The following fields in the cm_scache are + * uninitialized: + * fileType + * parentVnode + * parentUnique + */ lock_ReleaseWrite(&cm_scacheLock); /* now we have a held scache entry; just return it */ @@ -477,278 +477,278 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, * CM_SCACHESYNC_STOREDATA_EXCL and CM_SCACHEFLAG_DATASTORING. */ long cm_SyncOp(cm_scache_t *scp, cm_buf_t *bufp, cm_user_t *up, cm_req_t *reqp, - long rights, long flags) + long rights, long flags) { - osi_queueData_t *qdp; - long code; - cm_buf_t *tbufp; - long outRights; - int bufLocked; - - /* lookup this first */ - bufLocked = flags & CM_SCACHESYNC_BUFLOCKED; - - /* some minor assertions */ - if (flags & (CM_SCACHESYNC_STOREDATA | CM_SCACHESYNC_FETCHDATA - | CM_SCACHESYNC_READ | CM_SCACHESYNC_WRITE - | CM_SCACHESYNC_SETSIZE)) { - if (bufp) { - osi_assert(bufp->refCount > 0); - /* - osi_assert(cm_FidCmp(&bufp->fid, &scp->fid) == 0); - */ - } - } - else osi_assert(bufp == NULL); - - /* Do the access check. Now we don't really do the access check - * atomically, since the caller doesn't expect the parent dir to be - * returned locked, and that is what we'd have to do to prevent a - * callback breaking message on the parent due to a setacl call from - * being processed while we're running. So, instead, we check things - * here, and if things look fine with the access, we proceed to finish - * the rest of this check. Sort of a hack, but probably good enough. - */ + osi_queueData_t *qdp; + long code; + cm_buf_t *tbufp; + long outRights; + int bufLocked; + + /* lookup this first */ + bufLocked = flags & CM_SCACHESYNC_BUFLOCKED; + + /* some minor assertions */ + if (flags & (CM_SCACHESYNC_STOREDATA | CM_SCACHESYNC_FETCHDATA + | CM_SCACHESYNC_READ | CM_SCACHESYNC_WRITE + | CM_SCACHESYNC_SETSIZE)) { + if (bufp) { + osi_assert(bufp->refCount > 0); + /* + osi_assert(cm_FidCmp(&bufp->fid, &scp->fid) == 0); + */ + } + } + else osi_assert(bufp == NULL); + + /* Do the access check. Now we don't really do the access check + * atomically, since the caller doesn't expect the parent dir to be + * returned locked, and that is what we'd have to do to prevent a + * callback breaking message on the parent due to a setacl call from + * being processed while we're running. So, instead, we check things + * here, and if things look fine with the access, we proceed to finish + * the rest of this check. Sort of a hack, but probably good enough. + */ + + while (1) { + if (flags & CM_SCACHESYNC_FETCHSTATUS) { + /* if we're bringing in a new status block, ensure that + * we aren't already doing so, and that no one is + * changing the status concurrently, either. We need + * to do this, even if the status is of a different + * type, since we don't have the ability to figure out, + * in the AFS 3 protocols, which status-changing + * operation ran first, or even which order a read and + * a write occurred in. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) + goto sleep; + } + if (flags & (CM_SCACHESYNC_STORESIZE | CM_SCACHESYNC_STORESTATUS + | CM_SCACHESYNC_SETSIZE | CM_SCACHESYNC_GETCALLBACK)) { + /* if we're going to make an RPC to change the status, make sure + * that no one is bringing in or sending out the status. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) + goto sleep; + if (scp->bufReadsp || scp->bufWritesp) goto sleep; + } + if (flags & CM_SCACHESYNC_FETCHDATA) { + /* if we're bringing in a new chunk of data, make sure that + * nothing is happening to that chunk, and that we aren't + * changing the basic file status info, either. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) + goto sleep; + if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) + goto sleep; + } + if (flags & CM_SCACHESYNC_STOREDATA) { + /* same as fetch data */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) + goto sleep; + if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) + goto sleep; + } - while (1) { - if (flags & CM_SCACHESYNC_FETCHSTATUS) { - /* if we're bringing in a new status block, ensure that - * we aren't already doing so, and that no one is - * changing the status concurrently, either. We need - * to do this, even if the status is of a different - * type, since we don't have the ability to figure out, - * in the AFS 3 protocols, which status-changing - * operation ran first, or even which order a read and - * a write occurred in. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) - goto sleep; - } - if (flags & (CM_SCACHESYNC_STORESIZE | CM_SCACHESYNC_STORESTATUS - | CM_SCACHESYNC_SETSIZE | CM_SCACHESYNC_GETCALLBACK)) { - /* if we're going to make an RPC to change the status, make sure - * that no one is bringing in or sending out the status. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) - goto sleep; - if (scp->bufReadsp || scp->bufWritesp) goto sleep; - } - if (flags & CM_SCACHESYNC_FETCHDATA) { - /* if we're bringing in a new chunk of data, make sure that - * nothing is happening to that chunk, and that we aren't - * changing the basic file status info, either. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) - goto sleep; - if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) - goto sleep; - } - if (flags & CM_SCACHESYNC_STOREDATA) { - /* same as fetch data */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING | CM_SCACHEFLAG_GETCALLBACK)) - goto sleep; - if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) - goto sleep; - } + if (flags & CM_SCACHESYNC_STOREDATA_EXCL) { + /* Don't allow concurrent StoreData RPC's */ + if (scp->flags & CM_SCACHEFLAG_DATASTORING) + goto sleep; + } - if (flags & CM_SCACHESYNC_STOREDATA_EXCL) { - /* Don't allow concurrent StoreData RPC's */ - if (scp->flags & CM_SCACHEFLAG_DATASTORING) - goto sleep; - } - - if (flags & CM_SCACHESYNC_ASYNCSTORE) { - /* Don't allow more than one BKG store request */ - if (scp->flags & CM_SCACHEFLAG_ASYNCSTORING) - goto sleep; - } - - if (flags & CM_SCACHESYNC_LOCK) { - /* Don't allow concurrent fiddling with lock lists */ - if (scp->flags & CM_SCACHEFLAG_LOCKING) - goto sleep; - } - - /* now the operations that don't correspond to making RPCs */ - if (flags & CM_SCACHESYNC_GETSTATUS) { - /* we can use the status that's here, if we're not - * bringing in new status. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING)) - goto sleep; - } - if (flags & CM_SCACHESYNC_SETSTATUS) { - /* we can make a change to the local status, as long as - * the status isn't changing now. - * - * If we're fetching or storing a chunk of data, we can - * change the status locally, since the fetch/store - * operations don't change any of the data that we're - * changing here. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING)) - goto sleep; - } - if (flags & CM_SCACHESYNC_READ) { - /* we're going to read the data, make sure that the - * status is available, and that the data is here. It - * is OK to read while storing the data back. - */ - if (scp->flags & CM_SCACHEFLAG_FETCHING) - goto sleep; - if (bufp && ((bufp->cmFlags - & (CM_BUF_CMFETCHING - | CM_BUF_CMFULLYFETCHED)) - == CM_BUF_CMFETCHING)) - goto sleep; - } - if (flags & CM_SCACHESYNC_WRITE) { - /* don't write unless the status is stable and the chunk - * is stable. - */ - if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING - | CM_SCACHEFLAG_SIZESTORING)) - goto sleep; - if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) - goto sleep; - } + if (flags & CM_SCACHESYNC_ASYNCSTORE) { + /* Don't allow more than one BKG store request */ + if (scp->flags & CM_SCACHEFLAG_ASYNCSTORING) + goto sleep; + } + + if (flags & CM_SCACHESYNC_LOCK) { + /* Don't allow concurrent fiddling with lock lists */ + if (scp->flags & CM_SCACHEFLAG_LOCKING) + goto sleep; + } - // yj: modified this so that callback only checked if we're - // not checking something on /afs + /* now the operations that don't correspond to making RPCs */ + if (flags & CM_SCACHESYNC_GETSTATUS) { + /* we can use the status that's here, if we're not + * bringing in new status. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING)) + goto sleep; + } + if (flags & CM_SCACHESYNC_SETSTATUS) { + /* we can make a change to the local status, as long as + * the status isn't changing now. + * + * If we're fetching or storing a chunk of data, we can + * change the status locally, since the fetch/store + * operations don't change any of the data that we're + * changing here. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING)) + goto sleep; + } + if (flags & CM_SCACHESYNC_READ) { + /* we're going to read the data, make sure that the + * status is available, and that the data is here. It + * is OK to read while storing the data back. + */ + if (scp->flags & CM_SCACHEFLAG_FETCHING) + goto sleep; + if (bufp && ((bufp->cmFlags + & (CM_BUF_CMFETCHING + | CM_BUF_CMFULLYFETCHED)) + == CM_BUF_CMFETCHING)) + goto sleep; + } + if (flags & CM_SCACHESYNC_WRITE) { + /* don't write unless the status is stable and the chunk + * is stable. + */ + if (scp->flags & (CM_SCACHEFLAG_FETCHING | CM_SCACHEFLAG_STORING + | CM_SCACHEFLAG_SIZESTORING)) + goto sleep; + if (bufp && (bufp->cmFlags & (CM_BUF_CMFETCHING | CM_BUF_CMSTORING))) + goto sleep; + } + + // yj: modified this so that callback only checked if we're + // not checking something on /afs /* fix the conditional to match the one in cm_HaveCallback */ - if ( (flags & CM_SCACHESYNC_NEEDCALLBACK) + if ( (flags & CM_SCACHESYNC_NEEDCALLBACK) #ifdef AFS_FREELANCE_CLIENT && (!cm_freelanceEnabled || !(scp->fid.vnode==0x1 && scp->fid.unique==0x1) || scp->fid.cell!=AFS_FAKE_ROOT_CELL_ID || scp->fid.volume!=AFS_FAKE_ROOT_VOL_ID || - cm_fakeDirCallback < 2) + cm_fakeDirCallback < 2) #endif /* AFS_FREELANCE_CLIENT */ - ) { - if (!cm_HaveCallback(scp)) { - osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x", - (long) scp); - if (bufLocked) lock_ReleaseMutex(&bufp->mx); - code = cm_GetCallback(scp, up, reqp, 0); - if (bufLocked) { - lock_ReleaseMutex(&scp->mx); - lock_ObtainMutex(&bufp->mx); - lock_ObtainMutex(&scp->mx); - } - if (code) return code; - continue; - } + ) { + if (!cm_HaveCallback(scp)) { + osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x", + (long) scp); + if (bufLocked) lock_ReleaseMutex(&bufp->mx); + code = cm_GetCallback(scp, up, reqp, 0); + if (bufLocked) { + lock_ReleaseMutex(&scp->mx); + lock_ObtainMutex(&bufp->mx); + lock_ObtainMutex(&scp->mx); } - - if (rights) { - /* can't check access rights without a callback */ - osi_assert(flags & CM_SCACHESYNC_NEEDCALLBACK); - - if ((rights & PRSFS_WRITE) && (scp->flags & CM_SCACHEFLAG_RO)) - return CM_ERROR_READONLY; - - if (cm_HaveAccessRights(scp, up, rights, &outRights)) { - if (~outRights & rights) return CM_ERROR_NOACCESS; - } - else { - /* we don't know the required access rights */ - if (bufLocked) lock_ReleaseMutex(&bufp->mx); - code = cm_GetAccessRights(scp, up, reqp); - if (code) return code; - if (bufLocked) { - lock_ReleaseMutex(&scp->mx); - lock_ObtainMutex(&bufp->mx); - lock_ObtainMutex(&scp->mx); - } - continue; - } + if (code) return code; + continue; + } + } + + if (rights) { + /* can't check access rights without a callback */ + osi_assert(flags & CM_SCACHESYNC_NEEDCALLBACK); + + if ((rights & PRSFS_WRITE) && (scp->flags & CM_SCACHEFLAG_RO)) + return CM_ERROR_READONLY; + + if (cm_HaveAccessRights(scp, up, rights, &outRights)) { + if (~outRights & rights) return CM_ERROR_NOACCESS; + } + else { + /* we don't know the required access rights */ + if (bufLocked) lock_ReleaseMutex(&bufp->mx); + code = cm_GetAccessRights(scp, up, reqp); + if (code) return code; + if (bufLocked) { + lock_ReleaseMutex(&scp->mx); + lock_ObtainMutex(&bufp->mx); + lock_ObtainMutex(&scp->mx); } + continue; + } + } - /* if we get here, we're happy */ - break; + /* if we get here, we're happy */ + break; -sleep: - /* first check if we're not supposed to wait: fail - * in this case, returning with everything still locked. - */ - if (flags & CM_SCACHESYNC_NOWAIT) return CM_ERROR_WOULDBLOCK; + sleep: + /* first check if we're not supposed to wait: fail + * in this case, returning with everything still locked. + */ + if (flags & CM_SCACHESYNC_NOWAIT) return CM_ERROR_WOULDBLOCK; - /* wait here, then try again */ - osi_Log1(afsd_logp, "CM SyncOp sleeping scp %x", (long) scp); + /* wait here, then try again */ + osi_Log1(afsd_logp, "CM SyncOp sleeping scp %x", (long) scp); if ( scp->flags & CM_SCACHEFLAG_WAITING ) osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING already set for 0x%x", scp); else osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING set for 0x%x", scp); - scp->flags |= CM_SCACHEFLAG_WAITING; - if (bufLocked) lock_ReleaseMutex(&bufp->mx); + scp->flags |= CM_SCACHEFLAG_WAITING; + if (bufLocked) lock_ReleaseMutex(&bufp->mx); osi_SleepM((long) &scp->flags, &scp->mx); osi_Log0(afsd_logp, "CM SyncOp woke!"); if (bufLocked) lock_ObtainMutex(&bufp->mx); lock_ObtainMutex(&scp->mx); - } /* big while loop */ + } /* big while loop */ - /* now, update the recorded state for RPC-type calls */ - if (flags & CM_SCACHESYNC_FETCHSTATUS) - scp->flags |= CM_SCACHEFLAG_FETCHING; - if (flags & CM_SCACHESYNC_STORESTATUS) - scp->flags |= CM_SCACHEFLAG_STORING; - if (flags & CM_SCACHESYNC_STORESIZE) - scp->flags |= CM_SCACHEFLAG_SIZESTORING; - if (flags & CM_SCACHESYNC_GETCALLBACK) - scp->flags |= CM_SCACHEFLAG_GETCALLBACK; - if (flags & CM_SCACHESYNC_STOREDATA_EXCL) - scp->flags |= CM_SCACHEFLAG_DATASTORING; - if (flags & CM_SCACHESYNC_ASYNCSTORE) - scp->flags |= CM_SCACHEFLAG_ASYNCSTORING; - if (flags & CM_SCACHESYNC_LOCK) - scp->flags |= CM_SCACHEFLAG_LOCKING; - - /* now update the buffer pointer */ - if (flags & CM_SCACHESYNC_FETCHDATA) { - /* ensure that the buffer isn't already in the I/O list */ - if (bufp) { - for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { - tbufp = osi_GetQData(qdp); - osi_assert(tbufp != bufp); - } - } - - /* queue a held reference to the buffer in the "reading" I/O list */ - qdp = osi_QDAlloc(); - osi_SetQData(qdp, bufp); - if (bufp) { - buf_Hold(bufp); - bufp->cmFlags |= CM_BUF_CMFETCHING; - } - osi_QAdd((osi_queue_t **) &scp->bufReadsp, &qdp->q); + /* now, update the recorded state for RPC-type calls */ + if (flags & CM_SCACHESYNC_FETCHSTATUS) + scp->flags |= CM_SCACHEFLAG_FETCHING; + if (flags & CM_SCACHESYNC_STORESTATUS) + scp->flags |= CM_SCACHEFLAG_STORING; + if (flags & CM_SCACHESYNC_STORESIZE) + scp->flags |= CM_SCACHEFLAG_SIZESTORING; + if (flags & CM_SCACHESYNC_GETCALLBACK) + scp->flags |= CM_SCACHEFLAG_GETCALLBACK; + if (flags & CM_SCACHESYNC_STOREDATA_EXCL) + scp->flags |= CM_SCACHEFLAG_DATASTORING; + if (flags & CM_SCACHESYNC_ASYNCSTORE) + scp->flags |= CM_SCACHEFLAG_ASYNCSTORING; + if (flags & CM_SCACHESYNC_LOCK) + scp->flags |= CM_SCACHEFLAG_LOCKING; + + /* now update the buffer pointer */ + if (flags & CM_SCACHESYNC_FETCHDATA) { + /* ensure that the buffer isn't already in the I/O list */ + if (bufp) { + for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { + tbufp = osi_GetQData(qdp); + osi_assert(tbufp != bufp); + } } - if (flags & CM_SCACHESYNC_STOREDATA) { - /* ensure that the buffer isn't already in the I/O list */ - if (bufp) { - for(qdp = scp->bufWritesp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { - tbufp = osi_GetQData(qdp); - osi_assert(tbufp != bufp); - } - } - - /* queue a held reference to the buffer in the "writing" I/O list */ - qdp = osi_QDAlloc(); - osi_SetQData(qdp, bufp); - if (bufp) { - buf_Hold(bufp); - bufp->cmFlags |= CM_BUF_CMSTORING; - } - osi_QAdd((osi_queue_t **) &scp->bufWritesp, &qdp->q); + /* queue a held reference to the buffer in the "reading" I/O list */ + qdp = osi_QDAlloc(); + osi_SetQData(qdp, bufp); + if (bufp) { + buf_Hold(bufp); + bufp->cmFlags |= CM_BUF_CMFETCHING; } - - return 0; + osi_QAdd((osi_queue_t **) &scp->bufReadsp, &qdp->q); + } + + if (flags & CM_SCACHESYNC_STOREDATA) { + /* ensure that the buffer isn't already in the I/O list */ + if (bufp) { + for(qdp = scp->bufWritesp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { + tbufp = osi_GetQData(qdp); + osi_assert(tbufp != bufp); + } + } + + /* queue a held reference to the buffer in the "writing" I/O list */ + qdp = osi_QDAlloc(); + osi_SetQData(qdp, bufp); + if (bufp) { + buf_Hold(bufp); + bufp->cmFlags |= CM_BUF_CMSTORING; + } + osi_QAdd((osi_queue_t **) &scp->bufWritesp, &qdp->q); + } + + return 0; } /* for those syncops that setup for RPCs. @@ -756,67 +756,67 @@ sleep: */ void cm_SyncOpDone(cm_scache_t *scp, cm_buf_t *bufp, long flags) { - osi_queueData_t *qdp; - cm_buf_t *tbufp; - - /* now, update the recorded state for RPC-type calls */ - if (flags & CM_SCACHESYNC_FETCHSTATUS) - scp->flags &= ~CM_SCACHEFLAG_FETCHING; - if (flags & CM_SCACHESYNC_STORESTATUS) - scp->flags &= ~CM_SCACHEFLAG_STORING; - if (flags & CM_SCACHESYNC_STORESIZE) - scp->flags &= ~CM_SCACHEFLAG_SIZESTORING; - if (flags & CM_SCACHESYNC_GETCALLBACK) - scp->flags &= ~CM_SCACHEFLAG_GETCALLBACK; - if (flags & CM_SCACHESYNC_STOREDATA_EXCL) - scp->flags &= ~CM_SCACHEFLAG_DATASTORING; - if (flags & CM_SCACHESYNC_ASYNCSTORE) - scp->flags &= ~CM_SCACHEFLAG_ASYNCSTORING; - if (flags & CM_SCACHESYNC_LOCK) - scp->flags &= ~CM_SCACHEFLAG_LOCKING; - - /* now update the buffer pointer */ - if (flags & CM_SCACHESYNC_FETCHDATA) { - /* ensure that the buffer isn't already in the I/O list */ - for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { - tbufp = osi_GetQData(qdp); - if (tbufp == bufp) break; - } - osi_assert(qdp != NULL); - osi_assert(osi_GetQData(qdp) == bufp); - osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q); - osi_QDFree(qdp); - if (bufp) { - bufp->cmFlags &= - ~(CM_BUF_CMFETCHING | CM_BUF_CMFULLYFETCHED); - buf_Release(bufp); - } + osi_queueData_t *qdp; + cm_buf_t *tbufp; + + /* now, update the recorded state for RPC-type calls */ + if (flags & CM_SCACHESYNC_FETCHSTATUS) + scp->flags &= ~CM_SCACHEFLAG_FETCHING; + if (flags & CM_SCACHESYNC_STORESTATUS) + scp->flags &= ~CM_SCACHEFLAG_STORING; + if (flags & CM_SCACHESYNC_STORESIZE) + scp->flags &= ~CM_SCACHEFLAG_SIZESTORING; + if (flags & CM_SCACHESYNC_GETCALLBACK) + scp->flags &= ~CM_SCACHEFLAG_GETCALLBACK; + if (flags & CM_SCACHESYNC_STOREDATA_EXCL) + scp->flags &= ~CM_SCACHEFLAG_DATASTORING; + if (flags & CM_SCACHESYNC_ASYNCSTORE) + scp->flags &= ~CM_SCACHEFLAG_ASYNCSTORING; + if (flags & CM_SCACHESYNC_LOCK) + scp->flags &= ~CM_SCACHEFLAG_LOCKING; + + /* now update the buffer pointer */ + if (flags & CM_SCACHESYNC_FETCHDATA) { + /* ensure that the buffer isn't already in the I/O list */ + for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { + tbufp = osi_GetQData(qdp); + if (tbufp == bufp) break; + } + osi_assert(qdp != NULL); + osi_assert(osi_GetQData(qdp) == bufp); + osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q); + osi_QDFree(qdp); + if (bufp) { + bufp->cmFlags &= + ~(CM_BUF_CMFETCHING | CM_BUF_CMFULLYFETCHED); + buf_Release(bufp); } + } - /* now update the buffer pointer */ - if (flags & CM_SCACHESYNC_STOREDATA) { - /* ensure that the buffer isn't already in the I/O list */ - for(qdp = scp->bufWritesp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { - tbufp = osi_GetQData(qdp); - if (tbufp == bufp) break; - } - osi_assert(qdp != NULL); - osi_assert(osi_GetQData(qdp) == bufp); - osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q); - osi_QDFree(qdp); - if (bufp) { - bufp->cmFlags &= ~CM_BUF_CMSTORING; - buf_Release(bufp); - } + /* now update the buffer pointer */ + if (flags & CM_SCACHESYNC_STOREDATA) { + /* ensure that the buffer isn't already in the I/O list */ + for(qdp = scp->bufWritesp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) { + tbufp = osi_GetQData(qdp); + if (tbufp == bufp) break; } - - /* and wakeup anyone who is waiting */ - if (scp->flags & CM_SCACHEFLAG_WAITING) { - osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING reset for 0x%x", scp); - scp->flags &= ~CM_SCACHEFLAG_WAITING; - osi_Wakeup((long) &scp->flags); + osi_assert(qdp != NULL); + osi_assert(osi_GetQData(qdp) == bufp); + osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q); + osi_QDFree(qdp); + if (bufp) { + bufp->cmFlags &= ~CM_BUF_CMSTORING; + buf_Release(bufp); } -} + } + + /* and wakeup anyone who is waiting */ + if (scp->flags & CM_SCACHEFLAG_WAITING) { + osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING reset for 0x%x", scp); + scp->flags &= ~CM_SCACHEFLAG_WAITING; + osi_Wakeup((long) &scp->flags); + } +} /* merge in a response from an RPC. The scp must be locked, and the callback * is optional. @@ -832,123 +832,123 @@ void cm_SyncOpDone(cm_scache_t *scp, cm_buf_t *bufp, long flags) * started before that, can cause old info to be merged from the first call. */ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp, - cm_user_t *userp, int flags) + cm_user_t *userp, int flags) { - // yj: i want to create some fake status for the /afs directory and the - // entries under that directory + // yj: i want to create some fake status for the /afs directory and the + // entries under that directory #ifdef AFS_FREELANCE_CLIENT - if (cm_freelanceEnabled && scp == cm_rootSCachep) { - osi_Log0(afsd_logp,"cm_MergeStatus Freelance cm_rootSCachep"); - statusp->InterfaceVersion = 0x1; + if (cm_freelanceEnabled && scp == cm_rootSCachep) { + osi_Log0(afsd_logp,"cm_MergeStatus Freelance cm_rootSCachep"); + statusp->InterfaceVersion = 0x1; statusp->FileType = CM_SCACHETYPE_DIRECTORY; - statusp->LinkCount = scp->linkCount; - statusp->Length = cm_fakeDirSize; - statusp->DataVersion = cm_fakeDirVersion; - statusp->Author = 0x1; - statusp->Owner = 0x0; - statusp->CallerAccess = 0x9; - statusp->AnonymousAccess = 0x9; - statusp->UnixModeBits = 0x1ff; - statusp->ParentVnode = 0x1; - statusp->ParentUnique = 0x1; - statusp->ResidencyMask = 0; - statusp->ClientModTime = FakeFreelanceModTime; - statusp->ServerModTime = FakeFreelanceModTime; - statusp->Group = 0; - statusp->SyncCounter = 0; - statusp->dataVersionHigh = 0; - } + statusp->LinkCount = scp->linkCount; + statusp->Length = cm_fakeDirSize; + statusp->DataVersion = cm_fakeDirVersion; + statusp->Author = 0x1; + statusp->Owner = 0x0; + statusp->CallerAccess = 0x9; + statusp->AnonymousAccess = 0x9; + statusp->UnixModeBits = 0x1ff; + statusp->ParentVnode = 0x1; + statusp->ParentUnique = 0x1; + statusp->ResidencyMask = 0; + statusp->ClientModTime = FakeFreelanceModTime; + statusp->ServerModTime = FakeFreelanceModTime; + statusp->Group = 0; + statusp->SyncCounter = 0; + statusp->dataVersionHigh = 0; + } #endif /* AFS_FREELANCE_CLIENT */ - if (!(flags & CM_MERGEFLAG_FORCE) - && statusp->DataVersion < (unsigned long) scp->dataVersion) { - struct cm_cell *cellp; - struct cm_volume *volp; - - cellp = cm_FindCellByID(scp->fid.cell); - cm_GetVolumeByID(cellp, scp->fid.volume, userp, - (cm_req_t *) NULL, &volp); - if (scp->cbServerp) - osi_Log2(afsd_logp, "old data from server %x volume %s", - scp->cbServerp->addr.sin_addr.s_addr, - volp->namep); - osi_Log3(afsd_logp, "Bad merge, scp %x, scp dv %d, RPC dv %d", - scp, scp->dataVersion, statusp->DataVersion); - /* we have a number of data fetch/store operations running - * concurrently, and we can tell which one executed last at the - * server by its mtime. - * Choose the one with the largest mtime, and ignore the rest. - * - * These concurrent calls are incompatible with setting the - * mtime, so we won't have a locally changed mtime here. - * - * We could also have ACL info for a different user than usual, - * in which case we have to do that part of the merge, anyway. - * We won't have to worry about the info being old, since we - * won't have concurrent calls - * that change file status running from this machine. - * - * Added 3/17/98: if we see data version regression on an RO - * file, it's probably due to a server holding an out-of-date - * replica, rather than to concurrent RPC's. Failures to - * release replicas are now flagged by the volserver, but only - * since AFS 3.4 5.22, so there are plenty of clients getting - * out-of-date replicas out there. - * - * If we discover an out-of-date replica, by this time it's too - * late to go to another server and retry. Also, we can't - * reject the merge, because then there is no way for - * GetAccess to do its work, and the caller gets into an - * infinite loop. So we just grin and bear it. - */ - if (!(scp->flags & CM_SCACHEFLAG_RO)) - return; - } - scp->serverModTime = statusp->ServerModTime; - - if (!(scp->mask & CM_SCACHEMASK_CLIENTMODTIME)) { - scp->clientModTime = statusp->ClientModTime; - } - if (!(scp->mask & CM_SCACHEMASK_LENGTH)) { - scp->length.LowPart = statusp->Length; - scp->length.HighPart = 0; - } - - scp->serverLength.LowPart = statusp->Length; - scp->serverLength.HighPart = 0; - - scp->linkCount = statusp->LinkCount; - scp->dataVersion = statusp->DataVersion; - scp->owner = statusp->Owner; - scp->group = statusp->Group; - scp->unixModeBits = statusp->UnixModeBits & 07777; - - if (statusp->FileType == File) - scp->fileType = CM_SCACHETYPE_FILE; - else if (statusp->FileType == Directory) - scp->fileType = CM_SCACHETYPE_DIRECTORY; - else if (statusp->FileType == SymbolicLink) { - if ((scp->unixModeBits & 0111) == 0) - scp->fileType = CM_SCACHETYPE_MOUNTPOINT; - else - scp->fileType = CM_SCACHETYPE_SYMLINK; - } + if (!(flags & CM_MERGEFLAG_FORCE) + && statusp->DataVersion < (unsigned long) scp->dataVersion) { + struct cm_cell *cellp; + struct cm_volume *volp; + + cellp = cm_FindCellByID(scp->fid.cell); + cm_GetVolumeByID(cellp, scp->fid.volume, userp, + (cm_req_t *) NULL, &volp); + if (scp->cbServerp) + osi_Log2(afsd_logp, "old data from server %x volume %s", + scp->cbServerp->addr.sin_addr.s_addr, + volp->namep); + osi_Log3(afsd_logp, "Bad merge, scp %x, scp dv %d, RPC dv %d", + scp, scp->dataVersion, statusp->DataVersion); + /* we have a number of data fetch/store operations running + * concurrently, and we can tell which one executed last at the + * server by its mtime. + * Choose the one with the largest mtime, and ignore the rest. + * + * These concurrent calls are incompatible with setting the + * mtime, so we won't have a locally changed mtime here. + * + * We could also have ACL info for a different user than usual, + * in which case we have to do that part of the merge, anyway. + * We won't have to worry about the info being old, since we + * won't have concurrent calls + * that change file status running from this machine. + * + * Added 3/17/98: if we see data version regression on an RO + * file, it's probably due to a server holding an out-of-date + * replica, rather than to concurrent RPC's. Failures to + * release replicas are now flagged by the volserver, but only + * since AFS 3.4 5.22, so there are plenty of clients getting + * out-of-date replicas out there. + * + * If we discover an out-of-date replica, by this time it's too + * late to go to another server and retry. Also, we can't + * reject the merge, because then there is no way for + * GetAccess to do its work, and the caller gets into an + * infinite loop. So we just grin and bear it. + */ + if (!(scp->flags & CM_SCACHEFLAG_RO)) + return; + } + scp->serverModTime = statusp->ServerModTime; + + if (!(scp->mask & CM_SCACHEMASK_CLIENTMODTIME)) { + scp->clientModTime = statusp->ClientModTime; + } + if (!(scp->mask & CM_SCACHEMASK_LENGTH)) { + scp->length.LowPart = statusp->Length; + scp->length.HighPart = 0; + } + + scp->serverLength.LowPart = statusp->Length; + scp->serverLength.HighPart = 0; + + scp->linkCount = statusp->LinkCount; + scp->dataVersion = statusp->DataVersion; + scp->owner = statusp->Owner; + scp->group = statusp->Group; + scp->unixModeBits = statusp->UnixModeBits & 07777; + + if (statusp->FileType == File) + scp->fileType = CM_SCACHETYPE_FILE; + else if (statusp->FileType == Directory) + scp->fileType = CM_SCACHETYPE_DIRECTORY; + else if (statusp->FileType == SymbolicLink) { + if ((scp->unixModeBits & 0111) == 0) + scp->fileType = CM_SCACHETYPE_MOUNTPOINT; + else + scp->fileType = CM_SCACHETYPE_SYMLINK; + } else { osi_Log1(afsd_logp, "Merge, Invalid File Type, scp %x", scp); scp->fileType = 0; /* invalid */ } - /* and other stuff */ - scp->parentVnode = statusp->ParentVnode; - scp->parentUnique = statusp->ParentUnique; + /* and other stuff */ + scp->parentVnode = statusp->ParentVnode; + scp->parentUnique = statusp->ParentUnique; - /* and merge in the private acl cache info, if this is more than the public - * info; merge in the public stuff in any case. - */ - scp->anyAccess = statusp->AnonymousAccess; + /* and merge in the private acl cache info, if this is more than the public + * info; merge in the public stuff in any case. + */ + scp->anyAccess = statusp->AnonymousAccess; - if (userp != NULL) { - cm_AddACLCache(scp, userp, statusp->CallerAccess); - } + if (userp != NULL) { + cm_AddACLCache(scp, userp, statusp->CallerAccess); + } } /* note that our stat cache info is incorrect, so force us eventually @@ -961,60 +961,60 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp, */ void cm_DiscardSCache(cm_scache_t *scp) { - lock_AssertMutex(&scp->mx); + lock_AssertMutex(&scp->mx); if (scp->cbServerp) { cm_PutServer(scp->cbServerp); scp->cbServerp = NULL; } - scp->cbExpires = 0; - cm_dnlcPurgedp(scp); - cm_FreeAllACLEnts(scp); + scp->cbExpires = 0; + cm_dnlcPurgedp(scp); + cm_FreeAllACLEnts(scp); } void cm_AFSFidFromFid(AFSFid *afsFidp, cm_fid_t *fidp) { - afsFidp->Volume = fidp->volume; - afsFidp->Vnode = fidp->vnode; - afsFidp->Unique = fidp->unique; -} + afsFidp->Volume = fidp->volume; + afsFidp->Vnode = fidp->vnode; + afsFidp->Unique = fidp->unique; +} void cm_HoldSCache(cm_scache_t *scp) { - lock_ObtainWrite(&cm_scacheLock); - osi_assert(scp->refCount > 0); - scp->refCount++; - lock_ReleaseWrite(&cm_scacheLock); + lock_ObtainWrite(&cm_scacheLock); + osi_assert(scp->refCount > 0); + scp->refCount++; + lock_ReleaseWrite(&cm_scacheLock); } void cm_ReleaseSCache(cm_scache_t *scp) { - lock_ObtainWrite(&cm_scacheLock); - osi_assert(scp->refCount-- > 0); - lock_ReleaseWrite(&cm_scacheLock); + lock_ObtainWrite(&cm_scacheLock); + osi_assert(scp->refCount-- > 0); + lock_ReleaseWrite(&cm_scacheLock); } /* just look for the scp entry to get filetype */ /* doesn't need to be perfectly accurate, so locking doesn't matter too much */ int cm_FindFileType(cm_fid_t *fidp) { - long hash; - cm_scache_t *scp; + long hash; + cm_scache_t *scp; - hash = CM_SCACHE_HASH(fidp); + hash = CM_SCACHE_HASH(fidp); - osi_assert(fidp->cell != 0); + osi_assert(fidp->cell != 0); - lock_ObtainWrite(&cm_scacheLock); - for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { - if (cm_FidCmp(fidp, &scp->fid) == 0) { - /*scp->refCount++;*/ - /*cm_AdjustLRU(scp);*/ - lock_ReleaseWrite(&cm_scacheLock); - return scp->fileType; - } + lock_ObtainWrite(&cm_scacheLock); + for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) { + if (cm_FidCmp(fidp, &scp->fid) == 0) { + /*scp->refCount++;*/ + /*cm_AdjustLRU(scp);*/ + lock_ReleaseWrite(&cm_scacheLock); + return scp->fileType; } - lock_ReleaseWrite(&cm_scacheLock); - return 0; + } + lock_ReleaseWrite(&cm_scacheLock); + return 0; } /* dump all scp's that have reference count > 0 to a file. diff --git a/src/WINNT/afsd/cm_scache.h b/src/WINNT/afsd/cm_scache.h index 18b345033..3cf2bf33c 100644 --- a/src/WINNT/afsd/cm_scache.h +++ b/src/WINNT/afsd/cm_scache.h @@ -24,7 +24,7 @@ typedef struct cm_fid { typedef struct cm_accessCache { osi_queue_t q; /* queue header */ struct cm_user *userp; /* user having access rights */ - long rights; /* rights */ + unsigned long rights; /* rights */ } cm_accessCache_t; typedef struct cm_file_lock { @@ -50,7 +50,7 @@ typedef struct cm_scache { osi_queue_t q; /* lru queue; cm_scacheLock */ struct cm_scache *nextp; /* next in hash; cm_scacheLock */ cm_fid_t fid; - long flags; /* flags; locked by mx */ + unsigned long flags; /* flags; locked by mx */ /* synchronization stuff */ osi_mutex_t mx; /* mutex for this structure */ @@ -67,17 +67,17 @@ typedef struct cm_scache { long parentUnique; /* for ACL callbacks */ /* local modification stat */ - long mask; /* for clientModTime, length and + unsigned long mask; /* for clientModTime, length and * truncPos */ /* file status */ - int fileType; /* file type */ + unsigned int fileType; /* file type */ time_t clientModTime; /* mtime */ time_t serverModTime; /* at server, for concurrent call * comparisons */ osi_hyper_t length; /* file length */ cm_prefetch_t prefetch; /* prefetch info structure */ - int unixModeBits; /* unix protection mode bits */ + unsigned int unixModeBits; /* unix protection mode bits */ int linkCount; /* link count */ long dataVersion; /* data version */ long owner; /* file owner */ @@ -118,7 +118,7 @@ typedef struct cm_scache { osi_hyper_t bulkStatProgress; /* track bulk stats of large dirs */ /* open state */ - short openReads; /* opens for reading */ + short openReads; /* open for reading */ short openWrites; /* open for writing */ short openShares; /* open for read excl */ short openExcls; /* open for exclusives */ diff --git a/src/WINNT/client_config/config.cpp b/src/WINNT/client_config/config.cpp index d39f24fc3..f3ea6628f 100644 --- a/src/WINNT/client_config/config.cpp +++ b/src/WINNT/client_config/config.cpp @@ -671,51 +671,67 @@ BOOL Config_SetNumDaemons (ULONG cDaemons, ULONG *pStatus) void Config_GetSysName (LPTSTR pszName) { - if (!Config_ReadGlobalString (TEXT("SysName"), pszName, MAX_PATH)) - lstrcpy (pszName, TEXT("i386_nt40")); + if (!Config_ReadGlobalString (TEXT("SysName"), pszName, MAX_PATH)) + lstrcpy (pszName, TEXT("i386_nt40")); } BOOL Config_SetSysName (LPCTSTR pszName, ULONG *pStatus) { - BOOL rc = TRUE; - ULONG status = 0; - - if (Config_GetServiceState() == SERVICE_RUNNING) - { - struct { - ULONG cbData; - TCHAR szData[ PIOCTL_MAXSIZE ]; - } InData; - memset (&InData, 0x00, sizeof(InData)); - InData.cbData = lstrlen(pszName); - lstrcpy (InData.szData, pszName); - - BYTE OutData[ PIOCTL_MAXSIZE ]; - memset (OutData, 0x00, sizeof(OutData)); - - struct ViceIoctl IOInfo; - IOInfo.in_size = sizeof(ULONG) +lstrlen(pszName) +1; - IOInfo.in = (char *)&InData; - IOInfo.out = (char *)OutData; - IOInfo.out_size = PIOCTL_MAXSIZE; - - if ((status = pioctl (0, VIOC_AFS_SYSNAME, &IOInfo, 1)) != 0) - { - rc = FALSE; - } - } - - if (rc) - { - Config_WriteGlobalString (TEXT("SysName"), pszName); - } - - if (pStatus && !rc) - *pStatus = status; - if (!rc) - Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_SYSNAME, TEXT("%ld"), status); - return rc; + BOOL rc = TRUE; + ULONG status = 0; + + if (Config_GetServiceState() == SERVICE_RUNNING) + { + struct { + ULONG cbData; + TCHAR szData[ PIOCTL_MAXSIZE ]; + } InData; + memset (&InData, 0x00, sizeof(InData)); + USHORT i=0, j=0, len=lstrlen(pszName); + + if ( len == 0 ) { + Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_SYSNAME, TEXT("A sysname must be specified")); + return(-1); + } + + while ( pszName[i] ) { + if ( !isspace(pszName[i]) ) { + InData.szData[j++] = pszName[i]; + } else if (InData.szData[j-1] != '\0') { + InData.szData[j++] = '\0'; + InData.cbData++; + } + i++; + } + InData.szData[j++] = '\0'; + InData.cbData++; /* one word */ + + BYTE OutData[ PIOCTL_MAXSIZE ]; + memset (OutData, 0x00, sizeof(OutData)); + + struct ViceIoctl IOInfo; + IOInfo.in_size = sizeof(ULONG) + j; + IOInfo.in = (char *)&InData; + IOInfo.out = (char *)OutData; + IOInfo.out_size = PIOCTL_MAXSIZE; + + if ((status = pioctl (0, VIOC_AFS_SYSNAME, &IOInfo, 1)) != 0) + { + rc = FALSE; + } + } + + if (rc) + { + Config_WriteGlobalString (TEXT("SysName"), pszName); + } + + if (pStatus && !rc) + *pStatus = status; + if (!rc) + Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_SYSNAME, TEXT("%ld"), status); + return rc; } diff --git a/src/WINNT/client_config/tab_drives.cpp b/src/WINNT/client_config/tab_drives.cpp index 3ec357f21..f3b6c259c 100644 --- a/src/WINNT/client_config/tab_drives.cpp +++ b/src/WINNT/client_config/tab_drives.cpp @@ -316,7 +316,6 @@ void DrivesTab_EditMapping (HWND hDlg, int iDrive) AdjustAfsPath (szAfsPathNew, DriveMap.szMapping, TRUE, TRUE); if ( (lstrcmpi (szAfsPathOrig, szAfsPathNew)) || - (lstrcmpi (DriveMapOrig.szSubmount, DriveMap.szSubmount)) || (DriveMapOrig.chDrive != DriveMap.chDrive) || (DriveMapOrig.fPersistent != DriveMap.fPersistent) ) { @@ -332,23 +331,13 @@ void DrivesTab_EditMapping (HWND hDlg, int iDrive) } } - if (!ActivateDriveMap (DriveMap.chDrive, szAfsPathNew, DriveMap.szSubmount, DriveMap.fPersistent, &dwStatus)) + if (!ActivateDriveMap (DriveMap.chDrive, szAfsPathNew, "", DriveMap.fPersistent, &dwStatus)) { Message (MB_OK | MB_ICONHAND, IDS_ERROR_MAP, IDS_ERROR_MAP_DESC, TEXT("%08lX"), dwStatus); DrivesTab_FillList (hDlg); return; } - if (DriveMap.szSubmount[0]) - { - TCHAR szSubmountNow[ MAX_PATH ]; - if (GetDriveSubmount (DriveMap.chDrive, szSubmountNow)) - { - if (lstrcmpi (DriveMap.szSubmount, szSubmountNow)) - Message (MB_OK | MB_ICONASTERISK, GetCautionTitle(), IDS_NEWSUB_DESC); - } - } - if (iDrive != -1) memset (&g.Configuration.NetDrives.aDriveMap[ iDrive ], 0x00, sizeof(DRIVEMAP)); memcpy (&g.Configuration.NetDrives.aDriveMap[ DriveMap.chDrive-chDRIVE_A ], &DriveMap, sizeof(DRIVEMAP)); @@ -453,7 +442,6 @@ void DriveEdit_OnInitDialog (HWND hDlg) SetDlgItemText (hDlg, IDC_STATICSUBMOUNT, msgf); } SetDlgItemText (hDlg, IDC_PATH, szMapping); - SetDlgItemText (hDlg, IDC_DESC, pMap->szSubmount); CheckDlgButton (hDlg, IDC_PERSISTENT, (pMap->chDrive == 0) ? TRUE : (pMap->fPersistent)); @@ -470,15 +458,8 @@ void DriveEdit_OnOK (HWND hDlg) pMap->chDrive = chDRIVE_A + iDrive; GetDlgItemText (hDlg, IDC_PATH, pMap->szMapping, MAX_PATH); - GetDlgItemText (hDlg, IDC_DESC, pMap->szSubmount, MAX_PATH); pMap->fPersistent = IsDlgButtonChecked (hDlg, IDC_PERSISTENT); - if (pMap->szSubmount[0] && !IsValidSubmountName (pMap->szSubmount)) - { - Message (MB_ICONHAND, GetErrorTitle(), IDS_BADSUB_DESC); - return; - } - if ( (lstrncmpi (pMap->szMapping, cm_slash_mount_root, lstrlen(cm_slash_mount_root))) && (lstrncmpi (pMap->szMapping, cm_back_slash_mount_root, lstrlen(cm_back_slash_mount_root))) ) { -- 2.39.5