1 #ifndef __INCLUDE_INTERNAL_CC_H
2 #define __INCLUDE_INTERNAL_CC_H
6 #include <reactos/bugcodes.h>
10 LIST_ENTRY BcbSegmentListHead
;
11 LIST_ENTRY BcbRemoveListEntry
;
12 BOOLEAN RemoveOnClose
;
14 PFILE_OBJECT FileObject
;
15 ULONG CacheSegmentSize
;
16 LARGE_INTEGER AllocationSize
;
17 LARGE_INTEGER FileSize
;
22 typedef struct _CACHE_SEGMENT
24 /* Base address of the region where the cache segment data is mapped. */
27 * Memory area representing the region where the cache segment data is
30 struct _MEMORY_AREA
* MemoryArea
;
31 /* Are the contents of the cache segment data valid. */
33 /* Are the contents of the cache segment data newer than those on disk. */
35 /* Page out in progress */
38 /* Entry in the list of segments for this BCB. */
39 LIST_ENTRY BcbSegmentListEntry
;
40 /* Entry in the list of segments which are dirty. */
41 LIST_ENTRY DirtySegmentListEntry
;
42 /* Entry in the list of segments. */
43 LIST_ENTRY CacheSegmentListEntry
;
44 LIST_ENTRY CacheSegmentLRUListEntry
;
45 /* Offset in the file which this cache segment maps. */
49 /* Number of references. */
51 /* Pointer to the BCB for the file which this cache segment maps data for. */
53 /* Pointer to the next cache segment in a chain. */
54 struct _CACHE_SEGMENT
* NextInChain
;
55 } CACHE_SEGMENT
, *PCACHE_SEGMENT
;
57 typedef struct _INTERNAL_BCB
60 PCACHE_SEGMENT CacheSegment
;
62 CSHORT RefCount
; /* (At offset 0x34 on WinNT4) */
63 } INTERNAL_BCB
, *PINTERNAL_BCB
;
67 CcMdlReadCompleteDev(IN PMDL MdlChain
,
68 IN PFILE_OBJECT FileObject
);
72 CcMdlWriteCompleteDev(IN PLARGE_INTEGER FileOffset
,
74 IN PFILE_OBJECT FileObject
);
77 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
80 CcRosGetCacheSegment(PBCB Bcb
,
85 PCACHE_SEGMENT
* CacheSeg
);
90 CcRosFreeCacheSegment(PBCB
, PCACHE_SEGMENT
);
93 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
96 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
101 CcRosUnmapCacheSegment(PBCB Bcb
, ULONG FileOffset
, BOOLEAN NowDirty
);
104 CcRosLookupCacheSegment(PBCB Bcb
, ULONG FileOffset
);
107 CcRosGetCacheSegmentChain(PBCB Bcb
,
110 PCACHE_SEGMENT
* CacheSeg
);
113 CcInitCacheZeroPage(VOID
);
116 CcRosMarkDirtyCacheSegment(PBCB Bcb
, ULONG FileOffset
);
119 CcRosFlushDirtyPages(ULONG Target
, PULONG Count
);
122 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
125 CcRosReferenceCache(PFILE_OBJECT FileObject
);
128 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
131 CcRosReleaseCacheSegment (BCB
* Bcb
,
132 CACHE_SEGMENT
* CacheSeg
,
138 CcRosRequestCacheSegment (BCB
* Bcb
,
142 CACHE_SEGMENT
** CacheSeg
);
145 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);
148 * Macro for generic cache manage bugchecking. Note that this macro assumes
149 * that the file name including extension is always longer than 4 characters.
151 #define KEBUGCHECKCC \
152 KEBUGCHECKEX(CACHE_MANAGER, \
153 (*(DWORD*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
154 (__LINE__ & 0xFFFF), 0, 0, 0)