This is a variation of Joe Buehler's request.
New registry key "NonPersistentCache" places the cache file into the
Windows paging file. One limitation of doing so is that the page file
cannot be grown with "fs setcachesize" and the associated ioctl.
long maxcpus;
long ltt, ltto;
long rx_mtu, rx_nojumbo;
+ long virtualCache;
char rootCellName[256];
struct rx_service *serverp;
static struct rx_securityClass *nullServerSecurityClassp;
afsi_log("Default cache path %s", cm_CachePath);
}
+ dummyLen = sizeof(virtualCache);
+ code = RegQueryValueEx(parmKey, "NonPersistentCaching", NULL, NULL,
+ &virtualCache, &dummyLen);
+ if (code == ERROR_SUCCESS && virtualCache) {
+ buf_cacheType = CM_BUF_CACHETYPE_VIRTUAL;
+ } else {
+ buf_cacheType = CM_BUF_CACHETYPE_FILE;
+ }
+ afsi_log("Cache type is %s", ((buf_cacheType == CM_BUF_CACHETYPE_FILE)?"FILE":"VIRTUAL"));
+
dummyLen = sizeof(traceOnPanic);
code = RegQueryValueEx(parmKey, "TrapOnPanic", NULL, NULL,
(BYTE *) &traceOnPanic, &dummyLen);
long buf_nOrigBuffers;
long buf_bufferSize = CM_BUF_SIZE;
long buf_hashSize = CM_BUF_HASHSIZE;
+int buf_cacheType = CM_BUF_CACHETYPE_FILE;
#ifndef DJGPP
static
sectorSize = 1;
#ifndef DJGPP
+ if(buf_cacheType == CM_BUF_CACHETYPE_FILE) {
/* Reserve buffer space by mapping cache file */
psa = CreateCacheFileSA();
hf = CreateFile(cm_CachePath,
return CM_ERROR_INVAL;
}
FreeCacheFileSA(psa);
+ } else { /* buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL */
+ hf = INVALID_HANDLE_VALUE;
+ }
CacheHandle = hf;
hm = CreateFileMapping(hf,
NULL,
0, 0,
buf_nbuffers * buf_bufferSize);
if (data == NULL) {
- CloseHandle(hf);
+ if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf);
CloseHandle(hm);
return CM_ERROR_INVAL;
}
afsi_log("%d buffers being added to the existing cache of size %d",
nbuffers, buf_nbuffers);
+ if (buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL) {
+ /* The size of a virtual cache cannot be changed after it has
+ * been created. Subsequent calls to MapViewofFile() with
+ * an existing mapping object name would not allow the
+ * object to be resized. Return failure immediately.
+ */
+ return CM_ERROR_INVAL;
+ }
+
/*
* Cache file mapping constrained by
* system allocation granularity;
#define CM_BUF_HASHSIZE 1024
extern long buf_hashSize;
+/* cache type */
+#define CM_BUF_CACHETYPE_FILE 1
+#define CM_BUF_CACHETYPE_VIRTUAL 2
+extern int buf_cacheType;
+
/* force it to be signed so that mod comes out positive or 0 */
#define BUF_HASH(fidp,offsetp) ((((fidp)->vnode+((fidp)->unique << 5) \
+(fidp)->volume+(fidp)->cell \