#include <malloc.h>
#include <stdio.h>
#include <assert.h>
-#include <winnt/osi_malloc.h>
#include "afsd.h"
-void afsi_log();
+extern void afsi_log(char *pattern, ...);
/* This module implements the buffer package used by the local transaction
* system (cm). It is initialized by calling cm_Init, which calls buf_Init;
HANDLE hm;
long cs;
+ afsi_log("%d buffers being added to the existing cache of size %d",
+ nbuffers, buf_nbuffers);
+
/*
* Cache file mapping constrained by
* system allocation granularity;
/* done */
return code;
}
+
+/* dump the contents of the buf_hashTablepp. */
+int cm_DumpBufHashTable(FILE *outputFile, char *cookie)
+{
+ int zilch;
+ cm_buf_t *bp;
+ char output[1024];
+ int i;
+
+ lock_ObtainRead(&buf_globalLock);
+
+ sprintf(output, "%s - dumping buf_HashTable - buf_hashSize=%d\n", cookie, buf_hashSize);
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+
+ for (i = 0; i < buf_hashSize; i++)
+ {
+ for(bp = buf_hashTablepp[i]; bp; bp=bp->hashp)
+ {
+ if (bp->refCount)
+ {
+ sprintf(output, "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d,"
+ "vnode=%d, unique=%d), size=%d refCount=%d\n",
+ cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume,
+ bp->fid.vnode, bp->fid.unique, bp->size, bp->refCount);
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+ }
+ }
+ }
+
+ sprintf(output, "%s - Done dumping buf_HashTable.\n", cookie);
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+
+ lock_ReleaseRead(&buf_globalLock);
+ return 0;
+}
+