ReactOS 0.4.16-dev-340-g0540c21
newcc.h
Go to the documentation of this file.
1#pragma once
2
3typedef struct _NOCC_BCB
4{
5 /* Public part */
7
15
16 /* Reference counts */
18
20
25
26typedef struct _NOCC_CACHE_MAP
27{
40
41CODE_SEG("INIT")
42VOID
45
46VOID
50
51VOID
56
57CODE_SEG("INIT")
58VOID
61
65 BOOLEAN ActuallyRelease);
66
67VOID
70
71VOID
74
75/* Called by section.c */
80
81VOID
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
97
101
103NTAPI
105
106VOID
107NTAPI
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
132extern FAST_MUTEX CcMutex;
133extern KEVENT CcDeleteEvent;
137
138#define CcpLock() _CcpLock(__FILE__,__LINE__)
139#define CcpUnlock() _CcpUnlock(__FILE__,__LINE__)
140
141extern VOID _CcpLock(const char *file, int line);
142extern VOID _CcpUnlock(const char *file, int line);
143
144extern VOID CcpReferenceCache(ULONG Sector);
145extern VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate);
146
148NTAPI
152 IN ULONG Flags,
153 OUT PVOID *BcbResult,
154 OUT PVOID *Buffer);
155
157NTAPI
161 IN ULONG Flags,
162 IN OUT PVOID *Bcb);
163
164ULONG
166{
167 ULONG Ret;
168 KIRQL OldIrql = MiAcquirePfnLock();
169
171
172 MiReleasePfnLock(OldIrql);
173
174 return Ret;
175}
#define CODE_SEG(...)
static CC_FILE_SIZES FileSizes
unsigned char BOOLEAN
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
Definition: File.h:16
UCHAR KIRQL
Definition: env_spec_w32.h:591
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:415
IN PFCB IN FAT_FLUSH_TYPE FlushType
Definition: fatprocs.h:1083
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:49
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1369
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
FAST_MUTEX CcMutex
Definition: pinsup.c:101
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
BOOLEAN NTAPI CcpUnpinData(PNOCC_BCB Bcb, BOOLEAN ActuallyRelease)
BOOLEAN NTAPI CcGetFileSizes(PFILE_OBJECT FileObject, PCC_FILE_SIZES FileSizes)
ULONG CcCacheClockHand
Definition: pinsup.c:104
VOID NTAPI CcShutdownSystem(VOID)
Definition: cachesub.c:299
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
VOID NTAPI CcMdlReadComplete2(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList)
Definition: mdlsup.c:83
KEVENT CcpLazyWriteEvent
Definition: lazyrite.c:18
struct _NOCC_BCB NOCC_BCB
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
VOID NTAPI CcInitCacheZeroPage(VOID)
Definition: copy.c:56
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
VOID NTAPI CcMdlWriteComplete2(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
Definition: mdlsup.c:111
struct _NOCC_BCB * PNOCC_BCB
VOID _CcpLock(const char *file, int line)
Definition: pinsup.c:112
struct _NOCC_CACHE_MAP * PNOCC_CACHE_MAP
VOID NTAPI CcpReleaseFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:139
VOID CcpReferenceCache(ULONG Sector)
Definition: pinsup.c:368
VOID NTAPI CcInitView(VOID)
Definition: view.c:1476
LIST_ENTRY CcPendingUnmap
VOID CcpDereferenceCache(ULONG Sector, BOOLEAN Immediate)
Definition: pinsup.c:213
PRTL_BITMAP CcCacheBitmap
Definition: pinsup.c:100
KEVENT CcDeleteEvent
Definition: pinsup.c:102
struct _NOCC_CACHE_MAP NOCC_CACHE_MAP
ULONG NTAPI CcpCountCacheSections(PNOCC_CACHE_MAP Map)
ULONG MmGetReferenceCountPageWithoutLock(PFN_NUMBER Page)
Definition: newcc.h:165
BOOLEAN NTAPI CcFlushImageSection(PSECTION_OBJECT_POINTERS SectionObjectPointer, MMFLUSH_TYPE FlushType)
Definition: cachesub.c:245
VOID NTAPI CcPfInitializePrefetcher(VOID)
Definition: fssup.c:114
#define CACHE_NUM_SECTIONS
Definition: newcc.h:125
VOID _CcpUnlock(const char *file, int line)
Definition: pinsup.c:120
BOOLEAN NTAPI CcpAcquireFileLock(PNOCC_CACHE_MAP Map)
Definition: fssup.c:131
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
ULONG NTAPI MmGetReferenceCountPage(PFN_NUMBER Page)
Definition: freelist.c:539
ULONG PFN_NUMBER
Definition: ke.h:9
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: ncftp.h:79
Definition: typedefs.h:120
Definition: newcc.h:4
BOOLEAN Exclusive
Definition: newcc.h:23
struct _NOCC_CACHE_MAP * Map
Definition: newcc.h:8
ULONG Length
Definition: newcc.h:11
BOOLEAN Dirty
Definition: newcc.h:13
PVOID BaseAddress
Definition: newcc.h:12
LARGE_INTEGER FileOffset
Definition: newcc.h:10
PSECTION SectionObject
Definition: newcc.h:9
LIST_ENTRY ThisFileList
Definition: newcc.h:19
PUBLIC_BCB Bcb
Definition: newcc.h:6
ULONG RefCount
Definition: newcc.h:17
KEVENT ExclusiveWait
Definition: newcc.h:21
PVOID OwnerPointer
Definition: newcc.h:14
ULONG ExclusiveWaiter
Definition: newcc.h:22
ULONG NumberOfMaps
Definition: newcc.h:31
CACHE_MANAGER_CALLBACKS Callbacks
Definition: newcc.h:34
PVOID LogHandle
Definition: newcc.h:36
ULONG RefCount
Definition: newcc.h:32
PVOID LazyContext
Definition: newcc.h:35
LIST_ENTRY Entry
Definition: newcc.h:28
ULONG ReadAheadGranularity
Definition: newcc.h:38
CC_FILE_SIZES FileSizes
Definition: newcc.h:33
LIST_ENTRY PrivateCacheMaps
Definition: newcc.h:30
PFLUSH_TO_LSN FlushToLsn
Definition: newcc.h:37
LIST_ENTRY AssociatedBcb
Definition: newcc.h:29
Definition: fci.c:127
Definition: parser.c:49
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PUBLIC_BCB
Definition: cctypes.h:12
VOID(NTAPI * PFLUSH_TO_LSN)(_In_ PVOID LogHandle, _In_ LARGE_INTEGER Lsn)
Definition: cctypes.h:61
FAST_MUTEX
Definition: extypes.h:17
* PFILE_OBJECT
Definition: iotypes.h:1998
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:405
MMFLUSH_TYPE
Definition: mmtypes.h:183
#define const
Definition: zconf.h:233