1 #ifndef __INCLUDE_INTERNAL_CC_H
2 #define __INCLUDE_INTERNAL_CC_H
4 /* $Id: cc.h,v 1.21 2004/08/25 15:08:29 navaraf Exp $ */
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
;
66 CcMdlReadCompleteDev (IN PMDL MdlChain
,
67 IN PDEVICE_OBJECT DeviceObject
);
70 CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment
);
73 CcRosGetCacheSegment(PBCB Bcb
,
78 PCACHE_SEGMENT
* CacheSeg
);
83 CcRosFreeCacheSegment(PBCB
, PCACHE_SEGMENT
);
86 ReadCacheSegment(PCACHE_SEGMENT CacheSeg
);
89 WriteCacheSegment(PCACHE_SEGMENT CacheSeg
);
94 CcRosUnmapCacheSegment(PBCB Bcb
, ULONG FileOffset
, BOOLEAN NowDirty
);
97 CcRosLookupCacheSegment(PBCB Bcb
, ULONG FileOffset
);
100 CcRosGetCacheSegmentChain(PBCB Bcb
,
103 PCACHE_SEGMENT
* CacheSeg
);
106 CcInitCacheZeroPage(VOID
);
109 CcRosMarkDirtyCacheSegment(PBCB Bcb
, ULONG FileOffset
);
112 CcRosFlushDirtyPages(ULONG Target
, PULONG Count
);
115 CcRosDereferenceCache(PFILE_OBJECT FileObject
);
118 CcRosReferenceCache(PFILE_OBJECT FileObject
);
121 CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer
);
124 CcRosReleaseCacheSegment (BCB
* Bcb
,
125 CACHE_SEGMENT
* CacheSeg
,
131 CcRosRequestCacheSegment (BCB
* Bcb
,
135 CACHE_SEGMENT
** CacheSeg
);
138 CcTryToInitializeFileCache(PFILE_OBJECT FileObject
);
141 * Macro for generic cache manage bugchecking. Note that this macro assumes
142 * that the file name including extension is always longer than 4 characters.
144 #define KEBUGCHECKCC \
145 KEBUGCHECKEX(CACHE_MANAGER, \
146 (*(DWORD*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
147 (__LINE__ & 0xFFFF), 0, 0, 0)