ReactOS 0.4.15-dev-7942-gd23573b
pin.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/cc/pin.c
5 * PURPOSE: Implements cache managers pinning interface
6 *
7 * PROGRAMMERS: ?
8 Pierre Schweitzer (pierre@reactos.org)
9 */
10
11/* INCLUDES ******************************************************************/
12
13#include <ntoskrnl.h>
14#define NDEBUG
15#include <debug.h>
16
17/* GLOBALS *******************************************************************/
18
20
21/* Counters:
22 * - Number of calls to CcMapData that could wait
23 * - Number of calls to CcMapData that couldn't wait
24 * - Number of calls to CcPinRead that could wait
25 * - Number of calls to CcPinRead that couldn't wait
26 * - Number of calls to CcPinMappedDataCount
27 */
33
34/* FUNCTIONS *****************************************************************/
35
36static
40 IN PROS_SHARED_CACHE_MAP SharedCacheMap,
43 IN BOOLEAN Pinned)
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}
69
70static
71VOID
73 IN PROS_SHARED_CACHE_MAP SharedCacheMap,
75{
76 ULONG RefCount;
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
98 ExFreeToNPagedLookasideList(&iBcbLookasideList, Bcb);
99 }
100 else
101 {
102 KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
103 }
104}
105
106static
107PVOID
109 IN PROS_SHARED_CACHE_MAP SharedCacheMap,
110 IN PROS_VACB Vacb,
113 IN ULONG PinFlags,
114 IN BOOLEAN ToPin)
115{
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);
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}
209
210static
213 IN PROS_SHARED_CACHE_MAP SharedCacheMap,
216 IN ULONG Flags,
217 OUT PVOID * Bcb,
218 OUT PVOID * Buffer)
219{
220 PINTERNAL_BCB NewBcb;
222 ULONG VacbOffset;
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 {
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;
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 *Bcb = NULL;
306 *Buffer = NULL;
307 }
308 }
309 _SEH2_END;
310
311 if (Result)
312 {
313 *Bcb = &NewBcb->PFCB;
314 *Buffer = (PVOID)((ULONG_PTR)NewBcb->Vacb->BaseAddress + VacbOffset);
315 }
316
317 return Result;
318}
319
320/*
321 * @implemented
322 */
324NTAPI
329 IN ULONG Flags,
330 OUT PVOID *pBcb,
332{
334 PINTERNAL_BCB iBcb;
335 PROS_VACB Vacb;
336 PROS_SHARED_CACHE_MAP SharedCacheMap;
337 ULONG VacbOffset;
340
341 CCTRACE(CC_API_DEBUG, "CcMapData(FileObject 0x%p, FileOffset 0x%I64x, Length %lu, Flags 0x%lx,"
342 " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart,
343 Length, Flags, pBcb, pBuffer);
344
346 ASSERT(FileObject->SectionObjectPointer);
347 ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
348
349 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
350 ASSERT(SharedCacheMap);
351
352 if (Flags & MAP_WAIT)
353 {
355 }
356 else
357 {
359 }
360
361 VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
362 /* KMTests seem to show that it is allowed to call accross mapping granularity */
363 if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
364 {
365 DPRINT1("TRUNCATING DATA MAP FROM %lu to %lu!\n", Length, VACB_MAPPING_GRANULARITY - VacbOffset);
366 Length = VACB_MAPPING_GRANULARITY - VacbOffset;
367 }
368
369 KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
370 iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, FALSE);
371
372 if (iBcb == NULL)
373 {
374 KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
375
376 /* Call internal helper for getting a VACB */
377 Status = CcRosGetVacb(SharedCacheMap, FileOffset->QuadPart, &Vacb);
378 if (!NT_SUCCESS(Status))
379 {
380 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
381 SharedCacheMap->FileObject, FileOffset, Length, Flags);
383 }
384
385 iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE);
386 if (iBcb == NULL)
387 {
388 CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
389 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
390 SharedCacheMap->FileObject, FileOffset, Length, Flags);
391 *pBcb = NULL; // If you ever remove this for compat, make sure to review all callers for using an unititialized value
393 }
394 }
395 else
396 {
397 ++iBcb->RefCount;
398 KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
399 }
400
402 {
403 Result = FALSE;
404 /* Ensure the pages are resident */
406 BooleanFlagOn(Flags, MAP_NO_READ), VacbOffset, Length);
407 }
409 {
410 if (!Result)
411 {
412 CcpDereferenceBcb(SharedCacheMap, iBcb);
413 *pBcb = NULL;
414 *pBuffer = NULL;
415 }
416 }
417 _SEH2_END;
418
419 if (Result)
420 {
421 *pBcb = &iBcb->PFCB;
422 *pBuffer = (PVOID)((ULONG_PTR)iBcb->Vacb->BaseAddress + VacbOffset);
423 }
424
425 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> TRUE Bcb=%p, Buffer %p\n",
427 return Result;
428}
429
430/*
431 * @unimplemented
432 */
434NTAPI
439 IN ULONG Flags,
440 OUT PVOID * Bcb)
441{
444 PINTERNAL_BCB iBcb;
445 PROS_SHARED_CACHE_MAP SharedCacheMap;
446
447 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
449
451 ASSERT(FileObject->SectionObjectPointer);
452 ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
453
454 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
455 ASSERT(SharedCacheMap);
456 if (!SharedCacheMap->PinAccess)
457 {
458 DPRINT1("FIXME: Pinning a file with no pin access!\n");
459 return FALSE;
460 }
461
463
465
466 Result = CcpPinData(SharedCacheMap, FileOffset, Length, Flags, Bcb, &Buffer);
467 if (Result)
468 {
469 CcUnpinData(&iBcb->PFCB);
470 }
471
472 return Result;
473}
474
475/*
476 * @unimplemented
477 */
479NTAPI
484 IN ULONG Flags,
485 OUT PVOID * Bcb,
486 OUT PVOID * Buffer)
487{
488 PROS_SHARED_CACHE_MAP SharedCacheMap;
489
490 CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
492
494 ASSERT(FileObject->SectionObjectPointer);
495 ASSERT(FileObject->SectionObjectPointer->SharedCacheMap);
496
497 SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
498 ASSERT(SharedCacheMap);
499 if (!SharedCacheMap->PinAccess)
500 {
501 DPRINT1("FIXME: Pinning a file with no pin access!\n");
502 return FALSE;
503 }
504
505 if (Flags & PIN_WAIT)
506 {
508 }
509 else
510 {
512 }
513
514 return CcpPinData(SharedCacheMap, FileOffset, Length, Flags, Bcb, Buffer);
515}
516
517/*
518 * @unimplemented
519 */
521NTAPI
527 IN ULONG Flags,
528 OUT PVOID * Bcb,
529 OUT PVOID * Buffer)
530{
531 CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Zero=%d Flags=0x%lx\n",
533
534 /*
535 * FIXME: This is function is similar to CcPinRead, but doesn't
536 * read the data if they're not present. Instead it should just
537 * prepare the VACBs and zero them out if Zero != FALSE.
538 *
539 * For now calling CcPinRead is better than returning error or
540 * just having UNIMPLEMENTED here.
541 */
543}
544
545/*
546 * @implemented
547 */
550 IN PVOID Bcb,
551 IN PLARGE_INTEGER Lsn)
552{
554
555 CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n", Bcb, Lsn);
556
557 /* Tell Mm */
559 Add2Ptr(iBcb->Vacb->BaseAddress, iBcb->PFCB.MappedFileOffset.QuadPart - iBcb->Vacb->FileOffset.QuadPart),
560 iBcb->PFCB.MappedLength);
561
562 if (!iBcb->Vacb->Dirty)
563 {
565 }
566}
567
568
569/*
570 * @implemented
571 */
574 IN PVOID Bcb)
575{
576 CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
577
579}
580
581/*
582 * @unimplemented
583 */
584VOID
585NTAPI
587 IN PVOID Bcb,
589{
591
592 CCTRACE(CC_API_DEBUG, "Bcb=%p ResourceThreadId=%lu\n", Bcb, ResourceThreadId);
593
594 if (iBcb->PinCount != 0)
595 {
597 iBcb->PinCount--;
598 }
599
601}
602
603/*
604 * @implemented
605 */
606VOID
607NTAPI
609 IN PVOID Bcb)
610{
612
613 CCTRACE(CC_API_DEBUG, "Bcb=%p\n", Bcb);
614
615 iBcb->RefCount++;
616}
617
618/*
619 * @unimplemented
620 */
621VOID
622NTAPI
624 IN PVOID Bcb,
625 IN BOOLEAN WriteThrough,
627{
630 PROS_SHARED_CACHE_MAP SharedCacheMap;
631
632 CCTRACE(CC_API_DEBUG, "Bcb=%p WriteThrough=%d\n", Bcb, WriteThrough);
633
634 SharedCacheMap = iBcb->Vacb->SharedCacheMap;
635 IoStatus->Status = STATUS_SUCCESS;
636
637 if (WriteThrough)
638 {
639 CcFlushCache(iBcb->Vacb->SharedCacheMap->FileObject->SectionObjectPointer,
640 &iBcb->PFCB.MappedFileOffset,
641 iBcb->PFCB.MappedLength,
642 IoStatus);
643 }
644 else
645 {
646 IoStatus->Status = STATUS_SUCCESS;
647 IoStatus->Information = 0;
648 }
649
650 KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
651 if (--iBcb->RefCount == 0)
652 {
654 KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
655
656 if (iBcb->PinCount != 0)
657 {
659 iBcb->PinCount--;
660 ASSERT(iBcb->PinCount == 0);
661 }
662
663 /*
664 * Don't mark dirty, if it was dirty,
665 * the VACB was already marked as such
666 * following the call to CcSetDirtyPinnedData
667 */
669 iBcb->Vacb,
670 FALSE,
671 FALSE);
672
674 ExFreeToNPagedLookasideList(&iBcbLookasideList, iBcb);
675 }
676 else
677 {
678 KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
679 }
680}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
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
return Found
Definition: dirsup.c:1270
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExReleaseResourceForThreadLite(res, thrdID)
Definition: env_spec_w32.h:635
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define ExDeleteResourceLite(res)
Definition: env_spec_w32.h:647
#define ROUND_DOWN(n, align)
Definition: eventvwr.h:33
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:414
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:418
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
Status
Definition: gdiplustypes.h:25
#define Add2Ptr(PTR, INC)
#define ASSERT(a)
Definition: mode.c:44
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define PIN_NO_READ
#define PIN_EXCLUSIVE
#define PIN_IF_BCB
#define MAP_NO_READ
#define MAP_WAIT
#define PIN_WAIT
ULONG CcMapDataWait
Definition: pin.c:28
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pin.c:573
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
VOID NTAPI CcUnpinRepinnedBcb(IN PVOID Bcb, IN BOOLEAN WriteThrough, IN PIO_STATUS_BLOCK IoStatus)
Definition: pin.c:623
BOOLEAN NTAPI CcMapData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *pBcb, OUT PVOID *pBuffer)
Definition: pin.c:325
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
ULONG CcMapDataNoWait
Definition: pin.c:29
ULONG CcPinReadWait
Definition: pin.c:30
NPAGED_LOOKASIDE_LIST iBcbLookasideList
Definition: view.c:44
VOID NTAPI CcSetDirtyPinnedData(IN PVOID Bcb, IN PLARGE_INTEGER Lsn)
Definition: pin.c:549
BOOLEAN NTAPI CcPinMappedData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb)
Definition: pin.c:435
static VOID CcpDereferenceBcb(IN PROS_SHARED_CACHE_MAP SharedCacheMap, IN PINTERNAL_BCB Bcb)
Definition: pin.c:72
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
VOID NTAPI CcUnpinDataForThread(IN PVOID Bcb, IN ERESOURCE_THREAD ResourceThreadId)
Definition: pin.c:586
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: pin.c:522
ULONG CcPinMappedDataCount
Definition: pin.c:32
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:480
ULONG CcPinReadNoWait
Definition: pin.c:31
VOID NTAPI CcRepinBcb(IN PVOID Bcb)
Definition: pin.c:608
VOID CcRosMarkDirtyVacb(PROS_VACB Vacb)
Definition: view.c:649
NTSTATUS CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:574
BOOLEAN CcRosEnsureVacbResident(_In_ PROS_VACB Vacb, _In_ BOOLEAN Wait, _In_ BOOLEAN NoRead, _In_ ULONG Offset, _In_ ULONG Length)
Definition: view.c:910
NTSTATUS CcRosGetVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PROS_VACB *Vacb)
Definition: view.c:957
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1068
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define CC_API_DEBUG
Definition: cc.h:11
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
NTSTATUS NTAPI MmMakePagesDirty(_In_ PEPROCESS Process, _In_ PVOID Address, _In_ ULONG Length)
Definition: section.c:5202
#define ExRaiseStatus
Definition: ntoskrnl.h:114
#define _SEH2_VOLATILE
Definition: pseh2_64.h:163
PVOID pBuffer
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: cdstruc.h:902
ULONG PinCount
Definition: cc.h:236
ERESOURCE Lock
Definition: cc.h:233
CSHORT RefCount
Definition: cc.h:237
LIST_ENTRY BcbEntry
Definition: cc.h:238
PROS_VACB Vacb
Definition: cc.h:235
PUBLIC_BCB PFCB
Definition: cc.h:234
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
KSPIN_LOCK BcbSpinLock
Definition: cc.h:189
BOOLEAN PinAccess
Definition: cc.h:194
PFILE_OBJECT FileObject
Definition: cc.h:179
Definition: cc.h:207
BOOLEAN Dirty
Definition: cc.h:211
PROS_SHARED_CACHE_MAP SharedCacheMap
Definition: cc.h:226
LARGE_INTEGER FileOffset
Definition: cc.h:222
PVOID BaseAddress
Definition: cc.h:209
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_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:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define VACB_MAPPING_GRANULARITY
_In_ ERESOURCE_THREAD ResourceThreadId
Definition: exfuncs.h:1052
ULONG_PTR ERESOURCE_THREAD
Definition: extypes.h:208
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
* PFILE_OBJECT
Definition: iotypes.h:1998
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778