ReactOS  0.4.15-dev-2502-g9f3ed60
pin.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for pin.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static PINTERNAL_BCB NTAPI CcpFindBcb (IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Pinned)
 
static VOID CcpDereferenceBcb (IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
 
static PVOID CcpGetAppropriateBcb (IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PROS_VACB Vacb, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG PinFlags, IN BOOLEAN ToPin)
 
static BOOLEAN CcpPinData (IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
 
BOOLEAN NTAPI CcMapData (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *pBcb, OUT PVOID *pBuffer)
 
BOOLEAN NTAPI CcPinMappedData (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb)
 
BOOLEAN NTAPI CcPinRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
 
BOOLEAN NTAPI CcPreparePinWrite (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Zero, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
 
VOID NTAPI CcSetDirtyPinnedData (IN PVOID Bcb, IN PLARGE_INTEGER Lsn)
 
VOID NTAPI CcUnpinData (IN PVOID Bcb)
 
VOID NTAPI CcUnpinDataForThread (IN PVOID Bcb, IN ERESOURCE_THREAD ResourceThreadId)
 
VOID NTAPI CcRepinBcb (IN PVOID Bcb)
 
VOID NTAPI CcUnpinRepinnedBcb (IN PVOID Bcb, IN BOOLEAN WriteThrough, IN PIO_STATUS_BLOCK IoStatus)
 

Variables

NPAGED_LOOKASIDE_LIST iBcbLookasideList
 
ULONG CcMapDataWait = 0
 
ULONG CcMapDataNoWait = 0
 
ULONG CcPinReadWait = 0
 
ULONG CcPinReadNoWait = 0
 
ULONG CcPinMappedDataCount = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file pin.c.

Function Documentation

◆ CcMapData()

BOOLEAN NTAPI CcMapData ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN ULONG  Flags,
OUT PVOID pBcb,
OUT PVOID pBuffer 
)

Definition at line 321 of file pin.c.

328 {
329  KIRQL OldIrql;
330  PINTERNAL_BCB iBcb;
331  PROS_VACB Vacb;
332  PROS_SHARED_CACHE_MAP SharedCacheMap;
333  ULONG VacbOffset;
335  BOOLEAN Result;
336 
337  CCTRACE(CC_API_DEBUG, "CcMapData(FileObject 0x%p, FileOffset 0x%I64x, Length %lu, Flags 0x%lx,"
338  " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart,
339  Length, Flags, pBcb, pBuffer);
340 
342  ASSERT(FileObject->SectionObjectPointer);
343  ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
344 
345  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
346  ASSERT(SharedCacheMap);
347 
348  if (Flags & MAP_WAIT)
349  {
350  ++CcMapDataWait;
351  }
352  else
353  {
354  ++CcMapDataNoWait;
355  }
356 
357  VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
358  /* KMTests seem to show that it is allowed to call accross mapping granularity */
359  if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
360  {
361  DPRINT1("TRUNCATING DATA MAP FROM %lu to %lu!\n", Length, VACB_MAPPING_GRANULARITY - VacbOffset);
362  Length = VACB_MAPPING_GRANULARITY - VacbOffset;
363  }
364 
365  KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
366  iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, FALSE);
367 
368  if (iBcb == NULL)
369  {
370  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
371 
372  /* Call internal helper for getting a VACB */
373  Status = CcRosGetVacb(SharedCacheMap, FileOffset->QuadPart, &Vacb);
374  if (!NT_SUCCESS(Status))
375  {
376  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
377  SharedCacheMap->FileObject, FileOffset, Length, Flags);
379  }
380 
381  iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE);
382  if (iBcb == NULL)
383  {
384  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
385  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
386  SharedCacheMap->FileObject, FileOffset, Length, Flags);
387  *pBcb = NULL; // If you ever remove this for compat, make sure to review all callers for using an unititialized value
389  }
390  }
391  else
392  {
393  ++iBcb->RefCount;
394  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
395  }
396 
397  _SEH2_TRY
398  {
399  Result = FALSE;
400  /* Ensure the pages are resident */
402  BooleanFlagOn(Flags, MAP_NO_READ), VacbOffset, Length);
403  }
405  {
406  if (!Result)
407  {
408  CcpDereferenceBcb(SharedCacheMap, iBcb);
409  return FALSE;
410  }
411  }
412  _SEH2_END;
413 
414  *pBcb = &iBcb->PFCB;
415  *pBuffer = (PVOID)((ULONG_PTR)iBcb->Vacb->BaseAddress + VacbOffset);
416 
417  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> TRUE Bcb=%p, Buffer %p\n",
419  return Result;
420 }
Definition: cc.h:206
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PVOID BaseAddress
Definition: cc.h:209
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
KSPIN_LOCK BcbSpinLock
Definition: cc.h:189
LONG NTSTATUS
Definition: precomp.h:26
#define ExRaiseStatus
Definition: ntoskrnl.h:104
#define MAP_WAIT
NTSTATUS CcRosGetVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:863
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
PUBLIC_BCB PFCB
Definition: cc.h:234
unsigned char BOOLEAN
ULONG CcMapDataWait
Definition: pin.c:28
PVOID pBuffer
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void * PVOID
Definition: retypes.h:9
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
Status
Definition: gdiplustypes.h:24
static PVOID CcpGetAppropriateBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PROS_VACB Vacb, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG PinFlags, IN BOOLEAN ToPin)
Definition: pin.c:108
#define CC_API_DEBUG
Definition: cc.h:11
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
ULONG CcMapDataNoWait
Definition: pin.c:29
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
static PINTERNAL_BCB NTAPI CcpFindBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Pinned)
Definition: pin.c:39
_SEH2_END
Definition: create.c:4400
BOOLEAN CcRosEnsureVacbResident(_In_ PROS_VACB Vacb, _In_ BOOLEAN Wait, _In_ BOOLEAN NoRead, _In_ ULONG Offset, _In_ ULONG Length)
Definition: view.c:816
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define MAP_NO_READ
_SEH2_FINALLY
Definition: create.c:4371
#define NULL
Definition: types.h:112
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
static VOID CcpDereferenceBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
Definition: pin.c:72
#define DPRINT1
Definition: precomp.h:8
#define VACB_MAPPING_GRANULARITY
unsigned int ULONG
Definition: retypes.h:1
CSHORT RefCount
Definition: cc.h:237
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:453
PFILE_OBJECT FileObject
Definition: cc.h:179
PROS_VACB Vacb
Definition: cc.h:235

