ReactOS  0.4.15-dev-2087-g6bfb76b
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 VOID
66 NTAPI
68 
69 VOID
70 NTAPI
72 
73 /* Called by section.c */
74 BOOLEAN
75 NTAPI
78 
79 VOID
80 NTAPI
83  IN ULONG Length,
86  const char *File,
87  int Line);
88 
89 #define CcpFlushCache(M,F,L,I,D) _CcpFlushCache(M,F,L,I,D,__FILE__,__LINE__)
90 
91 BOOLEAN
92 NTAPI
95 
96 ULONG
97 NTAPI
99 
100 BOOLEAN
101 NTAPI
103 
104 VOID
105 NTAPI
107 
108 /*
109  * Macro for generic cache manage bugchecking. Note that this macro assumes
110  * that the file name including extension is always longer than 4 characters.
111  */
112 #define KEBUGCHECKCC \
113  KEBUGCHECKEX(CACHE_MANAGER, \
114  (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
115  (__LINE__ & 0xFFFF), 0, 0, 0)
116 
117 /* Private data */
118 
119 #define CACHE_SINGLE_FILE_MAX (16)
120 #define CACHE_OVERALL_SIZE (32 * 1024 * 1024)
121 #define CACHE_STRIPE VACB_MAPPING_GRANULARITY
122 #define CACHE_SHIFT 18
123 #define CACHE_NUM_SECTIONS (CACHE_OVERALL_SIZE / CACHE_STRIPE)
124 #define CACHE_ROUND_UP(x) (((x) + (CACHE_STRIPE-1)) & ~(CACHE_STRIPE-1))
125 #define CACHE_ROUND_DOWN(x) ((x) & ~(CACHE_STRIPE-1))
126 #define INVALID_CACHE ((ULONG)~0)
127 
130 extern FAST_MUTEX CcMutex;
131 extern KEVENT CcDeleteEvent;
132 extern ULONG CcCacheClockHand;
135 
136 #define CcpLock() _CcpLock(__FILE__,__LINE__)
137 #define CcpUnlock() _CcpUnlock(__FILE__,__LINE__)
138 
139 extern VOID _CcpLock(const char *file, int line);
140 extern VOID _CcpUnlock(const char *file, int line);
141 
142 extern VOID CcpReferenceCache(ULONG Sector);
143 extern VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate);
144 
145 BOOLEAN
146 NTAPI
149  IN ULONG Length,
150  IN ULONG Flags,
151  OUT PVOID *BcbResult,
152  OUT PVOID *Buffer);
153 
154 BOOLEAN
155 NTAPI
158  IN ULONG Length,
159  IN ULONG Flags,
160  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:123
_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
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:1374
VOID NTAPI CcInitCacheZeroPage(VOID)
Definition: copy.c:56
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
PSECTION SectionObject
Definition: newcc.h:9
KEVENT CcpLazyWriteEvent
Definition: lazyrite.c:18
PVOID LogHandle
Definition: newcc.h:36
* PFILE_OBJECT
Definition: iotypes.h:1995
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