1 #ifndef __INCLUDE_INTERNAL_CC_H
2 #define __INCLUDE_INTERNAL_CC_H
6 LIST_ENTRY BcbSegmentListHead
;
7 LIST_ENTRY BcbRemoveListEntry
;
10 PFILE_OBJECT FileObject
;
11 ULONG CacheSegmentSize
;
12 LARGE_INTEGER AllocationSize
;
13 LARGE_INTEGER FileSize
;
16 #if defined(DBG) || defined(KDBG)
17 BOOLEAN Trace
; /* enable extra trace output for this BCB and it's cache segments */
21 typedef struct _CACHE_SEGMENT
23 /* Base address of the region where the cache segment data is mapped. */
26 * Memory area representing the region where the cache segment data is
29 struct _MEMORY_AREA
* MemoryArea
;
30 /* Are the contents of the cache segment data valid. */
32 /* Are the contents of the cache segment data newer than those on disk. */
34 /* Page out in progress */
37 /* Entry in the list of segments for this BCB. */
38 LIST_ENTRY BcbSegmentListEntry
;
39 /* Entry in the list of segments which are dirty. */
40 LIST_ENTRY DirtySegmentListEntry
;
41 /* Entry in the list of segments. */
42 LIST_ENTRY CacheSegmentListEntry
;
43 LIST_ENTRY CacheSegmentLRUListEntry
;
44 /* Offset in the file which this cache segment maps. */
48 /* Number of references. */
50 /* Pointer to the BCB for the file which this cache segment maps data for. */
52 /* Pointer to the next cache segment in a chain. */
53 struct _CACHE_SEGMENT
* NextInChain
;
54 } CACHE_SEGMENT
, *PCACHE_SEGMENT
;
56 typedef struct _INTERNAL_BCB
59 PCACHE_SEGMENT CacheSegment
;
61 CSHORT RefCount
; /* (At offset 0x34 on WinNT4) */
62 } INTERNAL_BCB
, *PINTERNAL_BCB
;
67 IN PMDL MemoryDescriptorList
,
68 IN PFILE_OBJECT FileObject
73 CcMdlWriteCompleteDev(
74 IN PLARGE_INTEGER FileOffset
,
76 IN PFILE_OBJECT FileObject
81 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
91 PCACHE_SEGMENT
*CacheSeg
100 CcRosFreeCacheSegment(
107 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
111 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
115 CcInitializeCacheManager(VOID
);
119 CcRosUnmapCacheSegment(
127 CcRosLookupCacheSegment(
134 CcRosGetCacheSegmentChain(
138 PCACHE_SEGMENT
* CacheSeg
143 CcInitCacheZeroPage(VOID
);
147 CcRosMarkDirtyCacheSegment(
154 CcRosFlushDirtyPages(
161 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
165 CcRosReferenceCache(PFILE_OBJECT FileObject
);
169 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
173 CcRosReleaseCacheSegment(
175 CACHE_SEGMENT
*CacheSeg
,
183 CcRosRequestCacheSegment(
188 CACHE_SEGMENT
**CacheSeg
193 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);
196 * Macro for generic cache manage bugchecking. Note that this macro assumes
197 * that the file name including extension is always longer than 4 characters.
199 #define KEBUGCHECKCC \
200 KEBUGCHECKEX(CACHE_MANAGER, \
201 (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
202 (__LINE__ & 0xFFFF), 0, 0, 0)