◆ CcpDereferenceBcb()

static VOID CcpDereferenceBcb ( IN PROS_SHARED_CACHE_MAP  SharedCacheMap,
IN PINTERNAL_BCB  Bcb 
)
static

Definition at line 72 of file pin.c.

75 {
76  ULONG RefCount;
77  KIRQL OldIrql;
78 
79  KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
80  RefCount = --Bcb->RefCount;
81  if (RefCount == 0)
82  {
83  RemoveEntryList(&Bcb->BcbEntry);
84  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
85 
86  ASSERT(Bcb->PinCount == 0);
87  /*
88  * Don't mark dirty, if it was dirty,
89  * the VACB was already marked as such
90  * following the call to CcSetDirtyPinnedData
91  */
92  CcRosReleaseVacb(SharedCacheMap,
93  Bcb->Vacb,
94  FALSE,
95  FALSE);
96 
97  ExDeleteResourceLite(&Bcb->Lock);
98  ExFreeToNPagedLookasideList(&iBcbLookasideList, Bcb);
99  }
100  else
101  {
102  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
103  }
104 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:45
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
NPAGED_LOOKASIDE_LIST iBcbLookasideList
Definition: view.c:44
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:453

Referenced by CcMapData(), CcpGetAppropriateBcb(), CcpPinData(), and CcUnpinDataForThread().

◆ CcpFindBcb()

static PINTERNAL_BCB NTAPI CcpFindBcb ( IN PROS_SHARED_CACHE_MAP  SharedCacheMap,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Pinned 
)
static

Definition at line 39 of file pin.c.

44 {
47  PLIST_ENTRY NextEntry;
48 
49  for (NextEntry = SharedCacheMap->BcbList.Flink;
50  NextEntry != &SharedCacheMap->BcbList;
51  NextEntry = NextEntry->Flink)
52  {
53  Bcb = CONTAINING_RECORD(NextEntry, INTERNAL_BCB, BcbEntry);
54 
55  if (Bcb->PFCB.MappedFileOffset.QuadPart <= FileOffset->QuadPart &&
56  (Bcb->PFCB.MappedFileOffset.QuadPart + Bcb->PFCB.MappedLength) >=
57  (FileOffset->QuadPart + Length))
58  {
59  if ((Pinned && Bcb->PinCount > 0) || (!Pinned && Bcb->PinCount == 0))
60  {
61  Found = TRUE;
62  break;
63  }
64  }
65  }
66 
67  return (Found ? Bcb : NULL);
68 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
return Found
Definition: dirsup.c:1270
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112

Referenced by CcMapData(), CcpGetAppropriateBcb(), and CcpPinData().

◆ CcpGetAppropriateBcb()

static PVOID CcpGetAppropriateBcb ( IN PROS_SHARED_CACHE_MAP  SharedCacheMap,
IN PROS_VACB  Vacb,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN ULONG  PinFlags,
IN BOOLEAN  ToPin 
)
static

Definition at line 108 of file pin.c.

115 {
116  KIRQL OldIrql;
117  BOOLEAN Result;
118  PINTERNAL_BCB iBcb, DupBcb;
119 
120  iBcb = ExAllocateFromNPagedLookasideList(&iBcbLookasideList);
121  if (iBcb == NULL)
122  {
123  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
124  return NULL;
125  }
126 
127  RtlZeroMemory(iBcb, sizeof(*iBcb));
128  iBcb->PFCB.NodeTypeCode = 0x2FD; /* As per KMTests */
129  iBcb->PFCB.NodeByteSize = 0;
130  iBcb->PFCB.MappedLength = Length;
131  iBcb->PFCB.MappedFileOffset = *FileOffset;
132  iBcb->Vacb = Vacb;
133  iBcb->PinCount = 0;
134  iBcb->RefCount = 1;
136 
137  KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
138 
139  /* Check if we raced with another BCB creation */
140  DupBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, ToPin);
141  /* Yes, and we've lost */
142  if (DupBcb != NULL)
143  {
144  /* We will return that BCB */
145  ++DupBcb->RefCount;
146  Result = TRUE;
147  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
148 
149  if (ToPin)
150  {
151  if (BooleanFlagOn(PinFlags, PIN_EXCLUSIVE))
152  {
154  }
155  else
156  {
158  }
159 
160  if (Result)
161  {
162  DupBcb->PinCount++;
163  }
164  else
165  {
166  CcpDereferenceBcb(SharedCacheMap, DupBcb);
167  DupBcb = NULL;
168  }
169  }
170 
171  if (DupBcb != NULL)
172  {
173  /* Delete the loser */
174  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
175  ExDeleteResourceLite(&iBcb->Lock);
176  ExFreeToNPagedLookasideList(&iBcbLookasideList, iBcb);
177  }
178 
179  /* Return the winner - no need to update buffer address, it's
180  * relative to the VACB, which is unchanged.
181  */
182  iBcb = DupBcb;
183  }
184  /* Nope, insert ourselves */
185  else
186  {
187  if (ToPin)
188  {
189  iBcb->PinCount++;
190 
191  if (BooleanFlagOn(PinFlags, PIN_EXCLUSIVE))
192  {
194  }
195  else
196  {
198  }
199 
200  ASSERT(Result);
201  }
202 
203  InsertTailList(&SharedCacheMap->BcbList, &iBcb->BcbEntry);
204  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
205  }
206 
207  return iBcb;
208 }
LIST_ENTRY BcbEntry
Definition: cc.h:238
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
#define PIN_WAIT
#define InsertTailList(ListHead, Entry)
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
PUBLIC_BCB PFCB
Definition: cc.h:234
ULONG PinCount
Definition: cc.h:236
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define ASSERT(a)
Definition: mode.c:45
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
static PINTERNAL_BCB NTAPI CcpFindBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Pinned)
Definition: pin.c:39
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1063
NPAGED_LOOKASIDE_LIST iBcbLookasideList
Definition: view.c:44
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
static VOID CcpDereferenceBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
Definition: pin.c:72
#define PIN_EXCLUSIVE
ERESOURCE Lock
Definition: cc.h:233
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
CSHORT RefCount
Definition: cc.h:237
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:453
PROS_VACB Vacb
Definition: cc.h:235

