Initial original import from: fuse-2.4.2-2.fc4
[captive.git] / src / libcaptive / cc / sharedcachemap-priv.h
index f2179a5..7a7cf07 100644 (file)
@@ -42,7 +42,7 @@ struct _CaptiveSharedCacheMapObject {
 
        gint w32_ref_count;
        FILE_OBJECT *FileObject;
-       SECTION_OBJECT_POINTERS *SectionObjectPointers;
+       SECTION_OBJECT_POINTERS *SectionObjectPointer;
        /* ValidDataLength<=FileSize<=AllocationSize */
        /* 'AllocationSize' sets the mmap(2)ed area of buffers of this SharedCacheMap.
         * We must reallocate this area if 'AllocationSize' changes and in such case
@@ -54,11 +54,19 @@ struct _CaptiveSharedCacheMapObject {
         * as the offsets are usually PAGE_SIZE aligned due to pin-Bcb expectations.
         */
        guint64 FileSize;       /* ==CC_FILE_SIZES.FileSize.QuadPart */
-       /* We use 'FileSize' instead of 'ValidDataLength' as I assume W32
+       /* We use do not use 'ValidDataLength' as I assume W32
         * automatically increases 'ValidDataLength' during Cache Manager write operations.
         * We do not increase it and therefore it is mostly useless for us.
+        * In some cases (during NTFS mount) there may be also invalid 'ValidDataLength' at all:
+        *      CcSetFileSizes(AllocationSize=0x1000000,FileSize=0xf80208,ValidDataLength=0x23b801a0)
         */
        guint64 ValidDataLength;        /* ==CC_FILE_SIZES.ValidDataLength.QuadPart */
+       /* The real allocation size of 'buffer' and 'pages'.
+        * Maintained by captive_shared_cache_map_object_FileSizes_changed()
+        * to prevent continous reallocation to (n+1) size.
+        * We use (n*2) sizes for logaritmic time complexity.
+        */
+       guint64 alloc_length;
        CACHE_MANAGER_CALLBACKS CallBacks;
        VOID *LazyWriterContext;
        gboolean PinAccess;