buf_ForceTrace(TRUE);
afsi_log("--- begin dump ---");
+ cm_DumpCells(afsi_file, "a", 0);
+ cm_DumpVolumes(afsi_file, "a", 0);
cm_DumpSCache(afsi_file, "a", 0);
#ifdef keisa
cm_dnlcDump(afsi_file, "a");
afsi_log("--- end dump ---");
#ifdef DEBUG
- if (IsDebuggerPresent())
- DebugBreak();
+ if (IsDebuggerPresent())
+ DebugBreak();
#endif
SetEvent(WaitToTerminate);
cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags)
{
- cm_cell_t *cp;
+ cm_cell_t *cp, *cp2;
long code;
char fullname[200]="";
if (!strcmp(namep,SMB_IOCTL_FILENAME_NOSLASH))
return NULL;
- lock_ObtainWrite(&cm_cellLock);
+ lock_ObtainRead(&cm_cellLock);
for (cp = cm_data.allCellsp; cp; cp=cp->nextp) {
if (stricmp(namep, cp->name) == 0) {
strcpy(fullname, cp->name);
break;
}
}
+ lock_ReleaseRead(&cm_cellLock);
if (cp) {
cp = cm_UpdateCell(cp);
} else if (flags & CM_FLAG_CREATE) {
+ lock_ObtainWrite(&cm_cellLock);
+
+ /* when we dropped the lock the cell could have been added
+ * to the list so check again while holding the write lock
+ */
+ for (cp = cm_data.allCellsp; cp; cp=cp->nextp) {
+ if (stricmp(namep, cp->name) == 0) {
+ strcpy(fullname, cp->name);
+ break;
+ }
+ }
+
+ if (cp) {
+ lock_ReleaseWrite(&cm_cellLock);
+ goto done;
+ }
+
if ( cm_data.currentCells >= cm_data.maxCells )
osi_panic("Exceeded Max Cells", __FILE__, __LINE__);
cp->timeout = time(0) + 7200; /* two hour timeout */
}
+ /* we have now been given the fullname of the cell. It may
+ * be that we already have a cell with that name. If so,
+ * we should use it instead of completing the allocation
+ * of a new cm_cell_t
+ */
+ for (cp2 = cm_data.allCellsp; cp2; cp2=cp2->nextp) {
+ if (stricmp(fullname, cp2->name) == 0) {
+ break;
+ }
+ }
+
+ if (cp2) {
+ cm_FreeServerList(&cp->vlServersp, CM_FREESERVERLIST_DELETE);
+ cp = cp2;
+ lock_ReleaseWrite(&cm_cellLock);
+ goto done;
+ }
+
+
/* randomise among those vlservers having the same rank*/
cm_RandomizeServer(&cp->vlServersp);
/* the cellID cannot be 0 */
cp->cellID = ++cm_data.currentCells;
+ lock_ReleaseWrite(&cm_cellLock);
}
done:
if (cp && newnamep)
strcpy(newnamep, fullname);
- lock_ReleaseWrite(&cm_cellLock);
return cp;
}
{
cm_cell_t *cp;
- lock_ObtainWrite(&cm_cellLock);
+ lock_ObtainRead(&cm_cellLock);
for (cp = cm_data.allCellsp; cp; cp=cp->nextp) {
if (cellID == cp->cellID)
break;
}
+ lock_ReleaseRead(&cm_cellLock);
if (cp)
cp = cm_UpdateCell(cp);
- lock_ReleaseWrite(&cm_cellLock);
return cp;
}
}
}
+int cm_DumpCells(FILE *outputFile, char *cookie, int lock)
+{
+ cm_cell_t *cellp;
+ int zilch;
+ char output[1024];
+
+ if (lock)
+ lock_ObtainRead(&cm_cellLock);
+
+ sprintf(output, "%s - dumping cells - cm_data.currentCells=%d, cm_data.maxCells=%d\r\n",
+ cookie, cm_data.currentCells, cm_data.maxCells);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+
+ for (cellp = cm_data.allCellsp; cellp; cellp=cellp->nextp) {
+ sprintf(output, "%s cellp=0x%p,name=%s ID=%d flags=0x%x\r\n",
+ cookie, cellp, cellp->name, cellp->cellID, cellp->flags);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ }
+
+ sprintf(output, "%s - Done dumping cells.\r\n", cookie);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+
+ if (lock)
+ lock_ReleaseRead(&cm_cellLock);
+
+ return(0);
+}
+
extern cm_cell_t *cm_allCellsp;
+extern int cm_DumpCells(FILE *, char *, int);
+
#endif /* __CELL_H_ENV_ */
#endif
/* dump all interesting data */
- cm_DumpSCache(hLogFile, cookie, 1);
+ cm_DumpCells(hLogFile, cookie, 1);
cm_DumpVolumes(hLogFile, cookie, 1);
+ cm_DumpSCache(hLogFile, cookie, 1);
cm_DumpBufHashTable(hLogFile, cookie, 1);
smb_DumpVCP(hLogFile, cookie, 1);
for (scp = cm_data.allSCachesp; scp; scp = scp->allNextp)
{
- if (scp->refCount != 0)
- {
- sprintf(output, "%s scp=0x%p, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\r\n",
- cookie, scp, scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique,
- scp->refCount);
- WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
- }
+ sprintf(output, "%s scp=0x%p, fid (cell=%d, volume=%d, vnode=%d, unique=%d) volp=0x%p flags=0x%x refCount=%u\r\n",
+ cookie, scp, scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique,
+ scp->volp, scp->flags, scp->refCount);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
}
sprintf(output, "%s - dumping cm_data.hashTable - cm_data.scacheHashTableSize=%d\r\n", cookie, cm_data.scacheHashTableSize);
{
for(scp = cm_data.scacheHashTablep[i]; scp; scp=scp->nextp)
{
- if (scp->refCount != 0)
- {
- sprintf(output, "%s scp=0x%p, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\r\n",
- cookie, scp, i, scp->fid.cell, scp->fid.volume, scp->fid.vnode,
- scp->fid.unique, scp->refCount);
- WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
- }
+ sprintf(output, "%s scp=0x%p, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) volp=0x%p flags=0x%x refCount=%u\r\n",
+ cookie, scp, i, scp->fid.cell, scp->fid.volume, scp->fid.vnode,
+ scp->fid.unique, scp->volp, scp->flags, scp->refCount);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
}
}
}
#ifdef SEARCH_ALL_VOLUMES
- assert(volp == volp2);
+ osi_assert(volp == volp2);
#endif
lock_ReleaseRead(&cm_volumeLock);
}
#ifdef SEARCH_ALL_VOLUMES
- assert(volp2 == volp);
+ osi_assert(volp2 == volp);
#endif
if (!volp && (flags & CM_GETVOL_FLAG_CREATE)) {
}
#ifdef SEARCH_ALL_VOLUMES
- assert(volp == volp2);
+ osi_assert(volp == volp2);
#endif
lock_ReleaseRead(&cm_volumeLock);
for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp)
{
- if (volp->refCount != 0)
- {
- cm_scache_t *scp;
- int scprefs = 0;
-
- for (scp = cm_data.allSCachesp; scp; scp = scp->allNextp)
- {
- if (scp->volp == volp)
- scprefs++;
- }
+ cm_scache_t *scp;
+ int scprefs = 0;
- sprintf(output, "%s cell=%s name=%s rwID=%u roID=%u bkID=%u flags=0x%x fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u scpRefs=%u\r\n",
- cookie, volp->cellp->name, volp->namep, volp->rw.ID, volp->ro.ID, volp->bk.ID, volp->flags,
- volp->dotdotFid.cell, volp->dotdotFid.volume, volp->dotdotFid.vnode, volp->dotdotFid.unique,
- volp->refCount, scprefs);
- WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
- }
+ for (scp = cm_data.allSCachesp; scp; scp = scp->allNextp)
+ {
+ if (scp->volp == volp)
+ scprefs++;
+ }
+
+ sprintf(output, "%s - volp=0x%p cell=%s name=%s rwID=%u roID=%u bkID=%u flags=0x%x fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u scpRefs=%u\r\n",
+ cookie, volp, volp->cellp->name, volp->namep, volp->rw.ID, volp->ro.ID, volp->bk.ID, volp->flags,
+ volp->dotdotFid.cell, volp->dotdotFid.volume, volp->dotdotFid.vnode, volp->dotdotFid.unique,
+ volp->refCount, scprefs);
+ WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
}
sprintf(output, "%s - Done dumping volumes.\r\n", cookie);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
} astat;
unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 };
unsigned char kVista_WLA_MAC[6] = { 0x7F, 0x00, 0x00, 0x01, 0x4f, 0x50 };
+#ifdef USE_VMWARE
unsigned char kVMWare_MAC[5] = { 0x00, 0x50, 0x56, 0xC0, 0x00 };
+#endif
int status;
HKEY hkConfig;
LONG rv;
return FALSE;
}
return (memcmp(astat.status.adapter_address, kWLA_MAC, 6) == 0 ||
- memcmp(astat.status.adapter_address, kVista_WLA_MAC, 6) == 0 ||
- memcmp(astat.status.adapter_address, kVMWare_MAC, 5) == 0);
+ memcmp(astat.status.adapter_address, kVista_WLA_MAC, 6) == 0
+#ifdef USE_VMWARE
+ || memcmp(astat.status.adapter_address, kVMWare_MAC, 5) == 0
+#endif
+ );
}
// Get the netbios named used/to-be-used by the AFS SMB server.