Referenced by CcMapData(), and CcpPinData().

◆ CcPinMappedData()

BOOLEAN NTAPI CcPinMappedData ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN ULONG  Flags,
OUT PVOID Bcb 
)

Definition at line 427 of file pin.c.

433 {
434  BOOLEAN Result;
435  PVOID Buffer;
436  PINTERNAL_BCB iBcb;
437  PROS_SHARED_CACHE_MAP SharedCacheMap;
438 
439  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
441 
443  ASSERT(FileObject->SectionObjectPointer);
444  ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
445 
446  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
447  ASSERT(SharedCacheMap);
448  if (!SharedCacheMap->PinAccess)
449  {
450  DPRINT1("FIXME: Pinning a file with no pin access!\n");
451  return FALSE;
452  }
453 
454  iBcb = *Bcb ? CONTAINING_RECORD(*Bcb, INTERNAL_BCB, PFCB) : NULL;
455 
457 
458  Result = CcpPinData(SharedCacheMap, FileOffset, Length, Flags, Bcb, &Buffer);
459  if (Result)
460  {
461  CcUnpinData(&iBcb->PFCB);
462  }
463 
464  return Result;
465 }
BOOLEAN PinAccess
Definition: cc.h:194
static BOOLEAN CcpPinData(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pin.c:212
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
Definition: cdstruc.h:902
#define FALSE
Definition: types.h:117
PUBLIC_BCB PFCB
Definition: cc.h:234
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
#define CC_API_DEBUG
Definition: cc.h:11
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ASSERT(a)
Definition: mode.c:45
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pin.c:565
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
ULONG CcPinMappedDataCount
Definition: pin.c:32
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8

◆ CcPinRead()

BOOLEAN NTAPI CcPinRead ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN ULONG  Flags,
OUT PVOID Bcb,
OUT PVOID Buffer 
)

