ReactOS  0.4.10-dev-358-g66981e1
copy.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/copy.c
5  * PURPOSE: Implements cache managers copy interface
6  *
7  * PROGRAMMERS: Some people?
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 #define MAX_ZERO_LENGTH (256 * 1024)
22 
23 typedef enum _CC_COPY_OPERATION
24 {
29 
30 typedef enum _CC_CAN_WRITE_RETRY
31 {
32  FirstTry = 0,
37 
45 
46 /* Counters:
47  * - Amount of pages flushed to the disk
48  * - Number of flush operations
49  */
52 
53 /* FUNCTIONS *****************************************************************/
54 
55 VOID
56 NTAPI
58  IN PFN_NUMBER PageFrameIndex
59 );
60 
61 VOID
62 NTAPI
64  VOID)
65 {
67 
69  //MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
71  if (!NT_SUCCESS(Status))
72  {
73  DbgPrint("Can't allocate CcZeroPage.\n");
74  KeBugCheck(CACHE_MANAGER);
75  }
77 }
78 
80 NTAPI
82  PROS_VACB Vacb)
83 {
84  ULONG Size, Pages;
85  PMDL Mdl;
88  KEVENT Event;
89 
91  if (Size > VACB_MAPPING_GRANULARITY)
92  {
94  }
95 
96  Pages = BYTES_TO_PAGES(Size);
98 
99  Mdl = IoAllocateMdl(Vacb->BaseAddress, Pages * PAGE_SIZE, FALSE, FALSE, NULL);
100  if (!Mdl)
101  {
103  }
104 
105  Status = STATUS_SUCCESS;
106  _SEH2_TRY
107  {
109  }
111  {
112  Status = _SEH2_GetExceptionCode();
113  DPRINT1("MmProbeAndLockPages failed with: %lx for %p (%p, %p)\n", Status, Mdl, Vacb, Vacb->BaseAddress);
114  KeBugCheck(CACHE_MANAGER);
115  } _SEH2_END;
116 
117  if (NT_SUCCESS(Status))
118  {
119  Mdl->MdlFlags |= MDL_IO_PAGE_READ;
121  Status = IoPageRead(Vacb->SharedCacheMap->FileObject, Mdl, &Vacb->FileOffset, &Event, &IoStatus);
122  if (Status == STATUS_PENDING)
123  {
125  Status = IoStatus.Status;
126  }
127 
128  MmUnlockPages(Mdl);
129  }
130 
131  IoFreeMdl(Mdl);
132 
133  if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
134  {
135  DPRINT1("IoPageRead failed, Status %x\n", Status);
136  return Status;
137  }
138 
139  if (Size < VACB_MAPPING_GRANULARITY)
140  {
141  RtlZeroMemory((char*)Vacb->BaseAddress + Size,
142  VACB_MAPPING_GRANULARITY - Size);
143  }
144 
145  return STATUS_SUCCESS;
146 }
147 
148 NTSTATUS
149 NTAPI
151  PROS_VACB Vacb)
152 {
153  ULONG Size;
154  PMDL Mdl;
157  KEVENT Event;
158 
159  Size = (ULONG)(Vacb->SharedCacheMap->SectionSize.QuadPart - Vacb->FileOffset.QuadPart);
160  if (Size > VACB_MAPPING_GRANULARITY)
161  {
163  }
164  //
165  // Nonpaged pool PDEs in ReactOS must actually be synchronized between the
166  // MmGlobalPageDirectory and the real system PDE directory. What a mess...
167  //
168  {
169  ULONG i = 0;
170  do
171  {
173  } while (++i < (Size >> PAGE_SHIFT));
174  }
175 
176  Mdl = IoAllocateMdl(Vacb->BaseAddress, Size, FALSE, FALSE, NULL);
177  if (!Mdl)
178  {
180  }
181 
182  Status = STATUS_SUCCESS;
183  _SEH2_TRY
184  {
186  }
188  {
189  Status = _SEH2_GetExceptionCode();
190  DPRINT1("MmProbeAndLockPages failed with: %lx for %p (%p, %p)\n", Status, Mdl, Vacb, Vacb->BaseAddress);
191  KeBugCheck(CACHE_MANAGER);
192  } _SEH2_END;
193 
194  if (NT_SUCCESS(Status))
195  {
197  Status = IoSynchronousPageWrite(Vacb->SharedCacheMap->FileObject, Mdl, &Vacb->FileOffset, &Event, &IoStatus);
198  if (Status == STATUS_PENDING)
199  {
201  Status = IoStatus.Status;
202  }
203 
204  MmUnlockPages(Mdl);
205  }
206  IoFreeMdl(Mdl);
207  if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
208  {
209  DPRINT1("IoPageWrite failed, Status %x\n", Status);
210  return Status;
211  }
212 
213  return STATUS_SUCCESS;
214 }
215 
216 NTSTATUS
220  _In_ ULONG Length,
222 {
224 
225  if (Operation == CcOperationZero)
226  {
227  /* Zero */
228  RtlZeroMemory(BaseAddress, Length);
229  }
230  else
231  {
232  _SEH2_TRY
233  {
234  if (Operation == CcOperationWrite)
235  RtlCopyMemory(BaseAddress, Buffer, Length);
236  else
237  RtlCopyMemory(Buffer, BaseAddress, Length);
238  }
240  {
241  Status = _SEH2_GetExceptionCode();
242  }
243  _SEH2_END;
244  }
245  return Status;
246 }
247 
248 BOOLEAN
255  _In_ BOOLEAN Wait,
257 {
259  LONGLONG CurrentOffset;
261  KIRQL OldIrql;
262  PROS_SHARED_CACHE_MAP SharedCacheMap;
263  PLIST_ENTRY ListEntry;
264  PROS_VACB Vacb;
265  ULONG PartialLength;
267  BOOLEAN Valid;
268  PPRIVATE_CACHE_MAP PrivateCacheMap;
269 
270  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
271  PrivateCacheMap = FileObject->PrivateCacheMap;
272  CurrentOffset = FileOffset;
273  BytesCopied = 0;
274 
275  if (!Wait)
276  {
277  /* test if the requested data is available */
278  KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
279  /* FIXME: this loop doesn't take into account areas that don't have
280  * a VACB in the list yet */
281  ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
282  while (ListEntry != &SharedCacheMap->CacheMapVacbListHead)
283  {
284  Vacb = CONTAINING_RECORD(ListEntry,
285  ROS_VACB,
286  CacheMapVacbListEntry);
287  ListEntry = ListEntry->Flink;
288  if (!Vacb->Valid &&
291  CurrentOffset, Length))
292  {
293  KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, OldIrql);
294  /* data not available */
295  return FALSE;
296  }
297  if (Vacb->FileOffset.QuadPart >= CurrentOffset + Length)
298  break;
299  }
300  KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, OldIrql);
301  }
302 
303  PartialLength = CurrentOffset % VACB_MAPPING_GRANULARITY;
304  if (PartialLength != 0)
305  {
306  PartialLength = min(Length, VACB_MAPPING_GRANULARITY - PartialLength);
307  Status = CcRosRequestVacb(SharedCacheMap,
308  ROUND_DOWN(CurrentOffset,
310  &BaseAddress,
311  &Valid,
312  &Vacb);
313  if (!NT_SUCCESS(Status))
314  ExRaiseStatus(Status);
315  if (!Valid)
316  {
317  Status = CcReadVirtualAddress(Vacb);
318  if (!NT_SUCCESS(Status))
319  {
320  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
321  ExRaiseStatus(Status);
322  }
323  }
324  Status = ReadWriteOrZero((PUCHAR)BaseAddress + CurrentOffset % VACB_MAPPING_GRANULARITY,
325  Buffer,
326  PartialLength,
327  Operation);
328 
329  CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, Operation != CcOperationRead, FALSE);
330 
331  if (!NT_SUCCESS(Status))
333 
334  Length -= PartialLength;
335  CurrentOffset += PartialLength;
336  BytesCopied += PartialLength;
337 
338  if (Operation != CcOperationZero)
339  Buffer = (PVOID)((ULONG_PTR)Buffer + PartialLength);
340  }
341 
342  while (Length > 0)
343  {
344  ASSERT(CurrentOffset % VACB_MAPPING_GRANULARITY == 0);
345  PartialLength = min(VACB_MAPPING_GRANULARITY, Length);
346  Status = CcRosRequestVacb(SharedCacheMap,
347  CurrentOffset,
348  &BaseAddress,
349  &Valid,
350  &Vacb);
351  if (!NT_SUCCESS(Status))
352  ExRaiseStatus(Status);
353  if (!Valid &&
354  (Operation == CcOperationRead ||
355  PartialLength < VACB_MAPPING_GRANULARITY))
356  {
357  Status = CcReadVirtualAddress(Vacb);
358  if (!NT_SUCCESS(Status))
359  {
360  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
361  ExRaiseStatus(Status);
362  }
363  }
364  Status = ReadWriteOrZero(BaseAddress, Buffer, PartialLength, Operation);
365 
366  CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, Operation != CcOperationRead, FALSE);
367 
368  if (!NT_SUCCESS(Status))
370 
371  Length -= PartialLength;
372  CurrentOffset += PartialLength;
373  BytesCopied += PartialLength;
374 
375  if (Operation != CcOperationZero)
376  Buffer = (PVOID)((ULONG_PTR)Buffer + PartialLength);
377  }
378 
379  /* If that was a successful sync read operation, let's handle read ahead */
380  if (Operation == CcOperationRead && Length == 0 && Wait)
381  {
382  /* If file isn't random access and next read may get us cross VACB boundary,
383  * schedule next read
384  */
385  if (!BooleanFlagOn(FileObject->Flags, FO_RANDOM_ACCESS) &&
386  (CurrentOffset - 1) / VACB_MAPPING_GRANULARITY != (CurrentOffset + BytesCopied - 1) / VACB_MAPPING_GRANULARITY)
387  {
388  CcScheduleReadAhead(FileObject, (PLARGE_INTEGER)&FileOffset, BytesCopied);
389  }
390 
391  /* And update read history in private cache map */
392  PrivateCacheMap->FileOffset1.QuadPart = PrivateCacheMap->FileOffset2.QuadPart;
393  PrivateCacheMap->BeyondLastByte1.QuadPart = PrivateCacheMap->BeyondLastByte2.QuadPart;
394  PrivateCacheMap->FileOffset2.QuadPart = FileOffset;
395  PrivateCacheMap->BeyondLastByte2.QuadPart = FileOffset + BytesCopied;
396  }
397 
398  IoStatus->Status = STATUS_SUCCESS;
399  IoStatus->Information = BytesCopied;
400  return TRUE;
401 }
402 
403 VOID
405 {
406  ULONG WrittenBytes;
407 
408  /* We'll try to write as much as we can */
409  WrittenBytes = 0;
410  while (TRUE)
411  {
412  KIRQL OldIrql;
413  PLIST_ENTRY ListEntry;
414  PDEFERRED_WRITE DeferredWrite;
415 
416  DeferredWrite = NULL;
417 
418  /* Lock our deferred writes list */
420  for (ListEntry = CcDeferredWrites.Flink;
421  ListEntry != &CcDeferredWrites;
422  ListEntry = ListEntry->Flink)
423  {
424  /* Extract an entry */
425  DeferredWrite = CONTAINING_RECORD(ListEntry, DEFERRED_WRITE, DeferredWriteLinks);
426 
427  /* Compute the modified bytes, based on what we already wrote */
428  WrittenBytes += DeferredWrite->BytesToWrite;
429  /* We overflowed, give up */
430  if (WrittenBytes < DeferredWrite->BytesToWrite)
431  {
432  DeferredWrite = NULL;
433  break;
434  }
435 
436  /* Check we can write */
437  if (CcCanIWrite(DeferredWrite->FileObject, WrittenBytes, FALSE, RetryForceCheckPerFile))
438  {
439  /* We can, so remove it from the list and stop looking for entry */
440  RemoveEntryList(&DeferredWrite->DeferredWriteLinks);
441  break;
442  }
443 
444  /* If we don't accept modified pages, stop here */
445  if (!DeferredWrite->LimitModifiedPages)
446  {
447  DeferredWrite = NULL;
448  break;
449  }
450 
451  /* Reset count as nothing was written yet */
452  WrittenBytes -= DeferredWrite->BytesToWrite;
453  DeferredWrite = NULL;
454  }
456 
457  /* Nothing to write found, give up */
458  if (DeferredWrite == NULL)
459  {
460  break;
461  }
462 
463  /* If we have an event, set it and quit */
464  if (DeferredWrite->Event)
465  {
466  KeSetEvent(DeferredWrite->Event, IO_NO_INCREMENT, FALSE);
467  }
468  /* Otherwise, call the write routine and free the context */
469  else
470  {
471  DeferredWrite->PostRoutine(DeferredWrite->Context1, DeferredWrite->Context2);
472  ExFreePoolWithTag(DeferredWrite, 'CcDw');
473  }
474  }
475 }
476 
477 VOID
480 {
482  LONGLONG CurrentOffset;
483  KIRQL OldIrql;
484  PROS_SHARED_CACHE_MAP SharedCacheMap;
485  PROS_VACB Vacb;
486  ULONG PartialLength;
488  BOOLEAN Valid;
489  ULONG Length;
490  PPRIVATE_CACHE_MAP PrivateCacheMap;
491  BOOLEAN Locked;
492 
493  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
494 
495  /* Critical:
496  * PrivateCacheMap might disappear in-between if the handle
497  * to the file is closed (private is attached to the handle not to
498  * the file), so we need to lock the master lock while we deal with
499  * it. It won't disappear without attempting to lock such lock.
500  */
502  PrivateCacheMap = FileObject->PrivateCacheMap;
503  /* If the handle was closed since the read ahead was scheduled, just quit */
504  if (PrivateCacheMap == NULL)
505  {
507  ObDereferenceObject(FileObject);
508  return;
509  }
510  /* Otherwise, extract read offset and length and release private map */
511  else
512  {
514  CurrentOffset = PrivateCacheMap->ReadAheadOffset[1].QuadPart;
515  Length = PrivateCacheMap->ReadAheadLength[1];
517  }
519 
520  /* Time to go! */
521  DPRINT("Doing ReadAhead for %p\n", FileObject);
522  /* Lock the file, first */
523  if (!SharedCacheMap->Callbacks->AcquireForReadAhead(SharedCacheMap->LazyWriteContext, FALSE))
524  {
525  Locked = FALSE;
526  goto Clear;
527  }
528 
529  /* Remember it's locked */
530  Locked = TRUE;
531 
532  /* Don't read past the end of the file */
533  if (CurrentOffset >= SharedCacheMap->FileSize.QuadPart)
534  {
535  goto Clear;
536  }
537  if (CurrentOffset + Length > SharedCacheMap->FileSize.QuadPart)
538  {
539  Length = SharedCacheMap->FileSize.QuadPart - CurrentOffset;
540  }
541 
542  /* Next of the algorithm will lock like CcCopyData with the slight
543  * difference that we don't copy data back to an user-backed buffer
544  * We just bring data into Cc
545  */
546  PartialLength = CurrentOffset % VACB_MAPPING_GRANULARITY;
547  if (PartialLength != 0)
548  {
549  PartialLength = min(Length, VACB_MAPPING_GRANULARITY - PartialLength);
550  Status = CcRosRequestVacb(SharedCacheMap,
551  ROUND_DOWN(CurrentOffset,
553  &BaseAddress,
554  &Valid,
555  &Vacb);
556  if (!NT_SUCCESS(Status))
557  {
558  DPRINT1("Failed to request VACB: %lx!\n", Status);
559  goto Clear;
560  }
561 
562  if (!Valid)
563  {
564  Status = CcReadVirtualAddress(Vacb);
565  if (!NT_SUCCESS(Status))
566  {
567  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
568  DPRINT1("Failed to read data: %lx!\n", Status);
569  goto Clear;
570  }
571  }
572 
573  CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
574 
575  Length -= PartialLength;
576  CurrentOffset += PartialLength;
577  }
578 
579  while (Length > 0)
580  {
581  ASSERT(CurrentOffset % VACB_MAPPING_GRANULARITY == 0);
582  PartialLength = min(VACB_MAPPING_GRANULARITY, Length);
583  Status = CcRosRequestVacb(SharedCacheMap,
584  CurrentOffset,
585  &BaseAddress,
586  &Valid,
587  &Vacb);
588  if (!NT_SUCCESS(Status))
589  {
590  DPRINT1("Failed to request VACB: %lx!\n", Status);
591  goto Clear;
592  }
593 
594  if (!Valid)
595  {
596  Status = CcReadVirtualAddress(Vacb);
597  if (!NT_SUCCESS(Status))
598  {
599  CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE, FALSE);
600  DPRINT1("Failed to read data: %lx!\n", Status);
601  goto Clear;
602  }
603  }
604 
605  CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
606 
607  Length -= PartialLength;
608  CurrentOffset += PartialLength;
609  }
610 
611 Clear:
612  /* See previous comment about private cache map */
614  PrivateCacheMap = FileObject->PrivateCacheMap;
615  if (PrivateCacheMap != NULL)
616  {
617  /* Mark read ahead as unactive */
619  InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, ~PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE);
621  }
623 
624  /* If file was locked, release it */
625  if (Locked)
626  {
627  SharedCacheMap->Callbacks->ReleaseFromReadAhead(SharedCacheMap->LazyWriteContext);
628  }
629 
630  /* And drop our extra reference (See: CcScheduleReadAhead) */
631  ObDereferenceObject(FileObject);
632 
633  return;
634 }
635 
636 /*
637  * @unimplemented
638  */
639 BOOLEAN
640 NTAPI
643  IN ULONG BytesToWrite,
644  IN BOOLEAN Wait,
645  IN BOOLEAN Retrying)
646 {
647  KIRQL OldIrql;
648  KEVENT WaitEvent;
649  ULONG Length, Pages;
650  BOOLEAN PerFileDefer;
653  CC_CAN_WRITE_RETRY TryContext;
654  PROS_SHARED_CACHE_MAP SharedCacheMap;
655 
656  CCTRACE(CC_API_DEBUG, "FileObject=%p BytesToWrite=%lu Wait=%d Retrying=%d\n",
657  FileObject, BytesToWrite, Wait, Retrying);
658 
659  /* Write through is always OK */
660  if (BooleanFlagOn(FileObject->Flags, FO_WRITE_THROUGH))
661  {
662  return TRUE;
663  }
664 
665  TryContext = Retrying;
666  /* Allow remote file if not from posted */
667  if (IoIsFileOriginRemote(FileObject) && TryContext < RetryAllowRemote)
668  {
669  return TRUE;
670  }
671 
672  /* Don't exceed max tolerated size */
673  Length = MAX_ZERO_LENGTH;
674  if (BytesToWrite < MAX_ZERO_LENGTH)
675  {
676  Length = BytesToWrite;
677  }
678 
679  /* Convert it to pages count */
680  Pages = (Length + PAGE_SIZE - 1) >> PAGE_SHIFT;
681 
682  /* By default, assume limits per file won't be hit */
683  PerFileDefer = FALSE;
684  Fcb = FileObject->FsContext;
685  /* Do we have to check for limits per file? */
686  if (TryContext >= RetryForceCheckPerFile ||
688  {
689  /* If master is not locked, lock it now */
690  if (TryContext != RetryMasterLocked)
691  {
693  }
694 
695  /* Let's not assume the file is cached... */
696  if (FileObject->SectionObjectPointer != NULL &&
697  FileObject->SectionObjectPointer->SharedCacheMap != NULL)
698  {
699  SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
700  /* Do we have limits per file set? */
701  if (SharedCacheMap->DirtyPageThreshold != 0 &&
702  SharedCacheMap->DirtyPages != 0)
703  {
704  /* Yes, check whether they are blocking */
705  if (Pages + SharedCacheMap->DirtyPages > SharedCacheMap->DirtyPageThreshold)
706  {
707  PerFileDefer = TRUE;
708  }
709  }
710  }
711 
712  /* And don't forget to release master */
713  if (TryContext != RetryMasterLocked)
714  {
716  }
717  }
718 
719  /* So, now allow write if:
720  * - Not the first try or we have no throttling yet
721  * AND:
722  * - We don't exceed threshold!
723  * - We don't exceed what Mm can allow us to use
724  * + If we're above top, that's fine
725  * + If we're above bottom with limited modified pages, that's fine
726  * + Otherwise, throttle!
727  */
728  if ((TryContext != FirstTry || IsListEmpty(&CcDeferredWrites)) &&
732  !PerFileDefer)
733  {
734  return TRUE;
735  }
736 
737  /* If we can wait, we'll start the wait loop for waiting till we can
738  * write for real
739  */
740  if (!Wait)
741  {
742  return FALSE;
743  }
744 
745  /* Otherwise, if there are no deferred writes yet, start the lazy writer */
747  {
748  KIRQL OldIrql;
749 
753  }
754 
755  /* Initialize our wait event */
757 
758  /* And prepare a dummy context */
760  Context.NodeByteSize = sizeof(DEFERRED_WRITE);
761  Context.FileObject = FileObject;
762  Context.BytesToWrite = BytesToWrite;
764  Context.Event = &WaitEvent;
765 
766  /* And queue it */
767  if (Retrying)
768  {
769  /* To the top, if that's a retry */
771  &Context.DeferredWriteLinks,
773  }
774  else
775  {
776  /* To the bottom, if that's a first time */
778  &Context.DeferredWriteLinks,
780  }
781 
782  DPRINT1("Actively deferring write for: %p\n", FileObject);
783  /* Now, we'll loop until our event is set. When it is set, it means that caller
784  * can immediately write, and has to
785  */
786  do
787  {
790 
791  return TRUE;
792 }
793 
794 /*
795  * @implemented
796  */
797 BOOLEAN
798 NTAPI
802  IN ULONG Length,
803  IN BOOLEAN Wait,
804  OUT PVOID Buffer,
806 {
807  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu Wait=%d\n",
808  FileObject, FileOffset->QuadPart, Length, Wait);
809 
810  DPRINT("CcCopyRead(FileObject 0x%p, FileOffset %I64x, "
811  "Length %lu, Wait %u, Buffer 0x%p, IoStatus 0x%p)\n",
812  FileObject, FileOffset->QuadPart, Length, Wait,
813  Buffer, IoStatus);
814 
815  return CcCopyData(FileObject,
816  FileOffset->QuadPart,
817  Buffer,
818  Length,
820  Wait,
821  IoStatus);
822 }
823 
824 /*
825  * @implemented
826  */
827 BOOLEAN
828 NTAPI
832  IN ULONG Length,
833  IN BOOLEAN Wait,
834  IN PVOID Buffer)
835 {
837 
838  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu Wait=%d Buffer=%p\n",
839  FileObject, FileOffset->QuadPart, Length, Wait, Buffer);
840 
841  DPRINT("CcCopyWrite(FileObject 0x%p, FileOffset %I64x, "
842  "Length %lu, Wait %u, Buffer 0x%p)\n",
843  FileObject, FileOffset->QuadPart, Length, Wait, Buffer);
844 
845  return CcCopyData(FileObject,
846  FileOffset->QuadPart,
847  Buffer,
848  Length,
850  Wait,
851  &IoStatus);
852 }
853 
854 /*
855  * @implemented
856  */
857 VOID
858 NTAPI
861  IN PCC_POST_DEFERRED_WRITE PostRoutine,
862  IN PVOID Context1,
863  IN PVOID Context2,
864  IN ULONG BytesToWrite,
865  IN BOOLEAN Retrying)
866 {
867  KIRQL OldIrql;
870 
871  CCTRACE(CC_API_DEBUG, "FileObject=%p PostRoutine=%p Context1=%p Context2=%p BytesToWrite=%lu Retrying=%d\n",
872  FileObject, PostRoutine, Context1, Context2, BytesToWrite, Retrying);
873 
874  /* Try to allocate a context for queueing the write operation */
875  Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(DEFERRED_WRITE), 'CcDw');
876  /* If it failed, immediately execute the operation! */
877  if (Context == NULL)
878  {
879  PostRoutine(Context1, Context2);
880  return;
881  }
882 
883  Fcb = FileObject->FsContext;
884 
885  /* Otherwise, initialize the context */
886  RtlZeroMemory(Context, sizeof(DEFERRED_WRITE));
888  Context->NodeByteSize = sizeof(DEFERRED_WRITE);
889  Context->FileObject = FileObject;
890  Context->PostRoutine = PostRoutine;
891  Context->Context1 = Context1;
892  Context->Context2 = Context2;
893  Context->BytesToWrite = BytesToWrite;
895 
896  /* And queue it */
897  if (Retrying)
898  {
899  /* To the top, if that's a retry */
901  &Context->DeferredWriteLinks,
903  }
904  else
905  {
906  /* To the bottom, if that's a first time */
908  &Context->DeferredWriteLinks,
910  }
911 
912  /* Try to execute the posted writes */
914 
915  /* Schedule a lazy writer run to handle deferred writes */
917  if (!LazyWriter.ScanActive)
918  {
920  }
922 }
923 
924 /*
925  * @unimplemented
926  */
927 VOID
928 NTAPI
932  IN ULONG Length,
933  IN ULONG PageCount,
934  OUT PVOID Buffer,
936 {
937  LARGE_INTEGER LargeFileOffset;
939 
940  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%lu Length=%lu PageCount=%lu Buffer=%p\n",
941  FileObject, FileOffset, Length, PageCount, Buffer);
942 
943  DBG_UNREFERENCED_PARAMETER(PageCount);
944 
945  LargeFileOffset.QuadPart = FileOffset;
946  Success = CcCopyRead(FileObject,
947  &LargeFileOffset,
948  Length,
949  TRUE,
950  Buffer,
951  IoStatus);
952  ASSERT(Success == TRUE);
953 }
954 
955 /*
956  * @unimplemented
957  */
958 VOID
959 NTAPI
963  IN ULONG Length,
964  IN PVOID Buffer)
965 {
966  LARGE_INTEGER LargeFileOffset;
968 
969  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%lu Length=%lu Buffer=%p\n",
970  FileObject, FileOffset, Length, Buffer);
971 
972  LargeFileOffset.QuadPart = FileOffset;
973  Success = CcCopyWrite(FileObject,
974  &LargeFileOffset,
975  Length,
976  TRUE,
977  Buffer);
978  ASSERT(Success == TRUE);
979 }
980 
981 /*
982  * @implemented
983  */
984 BOOLEAN
985 NTAPI
988  IN PLARGE_INTEGER StartOffset,
989  IN PLARGE_INTEGER EndOffset,
990  IN BOOLEAN Wait)
991 {
993  LARGE_INTEGER WriteOffset;
995  ULONG CurrentLength;
996  PMDL Mdl;
997  ULONG i;
999  KEVENT Event;
1000 
1001  CCTRACE(CC_API_DEBUG, "FileObject=%p StartOffset=%I64u EndOffset=%I64u Wait=%d\n",
1002  FileObject, StartOffset->QuadPart, EndOffset->QuadPart, Wait);
1003 
1004  DPRINT("CcZeroData(FileObject 0x%p, StartOffset %I64x, EndOffset %I64x, "
1005  "Wait %u)\n", FileObject, StartOffset->QuadPart, EndOffset->QuadPart,
1006  Wait);
1007 
1008  Length = EndOffset->QuadPart - StartOffset->QuadPart;
1009  WriteOffset.QuadPart = StartOffset->QuadPart;
1010 
1011  if (FileObject->SectionObjectPointer->SharedCacheMap == NULL)
1012  {
1013  /* File is not cached */
1014 
1015  Mdl = _alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH));
1016 
1017  while (Length > 0)
1018  {
1019  if (Length + WriteOffset.QuadPart % PAGE_SIZE > MAX_ZERO_LENGTH)
1020  {
1021  CurrentLength = MAX_ZERO_LENGTH - WriteOffset.QuadPart % PAGE_SIZE;
1022  }
1023  else
1024  {
1025  CurrentLength = Length;
1026  }
1027  MmInitializeMdl(Mdl, (PVOID)(ULONG_PTR)WriteOffset.QuadPart, CurrentLength);
1028  Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
1029  for (i = 0; i < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); i++)
1030  {
1031  ((PPFN_NUMBER)(Mdl + 1))[i] = CcZeroPage;
1032  }
1034  Status = IoSynchronousPageWrite(FileObject, Mdl, &WriteOffset, &Event, &Iosb);
1035  if (Status == STATUS_PENDING)
1036  {
1038  Status = Iosb.Status;
1039  }
1040  if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA)
1041  {
1042  MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
1043  }
1044  if (!NT_SUCCESS(Status))
1045  {
1046  return FALSE;
1047  }
1048  WriteOffset.QuadPart += CurrentLength;
1049  Length -= CurrentLength;
1050  }
1051  }
1052  else
1053  {
1055 
1056  return CcCopyData(FileObject,
1057  WriteOffset.QuadPart,
1058  NULL,
1059  Length,
1061  Wait,
1062  &IoStatus);
1063  }
1064 
1065  return TRUE;
1066 }
#define MDL_IO_PAGE_READ
Definition: mmtypes.h:24
DWORD *typedef PVOID
Definition: winlogon.h:60
BOOLEAN CcCopyData(_In_ PFILE_OBJECT FileObject, _In_ LONGLONG FileOffset, _Inout_ PVOID Buffer, _In_ LONGLONG Length, _In_ CC_COPY_OPERATION Operation, _In_ BOOLEAN Wait, _Out_ PIO_STATUS_BLOCK IoStatus)
Definition: copy.c:249
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define IN
Definition: typedefs.h:38
#define InterlockedAnd
Definition: interlocked.h:62
BOOLEAN LimitModifiedPages
Definition: cctypes.h:178
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
CSHORT NodeByteSize
Definition: cctypes.h:170
Definition: cc.h:199
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG CcDirtyPageThreshold
Definition: view.c:61
PVOID BaseAddress
Definition: cc.h:202
#define MmInitializeMdl(_MemoryDescriptorList, _BaseVa, _Length)
#define DbgPrint
Definition: loader.c:25
LARGE_INTEGER SectionSize
Definition: cc.h:175
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
LARGE_INTEGER BeyondLastByte2
Definition: cctypes.h:80
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
ULONG CcDataFlushes
Definition: copy.c:51
return STATUS_SUCCESS
Definition: btrfs.c:2690
CSHORT NodeTypeCode
Definition: cctypes.h:169
BOOLEAN NTAPI CcCanIWrite(IN PFILE_OBJECT FileObject, IN ULONG BytesToWrite, IN BOOLEAN Wait, IN BOOLEAN Retrying)
Definition: copy.c:641
unsigned char * PUCHAR
Definition: retypes.h:3
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
#define FO_RANDOM_ACCESS
Definition: iotypes.h:1752
NTSTATUS NTAPI MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN MyWait, PPFN_NUMBER AllocatedPage)
Definition: balance.c:229
#define ExRaiseStatus
Definition: ntoskrnl.h:94
ULONG CcRosTraceLevel
Definition: copy.c:38
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1409
#define MC_SYSTEM
Definition: mm.h:95
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI IoPageRead(IN PFILE_OBJECT FileObject, IN PMDL Mdl, IN PLARGE_INTEGER Offset, IN PKEVENT Event, IN PIO_STATUS_BLOCK StatusBlock)
Definition: iofunc.c:1088
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
PVOID PMDL
Definition: usb.h:39
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
ULONG CcFastMdlReadWait
Definition: copy.c:39
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define MDL_MAPPED_TO_SYSTEM_VA
Definition: mmtypes.h:18
VOID CcPostDeferredWrites(VOID)
Definition: copy.c:404
BOOLEAN NTAPI CcCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
Definition: copy.c:799
_SEH2_TRY
Definition: create.c:4250
VOID NTAPI CcScheduleReadAhead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length)
Definition: cachesub.c:92
#define STATUS_END_OF_FILE
Definition: shellext.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:63
VOID CcPerformReadAhead(IN PFILE_OBJECT FileObject)
Definition: copy.c:478
ACPI_EFI_EVENT Event
Definition: acefiex.h:633
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG * PPFN_NUMBER
Definition: ke.h:8
VOID NTAPI CcFastCopyRead(IN PFILE_OBJECT FileObject, IN ULONG FileOffset, IN ULONG Length, IN ULONG PageCount, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
Definition: copy.c:929
GLenum GLclampf GLint i
Definition: glfuncs.h:14
PLIST_ENTRY NTAPI ExInterlockedInsertHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:114
ULONG PFN_NUMBER
Definition: ke.h:8
LAZY_WRITER LazyWriter
Definition: lazywrite.c:37
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOLEAN NTAPI IoIsFileOriginRemote(IN PFILE_OBJECT FileObject)
Definition: file.c:2882
#define FALSE
Definition: types.h:117
ULONG CcFastReadResourceMiss
Definition: copy.c:44
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:260
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:811
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LARGE_INTEGER BeyondLastByte1
Definition: cctypes.h:78
VOID NTAPI CcFastCopyWrite(IN PFILE_OBJECT FileObject, IN ULONG FileOffset, IN ULONG Length, IN PVOID Buffer)
Definition: copy.c:960
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
Definition: ndis.h:3149
smooth NULL
Definition: ftsmooth.c:416
#define NODE_TYPE_DEFERRED_WRITE
Definition: cc.h:285
#define _Out_
Definition: no_sal2.h:323
_In_ PLARGE_INTEGER _In_ ULONG _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ PVOID _In_ PVOID Context2
Definition: cctypes.h:53
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1469
Definition: bufpool.h:45
#define MI_SET_USAGE(x)
Definition: mm.h:251
PCACHE_MANAGER_CALLBACKS Callbacks
Definition: cc.h:180
ULONG CcFastReadNotPossible
Definition: copy.c:41
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
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:225
UINTN Size
Definition: acefiex.h:555
LIST_ENTRY CacheMapVacbListHead
Definition: cc.h:187
KSPIN_LOCK ReadAheadSpinLock
Definition: cctypes.h:83
VOID NTAPI CcDeferWrite(IN PFILE_OBJECT FileObject, IN PCC_POST_DEFERRED_WRITE PostRoutine, IN PVOID Context1, IN PVOID Context2, IN ULONG BytesToWrite, IN BOOLEAN Retrying)
Definition: copy.c:859
int64_t LONGLONG
Definition: typedefs.h:66
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
unsigned char BOOLEAN
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
ULONG CcDataPages
Definition: copy.c:50
#define CC_API_DEBUG
Definition: cc.h:11
LONG NTSTATUS
Definition: precomp.h:26
LIST_ENTRY DeferredWriteLinks
Definition: cctypes.h:173
return Iosb
Definition: create.c:4426
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NTAPI CcRosReleaseVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, PROS_VACB Vacb, BOOLEAN Valid, BOOLEAN Dirty, BOOLEAN Mapped)
Definition: view.c:412
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
struct _DEFERRED_WRITE DEFERRED_WRITE
enum _CC_CAN_WRITE_RETRY CC_CAN_WRITE_RETRY
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
LIST_ENTRY CcDeferredWrites
Definition: view.c:63
BOOLEAN ScanActive
Definition: cc.h:245
ULONG CcFastReadNoWait
Definition: copy.c:43
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
MMPFNLIST MmModifiedPageListHead
Definition: pfnlist.c:45
#define _Inout_
Definition: no_sal2.h:244
static PFN_NUMBER CcZeroPage
Definition: copy.c:19
* PFILE_OBJECT
Definition: iotypes.h:1954
#define FSRTL_FLAG_LIMIT_MODIFIED_PAGES
Definition: fsrtltypes.h:47
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
KSPIN_LOCK CcDeferredWriteSpinLock
Definition: view.c:64
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG MmThrottleBottom
Definition: mminit.c:397
#define BYTES_TO_PAGES(Size)
ULONG CcTotalDirtyPages
Definition: view.c:62
_CC_CAN_WRITE_RETRY
Definition: copy.c:30
MDL
Definition: mmtypes.h:117
VOID UINTN Length
Definition: acefiex.h:744
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
LARGE_INTEGER FileOffset1
Definition: cctypes.h:77
SIZE_T NTAPI MmSizeOfMdl(IN PVOID Base, IN SIZE_T Length)
Definition: mdlsup.c:383
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG CcFastReadWait
Definition: copy.c:42
Definition: typedefs.h:117
Definition: copy.c:32
VOID NTAPI CcInitCacheZeroPage(VOID)
Definition: copy.c:63
NTSTATUS NTAPI CcWriteVirtualAddress(PROS_VACB Vacb)
Definition: copy.c:150
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
ULONG MmThrottleTop
Definition: mminit.c:396
Status
Definition: gdiplustypes.h:24
VOID CcScheduleLazyWriteScan(IN BOOLEAN NoDelay)
Definition: lazywrite.c:181
PFILE_OBJECT FileObject
Definition: cctypes.h:171
FORCEINLINE BOOLEAN DoRangesIntersect(_In_ LONGLONG Offset1, _In_ LONGLONG Length1, _In_ LONGLONG Offset2, _In_ LONGLONG Length2)
Definition: cc.h:476
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
PVOID Context1
Definition: cctypes.h:176
ULONG CcFastMdlReadNotPossible
Definition: copy.c:40
#define _In_
Definition: no_sal2.h:204
#define ROUND_DOWN(n, align)
Definition: eventvwr.h:30
_SEH2_END
Definition: create.c:4424
_In_ PLARGE_INTEGER _In_ ULONG _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ PVOID Context1
Definition: cctypes.h:53
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
LARGE_INTEGER ReadAheadOffset[2]
Definition: cctypes.h:81
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:905
PFN_NUMBER NTAPI MmGetPfnForProcess(struct _EPROCESS *Process, PVOID Address)
NTSTATUS ReadWriteOrZero(_Inout_ PVOID BaseAddress, _Inout_opt_ PVOID Buffer, _In_ ULONG Length, _In_ CC_COPY_OPERATION Operation)
Definition: copy.c:217
enum _CC_COPY_OPERATION CC_COPY_OPERATION
BOOLEAN Valid
Definition: cc.h:206
PFN_NUMBER Total
Definition: mm.h:369
#define min(a, b)
Definition: monoChain.cc:55
NTSTATUS NTAPI IoSynchronousPageWrite(IN PFILE_OBJECT FileObject, IN PMDL Mdl, IN PLARGE_INTEGER Offset, IN PKEVENT Event, IN PIO_STATUS_BLOCK StatusBlock)
Definition: iofunc.c:1033
PCC_POST_DEFERRED_WRITE PostRoutine
Definition: cctypes.h:175
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
_In_ BOOLEAN Wait
Definition: cctypes.h:23
#define DPRINT1
Definition: precomp.h:8
LARGE_INTEGER CcIdleDelay
Definition: lazywrite.c:46
LARGE_INTEGER FileOffset
Definition: cc.h:219
_In_ PLARGE_INTEGER FileOffset
Definition: cctypes.h:53
LARGE_INTEGER FileOffset2
Definition: cctypes.h:79
#define VACB_MAPPING_GRANULARITY
_CC_COPY_OPERATION
Definition: copy.c:23
BOOLEAN NTAPI CcZeroData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER StartOffset, IN PLARGE_INTEGER EndOffset, IN BOOLEAN Wait)
Definition: copy.c:986
PVOID LazyWriteContext
Definition: cc.h:181
#define OUT
Definition: typedefs.h:39
LARGE_INTEGER FileSize
Definition: cc.h:174
BOOLEAN NTAPI CcCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN PVOID Buffer)
Definition: copy.c:829
struct tagContext Context
Definition: acpixf.h:1014
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
ULONG BytesToWrite
Definition: cctypes.h:172
void Clear(USHORT Window)
Definition: hardware.c:705
KSPIN_LOCK CacheMapLock
Definition: cc.h:190
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
PFILE_OBJECT FileObject
Definition: cc.h:176
_In_ PFCB Fcb
Definition: cdprocs.h:151
ULONG UlongFlags
Definition: cctypes.h:73
#define PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE
Definition: cctypes.h:64
NTSTATUS NTAPI CcRosRequestVacb(PROS_SHARED_CACHE_MAP SharedCacheMap, LONGLONG FileOffset, PVOID *BaseAddress, PBOOLEAN UptoDate, PROS_VACB *Vacb)
Definition: view.c:990
PKEVENT Event
Definition: cctypes.h:174
ULONG DirtyPageThreshold
Definition: cc.h:183
NTSTATUS NTAPI CcReadVirtualAddress(PROS_VACB Vacb)
Definition: copy.c:81
PVOID Context2
Definition: cctypes.h:177
ULONG DirtyPages
Definition: cc.h:177
ULONG ReadAheadLength[2]
Definition: cctypes.h:82
LONGLONG QuadPart
Definition: typedefs.h:112
#define FO_WRITE_THROUGH
Definition: iotypes.h:1735
#define _Inout_opt_
Definition: no_sal2.h:258
#define MAX_ZERO_LENGTH
Definition: copy.c:21