+comment file multi-mapping and #define CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR
authorshort <>
Sat, 12 Jul 2003 18:49:33 +0000 (18:49 +0000)
committershort <>
Sat, 12 Jul 2003 18:49:33 +0000 (18:49 +0000)
src/libcaptive/cc/map.c

index bab439f..d03d10e 100644 (file)
 /* CONFIG: */
 
 #define CAPTIVE_PUBLIC_BCB_NODETYPECODE 0xDE45 /* FIXME: unknown, undocumented */
+/* Prepare linear mapped space by CcInitializeCacheMap()?
+ * NT-5.1sp will map the same pages of a file to the same memory location
+ * either by CcMap*() or CcPin*().
+ * We do a separate mapping for each Bcb protected by bounding unmapped pages
+ * with IPC shm shared pages if a file page is mapped multiple times.
+ * I am not aware how they can reserve enough virtual memory space during
+ * client with mapping requests of increasing range tendency.
+ * This define will try to pre-map the file as one linear are during 
+ * CcInitializeCacheMap() according to its (CC_FILE_SIZES *)FileSizes
+ * but TODO the range is currently left unused in further mapping functions.
+ */
+/* #define CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR 1 */
 
 
 /* Flush all the buffers directly on the fly.
 gboolean captive_cc_unmounting=FALSE;
 
 
-/* map: (FILE_OBJECT *)FileObject -> (FILE_OBJECT *)FileObject */
+/* map: (FILE_OBJECT *)FileObject -> (struct fileobject_cached *) */
 static GHashTable *fileobject_cached_hash;
 
 struct fileobject_cached {
        CACHE_MANAGER_CALLBACKS CallBacks;
        VOID *LazyWriterContext;
+#ifdef CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR
        PVOID Bcb;
+#endif
        };
 
 static void fileobject_cached_hash_value_destroy_func(struct fileobject_cached *value)
@@ -98,7 +112,7 @@ VOID CcInitializeCacheMap(IN PFILE_OBJECT FileObject,
                IN PCC_FILE_SIZES FileSizes,IN BOOLEAN PinAccess,IN PCACHE_MANAGER_CALLBACKS CallBacks,IN PVOID LazyWriterContext)
 {
 struct fileobject_cached *fileobject_cached;
-#if 0
+#ifdef CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR
 guint64 size64;
 LARGE_INTEGER FileOffset0;
 PVOID Buffer_trash;
@@ -134,7 +148,7 @@ BOOLEAN errboolean;
                        FileObject,     /* key */
                        fileobject_cached);     /* value */
 
-#if 0
+#if CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR
        size64=MAX(MAX(FileSizes->AllocationSize.QuadPart,FileSizes->FileSize.QuadPart),
                        (FileSizes->ValidDataLength.QuadPart==G_MAXINT64 ? 0 : FileSizes->ValidDataLength.QuadPart));
        g_assert(((ULONG)size64)==size64);
@@ -534,7 +548,7 @@ BOOLEAN r=TRUE;
        if (!FileObject || !(fileobject_cached=g_hash_table_lookup(fileobject_cached_hash,FileObject)))
                r=FALSE;
        else {
-#if 0
+#ifdef CAPTIVE_FILE_INITIALIZED_CACHE_IS_LINEAR
                CcUnpinData(fileobject_cached->Bcb);
 #endif
                g_hash_table_remove(fileobject_cached_hash,FileObject);