Definition at line 472 of file pin.c.

479 {
480  PROS_SHARED_CACHE_MAP SharedCacheMap;
481 
482  CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
484 
486  ASSERT(FileObject->SectionObjectPointer);
487  ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
488 
489  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
490  ASSERT(SharedCacheMap);
491  if (!SharedCacheMap->PinAccess)
492  {
493  DPRINT1("FIXME: Pinning a file with no pin access!\n");
494  return FALSE;
495  }
496 
497  if (Flags & PIN_WAIT)
498  {
499  ++CcPinReadWait;
500  }
501  else
502  {
503  ++CcPinReadNoWait;
504  }
505 
506  return CcpPinData(SharedCacheMap, FileOffset, Length, Flags, Bcb, Buffer);
507 }
BOOLEAN PinAccess
Definition: cc.h:194
static BOOLEAN CcpPinData(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pin.c:212
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
#define PIN_WAIT
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
#define CC_API_DEBUG
Definition: cc.h:11
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ASSERT(a)
Definition: mode.c:45
ULONG CcPinReadNoWait
Definition: pin.c:31
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
ULONG CcPinReadWait
Definition: pin.c:30
#define DPRINT1
Definition: precomp.h:8

Referenced by CcPreparePinWrite().

◆ CcpPinData()

static BOOLEAN CcpPinData ( IN PROS_SHARED_CACHE_MAP  SharedCacheMap,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN ULONG  Flags,
OUT PVOID Bcb,
OUT PVOID Buffer 
)
static

Definition at line 212 of file pin.c.

219 {
220  PINTERNAL_BCB NewBcb;
221  KIRQL OldIrql;
222  ULONG VacbOffset;
224  BOOLEAN Result;
225 
226  VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
227 
228  if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
229  {
230  /* Complain loudly, we shoud pin the whole range */
231  DPRINT1("TRUNCATING DATA PIN FROM %lu to %lu!\n", Length, VACB_MAPPING_GRANULARITY - VacbOffset);
232  Length = VACB_MAPPING_GRANULARITY - VacbOffset;
233  }
234 
235  KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
236  NewBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, TRUE);
237 
238  if (NewBcb != NULL)
239  {
240  BOOLEAN Result;
241 
242  ++NewBcb->RefCount;
243  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
244 
247  else
249 
250  if (!Result)
251  {
252  CcpDereferenceBcb(SharedCacheMap, NewBcb);
253  return FALSE;
254  }
255 
256  NewBcb->PinCount++;
257  }
258  else
259  {
260  LONGLONG ROffset;
261  PROS_VACB Vacb;
262 
263  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
264 
266  {
267  return FALSE;
268  }
269 
270  /* Properly round offset and call internal helper for getting a VACB */
271  ROffset = ROUND_DOWN(FileOffset->QuadPart, VACB_MAPPING_GRANULARITY);
272  Status = CcRosGetVacb(SharedCacheMap, ROffset, &Vacb);
273  if (!NT_SUCCESS(Status))
274  {
275  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
276  SharedCacheMap->FileObject, FileOffset, Length, Flags);
278  return FALSE;
279  }
280 
281  NewBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, Flags, TRUE);
282  if (NewBcb == NULL)
283  {
284  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
285  return FALSE;
286  }
287  }
288 
289  Result = FALSE;
290  _SEH2_TRY
291  {
292  /* Ensure the pages are resident */
296  VacbOffset, Length);
297  }
299  {
300  if (!Result)
301  {
302  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
303  SharedCacheMap->FileObject, FileOffset, Length, Flags);
304  CcUnpinData(&NewBcb->PFCB);
305  return FALSE;
306  }
307  }
308  _SEH2_END;
309 
310  *Bcb = &NewBcb->PFCB;
311  *Buffer = (PVOID)((ULONG_PTR)NewBcb->Vacb->BaseAddress + VacbOffset);
312 
313  return TRUE;
314 }
Definition: cc.h:206
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
PVOID BaseAddress
Definition: cc.h:209
#define TRUE
Definition: types.h:120
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
LONG NTSTATUS
Definition: precomp.h:26
#define ExRaiseStatus
Definition: ntoskrnl.h:104
#define PIN_WAIT
NTSTATUS CcRosGetVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:863
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
PUBLIC_BCB PFCB
Definition: cc.h:234
ULONG PinCount
Definition: cc.h:236
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
Status
Definition: gdiplustypes.h:24
int64_t LONGLONG
Definition: typedefs.h:68
static PVOID CcpGetAppropriateBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PROS_VACB Vacb, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG PinFlags, IN BOOLEAN ToPin)
Definition: pin.c:108
#define CC_API_DEBUG
Definition: cc.h:11
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pin.c:565
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
static PINTERNAL_BCB NTAPI CcpFindBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Pinned)
Definition: pin.c:39
#define ROUND_DOWN(n, align)
Definition: eventvwr.h:30
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1063
_SEH2_END
Definition: create.c:4400
BOOLEAN CcRosEnsureVacbResident(_In_ PROS_VACB Vacb, _In_ BOOLEAN Wait, _In_ BOOLEAN NoRead, _In_ ULONG Offset, _In_ ULONG Length)
Definition: view.c:816
#define PIN_IF_BCB
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
_SEH2_FINALLY
Definition: create.c:4371
#define NULL
Definition: types.h:112
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
static VOID CcpDereferenceBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
Definition: pin.c:72
#define PIN_EXCLUSIVE
#define DPRINT1
Definition: precomp.h:8
#define VACB_MAPPING_GRANULARITY
unsigned int ULONG
Definition: retypes.h:1
ERESOURCE Lock
Definition: cc.h:233
CSHORT RefCount
Definition: cc.h:237
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:453
#define PIN_NO_READ
PROS_VACB Vacb
Definition: cc.h:235

