ReactOS  0.4.13-dev-99-g7e18b6d
memory.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3  * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4  * FILE: memory.c
5  * PURPOSE:
6  * PROGRAMMER: Mark Piper, Matt Wu, Bo BrantÚn.
7  * HOMEPAGE:
8  * UPDATE HISTORY:
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "rfsd.h"
14 
15 /* GLOBALS ***************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 #ifdef ALLOC_PRAGMA
22 #pragma alloc_text(PAGE, RfsdAllocateIrpContext)
23 #pragma alloc_text(PAGE, RfsdFreeIrpContext)
24 #pragma alloc_text(PAGE, RfsdAllocateFcb)
25 #pragma alloc_text(PAGE, RfsdFreeFcb)
26 #pragma alloc_text(PAGE, RfsdAllocateMcb)
27 #pragma alloc_text(PAGE, RfsdSearchMcbTree)
28 #pragma alloc_text(PAGE, RfsdSearchMcb)
29 #pragma alloc_text(PAGE, RfsdGetFullFileName)
30 #pragma alloc_text(PAGE, RfsdRefreshMcb)
31 #pragma alloc_text(PAGE, RfsdAddMcbNode)
32 #pragma alloc_text(PAGE, RfsdDeleteMcbNode)
33 #pragma alloc_text(PAGE, RfsdFreeMcbTree)
34 #if !RFSD_READ_ONLY
35 #pragma alloc_text(PAGE, RfsdCheckBitmapConsistency)
36 #pragma alloc_text(PAGE, RfsdCheckSetBlock)
37 #endif // !RFSD_READ_ONLY
38 #pragma alloc_text(PAGE, RfsdInitializeVcb)
39 #pragma alloc_text(PAGE, RfsdFreeCcb)
40 #pragma alloc_text(PAGE, RfsdAllocateCcb)
41 #pragma alloc_text(PAGE, RfsdFreeVcb)
42 #pragma alloc_text(PAGE, RfsdCreateFcbFromMcb)
43 #pragma alloc_text(PAGE, RfsdSyncUninitializeCacheMap)
44 #endif
45 
49  IN PIRP Irp )
50 {
51  PIO_STACK_LOCATION IoStackLocation;
52  PRFSD_IRP_CONTEXT IrpContext;
53 
54  PAGED_CODE();
55 
57  ASSERT(Irp != NULL);
58 
59  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
60 
63  TRUE );
64 
65  IrpContext = (PRFSD_IRP_CONTEXT) (
66  ExAllocateFromNPagedLookasideList(
68 
72 
73  if (IrpContext == NULL) {
74 
76 
77  //
78  // Zero out the irp context and indicate that it is from pool and
79  // not region allocated
80  //
81 
82  RtlZeroMemory(IrpContext, sizeof(RFSD_IRP_CONTEXT));
83 
85 
86  } else {
87 
88  //
89  // Zero out the irp context and indicate that it is from zone and
90  // not pool allocated
91  //
92 
93  RtlZeroMemory(IrpContext, sizeof(RFSD_IRP_CONTEXT) );
94  }
95 
96  if (!IrpContext) {
97  return NULL;
98  }
99 
100  IrpContext->Identifier.Type = RFSDICX;
101  IrpContext->Identifier.Size = sizeof(RFSD_IRP_CONTEXT);
102 
103  IrpContext->Irp = Irp;
104 
105  IrpContext->MajorFunction = IoStackLocation->MajorFunction;
106  IrpContext->MinorFunction = IoStackLocation->MinorFunction;
107 
108  IrpContext->DeviceObject = DeviceObject;
109 
110  IrpContext->FileObject = IoStackLocation->FileObject;
111 
112  if (IrpContext->FileObject != NULL) {
113  IrpContext->RealDevice = IrpContext->FileObject->DeviceObject;
114  } else if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL) {
115  if (IoStackLocation->Parameters.MountVolume.Vpb) {
116  IrpContext->RealDevice =
117  IoStackLocation->Parameters.MountVolume.Vpb->RealDevice;
118  }
119  }
120 
121  if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
122  IrpContext->MajorFunction == IRP_MJ_DEVICE_CONTROL ||
123  IrpContext->MajorFunction == IRP_MJ_SHUTDOWN) {
124  IrpContext->IsSynchronous = TRUE;
125  } else if (IrpContext->MajorFunction == IRP_MJ_CLEANUP ||
126  IrpContext->MajorFunction == IRP_MJ_CLOSE) {
127  IrpContext->IsSynchronous = FALSE;
128  }
129 #if (_WIN32_WINNT >= 0x0500)
130  else if (IrpContext->MajorFunction == IRP_MJ_PNP) {
132  IrpContext->IsSynchronous = TRUE;
133  } else {
135  }
136  }
137 #endif //(_WIN32_WINNT >= 0x0500)
138  else {
140  }
141 
142 #if 0
143  //
144  // Temporary workaround for a bug in close that makes it reference a
145  // fileobject when it is no longer valid.
146  //
147  if (IrpContext->MajorFunction == IRP_MJ_CLOSE) {
148  IrpContext->IsSynchronous = TRUE;
149  }
150 #endif
151 
152  IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp);
153 
154  IrpContext->ExceptionInProgress = FALSE;
155 
156  return IrpContext;
157 }
158 
159 NTSTATUS
161  IN PRFSD_IRP_CONTEXT IrpContext,
162  IN NTSTATUS Status )
163 {
164  PIRP Irp = NULL;
165  BOOLEAN bPrint;
166 
167  Irp = IrpContext->Irp;
168 
169  if (Irp != NULL) {
170 
171  if (NT_ERROR(Status)) {
172  Irp->IoStatus.Information = 0;
173  }
174 
175  Irp->IoStatus.Status = Status;
176  bPrint = !IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_REQUEUED);
177 
179  Irp, bPrint, (CCHAR)(NT_SUCCESS(Status)?
181 
182  IrpContext->Irp = NULL;
183  }
184 
185  RfsdFreeIrpContext(IrpContext);
186 
187  return Status;
188 }
189 
191 VOID
193 {
194  PAGED_CODE();
195 
196  ASSERT(IrpContext != NULL);
197 
198  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
199  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
200 
201  RfsdUnpinRepinnedBcbs(IrpContext);
202 
203  // Return the Irp context record to the region or to pool depending on
204  // its flag
205 
206  if (FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_FROM_POOL)) {
207 
208  IrpContext->Identifier.Type = 0;
209  IrpContext->Identifier.Size = 0;
210 
211  ExFreePool( IrpContext );
212 
213  } else {
214 
215  IrpContext->Identifier.Type = 0;
216  IrpContext->Identifier.Size = 0;
217 
220  TRUE );
221 
222  ExFreeToNPagedLookasideList(&(RfsdGlobal->RfsdIrpContextLookasideList), IrpContext);
223 
227 
228  }
229 }
230 
231 VOID
233  IN PRFSD_IRP_CONTEXT IrpContext,
234  IN PBCB Bcb
235  )
236 {
237  PRFSD_REPINNED_BCBS Repinned;
238 
239  Repinned = &IrpContext->Repinned;
240 
241  return;
242 
243 #if 0
244 
245  ULONG i;
246 
247  while (Repinned) {
248 
249  for (i = 0; i < RFSD_REPINNED_BCBS_ARRAY_SIZE; i += 1) {
250  if (Repinned->Bcb[i] == Bcb) {
251  return;
252  }
253  }
254 
255  Repinned = Repinned->Next;
256  }
257 
258  while (TRUE) {
259 
260  for (i = 0; i < RFSD_REPINNED_BCBS_ARRAY_SIZE; i += 1) {
261  if (Repinned->Bcb[i] == Bcb) {
262  return;
263  }
264 
265  if (Repinned->Bcb[i] == NULL) {
266  Repinned->Bcb[i] = Bcb;
267  CcRepinBcb( Bcb );
268 
269  return;
270  }
271  }
272 
273  if (Repinned->Next == NULL) {
275  RtlZeroMemory( Repinned->Next, sizeof(RFSD_REPINNED_BCBS) );
276  }
277 
278  Repinned = Repinned->Next;
279  }
280 
281 #endif
282 
283 }
284 
285 VOID
287  IN PRFSD_IRP_CONTEXT IrpContext
288  )
289 {
290  IO_STATUS_BLOCK RaiseIosb;
291  PRFSD_REPINNED_BCBS Repinned;
292  BOOLEAN WriteThroughToDisk;
294  BOOLEAN ForceVerify = FALSE;
295  ULONG i;
296 
297  Repinned = &IrpContext->Repinned;
298  RaiseIosb.Status = STATUS_SUCCESS;
299 
300  WriteThroughToDisk = (BOOLEAN) (IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WRITE_THROUGH) ||
301  IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_FLOPPY));
302 
303  while (Repinned != NULL) {
304  for (i = 0; i < RFSD_REPINNED_BCBS_ARRAY_SIZE; i += 1) {
305  if (Repinned->Bcb[i] != NULL) {
307 
309 
310  if ( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_FLOPPY) ) {
311  FileObject = CcGetFileObjectFromBcb( Repinned->Bcb[i] );
312  }
313 
315 
316  CcUnpinRepinnedBcb( Repinned->Bcb[i],
317  WriteThroughToDisk,
318  &Iosb );
319 
321 
322  if ( !NT_SUCCESS(Iosb.Status) ) {
323  if (RaiseIosb.Status == STATUS_SUCCESS) {
324  RaiseIosb = Iosb;
325  }
326 
327  if (FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_FLOPPY) &&
328  (IrpContext->MajorFunction != IRP_MJ_CLEANUP) &&
329  (IrpContext->MajorFunction != IRP_MJ_FLUSH_BUFFERS) &&
330  (IrpContext->MajorFunction != IRP_MJ_SET_INFORMATION)) {
331 
332  CcPurgeCacheSection( FileObject->SectionObjectPointer,
333  NULL,
334  0,
335  FALSE );
336 
337  ForceVerify = TRUE;
338  }
339  }
340 
341  Repinned->Bcb[i] = NULL;
342 
343  } else {
344 
345  break;
346  }
347  }
348 
349  if (Repinned != &IrpContext->Repinned)
350 {
351  PRFSD_REPINNED_BCBS Saved;
352 
353  Saved = Repinned->Next;
354  ExFreePool( Repinned );
355  Repinned = Saved;
356 
357  } else {
358 
359  Repinned = Repinned->Next;
360  IrpContext->Repinned.Next = NULL;
361  }
362  }
363 
364  if (!NT_SUCCESS(RaiseIosb.Status)) {
365 
366  DbgBreak();
367 
368  if (ForceVerify && FileObject) {
369  SetFlag(FileObject->DeviceObject->Flags, DO_VERIFY_VOLUME);
370  IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
371  FileObject->DeviceObject );
372  }
373 
374  IrpContext->Irp->IoStatus = RaiseIosb;
375  RfsdNormalizeAndRaiseStatus(IrpContext, RaiseIosb.Status );
376  }
377 
378  return;
379 }
380 
382 PRFSD_FCB
384  IN PRFSD_MCB RfsdMcb,
385  IN PRFSD_INODE Inode )
386 {
387  PRFSD_FCB Fcb;
388 
389  PAGED_CODE();
390 
393  TRUE );
394 
395  Fcb = (PRFSD_FCB) ExAllocateFromNPagedLookasideList(
397 
401 
402  if (Fcb == NULL) {
404 
405  RtlZeroMemory(Fcb, sizeof(RFSD_FCB));
406 
408  } else {
409  RtlZeroMemory(Fcb, sizeof(RFSD_FCB));
410  }
411 
412  if (!Fcb) {
413  return NULL;
414  }
415 
417  Fcb->Identifier.Size = sizeof(RFSD_FCB);
418 
420  &Fcb->FileLockAnchor,
421  NULL,
422  NULL );
423 
424  Fcb->OpenHandleCount = 0;
425  Fcb->ReferenceCount = 0;
426 
427  Fcb->Vcb = Vcb;
428 
429 #if DBG
430 
431  Fcb->AnsiFileName.MaximumLength = (USHORT)
432  RfsdUnicodeToOEMSize(&(RfsdMcb->ShortName)) + 1;
433 
434  Fcb->AnsiFileName.Buffer = (PUCHAR)
435  ExAllocatePoolWithTag(PagedPool, Fcb->AnsiFileName.MaximumLength, RFSD_POOL_TAG);
436 
437  if (!Fcb->AnsiFileName.Buffer) {
438  goto errorout;
439  }
440 
441  RtlZeroMemory(Fcb->AnsiFileName.Buffer, Fcb->AnsiFileName.MaximumLength);
442 
443  RfsdUnicodeToOEM( &(Fcb->AnsiFileName),
444  &(RfsdMcb->ShortName));
445 
446 #endif
447 
448  RfsdMcb->FileAttr = FILE_ATTRIBUTE_NORMAL;
449 
450  if (S_ISDIR(Inode->i_mode)) {
451  SetFlag(RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY);
452  }
453 
454  if ( IsFlagOn(Vcb->Flags, VCB_READ_ONLY) ||
455  RfsdIsReadOnly(Inode->i_mode)) {
456  SetFlag(RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
457  }
458 
459  Fcb->Inode = Inode;
460 
461  Fcb->RfsdMcb = RfsdMcb;
462  RfsdMcb->RfsdFcb = Fcb;
463 
465 
466  Fcb->Header.NodeTypeCode = (USHORT) RFSDFCB;
467  Fcb->Header.NodeByteSize = sizeof(RFSD_FCB);
468  Fcb->Header.IsFastIoPossible = FastIoIsNotPossible;
469  Fcb->Header.Resource = &(Fcb->MainResource);
470  Fcb->Header.PagingIoResource = &(Fcb->PagingIoResource);
471 
472  // NOTE: In EXT2, the low part was stored in i_size (a 32-bit value); the high part would be stored in the acl field...
473  // However, on ReiserFS, the i_size is a 64-bit value.
474  Fcb->Header.FileSize.QuadPart = Fcb->Inode->i_size;
475 
476 
477  Fcb->Header.AllocationSize.QuadPart =
478  CEILING_ALIGNED(Fcb->Header.FileSize.QuadPart, (ULONGLONG)Vcb->BlockSize);
479 
480  Fcb->Header.ValidDataLength.QuadPart = (LONGLONG)(0x7fffffffffffffff);
481 
482  Fcb->SectionObject.DataSectionObject = NULL;
483  Fcb->SectionObject.SharedCacheMap = NULL;
484  Fcb->SectionObject.ImageSectionObject = NULL;
485 
488 
489  InsertTailList(&Vcb->FcbList, &Fcb->Next);
490 
491 #if DBG
492 
495  TRUE );
496 
497  RfsdGlobal->FcbAllocated++;
498 
502 #endif
503 
504  return Fcb;
505 
506 #if DBG
507 errorout:
508 #endif
509 
510  if (Fcb) {
511 
512 #if DBG
513  if (Fcb->AnsiFileName.Buffer)
514  ExFreePool(Fcb->AnsiFileName.Buffer);
515 #endif
516 
517  if (FlagOn(Fcb->Flags, FCB_FROM_POOL)) {
518 
519  ExFreePool( Fcb );
520 
521  } else {
522 
525  TRUE );
526 
527  ExFreeToNPagedLookasideList(&(RfsdGlobal->RfsdFcbLookasideList), Fcb);
528 
532  }
533 
534  }
535 
536  return NULL;
537 }
538 
540 VOID
542 {
543  PRFSD_VCB Vcb;
544 
545  PAGED_CODE();
546 
547  ASSERT(Fcb != NULL);
548 
549  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
550  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
551 
552  Vcb = Fcb->Vcb;
553 
554  FsRtlUninitializeFileLock(&Fcb->FileLockAnchor);
555 
557 
559 
560  Fcb->RfsdMcb->RfsdFcb = NULL;
561 
563  if (Fcb->RfsdMcb) {
564  RfsdDeleteMcbNode(Vcb, Fcb->RfsdMcb->Parent, Fcb->RfsdMcb);
565  RfsdFreeMcb(Fcb->RfsdMcb);
566  }
567  }
568 
569  if (Fcb->LongName.Buffer) {
570  ExFreePool(Fcb->LongName.Buffer);
571  Fcb->LongName.Buffer = NULL;
572  }
573 
574 #if DBG
575  ExFreePool(Fcb->AnsiFileName.Buffer);
576 #endif
577 
578  ExFreePool(Fcb->Inode);
579 
580  Fcb->Header.NodeTypeCode = (SHORT)0xCCCC;
581  Fcb->Header.NodeByteSize = (SHORT)0xC0C0;
582 
583  if (FlagOn(Fcb->Flags, FCB_FROM_POOL)) {
584 
585  ExFreePool( Fcb );
586 
587  } else {
588 
591  TRUE );
592 
593  ExFreeToNPagedLookasideList(&(RfsdGlobal->RfsdFcbLookasideList), Fcb);
594 
598  }
599 
600 #if DBG
601 
604  TRUE );
605 
606  RfsdGlobal->FcbAllocated--;
607 
611 #endif
612 
613 }
614 
616 PRFSD_CCB
618 {
619  PRFSD_CCB Ccb;
620 
621  PAGED_CODE();
622 
625  TRUE );
626 
627  Ccb = (PRFSD_CCB) (ExAllocateFromNPagedLookasideList( &(RfsdGlobal->RfsdCcbLookasideList)));
628 
632 
633  if (Ccb == NULL) {
635 
636  RtlZeroMemory(Ccb, sizeof(RFSD_CCB));
637 
639  } else {
640  RtlZeroMemory(Ccb, sizeof(RFSD_CCB));
641  }
642 
643  if (!Ccb) {
644  return NULL;
645  }
646 
648  Ccb->Identifier.Size = sizeof(RFSD_CCB);
649 
650  Ccb->CurrentByteOffset = 0;
651 
652  Ccb->DirectorySearchPattern.Length = 0;
653  Ccb->DirectorySearchPattern.MaximumLength = 0;
654  Ccb->DirectorySearchPattern.Buffer = 0;
655 
656  return Ccb;
657 }
658 
660 VOID
662 {
663  PAGED_CODE();
664 
665  ASSERT(Ccb != NULL);
666 
667  ASSERT((Ccb->Identifier.Type == RFSDCCB) &&
668  (Ccb->Identifier.Size == sizeof(RFSD_CCB)));
669 
670  if (Ccb->DirectorySearchPattern.Buffer != NULL) {
671  ExFreePool(Ccb->DirectorySearchPattern.Buffer);
672  }
673 
674  if (FlagOn(Ccb->Flags, CCB_FROM_POOL)) {
675 
676  ExFreePool( Ccb );
677 
678  } else {
679 
682  TRUE );
683 
684  ExFreeToNPagedLookasideList(&(RfsdGlobal->RfsdCcbLookasideList), Ccb);
685 
689  }
690 }
691 
693 PRFSD_MCB
695 {
696  PRFSD_MCB Mcb = NULL;
698  ULONG Extra = 0;
699 
700  PAGED_CODE();
701 
702 #define MCB_NUM_SHIFT 0x04
703 
705  Extra = RfsdGlobal->McbAllocated -
708 
710  "RfsdAllocateMcb: CurrDepth=%xh/%xh/%xh FileName=%S\n",
713  RfsdGlobal->FcbAllocated,
714  FileName->Buffer));
715 
716  List = Vcb->McbList.Flink;
717 
718  while ((List != &(Vcb->McbList)) && (Extra > 0)) {
720  List = List->Flink;
721 
722  if ((!RFSD_IS_ROOT_KEY(Mcb->Key)) && (Mcb->Child == NULL) &&
723  (Mcb->RfsdFcb == NULL) && (!IsMcbUsed(Mcb))) {
724  RfsdPrint((DBG_INFO, "RfsdAllocateMcb: Mcb %S will be freed.\n",
725  Mcb->ShortName.Buffer));
726 
727  if (RfsdDeleteMcbNode(Vcb, Vcb->McbTree, Mcb)) {
728  RfsdFreeMcb(Mcb);
729 
730  Extra--;
731  }
732  }
733  }
734 
737  TRUE );
738 
739  Mcb = (PRFSD_MCB) (ExAllocateFromPagedLookasideList(
741 
745 
746  if (Mcb == NULL) {
748 
749  RtlZeroMemory(Mcb, sizeof(RFSD_MCB));
750 
751  SetFlag(Mcb->Flags, MCB_FROM_POOL);
752  } else {
753  RtlZeroMemory(Mcb, sizeof(RFSD_MCB));
754  }
755 
756  if (!Mcb) {
757  return NULL;
758  }
759 
760  Mcb->Identifier.Type = RFSDMCB;
761  Mcb->Identifier.Size = sizeof(RFSD_MCB);
762 
763  if (FileName && FileName->Length) {
764 
765  Mcb->ShortName.Length = FileName->Length;
766  Mcb->ShortName.MaximumLength = Mcb->ShortName.Length + 2;
767 
768  Mcb->ShortName.Buffer = ExAllocatePoolWithTag(PagedPool, Mcb->ShortName.MaximumLength, RFSD_POOL_TAG);
769 
770  if (!Mcb->ShortName.Buffer)
771  goto errorout;
772 
773  RtlZeroMemory(Mcb->ShortName.Buffer, Mcb->ShortName.MaximumLength);
774  RtlCopyMemory(Mcb->ShortName.Buffer, FileName->Buffer, Mcb->ShortName.Length);
775  }
776 
777  Mcb->FileAttr = FileAttr;
778 
781  TRUE );
782 
784 
788 
789  return Mcb;
790 
791 errorout:
792 
793  if (Mcb) {
794 
795  if (Mcb->ShortName.Buffer)
796  ExFreePool(Mcb->ShortName.Buffer);
797 
798  if (FlagOn(Mcb->Flags, MCB_FROM_POOL)) {
799 
800  ExFreePool( Mcb );
801 
802  } else {
803 
806  TRUE );
807 
808  ExFreeToPagedLookasideList(&(RfsdGlobal->RfsdMcbLookasideList), Mcb);
809 
813  }
814  }
815 
816  return NULL;
817 }
818 
820 VOID
822 {
823 #ifndef __REACTOS__
824  PRFSD_MCB Parent = Mcb->Parent;
825 #endif
826 
827  ASSERT(Mcb != NULL);
828 
829  ASSERT((Mcb->Identifier.Type == RFSDMCB) &&
830  (Mcb->Identifier.Size == sizeof(RFSD_MCB)));
831 
832  RfsdPrint((DBG_INFO, "RfsdFreeMcb: Mcb %S will be freed.\n", Mcb->ShortName.Buffer));
833 
834  if (Mcb->ShortName.Buffer)
835  ExFreePool(Mcb->ShortName.Buffer);
836 
837  if (FlagOn(Mcb->Flags, MCB_FROM_POOL)) {
838 
839  ExFreePool( Mcb );
840 
841  } else {
842 
845  TRUE );
846 
847  ExFreeToPagedLookasideList(&(RfsdGlobal->RfsdMcbLookasideList), Mcb);
848 
852  }
853 
856  TRUE );
857 
859 
863 }
864 
866 PRFSD_FCB
868 {
869  PRFSD_FCB Fcb = NULL;
870  RFSD_INODE RfsdIno;
871 
872  PAGED_CODE();
873 
874  if (Mcb->RfsdFcb)
875  return Mcb->RfsdFcb;
876 
877  if (RfsdLoadInode(Vcb, &(Mcb->Key), &RfsdIno)) {
879  if (!pTmpInode) {
880  goto errorout;
881  }
882 
883  RtlCopyMemory(pTmpInode, &RfsdIno, sizeof(RFSD_INODE));
884  Fcb = RfsdAllocateFcb(Vcb, Mcb, pTmpInode);
885  if (!Fcb) {
886  ExFreePool(pTmpInode);
887  }
888  }
889 
890 errorout:
891 
892  return Fcb;
893 }
894 
895 BOOLEAN
897 {
898  USHORT Length = 0;
899  PRFSD_MCB TmpMcb = Mcb;
900  PUNICODE_STRING FileNames[256];
901  SHORT Count = 0 , i = 0, j = 0;
902 
903  PAGED_CODE();
904 
905  while(TmpMcb && Count < 256) {
906  if (RFSD_IS_ROOT_KEY(TmpMcb->Key))
907  break;
908 
909  FileNames[Count++] = &TmpMcb->ShortName;
910  Length += (2 + TmpMcb->ShortName.Length);
911 
912  TmpMcb = TmpMcb->Parent;
913  }
914 
915  if (Count >= 256)
916  return FALSE;
917 
918  if (Count ==0)
919  Length = 2;
920 
921  FileName->Length = Length;
922  FileName->MaximumLength = Length + 2;
924 
925  if (!FileName->Buffer) {
926  return FALSE;
927  }
928 
929  RtlZeroMemory(FileName->Buffer, FileName->MaximumLength);
930 
931  if (Count == 0) {
932  FileName->Buffer[0] = L'\\';
933  return TRUE;
934  }
935 
936  for (i = Count - 1; i >= 0 && j < (SHORT)(FileName->MaximumLength); i--) {
937  FileName->Buffer[j++] = L'\\';
938 
939  RtlCopyMemory( &(FileName->Buffer[j]),
940  FileNames[i]->Buffer,
941  FileNames[i]->Length );
942 
943  j += FileNames[i]->Length / 2;
944  }
945 
946  return TRUE;
947 }
948 
949 PRFSD_MCB
951  PRFSD_MCB RfsdMcb,
953 {
954  PRFSD_MCB Mcb = NULL;
956  BOOLEAN bFind = FALSE;
957 
958  PAGED_CODE();
959 
960  List = Vcb->McbList.Flink;
961 
962  while ((!bFind) && (List != &(Vcb->McbList))) {
964  List = List->Flink;
965 
966  if (CompareShortKeys(&(Mcb->Key), Key) == RFSD_KEYS_MATCH) {
967  bFind = TRUE;
968  break;
969  }
970  }
971 
972  if (bFind) {
973  ASSERT(Mcb != NULL);
975  } else {
976  Mcb = NULL;
977  }
978 
979  return Mcb;
980 }
981 
986 PRFSD_MCB
990 {
991  PRFSD_MCB TmpMcb = Parent->Child;
992 
993  PAGED_CODE();
994 
995  while (TmpMcb) {
997  &(TmpMcb->ShortName),
998  FileName, TRUE ))
999  break;
1000 
1001  TmpMcb = TmpMcb->Next;
1002  }
1003 
1004  if (TmpMcb) {
1005  RfsdRefreshMcb(Vcb, TmpMcb);
1006  }
1007 
1008  return TmpMcb;
1009 }
1010 
1011 VOID
1013 {
1014  PAGED_CODE();
1015 
1016  ASSERT (IsFlagOn(Mcb->Flags, MCB_IN_TREE));
1017 
1018  RemoveEntryList(&(Mcb->Link));
1019  InsertTailList(&(Vcb->McbList), &(Mcb->Link));
1020 }
1021 
1022 VOID
1024 {
1025  PRFSD_MCB TmpMcb = Parent->Child;
1026 
1027  PAGED_CODE();
1028 
1029  if(IsFlagOn(Child->Flags, MCB_IN_TREE)) {
1030  DbgBreak();
1031  RfsdPrint((DBG_ERROR, "RfsdAddMcbNode: Child Mcb is alreay in the tree.\n"));
1032  return;
1033  }
1034 
1035  if (TmpMcb) {
1036  ASSERT(TmpMcb->Parent == Parent);
1037 
1038  while (TmpMcb->Next) {
1039  TmpMcb = TmpMcb->Next;
1040  ASSERT(TmpMcb->Parent == Parent);
1041  }
1042 
1043  TmpMcb->Next = Child;
1044  Child->Parent = Parent;
1045  Child->Next = NULL;
1046  } else {
1047  Parent->Child = Child;
1048  Child->Parent = Parent;
1049  Child->Next = NULL;
1050  }
1051 
1052  InsertTailList(&(Vcb->McbList), &(Child->Link));
1053  SetFlag(Child->Flags, MCB_IN_TREE);
1054 }
1055 
1056 BOOLEAN
1058 {
1059  PRFSD_MCB TmpMcb;
1060 
1061  PAGED_CODE();
1062 
1063  if(!IsFlagOn(RfsdMcb->Flags, MCB_IN_TREE)) {
1064  return TRUE;
1065  }
1066 
1067  if (RfsdMcb->Parent) {
1068  if (RfsdMcb->Parent->Child == RfsdMcb) {
1069  RfsdMcb->Parent->Child = RfsdMcb->Next;
1070  } else {
1071  TmpMcb = RfsdMcb->Parent->Child;
1072 
1073  while (TmpMcb && TmpMcb->Next != RfsdMcb)
1074  TmpMcb = TmpMcb->Next;
1075 
1076  if (TmpMcb) {
1077  TmpMcb->Next = RfsdMcb->Next;
1078  } else {
1079  // error
1080  return FALSE;
1081  }
1082  }
1083  } else if (RfsdMcb->Child) {
1084  return FALSE;
1085  }
1086 
1087  RemoveEntryList(&(RfsdMcb->Link));
1088  ClearFlag(RfsdMcb->Flags, MCB_IN_TREE);
1089 
1090  return TRUE;
1091 }
1092 
1095 {
1096  PAGED_CODE();
1097 
1098  if (!McbTree)
1099  return;
1100 
1101  if (McbTree->Child) {
1102  RfsdFreeMcbTree(McbTree->Child);
1103  }
1104 
1105  if (McbTree->Next) {
1106 
1107  PRFSD_MCB Current;
1108  PRFSD_MCB Next;
1109 
1110  Current = McbTree->Next;
1111 
1112  while (Current) {
1113 
1114  Next = Current->Next;
1115 
1116  if (Current->Child) {
1117  RfsdFreeMcbTree(Current->Child);
1118  }
1119 
1120  RfsdFreeMcb(Current);
1121  Current = Next;
1122  }
1123  }
1124 
1125  RfsdFreeMcb(McbTree);
1126 }
1127 
1128 #if !RFSD_READ_ONLY
1129 
1130 BOOLEAN
1132 {
1133  ULONG Group, dwBlk, Length;
1134 
1135  RTL_BITMAP BlockBitmap;
1136  PVOID BitmapCache;
1137  PBCB BitmapBcb;
1138 
1140 
1141  BOOLEAN bModified = FALSE;
1142 
1143  PAGED_CODE();
1144 #if 0
1146 
1147  dwBlk = (Block - RFSD_FIRST_DATA_BLOCK) % BLOCKS_PER_GROUP;
1148 
1149 
1150  Offset.QuadPart = (LONGLONG) Vcb->BlockSize;
1151  Offset.QuadPart = Offset.QuadPart * Vcb->GroupDesc[Group].bg_block_bitmap;
1152 
1153  if (Group == Vcb->NumOfGroups - 1) {
1155 
1156  /* s_blocks_count is integer multiple of s_blocks_per_group */
1157  if (Length == 0)
1159  } else {
1161  }
1162 
1163  if (dwBlk >= Length)
1164  return FALSE;
1165 
1166  if (!CcPinRead( Vcb->StreamObj,
1167  &Offset,
1168  Vcb->BlockSize,
1169  PIN_WAIT,
1170  &BitmapBcb,
1171  &BitmapCache ) ) {
1172 
1173  RfsdPrint((DBG_ERROR, "RfsdDeleteBlock: PinReading error ...\n"));
1174  return FALSE;
1175  }
1176 
1177  RtlInitializeBitMap( &BlockBitmap,
1178  BitmapCache,
1179  Length );
1180 
1181  if (RtlCheckBit(&BlockBitmap, dwBlk) == 0) {
1182  DbgBreak();
1183  RtlSetBits(&BlockBitmap, dwBlk, 1);
1184  bModified = TRUE;
1185  }
1186 
1187  if (bModified) {
1188 
1189  CcSetDirtyPinnedData(BitmapBcb, NULL );
1190 
1191  RfsdRepinBcb(IrpContext, BitmapBcb);
1192 
1193  RfsdAddMcbEntry(Vcb, Offset.QuadPart, (LONGLONG)Vcb->BlockSize);
1194  }
1195 
1196  {
1197  CcUnpinData(BitmapBcb);
1198  BitmapBcb = NULL;
1199  BitmapCache = NULL;
1200 
1201  RtlZeroMemory(&BlockBitmap, sizeof(RTL_BITMAP));
1202  }
1203 #endif // 0
1204  return (!bModified);
1205 }
1206 
1207 BOOLEAN
1209 {
1210  ULONG i, j, InodeBlocks;
1211 
1212  PAGED_CODE();
1213 #if 0
1214  for (i = 0; i < Vcb->NumOfGroups; i++) {
1215 
1216  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_block_bitmap);
1217  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_inode_bitmap);
1218 
1219 
1220  if (i == Vcb->NumOfGroups - 1) {
1221  InodeBlocks = ((INODES_COUNT % INODES_PER_GROUP) *
1222  sizeof(RFSD_INODE) + Vcb->BlockSize - 1) /
1223  (Vcb->BlockSize);
1224  } else {
1225  InodeBlocks = (INODES_PER_GROUP * sizeof(RFSD_INODE) + Vcb->BlockSize - 1) / (Vcb->BlockSize);
1226  }
1227 
1228  for (j = 0; j < InodeBlocks; j++ )
1229  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_inode_table + j);
1230  }
1231 #endif // 0
1232  return TRUE;
1233 }
1234 
1235 #endif // !RFSD_READ_ONLY
1236 
1237 VOID
1239 {
1240  InsertTailList(&(RfsdGlobal->VcbList), &Vcb->Next);
1241 }
1242 
1243 VOID
1245 {
1246  RemoveEntryList(&Vcb->Next);
1247 }
1248 
1250 NTSTATUS
1252  IN PRFSD_VCB Vcb,
1253  IN PRFSD_SUPER_BLOCK RfsdSb,
1255  IN PDEVICE_OBJECT VolumeDevice,
1256  IN PVPB Vpb )
1257 {
1258  BOOLEAN VcbResourceInitialized = FALSE;
1259  USHORT VolumeLabelLength;
1260  ULONG IoctlSize;
1261  BOOLEAN NotifySyncInitialized = FALSE;
1262  LONGLONG DiskSize;
1263  LONGLONG PartSize;
1266  USHORT Buffer[2];
1267  ULONG ChangeCount;
1268  char s_volume_name[16] = "ReiserFS\0"; /* volume name */ // FUTURE: pull in from v2 superblock, if available
1269  int templen;
1270 
1271  PAGED_CODE();
1272 
1273  _SEH2_TRY {
1274 
1275  if (!Vpb) {
1276 
1278  _SEH2_LEAVE;
1279  }
1280 
1281  RfsdPrint((DBG_ERROR, "RfsdInitializeVcb: Flink = %xh McbList = %xh\n",
1282  Vcb->McbList.Flink, &(Vcb->McbList.Flink)));
1283 
1284 #if RFSD_READ_ONLY
1285  SetFlag(Vcb->Flags, VCB_READ_ONLY);
1286 #endif //READ_ONLY
1287 
1288  if (IsFlagOn(Vpb->RealDevice->Characteristics, FILE_REMOVABLE_MEDIA)) {
1289  SetFlag(Vcb->Flags, VCB_REMOVABLE_MEDIA);
1290  }
1291 
1292  if (IsFlagOn(Vpb->RealDevice->Characteristics, FILE_FLOPPY_DISKETTE)) {
1293  SetFlag(Vcb->Flags, VCB_FLOPPY_DISK);
1294  }
1295 
1296  /*if (IsFlagOn(RfsdGlobal->Flags, RFSD_SUPPORT_WRITING)) {
1297  if ((IsFlagOn(RfsdSb->s_feature_incompat, EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) ||
1298  IsFlagOn(RfsdSb->s_feature_incompat, EXT3_FEATURE_INCOMPAT_RECOVER) ||
1299  IsFlagOn(RfsdSb->s_feature_compat, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) ) {
1300  if(IsFlagOn(RfsdGlobal->Flags, EXT3_FORCE_WRITING)) {
1301  ClearFlag(Vcb->Flags, VCB_READ_ONLY);
1302  } else {
1303  SetFlag(Vcb->Flags, VCB_READ_ONLY);
1304  }
1305  } else {
1306  ClearFlag(Vcb->Flags, VCB_READ_ONLY);
1307  }
1308  } else {
1309  SetFlag(Vcb->Flags, VCB_READ_ONLY);
1310  }*/
1311  // RFSD will be read only.
1312  SetFlag(Vcb->Flags, VCB_READ_ONLY);
1313 
1314  ExInitializeResourceLite(&Vcb->MainResource);
1315  ExInitializeResourceLite(&Vcb->PagingIoResource);
1316 
1317  ExInitializeResourceLite(&Vcb->McbResource);
1318 
1319  VcbResourceInitialized = TRUE;
1320 
1321  Vcb->Vpb = Vpb;
1322 
1323  Vcb->RealDevice = Vpb->RealDevice;
1324  Vpb->DeviceObject = VolumeDevice;
1325 
1326  {
1327  UNICODE_STRING LabelName;
1329 
1330 
1331 
1332  LabelName.MaximumLength = 16 * 2;
1333  LabelName.Length = 0;
1334  LabelName.Buffer = Vcb->Vpb->VolumeLabel;
1335 
1336  RtlZeroMemory(LabelName.Buffer, LabelName.MaximumLength);
1337 
1338  VolumeLabelLength = 16;
1339 
1340  while( (VolumeLabelLength > 0) &&
1341  ((s_volume_name[VolumeLabelLength-1] == '\0') ||
1342  (s_volume_name[VolumeLabelLength-1] == ' ')) ) {
1343  VolumeLabelLength--;
1344  }
1345 
1346  OemName.Buffer = s_volume_name;
1347  OemName.MaximumLength = 16;
1348  OemName.Length = VolumeLabelLength;
1349 
1350  templen = RtlOemStringToUnicodeSize(&OemName);
1351 
1352  Status = RfsdOEMToUnicode( &LabelName,
1353  &OemName );
1354 
1355  if (!NT_SUCCESS(Status)) {
1356  _SEH2_LEAVE;
1357  }
1358 
1359  Vpb->VolumeLabelLength = LabelName.Length;
1360  }
1361 
1362 #if DISABLED
1363  Vpb->SerialNumber = ((ULONG*)RfsdSb->s_uuid)[0] + ((ULONG*)RfsdSb->s_uuid)[1] +
1364  ((ULONG*)RfsdSb->s_uuid)[2] + ((ULONG*)RfsdSb->s_uuid)[3];
1365 #endif
1366 
1367  Vcb->StreamObj = IoCreateStreamFileObject( NULL, Vcb->Vpb->RealDevice);
1368 
1369  if (Vcb->StreamObj) {
1370 
1371  Vcb->StreamObj->SectionObjectPointer = &(Vcb->SectionObject);
1372  Vcb->StreamObj->Vpb = Vcb->Vpb;
1373  Vcb->StreamObj->ReadAccess = TRUE;
1374  if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY))
1375  {
1376  Vcb->StreamObj->WriteAccess = TRUE;
1377  Vcb->StreamObj->DeleteAccess = TRUE;
1378  }
1379  else
1380  {
1381  Vcb->StreamObj->WriteAccess = TRUE;
1382  Vcb->StreamObj->DeleteAccess = TRUE;
1383  }
1384  Vcb->StreamObj->FsContext = (PVOID) Vcb;
1385  Vcb->StreamObj->FsContext2 = NULL;
1386  Vcb->StreamObj->Vpb = Vcb->Vpb;
1387 
1388  SetFlag(Vcb->StreamObj->Flags, FO_NO_INTERMEDIATE_BUFFERING);
1389  } else {
1390  _SEH2_LEAVE;
1391  }
1392 
1393  InitializeListHead(&Vcb->FcbList);
1394 
1395  InitializeListHead(&Vcb->NotifyList);
1396 
1397  FsRtlNotifyInitializeSync(&Vcb->NotifySync);
1398 
1399  NotifySyncInitialized = TRUE;
1400 
1401  Vcb->DeviceObject = VolumeDevice;
1402 
1403  Vcb->TargetDeviceObject = TargetDevice;
1404 
1405  Vcb->OpenFileHandleCount = 0;
1406 
1407  Vcb->ReferenceCount = 0;
1408 
1409  Vcb->SuperBlock = RfsdSb;
1410 
1411  Vcb->Header.NodeTypeCode = (USHORT) RFSDVCB;
1412  Vcb->Header.NodeByteSize = sizeof(RFSD_VCB);
1413  Vcb->Header.IsFastIoPossible = FastIoIsNotPossible;
1414  Vcb->Header.Resource = &(Vcb->MainResource);
1415  Vcb->Header.PagingIoResource = &(Vcb->PagingIoResource);
1416 
1417  Vcb->Vpb->SerialNumber = 'MATT';
1418 
1419  DiskSize =
1420  Vcb->DiskGeometry.Cylinders.QuadPart *
1421  Vcb->DiskGeometry.TracksPerCylinder *
1422  Vcb->DiskGeometry.SectorsPerTrack *
1423  Vcb->DiskGeometry.BytesPerSector;
1424 
1425  IoctlSize = sizeof(PARTITION_INFORMATION);
1426 
1428  TargetDevice,
1430  NULL,
1431  0,
1432  &Vcb->PartitionInformation,
1433  &IoctlSize );
1434 
1435  PartSize = Vcb->PartitionInformation.PartitionLength.QuadPart;
1436 
1437  if (!NT_SUCCESS(Status)) {
1438  Vcb->PartitionInformation.StartingOffset.QuadPart = 0;
1439 
1440  Vcb->PartitionInformation.PartitionLength.QuadPart =
1441  DiskSize;
1442 
1443  PartSize = DiskSize;
1444 
1446  }
1447 
1448  IoctlSize = sizeof(ULONG);
1450  TargetDevice,
1452  NULL,
1453  0,
1454  &ChangeCount,
1455  &IoctlSize );
1456 
1457  if (!NT_SUCCESS(Status)) {
1458  _SEH2_LEAVE;
1459  }
1460 
1461  Vcb->ChangeCount = ChangeCount;
1462 
1463  Vcb->Header.AllocationSize.QuadPart =
1464  Vcb->Header.FileSize.QuadPart = PartSize;
1465 
1466  Vcb->Header.ValidDataLength.QuadPart =
1467  (LONGLONG)(0x7fffffffffffffff);
1468 /*
1469  Vcb->Header.AllocationSize.QuadPart = (LONGLONG)(rfsd_super_block->s_blocks_count - rfsd_super_block->s_free_blocks_count)
1470  * (RFSD_MIN_BLOCK << rfsd_super_block->s_log_block_size);
1471  Vcb->Header.FileSize.QuadPart = Vcb->Header.AllocationSize.QuadPart;
1472  Vcb->Header.ValidDataLength.QuadPart = Vcb->Header.AllocationSize.QuadPart;
1473 */
1474  {
1476 
1479  Vcb->Header.AllocationSize.QuadPart;
1480 
1481  FileSizes.ValidDataLength.QuadPart= (LONGLONG)(0x7fffffffffffffff);
1482 
1483  CcInitializeCacheMap( Vcb->StreamObj,
1484  &FileSizes,
1485  TRUE,
1487  Vcb );
1488  }
1489 #if DISABLED // IN FFFS TOO
1490  if (!RfsdLoadGroup(Vcb)) {
1492  _SEH2_LEAVE;
1493  }
1494 #endif
1495 
1496  FsRtlInitializeLargeMcb(&(Vcb->DirtyMcbs), PagedPool);
1497  InitializeListHead(&(Vcb->McbList));
1498 
1499 
1500  //
1501  // Now allocating the mcb for root ...
1502  //
1503 
1504  Buffer[0] = L'\\';
1505  Buffer[1] = 0;
1506 
1507  RootNode.Buffer = Buffer;
1508  RootNode.MaximumLength = RootNode.Length = 2;
1509 
1510  Vcb->McbTree = RfsdAllocateMcb( Vcb, &RootNode,
1512 
1513  if (!Vcb->McbTree) {
1514  _SEH2_LEAVE;
1515  }
1516 
1517  // Set the root of the filesystem to the root directory's inode / stat data structure
1518  Vcb->McbTree->Key.k_dir_id = RFSD_ROOT_PARENT_ID;
1519  Vcb->McbTree->Key.k_objectid = RFSD_ROOT_OBJECT_ID;
1520  Vcb->McbTree->Key.k_offset = 0;
1521  Vcb->McbTree->Key.k_type = RFSD_KEY_TYPE_v1_STAT_DATA;
1522 
1523 #ifdef DISABLED
1525  RfsdCheckBitmapConsistency(IrpContext, Vcb);
1526  }
1527 
1528  {
1529  ULONG dwData[RFSD_BLOCK_TYPES] = {RFSD_NDIR_BLOCKS, 1, 1, 1};
1530  ULONG dwMeta[RFSD_BLOCK_TYPES] = {0, 0, 0, 0};
1531  ULONG i;
1532 
1533  KdPrint(("Reminder: " __FUNCTION__ ", dwData, dwMeta??\n"));
1534 
1535  for (i = 0; i < RFSD_BLOCK_TYPES; i++) {
1536  dwData[i] = dwData[i] << ((BLOCK_BITS - 2) * i);
1537 
1538  if (i > 0) {
1539  dwMeta[i] = 1 + (dwMeta[i - 1] << (BLOCK_BITS - 2));
1540  }
1541 
1542  Vcb->dwData[i] = dwData[i];
1543  Vcb->dwMeta[i] = dwMeta[i];
1544  }
1545  }
1546 #endif
1547 
1548  SetFlag(Vcb->Flags, VCB_INITIALIZED);
1549 
1550  } _SEH2_FINALLY {
1551 
1552  if (!NT_SUCCESS(Status)) {
1553 
1554  if (NotifySyncInitialized) {
1555  FsRtlNotifyUninitializeSync(&Vcb->NotifySync);
1556  }
1557 
1558  if (Vcb->GroupDesc) {
1559  ExFreePool(Vcb->GroupDesc);
1560  // CcUnpinData(Vcb->GroupDescBcb);
1561  Vcb->GroupDesc = NULL;
1562  }
1563 
1564  if (Vcb->SuperBlock) {
1565  ExFreePool(Vcb->SuperBlock);
1566  Vcb->SuperBlock = NULL;
1567  }
1568 
1569  if (VcbResourceInitialized) {
1570  ExDeleteResourceLite(&Vcb->MainResource);
1571  ExDeleteResourceLite(&Vcb->PagingIoResource);
1572  }
1573  }
1574  } _SEH2_END;
1575 
1576  return Status;
1577 }
1578 
1580 VOID
1582 {
1583  PAGED_CODE();
1584 
1585  ASSERT(Vcb != NULL);
1586 
1587  ASSERT((Vcb->Identifier.Type == RFSDVCB) &&
1588  (Vcb->Identifier.Size == sizeof(RFSD_VCB)));
1589 
1590  FsRtlNotifyUninitializeSync(&Vcb->NotifySync);
1591 
1592  if (Vcb->StreamObj) {
1593  if (IsFlagOn(Vcb->StreamObj->Flags, FO_FILE_MODIFIED)) {
1595 
1596  CcFlushCache(&(Vcb->SectionObject), NULL, 0, &IoStatus);
1597  ClearFlag(Vcb->StreamObj->Flags, FO_FILE_MODIFIED);
1598  }
1599 
1600  if (Vcb->StreamObj->PrivateCacheMap)
1601  RfsdSyncUninitializeCacheMap(Vcb->StreamObj);
1602 
1603  ObDereferenceObject(Vcb->StreamObj);
1604  Vcb->StreamObj = NULL;
1605  }
1606 
1607 #if DBG
1608  if (FsRtlNumberOfRunsInLargeMcb(&(Vcb->DirtyMcbs)) != 0) {
1609  LONGLONG DirtyVba;
1610  LONGLONG DirtyLba;
1611  LONGLONG DirtyLength;
1612  int i;
1613 
1614  for (i = 0; FsRtlGetNextLargeMcbEntry (&(Vcb->DirtyMcbs), i, &DirtyVba, &DirtyLba, &DirtyLength); i++)
1615  {
1616  RfsdPrint((DBG_INFO, "DirtyVba = %I64xh\n", DirtyVba));
1617  RfsdPrint((DBG_INFO, "DirtyLba = %I64xh\n", DirtyLba));
1618  RfsdPrint((DBG_INFO, "DirtyLen = %I64xh\n\n", DirtyLength));
1619  }
1620 
1621  DbgBreak();
1622  }
1623 #endif
1624 
1625  FsRtlUninitializeLargeMcb(&(Vcb->DirtyMcbs));
1626 
1627  RfsdFreeMcbTree(Vcb->McbTree);
1628 
1629  if (Vcb->GroupDesc) {
1630  ExFreePool(Vcb->GroupDesc);
1631  // CcUnpinData(Vcb->GroupDescBcb);
1632  Vcb->GroupDesc = NULL;
1633  }
1634 
1635  if (Vcb->SuperBlock) {
1636  ExFreePool(Vcb->SuperBlock);
1637  Vcb->SuperBlock = NULL;
1638  }
1639 
1640  ExDeleteResourceLite(&Vcb->McbResource);
1641 
1642  ExDeleteResourceLite(&Vcb->PagingIoResource);
1643 
1644  ExDeleteResourceLite(&Vcb->MainResource);
1645 
1646  IoDeleteDevice(Vcb->DeviceObject);
1647 }
1648 
1649 VOID
1652  )
1653 {
1654  CACHE_UNINITIALIZE_EVENT UninitializeCompleteEvent;
1655  NTSTATUS WaitStatus;
1656  LARGE_INTEGER RfsdLargeZero = {0,0};
1657 
1658  PAGED_CODE();
1659 
1660  KeInitializeEvent( &UninitializeCompleteEvent.Event,
1662  FALSE);
1663 
1665  &RfsdLargeZero,
1666  &UninitializeCompleteEvent );
1667 
1668  WaitStatus = KeWaitForSingleObject( &UninitializeCompleteEvent.Event,
1669  Executive,
1670  KernelMode,
1671  FALSE,
1672  NULL);
1673 
1674  ASSERT (NT_SUCCESS(WaitStatus));
1675 }
struct _RFSD_CCB * PRFSD_CCB
BOOLEAN IsSynchronous
Definition: rfsd.h:780
#define RFSD_ROOT_OBJECT_ID
Definition: rfsd.h:51
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTSTATUS RfsdDiskIoControl(IN PDEVICE_OBJECT DeviceOjbect, IN ULONG IoctlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize)
Definition: blockio.c:492
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
VOID RfsdInsertVcb(PRFSD_VCB Vcb)
Definition: memory.c:1238
PBCB Bcb[RFSD_REPINNED_BCBS_ARRAY_SIZE]
Definition: rfsd.h:369
#define RfsdIsReadOnly(m)
Definition: rfsd.h:295
NTSTATUS RfsdUnicodeToOEM(IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
Definition: misc.c:246
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define IN
Definition: typedefs.h:38
__drv_mustHoldCriticalRegion PRFSD_FCB RfsdCreateFcbFromMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb)
Definition: memory.c:867
#define RFSD_CHECKING_BITMAP
Definition: rfsd.h:450
__drv_mustHoldCriticalRegion PRFSD_FCB RfsdAllocateFcb(IN PRFSD_VCB Vcb, IN PRFSD_MCB RfsdMcb, IN PRFSD_INODE Inode)
Definition: memory.c:383
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP, PULONG, ULONG)
__drv_mustHoldCriticalRegion VOID RfsdFreeMcbTree(PRFSD_MCB McbTree)
Definition: memory.c:1094
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
#define MCB_FROM_POOL
Definition: ext2fs.h:943
BOOLEAN IsTopLevel
Definition: rfsd.h:783
#define IRP_MJ_FLUSH_BUFFERS
USHORT MaxDepth
Definition: rfsd.h:413
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
__drv_mustHoldCriticalRegion VOID RfsdFreeVcb(IN PRFSD_VCB Vcb)
Definition: memory.c:1581
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
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:688
VOID NTAPI FsRtlInitializeFileLock(IN PFILE_LOCK FileLock, IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL, IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL)
Definition: filelock.c:1261
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define CEILING_ALIGNED(T, A, B)
Definition: ext2fs.h:111
#define IRP_MJ_SHUTDOWN
UCHAR MinorFunction
Definition: rfsd.h:765
_In_ PIRP Irp
Definition: csq.h:116
ERESOURCE LAResource
Definition: rfsd.h:394
PRFSD_MCB Parent
Definition: rfsd.h:684
VOID NTAPI CcSetDirtyPinnedData(IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
Definition: cachesub.c:121
#define IRP_CONTEXT_FLAG_WRITE_THROUGH
Definition: ext2fs.h:1079
VOID NTAPI FsRtlUninitializeFileLock(IN PFILE_LOCK FileLock)
Definition: filelock.c:1278
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
unsigned char * PUCHAR
Definition: retypes.h:3
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
VOID RfsdRepinBcb(IN PRFSD_IRP_CONTEXT IrpContext, IN PBCB Bcb)
Definition: memory.c:232
NPAGED_LOOKASIDE_LIST RfsdIrpContextLookasideList
Definition: rfsd.h:414
__drv_mustHoldCriticalRegion NTSTATUS RfsdInitializeVcb(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_SUPER_BLOCK RfsdSb, IN PDEVICE_OBJECT TargetDevice, IN PDEVICE_OBJECT VolumeDevice, IN PVPB Vpb)
Definition: memory.c:1251
BOOLEAN RfsdAddMcbEntry(IN PRFSD_VCB Vcb, IN LONGLONG Lba, IN LONGLONG Length)
LONG NTSTATUS
Definition: precomp.h:26
#define IOCTL_DISK_CHECK_VERIFY
Definition: cdrw_usr.h:175
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pinsup.c:955
#define RFSD_FIRST_DATA_BLOCK
Definition: rfsd.h:126
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define RFSD_IS_ROOT_KEY(x)
Definition: rfsd.h:52
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define RFSD_POOL_TAG
Definition: rfsd.h:99
#define IRP_CONTEXT_FLAG_FROM_POOL
Definition: ext2fs.h:1077
#define PIN_WAIT
#define RtlCheckBit(BMH, BP)
Definition: rtlfuncs.h:3154
ULONG Flags
Definition: rfsd.h:680
PAGED_LOOKASIDE_LIST RfsdMcbLookasideList
Definition: rfsd.h:417
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
LIST_ENTRY VcbList
Definition: rfsd.h:410
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:716
static CC_FILE_SIZES FileSizes
BOOLEAN NTAPI IoIsOperationSynchronous(IN PIRP Irp)
Definition: irp.c:1882
#define FO_NO_INTERMEDIATE_BUFFERING
Definition: iotypes.h:1734
STRING OEM_STRING
Definition: umtypes.h:203
#define InsertTailList(ListHead, Entry)
struct _PARTITION_INFORMATION PARTITION_INFORMATION
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
VOID RfsdSyncUninitializeCacheMap(IN PFILE_OBJECT FileObject)
Definition: memory.c:1650
Definition: rfsd.h:327
ULONG NTAPI FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
Definition: largemcb.c:769
RFSD_KEY_IN_MEMORY Key
Definition: rfsd.h:697
Definition: rfsd.h:323
PFILE_OBJECT NTAPI CcGetFileObjectFromBcb(PVOID Bcb)
Definition: fssup.c:623
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
LARGE_INTEGER FileSize
Definition: cctypes.h:16
PFILE_OBJECT FileObject
Definition: rfsd.h:774
#define VCB_REMOVABLE_MEDIA
Definition: ext2fs.h:799
_SEH2_TRY
Definition: create.c:4250
Definition: rfsd.h:324
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
BOOLEAN NTAPI FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb, IN ULONG RunIndex, OUT PLONGLONG Vbn, OUT PLONGLONG Lbn, OUT PLONGLONG SectorCount)
Definition: largemcb.c:391
__drv_mustHoldCriticalRegion VOID RfsdFreeMcb(IN PRFSD_MCB Mcb)
Definition: memory.c:821
union _FCB::@685 LongName
#define FO_FILE_MODIFIED
Definition: iotypes.h:1744
#define RFSD_KEY_TYPE_v1_STAT_DATA
Definition: reiserfs.h:277
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RFSD_ROOT_PARENT_ID
Definition: rfsd.h:50
ERESOURCE CountResource
Definition: rfsd.h:391
VOID RfsdRemoveVcb(PRFSD_VCB Vcb)
Definition: memory.c:1244
#define IO_DISK_INCREMENT
Definition: iotypes.h:567
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
RFSD_KEY_COMPARISON CompareShortKeys(IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
Definition: rfsd.c:2811
struct _RFSD_FCB RFSD_FCB
#define TOTAL_BLOCKS
Definition: ext2fs.h:101
__drv_mustHoldCriticalRegion VOID RfsdFreeIrpContext(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: memory.c:192
short SHORT
Definition: pedump.c:59
#define FILE_REMOVABLE_MEDIA
Definition: nt_native.h:807
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
VOID NTAPI FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb, IN POOL_TYPE PoolType)
Definition: largemcb.c:450
unsigned char BOOLEAN
#define BLOCK_BITS
Definition: stream.h:22
smooth NULL
Definition: ftsmooth.c:416
RFSD_IDENTIFIER_TYPE Type
Definition: rfsd.h:336
PRFSD_MCB Next
Definition: rfsd.h:686
__drv_mustHoldCriticalRegion PRFSD_IRP_CONTEXT RfsdAllocateIrpContext(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: memory.c:48
PRFSD_MCB RfsdSearchMcb(PRFSD_VCB Vcb, PRFSD_MCB Parent, PUNICODE_STRING FileName)
Definition: memory.c:987
VOID RfsdAddMcbNode(PRFSD_VCB Vcb, PRFSD_MCB Parent, PRFSD_MCB Child)
Definition: memory.c:1023
UCHAR MajorFunction
Definition: rfsd.h:764
Definition: rfsd.h:326
Definition: bufpool.h:45
USHORT McbAllocated
Definition: rfsd.h:420
NPAGED_LOOKASIDE_LIST RfsdCcbLookasideList
Definition: rfsd.h:416
struct _RFSD_VCB RFSD_VCB
void * PVOID
Definition: retypes.h:9
_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
#define MCB_NUM_SHIFT
PFILE_OBJECT NTAPI IoCreateStreamFileObject(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
Definition: file.c:3186
PRFSD_MCB Child
Definition: rfsd.h:685
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
ULONG OpenHandleCount
Definition: ntfs.h:521
int64_t LONGLONG
Definition: typedefs.h:66
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ULONG Flags
Definition: rfsd.h:431
LIST_ENTRY List
Definition: psmgr.c:57
if(!(yy_init))
Definition: macro.lex.yy.c:714
VOID NTAPI CcUnpinRepinnedBcb(IN PVOID Bcb, IN BOOLEAN WriteThrough, OUT PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:343
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
Definition: fssup.c:193
char CCHAR
Definition: typedefs.h:50
uint64_t ULONGLONG
Definition: typedefs.h:65
#define S_ISDIR(mode)
Definition: various.h:18
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define RFSD_KEYS_MATCH
Definition: rfsd.h:63
BOOLEAN RfsdDeleteMcbNode(PRFSD_VCB Vcb, PRFSD_MCB McbTree, PRFSD_MCB RfsdMcb)
Definition: memory.c:1057
#define Vcb
Definition: cdprocs.h:1425
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
BOOLEAN RfsdLoadGroup(IN PRFSD_VCB Vcb)
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
RFSD_IDENTIFIER Identifier
Definition: rfsd.h:755
ULONG RfsdUnicodeToOEMSize(IN PUNICODE_STRING Unicode)
Definition: misc.c:233
PDEVICE_OBJECT DeviceObject
Definition: rfsd.h:768
#define NT_ERROR(Status)
Definition: umtypes.h:106
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1954
#define RFSD_BLOCK_TYPES
Definition: rfsd.h:105
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pinsup.c:802
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Flags
Definition: ntfs.h:520
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: rfsd.h:401
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
__drv_mustHoldCriticalRegion PRFSD_CCB RfsdAllocateCcb(VOID)
Definition: memory.c:617
__drv_mustHoldCriticalRegion VOID RfsdFreeCcb(IN PRFSD_CCB Ccb)
Definition: memory.c:661
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IOCTL_DISK_GET_PARTITION_INFO
Definition: ntdddisk.h:88
static const WCHAR L[]
Definition: oid.c:1250
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
LARGE_INTEGER ValidDataLength
Definition: cctypes.h:17
#define DBG_ERROR
Definition: ffsdrv.h:1031
Definition: typedefs.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
__drv_mustHoldCriticalRegion VOID RfsdFreeFcb(IN PRFSD_FCB Fcb)
Definition: memory.c:541
struct _RFSD_IRP_CONTEXT * PRFSD_IRP_CONTEXT
ERESOURCE MainResource
Definition: ntfs.h:512
#define VCB_READ_ONLY
Definition: ext2fs.h:795
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
BOOLEAN RfsdCheckBitmapConsistency(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
Definition: memory.c:1208
BOOLEAN RfsdLoadInode(IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pKey, IN OUT PRFSD_INODE Inode)
Definition: rfsd.c:253
Definition: rfsd.h:325
Status
Definition: gdiplustypes.h:24
struct _RFSD_MCB * PRFSD_MCB
Definition: rfsd.h:343
BOOLEAN ExceptionInProgress
Definition: rfsd.h:789
#define IsMcbUsed(Mcb)
Definition: ext2fs.h:952
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define FCB_FROM_POOL
Definition: ext2fs.h:871
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1250
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
#define MCB_IN_TREE
Definition: ffsdrv.h:679
BOOLEAN RfsdGetFullFileName(PRFSD_MCB Mcb, PUNICODE_STRING FileName)
Definition: memory.c:896
_SEH2_END
Definition: create.c:4424
#define VCB_FLOPPY_DISK
Definition: ext2fs.h:797
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
LARGE_INTEGER AllocationSize
Definition: cctypes.h:15
#define IRP_CONTEXT_FLAG_FLOPPY
Definition: ext2fs.h:1080
unsigned short USHORT
Definition: pedump.c:61
ULONG Flags
Definition: rfsd.h:761
VOID RfsdUnpinRepinnedBcbs(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: memory.c:286
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:284
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
#define CCB_FROM_POOL
Definition: ext2fs.h:1022
_SEH2_FINALLY
Definition: create.c:4395
VOID NTAPI FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb)
Definition: largemcb.c:1053
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
NTSTATUS RfsdOEMToUnicode(IN OUT PUNICODE_STRING Oem, IN POEM_STRING Unicode)
Definition: misc.c:195
#define IRP_CONTEXT_FLAG_REQUEUED
Definition: ext2fs.h:1085
LIST_ENTRY Link
Definition: rfsd.h:706
NPAGED_LOOKASIDE_LIST RfsdFcbLookasideList
Definition: rfsd.h:415
#define FCB_FILE_DELETED
Definition: ffsdrv.h:635
UNICODE_STRING ShortName
Definition: rfsd.h:694
#define IRP_MJ_CLEANUP
VOID NTAPI FsRtlNotifyInitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1561
__drv_mustHoldCriticalRegion PRFSD_MCB RfsdAllocateMcb(PRFSD_VCB Vcb, PUNICODE_STRING FileName, ULONG FileAttr)
Definition: memory.c:694
Definition: iotypes.h:166
struct _RFSD_REPINNED_BCBS * Next
Definition: rfsd.h:360
#define BOOLEAN
Definition: pedump.c:73
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define INODES_PER_GROUP
Definition: ext2fs.h:99
ERESOURCE PagingIoResource
Definition: ntfs.h:511
PDEVICE_OBJECT RealDevice
Definition: rfsd.h:771
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:716
#define INODES_COUNT
Definition: ext2fs.h:97
PVCB Vcb
Definition: cdstruc.h:939
#define DbgBreak()
Definition: ext2fs.h:46
VOID NTAPI CcRepinBcb(IN PVOID Bcb)
Definition: cachesub.c:331
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
ULONG Size
Definition: rfsd.h:337
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
NTSYSAPI void WINAPI RtlSetBits(PRTL_BITMAP, ULONG, ULONG)
struct _RFSD_CCB RFSD_CCB
#define DBG_INFO
Definition: ffsdrv.h:1034
struct _RFSD_IRP_CONTEXT RFSD_IRP_CONTEXT
VOID NTAPI FsRtlNotifyUninitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1639
#define VCB_INITIALIZED
Definition: ext2fs.h:779
#define _SEH2_LEAVE
Definition: filesup.c:20
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1294
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FILE_FLOPPY_DISKETTE
Definition: nt_native.h:809
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
struct _RFSD_MCB RFSD_MCB
Definition: rfsd.h:343
return STATUS_SUCCESS
Definition: btrfs.c:2725
BOOLEAN RfsdCheckSetBlock(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Block)
Definition: memory.c:1131
#define __FUNCTION__
Definition: types.h:112
VOID RfsdRefreshMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb)
Definition: memory.c:1012
#define KdPrint(x)
Definition: env_spec_w32.h:288
PRFSD_MCB RfsdSearchMcbTree(PRFSD_VCB Vcb, PRFSD_MCB RfsdMcb, PRFSD_KEY_IN_MEMORY Key)
Definition: memory.c:950
ULONG Size
Definition: ntfs.h:96
#define BLOCKS_PER_GROUP
Definition: ext2fs.h:100
struct stat_data RFSD_INODE
Definition: rfsd.h:33
#define RFSD_REPINNED_BCBS_ARRAY_SIZE
Definition: rfsd.h:352
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define RfsdNormalizeAndRaiseStatus(IRPCONTEXT, STATUS)
Definition: rfsd.h:182
LONGLONG QuadPart
Definition: typedefs.h:112
#define RfsdCompleteRequest(Irp, bPrint, PriorityBoost)
Definition: rfsd.h:1072
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
NTSYSAPI UINT WINAPI RtlOemStringToUnicodeSize(const STRING *)
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65