ReactOS  0.4.14-dev-337-gf981a68
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 INIT_FUNCTION
42 VOID
43 NTAPI
45 
46 VOID
47 NTAPI
50 
51 VOID
52 NTAPI
55  IN PMDL MdlChain);
56 
57 INIT_FUNCTION
58 VOID
59 NTAPI
61 
62 BOOLEAN
63 NTAPI
65  BOOLEAN ActuallyRelease);
66 
67 INIT_FUNCTION
68 BOOLEAN
69 NTAPI
71 
72 VOID
73 NTAPI
75 
76 VOID
77 NTAPI
79 
80 /* Called by section.c */
81 BOOLEAN
82 NTAPI
85 
86 VOID
87 NTAPI
90  IN ULONG Length,
93  const char *File,
94  int Line);
95 
96 #define CcpFlushCache(M,F,L,I,D) _CcpFlushCache(M,F,L,I,D,__FILE__,__LINE__)
97 
98 BOOLEAN
99 NTAPI
102 
103 ULONG
104 NTAPI
106 
107 BOOLEAN
108 NTAPI
110 
111 VOID
112 NTAPI
114 
115 /*
116  * Macro for generic cache manage bugchecking. Note that this macro assumes
117  * that the file name including extension is always longer than 4 characters.
118  */
119 #define KEBUGCHECKCC \
120  KEBUGCHECKEX(CACHE_MANAGER, \
121  (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
122  (__LINE__ & 0xFFFF), 0, 0, 0)
123 
124 /* Private data */
125 
126 #define CACHE_SINGLE_FILE_MAX (16)
127 #define CACHE_OVERALL_SIZE (32 * 1024 * 1024)
128 #define CACHE_STRIPE VACB_MAPPING_GRANULARITY
129 #define CACHE_SHIFT 18
130 #define CACHE_NUM_SECTIONS (CACHE_OVERALL_SIZE / CACHE_STRIPE)
131 #define CACHE_ROUND_UP(x) (((x) + (CACHE_STRIPE-1)) & ~(CACHE_STRIPE-1))
132 #define CACHE_ROUND_DOWN(x) ((x) & ~(CACHE_STRIPE-1))
133 #define INVALID_CACHE ((ULONG)~0)
134 
137 extern FAST_MUTEX CcMutex;
138 extern KEVENT CcDeleteEvent;
139 extern ULONG CcCacheClockHand;
142 
143 #define CcpLock() _CcpLock(__FILE__,__LINE__)
144 #define CcpUnlock() _CcpUnlock(__FILE__,__LINE__)
145 
146 extern VOID _CcpLock(const char *file, int line);
147 extern VOID _CcpUnlock(const char *file, int line);
148 
149 extern VOID CcpReferenceCache(ULONG Sector);
150 extern VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate);
151 
152 BOOLEAN
153 NTAPI
156  IN ULONG Length,
157  IN ULONG Flags,
158  OUT PVOID *BcbResult,
159  OUT PVOID *Buffer);
160 
161 BOOLEAN
162 NTAPI
165  IN ULONG Length,
166  IN ULONG Flags,
167  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:38
LIST_ENTRY CcPendingUnmap
FAST_MUTEX CcMutex
Definition: pinsup.c:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
PVOID LazyContext
Definition: newcc.h:35
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
struct _NOCC_BCB NOCC_BCB
ULONG Length
Definition: newcc.h:11
#define CACHE_NUM_SECTIONS
Definition: newcc.h:130
_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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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:406
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 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
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
IN PFCB IN FAT_FLUSH_TYPE FlushType
Definition: fatprocs.h:1071
FAST_MUTEX
Definition: extypes.h:17
LIST_ENTRY Entry
Definition: newcc.h:28
PROS_SECTION_OBJECT SectionObject
Definition: newcc.h:9
KEVENT CcpLazyWriteEvent
Definition: lazyrite.c:18
INIT_FUNCTION VOID NTAPI CcInitView(VOID)
Definition: view.c:1535
PVOID LogHandle
Definition: newcc.h:36
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
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:117
LARGE_INTEGER FileOffset
Definition: newcc.h:10
BOOLEAN NTAPI CcpAcquireFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:129
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:151
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:39
PVOID OwnerPointer
Definition: newcc.h:14
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY ThisFileList
Definition: newcc.h:19
INIT_FUNCTION BOOLEAN NTAPI CcInitializeCacheManager(VOID)
Definition: fssup.c:82
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
INIT_FUNCTION VOID NTAPI CcPfInitializePrefetcher(VOID)
Definition: fssup.c:112
VOID NTAPI CcpReleaseFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:137
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP
Definition: fci.c:126
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULONG CcCacheClockHand
Definition: pinsup.c:104