Referenced by CcPinMappedData(), and CcPinRead().

◆ CcPreparePinWrite()

BOOLEAN NTAPI CcPreparePinWrite ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Zero,
IN ULONG  Flags,
OUT PVOID Bcb,
OUT PVOID Buffer 
)

Definition at line 514 of file pin.c.

522 {
523  CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Zero=%d Flags=0x%lx\n",
525 
526  /*
527  * FIXME: This is function is similar to CcPinRead, but doesn't
528  * read the data if they're not present. Instead it should just
529  * prepare the VACBs and zero them out if Zero != FALSE.
530  *
531  * For now calling CcPinRead is better than returning error or
532  * just having UNIMPLEMENTED here.
533  */
535 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
#define CC_API_DEBUG
Definition: cc.h:11
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:411
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pin.c:472

◆ CcRepinBcb()

VOID NTAPI CcRepinBcb ( IN PVOID  Bcb)

Definition at line 600 of file pin.c.

602 {
604 
605  CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
606 
607  iBcb->RefCount++;
608 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
Definition: cdstruc.h:902
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define CC_API_DEBUG
Definition: cc.h:11
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
CSHORT RefCount
Definition: cc.h:237

◆ CcSetDirtyPinnedData()

VOID NTAPI CcSetDirtyPinnedData ( IN PVOID  Bcb,
IN PLARGE_INTEGER  Lsn 
)

Definition at line 541 of file pin.c.

544 {
546 
547  CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n", Bcb, Lsn);
548 
549  /* Tell Mm */
551  Add2Ptr(iBcb->Vacb->BaseAddress, iBcb->PFCB.MappedFileOffset.QuadPart - iBcb->Vacb->FileOffset.QuadPart),
552  iBcb->PFCB.MappedLength);
553 
554  if (!iBcb->Vacb->Dirty)
555  {
556  CcRosMarkDirtyVacb(iBcb->Vacb);
557  }
558 }
#define Add2Ptr(PTR, INC)
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
PVOID BaseAddress
Definition: cc.h:209
Definition: cdstruc.h:902
PUBLIC_BCB PFCB
Definition: cc.h:234
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define CC_API_DEBUG
Definition: cc.h:11
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
VOID CcRosMarkDirtyVacb(PROS_VACB Vacb)
Definition: view.c:528
BOOLEAN Dirty
Definition: cc.h:211
NTSTATUS NTAPI MmMakePagesDirty(_In_ PEPROCESS Process, _In_ PVOID Address, _In_ ULONG Length)
Definition: section.c:4885
#define NULL
Definition: types.h:112
LARGE_INTEGER FileOffset
Definition: cc.h:222
LONGLONG QuadPart
Definition: typedefs.h:114
PROS_VACB Vacb
Definition: cc.h:235

◆ CcUnpinData()

VOID NTAPI CcUnpinData ( IN PVOID  Bcb)

Definition at line 565 of file pin.c.

567 {
568  CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
569 
571 }
ULONG_PTR ERESOURCE_THREAD
Definition: extypes.h:208
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
VOID NTAPI CcUnpinDataForThread(IN PVOID Bcb, IN ERESOURCE_THREAD ResourceThreadId)
Definition: pin.c:578
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define CC_API_DEBUG
Definition: cc.h:11
#define CCTRACE(x, fmt,...)
Definition: cc.h:36

Referenced by CcPinMappedData(), and CcpPinData().

◆ CcUnpinDataForThread()

VOID NTAPI CcUnpinDataForThread ( IN PVOID  Bcb,
IN ERESOURCE_THREAD  ResourceThreadId 
)

Definition at line 578 of file pin.c.

581 {
583 
584  CCTRACE(CC_API_DEBUG, "Bcb=%p ResourceThreadId=%lu\n", Bcb, ResourceThreadId);
585 
586  if (iBcb->PinCount != 0)
587  {
589  iBcb->PinCount--;
590  }
591 
592  CcpDereferenceBcb(iBcb->Vacb->SharedCacheMap, iBcb);
593 }
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
Definition: cdstruc.h:902
ULONG PinCount
Definition: cc.h:236
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PROS_SHARED_CACHE_MAP SharedCacheMap
Definition: cc.h:226
#define CC_API_DEBUG
Definition: cc.h:11
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
_In_ ERESOURCE_THREAD ResourceThreadId
Definition: exfuncs.h:1052
static VOID CcpDereferenceBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
Definition: pin.c:72
ERESOURCE Lock
Definition: cc.h:233
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
PROS_VACB Vacb
Definition: cc.h:235

Referenced by CcUnpinData().

◆ CcUnpinRepinnedBcb()

VOID NTAPI CcUnpinRepinnedBcb ( IN PVOID  Bcb,
IN BOOLEAN  WriteThrough,
IN PIO_STATUS_BLOCK  IoStatus 
)

Definition at line 615 of file pin.c.

619 {
621  KIRQL OldIrql;
622  PROS_SHARED_CACHE_MAP SharedCacheMap;
623 
624  CCTRACE(CC_API_DEBUG, "Bcb=%p WriteThrough=%d\n", Bcb, WriteThrough);
625 
626  SharedCacheMap = iBcb->Vacb->SharedCacheMap;
627  IoStatus->Status = STATUS_SUCCESS;
628 
629  if (WriteThrough)
630  {
631  CcFlushCache(iBcb->Vacb->SharedCacheMap->FileObject->SectionObjectPointer,
632  &iBcb->PFCB.MappedFileOffset,
633  iBcb->PFCB.MappedLength,
634  IoStatus);
635  }
636  else
637  {
638  IoStatus->Status = STATUS_SUCCESS;
639  IoStatus->Information = 0;
640  }
641 
642  KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
643  if (--iBcb->RefCount == 0)
644  {
645  RemoveEntryList(&iBcb->BcbEntry);
646  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
647 
648  if (iBcb->PinCount != 0)
649  {
650  ExReleaseResourceLite(&iBcb->Lock);
651  iBcb->PinCount--;
652  ASSERT(iBcb->PinCount == 0);
653  }
654 
655  /*
656  * Don't mark dirty, if it was dirty,
657  * the VACB was already marked as such
658  * following the call to CcSetDirtyPinnedData
659  */
661  iBcb->Vacb,
662  FALSE,
663  FALSE);
664 
665  ExDeleteResourceLite(&iBcb->Lock);
666  ExFreeToNPagedLookasideList(&iBcbLookasideList, iBcb);
667  }
668  else
669  {
670  KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
671  }
672 }
LIST_ENTRY BcbEntry
Definition: cc.h:238
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:411
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
Definition: cdstruc.h:902
KSPIN_LOCK BcbSpinLock
Definition: cc.h:189
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
PUBLIC_BCB PFCB
Definition: cc.h:234
ULONG PinCount
Definition: cc.h:236
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PROS_SHARED_CACHE_MAP SharedCacheMap
Definition: cc.h:226
#define CC_API_DEBUG
Definition: cc.h:11
#define ASSERT(a)
Definition: mode.c:45
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
NPAGED_LOOKASIDE_LIST iBcbLookasideList
Definition: view.c:44
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
ERESOURCE Lock
Definition: cc.h:233
CSHORT RefCount
Definition: cc.h:237
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:453
#define STATUS_SUCCESS
Definition: shellext.h:65
PFILE_OBJECT FileObject
Definition: cc.h:179
PROS_VACB Vacb
Definition: cc.h:235

Variable Documentation

◆ CcMapDataNoWait

ULONG CcMapDataNoWait = 0

Definition at line 29 of file pin.c.

Referenced by CcMapData(), and QSI_DEF().

◆ CcMapDataWait

ULONG CcMapDataWait = 0

Definition at line 28 of file pin.c.

Referenced by CcMapData(), and QSI_DEF().

◆ CcPinMappedDataCount

ULONG CcPinMappedDataCount = 0

Definition at line 32 of file pin.c.

Referenced by CcPinMappedData(), and QSI_DEF().

◆ CcPinReadNoWait

ULONG CcPinReadNoWait = 0

Definition at line 31 of file pin.c.

Referenced by CcPinRead(), and QSI_DEF().

◆ CcPinReadWait

ULONG CcPinReadWait = 0

Definition at line 30 of file pin.c.

Referenced by CcPinRead(), and QSI_DEF().

◆ iBcbLookasideList

NPAGED_LOOKASIDE_LIST iBcbLookasideList

Definition at line 44 of file view.c.

Referenced by CcInitView(), CcpDereferenceBcb(), CcpGetAppropriateBcb(), and CcUnpinRepinnedBcb().