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
;
18 typedef struct _CACHE_SEGMENT
20 /* Base address of the region where the cache segment data is mapped. */
23 * Memory area representing the region where the cache segment data is
26 struct _MEMORY_AREA
* MemoryArea
;
27 /* Are the contents of the cache segment data valid. */
29 /* Are the contents of the cache segment data newer than those on disk. */
31 /* Page out in progress */
34 /* Entry in the list of segments for this BCB. */
35 LIST_ENTRY BcbSegmentListEntry
;
36 /* Entry in the list of segments which are dirty. */
37 LIST_ENTRY DirtySegmentListEntry
;
38 /* Entry in the list of segments. */
39 LIST_ENTRY CacheSegmentListEntry
;
40 LIST_ENTRY CacheSegmentLRUListEntry
;
41 /* Offset in the file which this cache segment maps. */
45 /* Number of references. */
47 /* Pointer to the BCB for the file which this cache segment maps data for. */
49 /* Pointer to the next cache segment in a chain. */
50 struct _CACHE_SEGMENT
* NextInChain
;
51 } CACHE_SEGMENT
, *PCACHE_SEGMENT
;
53 typedef struct _INTERNAL_BCB
56 PCACHE_SEGMENT CacheSegment
;
58 CSHORT RefCount
; /* (At offset 0x34 on WinNT4) */
59 } INTERNAL_BCB
, *PINTERNAL_BCB
;
63 CcMdlReadCompleteDev(IN PMDL MdlChain
,
64 IN PFILE_OBJECT FileObject
);
68 CcMdlWriteCompleteDev(IN PLARGE_INTEGER FileOffset
,
70 IN PFILE_OBJECT FileObject
);
73 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
76 CcRosGetCacheSegment(PBCB Bcb
,
81 PCACHE_SEGMENT
* CacheSeg
);
86 CcRosFreeCacheSegment(PBCB
, PCACHE_SEGMENT
);
89 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
92 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
97 CcRosUnmapCacheSegment(PBCB Bcb
, ULONG FileOffset
, BOOLEAN NowDirty
);
100 CcRosLookupCacheSegment(PBCB Bcb
, ULONG FileOffset
);
103 CcRosGetCacheSegmentChain(PBCB Bcb
,
106 PCACHE_SEGMENT
* CacheSeg
);
109 CcInitCacheZeroPage(VOID
);
112 CcRosMarkDirtyCacheSegment(PBCB Bcb
, ULONG FileOffset
);
115 CcRosFlushDirtyPages(ULONG Target
, PULONG Count
);
118 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
121 CcRosReferenceCache(PFILE_OBJECT FileObject
);
124 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
127 CcRosReleaseCacheSegment (BCB
* Bcb
,
128 CACHE_SEGMENT
* CacheSeg
,
134 CcRosRequestCacheSegment (BCB
* Bcb
,
138 CACHE_SEGMENT
** CacheSeg
);
141 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);
144 * Macro for generic cache manage bugchecking. Note that this macro assumes
145 * that the file name including extension is always longer than 4 characters.
147 #define KEBUGCHECKCC \
148 KEBUGCHECKEX(CACHE_MANAGER, \
149 (*(DWORD*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
150 (__LINE__ & 0xFFFF), 0, 0, 0)