ReactOS  0.4.15-dev-1389-g828d5fa
newcc.h
Go to the documentation of this file.
1 #pragma once
2 
3 typedef struct _NOCC_BCB
4 {
5  /* Public part */
7 
15 
16  /* Reference counts */
18 
20 
25 
26 typedef struct _NOCC_CACHE_MAP
27 {
40 
41 VOID
42 NTAPI
44 
45 VOID
46 NTAPI
49 
50 VOID
51 NTAPI
54  IN PMDL MdlChain);
55 
56 VOID
57 NTAPI
59 
60 BOOLEAN
61 NTAPI
63  BOOLEAN ActuallyRelease);
64 
65 BOOLEAN
66 NTAPI
68 
69 VOID
70 NTAPI
72 
73 VOID
74 NTAPI
76 
77 /* Called by section.c */
78 BOOLEAN
79 NTAPI
82 
83 VOID
84 NTAPI
87  IN ULONG Length,
90  const char *File,
91  int Line);
92 
93 #define CcpFlushCache(M,F,L,I,D) _CcpFlushCache(M,F,L,I,D,__FILE__,__LINE__)
94 
95 BOOLEAN
96 NTAPI
99 
100 ULONG
101 NTAPI
103 
104 BOOLEAN
105 NTAPI
107 
108 VOID
109 NTAPI
111 
112 /*
113  * Macro for generic cache manage bugchecking. Note that this macro assumes
114  * that the file name including extension is always longer than 4 characters.
115  */
116 #define KEBUGCHECKCC \
117  KEBUGCHECKEX(CACHE_MANAGER, \
118  (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
119  (__LINE__ & 0xFFFF), 0, 0, 0)
120 
121 /* Private data */
122 
123 #define CACHE_SINGLE_FILE_MAX (16)
124 #define CACHE_OVERALL_SIZE (32 * 1024 * 1024)
125 #define CACHE_STRIPE VACB_MAPPING_GRANULARITY
126 #define CACHE_SHIFT 18
127 #define CACHE_NUM_SECTIONS (CACHE_OVERALL_SIZE / CACHE_STRIPE)
128 #define CACHE_ROUND_UP(x) (((x) + (CACHE_STRIPE-1)) & ~(CACHE_STRIPE-1))
129 #define CACHE_ROUND_DOWN(x) ((x) & ~(CACHE_STRIPE-1))
130 #define INVALID_CACHE ((ULONG)~0)
131 
134 extern FAST_MUTEX CcMutex;
135 extern KEVENT CcDeleteEvent;
136 extern ULONG CcCacheClockHand;
139 
140 #define CcpLock() _CcpLock(__FILE__,__LINE__)
141 #define CcpUnlock() _CcpUnlock(__FILE__,__LINE__)
142 
143 extern VOID _CcpLock(const char *file, int line);
144 extern VOID _CcpUnlock(const char *file, int line);
145 
146 extern VOID CcpReferenceCache(ULONG Sector);
147 extern VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate);
148 
149 BOOLEAN
150 NTAPI
153  IN ULONG Length,
154  IN ULONG Flags,
155  OUT PVOID *BcbResult,
156  OUT PVOID *Buffer);
157 
158 BOOLEAN
159 NTAPI
162  IN ULONG Length,
163  IN ULONG Flags,
164  IN OUT PVOID *Bcb);
BOOLEAN NTAPI CcpUnpinData(PNOCC_BCB Bcb, BOOLEAN ActuallyRelease)
MMFLUSH_TYPE
Definition: mmtypes.h:183
VOID(NTAPI * PFLUSH_TO_LSN)(_In_ PVOID LogHandle, _In_ LARGE_INTEGER Lsn)
Definition: cctypes.h:61
#define IN
Definition: typedefs.h:39
LIST_ENTRY CcPendingUnmap
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
FAST_MUTEX CcMutex
Definition: pinsup.c:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
PVOID LazyContext
Definition: newcc.h:35
struct _NOCC_BCB NOCC_BCB
ULONG Length
Definition: newcc.h:11
#define CACHE_NUM_SECTIONS
Definition: newcc.h:127
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
VOID CcpReferenceCache(ULONG Sector)
Definition: pinsup.c:368
ULONG RefCount
Definition: newcc.h:17
PVOID BaseAddress
Definition: newcc.h:12
static CC_FILE_SIZES FileSizes
PUBLIC_BCB
Definition: cctypes.h:12
Definition: newcc.h:3
VOID NTAPI _CcpFlushCache(IN PNOCC_CACHE_MAP Map, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus, BOOLEAN Delete, const char *File, int Line)
Definition: cachesub.c:142
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
ULONG NumberOfMaps
Definition: newcc.h:31
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1368
BOOLEAN Exclusive
Definition: newcc.h:23
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PUBLIC_BCB Bcb
Definition: newcc.h:6
ULONG NTAPI CcpCountCacheSections(PNOCC_CACHE_MAP Map)
BOOLEAN Dirty
Definition: newcc.h:13
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:405
BOOLEAN NTAPI CcpPinMappedData(IN PNOCC_CACHE_MAP Map, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, IN OUT PVOID *Bcb)
Definition: pinsup.c:730
BOOLEAN NTAPI CcGetFileSizes(PFILE_OBJECT FileObject, PCC_FILE_SIZES FileSizes)
ULONG RefCount
Definition: newcc.h:32
unsigned char BOOLEAN
ULONG ExclusiveWaiter
Definition: newcc.h:22
BOOLEAN NTAPI CcInitializeCacheManager(VOID)
Definition: fssup.c:83
KEVENT CcDeleteEvent
Definition: pinsup.c:102
Definition: parser.c:48
VOID _CcpLock(const char *file, int line)
Definition: pinsup.c:112
Definition: bufpool.h:45
VOID NTAPI CcInitView(VOID)
Definition: view.c:1531
VOID NTAPI CcInitCacheZeroPage(VOID)
Definition: copy.c:63
LIST_ENTRY AssociatedBcb
Definition: newcc.h:29
BOOLEAN NTAPI CcpMapData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *BcbResult, OUT PVOID *Buffer)
Definition: pinsup.c:465
IN PFCB IN FAT_FLUSH_TYPE FlushType
Definition: fatprocs.h:1080
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
VOID NTAPI CcPfInitializePrefetcher(VOID)
Definition: fssup.c:114
FAST_MUTEX
Definition: extypes.h:17
LIST_ENTRY Entry
Definition: newcc.h:28
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PROS_SECTION_OBJECT SectionObject
Definition: newcc.h:9
KEVENT CcpLazyWriteEvent
Definition: lazyrite.c:18
PVOID LogHandle
Definition: newcc.h:36
* PFILE_OBJECT
Definition: iotypes.h:1978
LIST_ENTRY PrivateCacheMaps
Definition: newcc.h:30
Definition: ncftp.h:79
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
VOID NTAPI CcMdlReadComplete2(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList)
Definition: mdlsup.c:83
VOID NTAPI CcShutdownSystem(VOID)
Definition: cachesub.c:299
Definition: typedefs.h:119
LARGE_INTEGER FileOffset
Definition: newcc.h:10
BOOLEAN NTAPI CcpAcquireFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:131
struct _NOCC_CACHE_MAP NOCC_CACHE_MAP
CC_FILE_SIZES FileSizes
Definition: newcc.h:33
struct _NOCC_CACHE_MAP * Map
Definition: newcc.h:8
BOOLEAN NTAPI CcFlushImageSection(PSECTION_OBJECT_POINTERS SectionObjectPointer, MMFLUSH_TYPE FlushType)
Definition: cachesub.c:245
VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate)
Definition: pinsup.c:213
VOID _CcpUnlock(const char *file, int line)
Definition: pinsup.c:120
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
CACHE_MANAGER_CALLBACKS Callbacks
Definition: newcc.h:34
struct _NOCC_BCB * PNOCC_BCB
VOID NTAPI CcMdlWriteComplete2(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
Definition: mdlsup.c:111
#define OUT
Definition: typedefs.h:40
PVOID OwnerPointer
Definition: newcc.h:14
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY ThisFileList
Definition: newcc.h:19
KEVENT ExclusiveWait
Definition: newcc.h:21
Definition: File.h:15
ULONG ReadAheadGranularity
Definition: newcc.h:38
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
PFLUSH_TO_LSN FlushToLsn
Definition: newcc.h:37
VOID NTAPI CcpReleaseFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:139
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP
Definition: fci.c:126
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULONG CcCacheClockHand
Definition: pinsup.c:104