ReactOS  0.4.15-dev-3440-g915569a
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 CODE_SEG("INIT")
42 VOID
43 NTAPI
45 
46 VOID
47 NTAPI
50 
51 VOID
52 NTAPI
55  IN PMDL MdlChain);
56 
57 CODE_SEG("INIT")
58 VOID
59 NTAPI
61 
62 BOOLEAN
63 NTAPI
65  BOOLEAN ActuallyRelease);
66 
67 VOID
68 NTAPI
70 
71 VOID
72 NTAPI
74 
75 /* Called by section.c */
76 BOOLEAN
77 NTAPI
80 
81 VOID
82 NTAPI
85  IN ULONG Length,
88  const char *File,
89  int Line);
90 
91 #define CcpFlushCache(M,F,L,I,D) _CcpFlushCache(M,F,L,I,D,__FILE__,__LINE__)
92 
93 BOOLEAN
94 NTAPI
97 
98 ULONG
99 NTAPI
101 
102 BOOLEAN
103 NTAPI
105 
106 VOID
107 NTAPI
109 
110 /*
111  * Macro for generic cache manage bugchecking. Note that this macro assumes
112  * that the file name including extension is always longer than 4 characters.
113  */
114 #define KEBUGCHECKCC \
115  KEBUGCHECKEX(CACHE_MANAGER, \
116  (*(ULONG*)(__FILE__ + sizeof(__FILE__) - 4) << 16) | \
117  (__LINE__ & 0xFFFF), 0, 0, 0)
118 
119 /* Private data */
120 
121 #define CACHE_SINGLE_FILE_MAX (16)
122 #define CACHE_OVERALL_SIZE (32 * 1024 * 1024)
123 #define CACHE_STRIPE VACB_MAPPING_GRANULARITY
124 #define CACHE_SHIFT 18
125 #define CACHE_NUM_SECTIONS (CACHE_OVERALL_SIZE / CACHE_STRIPE)
126 #define CACHE_ROUND_UP(x) (((x) + (CACHE_STRIPE-1)) & ~(CACHE_STRIPE-1))
127 #define CACHE_ROUND_DOWN(x) ((x) & ~(CACHE_STRIPE-1))
128 #define INVALID_CACHE ((ULONG)~0)
129 
132 extern FAST_MUTEX CcMutex;
133 extern KEVENT CcDeleteEvent;
134 extern ULONG CcCacheClockHand;
137 
138 #define CcpLock() _CcpLock(__FILE__,__LINE__)
139 #define CcpUnlock() _CcpUnlock(__FILE__,__LINE__)
140 
141 extern VOID _CcpLock(const char *file, int line);
142 extern VOID _CcpUnlock(const char *file, int line);
143 
144 extern VOID CcpReferenceCache(ULONG Sector);
145 extern VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate);
146 
147 BOOLEAN
148 NTAPI
151  IN ULONG Length,
152  IN ULONG Flags,
153  OUT PVOID *BcbResult,
154  OUT PVOID *Buffer);
155 
156 BOOLEAN
157 NTAPI
160  IN ULONG Length,
161  IN ULONG Flags,
162  IN OUT PVOID *Bcb);
163 
164 ULONG
166 {
167  ULONG Ret;
168  KIRQL OldIrql = MiAcquirePfnLock();
169 
171 
172  MiReleasePfnLock(OldIrql);
173 
174  return Ret;
175 }
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:125
_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
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG PFN_NUMBER
Definition: ke.h:9
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
PFN_NUMBER Page
Definition: section.c:4924
VOID NTAPI CcInitView(VOID)
Definition: view.c:1355
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:1998
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:538
LIST_ENTRY PrivateCacheMaps
Definition: newcc.h:30
Definition: ncftp.h:79
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
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
ULONG MmGetReferenceCountPageWithoutLock(PFN_NUMBER Page)
Definition: newcc.h:165
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
#define const
Definition: zconf.h:230
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
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
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