ReactOS  0.4.15-dev-1070-ge1a01de
fileinfo.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: fileinfo.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, RfsdQueryInformation)
23 #pragma alloc_text(PAGE, RfsdSetInformation)
24 #if !RFSD_READ_ONLY
25 #pragma alloc_text(PAGE, RfsdExpandFile)
26 #pragma alloc_text(PAGE, RfsdTruncateFile)
27 #pragma alloc_text(PAGE, RfsdSetDispositionInfo)
28 #pragma alloc_text(PAGE, RfsdSetRenameInfo)
29 #pragma alloc_text(PAGE, RfsdDeleteFile)
30 #endif // !RFSD_READ_ONLY
31 #endif
32 
36 {
40  PRFSD_VCB Vcb;
41  PRFSD_FCB Fcb = 0;
42  PRFSD_CCB Ccb;
43  PIRP Irp;
44  PIO_STACK_LOCATION IoStackLocation;
46  ULONG Length;
47  PVOID Buffer;
48  BOOLEAN FcbResourceAcquired = FALSE;
51 
52  PAGED_CODE();
53 
54  _SEH2_TRY {
55 
56  ASSERT(IrpContext != NULL);
57 
58  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
59  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
60 
61  DeviceObject = IrpContext->DeviceObject;
62 
63  //
64  // This request is not allowed on the main device object
65  //
69  }
70 
71  FileObject = IrpContext->FileObject;
72 
73  Fcb = (PRFSD_FCB) FileObject->FsContext;
74 
75  ASSERT(Fcb != NULL);
76 
77  //
78  // This request is not allowed on volumes
79  //
80  if (Fcb->Identifier.Type == RFSDVCB) {
83  }
84 
86  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
87 
88  Vcb = Fcb->Vcb;
89 
90 /*
91  if ( !IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY) &&
92  !FlagOn(Fcb->Flags, FCB_PAGE_FILE))
93 */
94  {
96  &Fcb->MainResource,
97  IrpContext->IsSynchronous
98  )) {
99 
101  _SEH2_LEAVE;
102  }
103 
104  FcbResourceAcquired = TRUE;
105  }
106 
107  Ccb = (PRFSD_CCB) FileObject->FsContext2;
108 
109  ASSERT(Ccb != NULL);
110 
111  ASSERT((Ccb->Identifier.Type == RFSDCCB) &&
112  (Ccb->Identifier.Size == sizeof(RFSD_CCB)));
113 
114  Irp = IrpContext->Irp;
115 
116  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
117 
119  IoStackLocation->Parameters.QueryFile.FileInformationClass;
120 
121  Length = IoStackLocation->Parameters.QueryFile.Length;
122 
123  Buffer = Irp->AssociatedIrp.SystemBuffer;
124 
126 
127  FileSize = (LONGLONG) Fcb->Inode->i_size;
128 
130 
131  switch (FileInformationClass) {
132 
134  {
136 
137  if (Length < sizeof(FILE_BASIC_INFORMATION)) {
139  _SEH2_LEAVE;
140  }
141 
143 
145 
146  FileBasicInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
147 
148  FileBasicInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
149 
150  FileBasicInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
151 
152  FileBasicInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
153 
154  FileBasicInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
155 
156  Irp->IoStatus.Information = sizeof(FILE_BASIC_INFORMATION);
158  _SEH2_LEAVE;
159  }
160 
161 #if (_WIN32_WINNT >= 0x0500)
162 
164  {
166 
167  if (Length < sizeof(FILE_ATTRIBUTE_TAG_INFORMATION)) {
169  _SEH2_LEAVE;
170  }
171 
173 
174  FATI->FileAttributes = Fcb->RfsdMcb->FileAttr;
175  FATI->ReparseTag = 0;
176 
177  Irp->IoStatus.Information = sizeof(FILE_ATTRIBUTE_TAG_INFORMATION);
179  _SEH2_LEAVE;
180  }
181 #endif // (_WIN32_WINNT >= 0x0500)
182 
184  {
186 
187  if (Length < sizeof(FILE_STANDARD_INFORMATION)) {
189  _SEH2_LEAVE;
190  }
191 
193 
194  FileStandardInformation->AllocationSize.QuadPart = AllocationSize;
195  FileStandardInformation->EndOfFile.QuadPart = FileSize;
196 
197  FileStandardInformation->NumberOfLinks = Fcb->Inode->i_links_count;
198 
199  if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
200  FileStandardInformation->DeletePending = FALSE;
201  else
203 
204  if (Fcb->RfsdMcb->FileAttr & FILE_ATTRIBUTE_DIRECTORY) {
205  FileStandardInformation->Directory = TRUE;
206  } else {
207  FileStandardInformation->Directory = FALSE;
208  }
209 
210  Irp->IoStatus.Information = sizeof(FILE_STANDARD_INFORMATION);
212  _SEH2_LEAVE;
213  }
214 
216  {
218 
219  if (Length < sizeof(FILE_INTERNAL_INFORMATION)) {
221  _SEH2_LEAVE;
222  }
223 
225 
226  // The "inode number"
227  FileInternalInformation->IndexNumber.LowPart = Fcb->RfsdMcb->Key.k_dir_id;
228  FileInternalInformation->IndexNumber.HighPart = Fcb->RfsdMcb->Key.k_objectid;
229 
230  Irp->IoStatus.Information = sizeof(FILE_INTERNAL_INFORMATION);
232  _SEH2_LEAVE;
233  }
234 
235  case FileEaInformation:
236  {
238 
239  if (Length < sizeof(FILE_EA_INFORMATION)) {
241  _SEH2_LEAVE;
242  }
243 
245 
246  // Romfs doesn't have any extended attributes
247  FileEaInformation->EaSize = 0;
248 
249  Irp->IoStatus.Information = sizeof(FILE_EA_INFORMATION);
251  _SEH2_LEAVE;
252  }
253 
254  case FileNameInformation:
255  {
257 
258  if (Length < sizeof(FILE_NAME_INFORMATION) +
259  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR)) {
261  _SEH2_LEAVE;
262  }
263 
265 
266  FileNameInformation->FileNameLength = Fcb->RfsdMcb->ShortName.Length;
267 
269  FileNameInformation->FileName,
270  Fcb->RfsdMcb->ShortName.Buffer,
271  Fcb->RfsdMcb->ShortName.Length );
272 
273  Irp->IoStatus.Information = sizeof(FILE_NAME_INFORMATION) +
274  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR);
276  _SEH2_LEAVE;
277  }
278 
280  {
282 
283  if (Length < sizeof(FILE_POSITION_INFORMATION)) {
285  _SEH2_LEAVE;
286  }
287 
289 
290  FilePositionInformation->CurrentByteOffset =
291  FileObject->CurrentByteOffset;
292 
293  Irp->IoStatus.Information = sizeof(FILE_POSITION_INFORMATION);
295  _SEH2_LEAVE;
296  }
297 
298  case FileAllInformation:
299  {
307 
308  if (Length < sizeof(FILE_ALL_INFORMATION)) {
310  _SEH2_LEAVE;
311  }
312 
314 
316  &FileAllInformation->BasicInformation;
317 
319  &FileAllInformation->StandardInformation;
320 
322  &FileAllInformation->InternalInformation;
323 
325  &FileAllInformation->EaInformation;
326 
328  &FileAllInformation->PositionInformation;
329 
331  &FileAllInformation->NameInformation;
332 
333  FileBasicInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
334 
335  FileBasicInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
336 
337  FileBasicInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
338 
339  FileBasicInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
340 
341  FileBasicInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
342 
343  FileStandardInformation->AllocationSize.QuadPart = AllocationSize;
344 
345  FileStandardInformation->EndOfFile.QuadPart = FileSize;
346 
347  FileStandardInformation->NumberOfLinks = Fcb->Inode->i_links_count;
348 
349  if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
350  FileStandardInformation->DeletePending = FALSE;
351  else
353 
354  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
355  FileStandardInformation->Directory = TRUE;
356  } else {
357  FileStandardInformation->Directory = FALSE;
358  }
359 
360  // The "inode number"
361  FileInternalInformation->IndexNumber.LowPart = Fcb->RfsdMcb->Key.k_dir_id;
362  FileInternalInformation->IndexNumber.HighPart = Fcb->RfsdMcb->Key.k_objectid;
363 
364  // Romfs doesn't have any extended attributes
365  FileEaInformation->EaSize = 0;
366 
367  FilePositionInformation->CurrentByteOffset =
368  FileObject->CurrentByteOffset;
369 
370  if (Length < sizeof(FILE_ALL_INFORMATION) +
371  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR)) {
372  Irp->IoStatus.Information = sizeof(FILE_ALL_INFORMATION);
374  _SEH2_LEAVE;
375  }
376 
377  FileNameInformation->FileNameLength = Fcb->RfsdMcb->ShortName.Length;
378 
380  FileNameInformation->FileName,
381  Fcb->RfsdMcb->ShortName.Buffer,
382  Fcb->RfsdMcb->ShortName.Length
383  );
384 
385  Irp->IoStatus.Information = sizeof(FILE_ALL_INFORMATION) +
386  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR);
388  _SEH2_LEAVE;
389  }
390 
391  /*
392  case FileAlternateNameInformation:
393  {
394  // TODO: [ext2fsd] Handle FileAlternateNameInformation
395 
396  // Here we would like to use RtlGenerate8dot3Name but I don't
397  // know how to use the argument PGENERATE_NAME_CONTEXT
398  }
399  */
400 
402  {
404 
405  if (Length < sizeof(FILE_NETWORK_OPEN_INFORMATION)) {
407  _SEH2_LEAVE;
408  }
409 
412 
413  FileNetworkOpenInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
414 
415  FileNetworkOpenInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
416 
417  FileNetworkOpenInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
418 
419  FileNetworkOpenInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
420 
421  FileNetworkOpenInformation->AllocationSize.QuadPart = AllocationSize;
422 
423  FileNetworkOpenInformation->EndOfFile.QuadPart = FileSize;
424 
425  FileNetworkOpenInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
426 
427  Irp->IoStatus.Information =
430  _SEH2_LEAVE;
431  }
432 
433  default:
435  }
436 
437  } _SEH2_FINALLY {
438 
439  if (FcbResourceAcquired) {
441  &Fcb->MainResource,
443  }
444 
445  if (!IrpContext->ExceptionInProgress) {
446  if (Status == STATUS_PENDING) {
447  RfsdQueueRequest(IrpContext);
448  } else {
449  RfsdCompleteIrpContext(IrpContext, Status);
450  }
451  }
452  } _SEH2_END;
453 
454  return Status;
455 }
456 
458 NTSTATUS
460 {
463  PRFSD_VCB Vcb = 0;
465  PRFSD_FCB Fcb = 0;
466  PRFSD_CCB Ccb;
467  PIRP Irp;
468  PIO_STACK_LOCATION IoStackLocation;
470 
471  ULONG NotifyFilter = 0;
472 
473  ULONG Length;
474  PVOID Buffer;
475  BOOLEAN FcbMainResourceAcquired = FALSE;
476 
477  BOOLEAN VcbResourceAcquired = FALSE;
478  BOOLEAN FcbPagingIoResourceAcquired = FALSE;
479 
480  PAGED_CODE();
481 
482  _SEH2_TRY {
483 
484  ASSERT(IrpContext != NULL);
485 
486  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
487  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
488 
489  DeviceObject = IrpContext->DeviceObject;
490 
491  //
492  // This request is not allowed on the main device object
493  //
496  _SEH2_LEAVE;
497  }
498 
499  Vcb = (PRFSD_VCB) DeviceObject->DeviceExtension;
500 
501  ASSERT(Vcb != NULL);
502 
503  ASSERT((Vcb->Identifier.Type == RFSDVCB) &&
504  (Vcb->Identifier.Size == sizeof(RFSD_VCB)));
505 
506  ASSERT(IsMounted(Vcb));
507 
508  FileObject = IrpContext->FileObject;
509 
510  Fcb = (PRFSD_FCB) FileObject->FsContext;
511 
512  ASSERT(Fcb != NULL);
513 
514  //
515  // This request is not allowed on volumes
516  //
517  if (Fcb->Identifier.Type == RFSDVCB) {
518  DbgBreak();
519 
521  _SEH2_LEAVE;
522  }
523 
524  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
525  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
526 
529  _SEH2_LEAVE;
530  }
531 
532  Ccb = (PRFSD_CCB) FileObject->FsContext2;
533 
534  ASSERT(Ccb != NULL);
535 
536  ASSERT((Ccb->Identifier.Type == RFSDCCB) &&
537  (Ccb->Identifier.Size == sizeof(RFSD_CCB)));
538 
539  Irp = IrpContext->Irp;
540 
541  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
542 
544  IoStackLocation->Parameters.SetFile.FileInformationClass;
545 
546  Length = IoStackLocation->Parameters.SetFile.Length;
547 
548  Buffer = Irp->AssociatedIrp.SystemBuffer;
549 
550  if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY)) {
551 
555 
556 #ifdef _MSC_VER
557 #pragma prefast( suppress: 28137, "by design" )
558 #endif
560  &Vcb->MainResource,
561  IrpContext->IsSynchronous )) {
562 
564  _SEH2_LEAVE;
565  }
566 
567  VcbResourceAcquired = TRUE;
568  }
569 
570  } else if (!FlagOn(Fcb->Flags, FCB_PAGE_FILE)) {
571 
572 #ifdef _MSC_VER
573 #pragma prefast( suppress: 28137, "by design" )
574 #endif
576  &Fcb->MainResource,
577  IrpContext->IsSynchronous )) {
579  _SEH2_LEAVE;
580  }
581 
582  FcbMainResourceAcquired = TRUE;
583  }
584 
585  if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY)) {
586 
589  _SEH2_LEAVE;
590  }
591  }
592 
598 
599 #ifdef _MSC_VER
600 #pragma prefast( suppress: 28137, "by design" )
601 #endif
604  IrpContext->IsSynchronous )) {
606  _SEH2_LEAVE;
607  }
608 
609  FcbPagingIoResourceAcquired = TRUE;
610  }
611 
612 /*
613  if (FileInformationClass != FileDispositionInformation
614  && FlagOn(Fcb->Flags, FCB_DELETE_PENDING))
615  {
616  Status = STATUS_DELETE_PENDING;
617  _SEH2_LEAVE;
618  }
619 */
620  switch (FileInformationClass) {
621 
622 #if !RFSD_READ_ONLY
623 #if 0
625  {
627  PRFSD_INODE RfsdInode = Fcb->Inode;
628 
629  if (FBI->CreationTime.QuadPart) {
630  RfsdInode->i_ctime = (ULONG)(RfsdInodeTime(FBI->CreationTime));
631  }
632 
633  if (FBI->LastAccessTime.QuadPart) {
634  RfsdInode->i_atime = (ULONG)(RfsdInodeTime(FBI->LastAccessTime));
635  }
636 
637  if (FBI->LastWriteTime.QuadPart) {
638  RfsdInode->i_mtime = (ULONG)(RfsdInodeTime(FBI->LastWriteTime));
639  }
640 
642  RfsdSetReadOnly(Fcb->Inode->i_mode);
643  SetFlag(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
644  } else {
645  RfsdSetWritable(Fcb->Inode->i_mode);
646  ClearFlag(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
647  }
648 
649  if(RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RfsdInode)) {
651  }
652 
655  } else {
657  }
658 
663 
665  }
666 
667  break;
668 
670  {
672 
673  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
675  _SEH2_LEAVE;
676  }
677 
678  if ( FAI->AllocationSize.QuadPart ==
679  Fcb->Header.AllocationSize.QuadPart) {
680 
682 
683  } else if ( FAI->AllocationSize.QuadPart >
684  Fcb->Header.AllocationSize.QuadPart ) {
685 
687  IrpContext,
688  Vcb, Fcb,
689  &(FAI->AllocationSize));
690 
691  if (NT_SUCCESS(Status)) {
692 
693  RfsdSaveInode( IrpContext,
694  Vcb,
695  Fcb->RfsdMcb->Inode,
696  Fcb->Inode );
697  }
698 
699  } else {
700 
701  if (MmCanFileBeTruncated(&(Fcb->SectionObject), &(FAI->AllocationSize))) {
702 
703  LARGE_INTEGER EndOfFile;
704 
705  EndOfFile.QuadPart = FAI->AllocationSize.QuadPart +
706  (LONGLONG)(Vcb->BlockSize - 1);
707 
708  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &(EndOfFile));
709 
710  if (NT_SUCCESS(Status)) {
711 
712  if ( FAI->AllocationSize.QuadPart <
713  Fcb->Header.FileSize.QuadPart) {
714  Fcb->Header.FileSize.QuadPart =
716  }
717 
718  RfsdSaveInode( IrpContext,
719  Vcb,
720  Fcb->RfsdMcb->Inode,
721  Fcb->Inode);
722  }
723 
724  } else {
725 
727  _SEH2_LEAVE;
728  }
729  }
730 
731  if (NT_SUCCESS(Status)) {
732 
734  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
736 
739 
740  }
741 
742  }
743 
744  break;
745 
747  {
749 
750  BOOLEAN CacheInitialized = FALSE;
751 
752  if (IsDirectory(Fcb)) {
754  _SEH2_LEAVE;
755  }
756 
757  if (FEOFI->EndOfFile.HighPart != 0) {
759  _SEH2_LEAVE;
760  }
761 
762 
763  if (IoStackLocation->Parameters.SetFile.AdvanceOnly) {
765  _SEH2_LEAVE;
766  }
767 
768  if ((FileObject->SectionObjectPointer->DataSectionObject != NULL) &&
769  (FileObject->SectionObjectPointer->SharedCacheMap == NULL) &&
770  !FlagOn(Irp->Flags, IRP_PAGING_IO)) {
771 
773 
775  FileObject,
776  (PCC_FILE_SIZES)&(Fcb->Header.AllocationSize),
777  FALSE,
779  Fcb );
780 
781  CacheInitialized = TRUE;
782  }
783 
784  if ( FEOFI->EndOfFile.QuadPart ==
785  Fcb->Header.AllocationSize.QuadPart) {
786 
788 
789  } else if ( FEOFI->EndOfFile.QuadPart >
790  Fcb->Header.AllocationSize.QuadPart) {
791 
792  LARGE_INTEGER FileSize = Fcb->Header.FileSize;
793 
794  Status = RfsdExpandFile(IrpContext, Vcb, Fcb, &(FEOFI->EndOfFile));
795 
796  if (NT_SUCCESS(Status)) {
797 
798  Fcb->Header.FileSize.QuadPart = FEOFI->EndOfFile.QuadPart;
799 
800  Fcb->Inode->i_size = FEOFI->EndOfFile.QuadPart;
801 
802  Fcb->Header.ValidDataLength.QuadPart =
803  (LONGLONG)(0x7fffffffffffffff);
804 
805  RfsdSaveInode( IrpContext,
806  Vcb,
807  Fcb->RfsdMcb->Inode,
808  Fcb->Inode);
809 
810 
812  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
813 
815 
816  RfsdZeroHoles( IrpContext,
817  Vcb, FileObject,
819  Fcb->Header.AllocationSize.QuadPart -
820  FileSize.QuadPart );
821 
824 
825  }
826  } else {
827 
828  if (MmCanFileBeTruncated(&(Fcb->SectionObject), &(FEOFI->EndOfFile))) {
829 
830  LARGE_INTEGER EndOfFile = FEOFI->EndOfFile;
831 
832  EndOfFile.QuadPart = EndOfFile.QuadPart +
833  (LONGLONG)(Vcb->BlockSize - 1);
834 
835  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &(EndOfFile));
836 
837  if (NT_SUCCESS(Status)) {
838 
839  Fcb->Header.FileSize.QuadPart = FEOFI->EndOfFile.QuadPart;
840  Fcb->Inode->i_size = FEOFI->EndOfFile.QuadPart;
841 
842  RfsdSaveInode( IrpContext,
843  Vcb,
844  Fcb->RfsdMcb->Inode,
845  Fcb->Inode);
846 
848  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
849 
851 
854  }
855 
856  } else {
857 
859  _SEH2_LEAVE;
860  }
861  }
862  }
863 
864  break;
865 
867  {
869 
870  Status = RfsdSetDispositionInfo(IrpContext, Vcb, Fcb, FDI->DeleteFile);
871  }
872 
873  break;
874 
876  {
877  Status = RfsdSetRenameInfo(IrpContext, Vcb, Fcb);
878  }
879 
880  break;
881 #endif // 0
882 #endif // !RFSD_READ_ONLY
883 
884  //
885  // This is the only set file information request supported on read
886  // only file systems
887  //
889  {
891 
892  if (Length < sizeof(FILE_POSITION_INFORMATION)) {
894  _SEH2_LEAVE;
895  }
896 
898 
900  (FilePositionInformation->CurrentByteOffset.LowPart &
901  DeviceObject->AlignmentRequirement) ) {
903  _SEH2_LEAVE;
904  }
905 
906  FileObject->CurrentByteOffset =
907  FilePositionInformation->CurrentByteOffset;
908 
910  _SEH2_LEAVE;
911  }
912 
913  break;
914 
915  default:
917  }
918 
919  } _SEH2_FINALLY {
920 
921  if (FcbPagingIoResourceAcquired) {
925  }
926 
927  if (NT_SUCCESS(Status) && (NotifyFilter != 0)) {
929  IrpContext,
930  Vcb,
931  Fcb,
932  NotifyFilter,
934 
935  }
936 
937  if (FcbMainResourceAcquired) {
939  &Fcb->MainResource,
941  }
942 
943  if (VcbResourceAcquired) {
945  &Vcb->MainResource,
947  }
948 
949  if (!IrpContext->ExceptionInProgress) {
950  if (Status == STATUS_PENDING) {
951  RfsdQueueRequest(IrpContext);
952  } else {
953  RfsdCompleteIrpContext(IrpContext, Status);
954  }
955  }
956  } _SEH2_END;
957 
958  return Status;
959 }
960 
961 #if !RFSD_READ_ONLY
962 
963 NTSTATUS
967 {
968  ULONG dwRet = 0;
970 
971  PAGED_CODE();
972 
973  if (AllocationSize->QuadPart <= Fcb->Header.AllocationSize.QuadPart) {
974  return Status;
975  }
976 
977  if (((LONGLONG)SUPER_BLOCK->s_free_blocks_count) * Vcb->BlockSize <=
978  (AllocationSize->QuadPart - Fcb->Header.AllocationSize.QuadPart) ) {
979  RfsdPrint((DBG_ERROR, "RfsdExpandFile: There is no enough disk space available.\n"));
980  return STATUS_DISK_FULL;
981  }
982 
983  while (NT_SUCCESS(Status) && (AllocationSize->QuadPart > Fcb->Header.AllocationSize.QuadPart)) {
984  Status = RfsdExpandInode(IrpContext, Vcb, Fcb, &dwRet);
985  }
986 
987  return Status;
988 }
989 
990 NTSTATUS
994 {
996 
997  PAGED_CODE();
998 
999  while (NT_SUCCESS(Status) && (AllocationSize->QuadPart <
1000  Fcb->Header.AllocationSize.QuadPart)) {
1001  Status= RfsdTruncateInode(IrpContext, Vcb, Fcb);
1002  }
1003 
1004  return Status;
1005 }
1006 
1007 NTSTATUS
1009  PRFSD_IRP_CONTEXT IrpContext,
1010  PRFSD_VCB Vcb,
1011  PRFSD_FCB Fcb,
1012  BOOLEAN bDelete)
1013 {
1014  PIRP Irp = IrpContext->Irp;
1016 
1017  PAGED_CODE();
1018 
1020 
1021  RfsdPrint((DBG_INFO, "RfsdSetDispositionInfo: bDelete=%x\n", bDelete));
1022 
1023  if (bDelete) {
1024 
1025  RfsdPrint((DBG_INFO, "RfsdSetDispositionInformation: MmFlushImageSection on %s.\n",
1026  Fcb->AnsiFileName.Buffer));
1027 
1028  if (!MmFlushImageSection( &Fcb->SectionObject,
1029  MmFlushForDelete )) {
1030  return STATUS_CANNOT_DELETE;
1031  }
1032 
1033  if (RFSD_IS_ROOT_KEY(Fcb->RfsdMcb->Key)) {
1034  return STATUS_CANNOT_DELETE;
1035  }
1036 
1037  if (IsDirectory(Fcb)) {
1038  if (!RfsdIsDirectoryEmpty(Vcb, Fcb)) {
1040  }
1041  }
1042 
1044  IrpSp->FileObject->DeletePending = TRUE;
1045 
1046  if (IsDirectory(Fcb)) {
1047  FsRtlNotifyFullChangeDirectory( Vcb->NotifySync,
1048  &Vcb->NotifyList,
1049  Fcb,
1050  NULL,
1051  FALSE,
1052  FALSE,
1053  0,
1054  NULL,
1055  NULL,
1056  NULL );
1057  }
1058 
1059  } else {
1060 
1062  IrpSp->FileObject->DeletePending = FALSE;
1063  }
1064 
1065  return STATUS_SUCCESS;
1066 }
1067 
1068 NTSTATUS
1070  PRFSD_IRP_CONTEXT IrpContext,
1071  PRFSD_VCB Vcb,
1072  PRFSD_FCB Fcb )
1073 {
1075  PRFSD_MCB TargetMcb;
1076 
1077  PRFSD_MCB Mcb;
1078  RFSD_INODE Inode;
1079 
1081 
1082  NTSTATUS Status;
1083 
1084  PIRP Irp;
1086 
1088  PFILE_OBJECT TargetObject;
1089  BOOLEAN ReplaceIfExists;
1090 
1091  BOOLEAN bMove = FALSE;
1092 
1094 
1095  PAGED_CODE();
1096 #if 0
1097  if (Fcb->RfsdMcb->Inode == RFSD_ROOT_INO) {
1099  goto errorout;
1100  }
1101 
1102  Irp = IrpContext->Irp;
1104 
1106  TargetObject = IrpSp->Parameters.SetFile.FileObject;
1107  ReplaceIfExists = IrpSp->Parameters.SetFile.ReplaceIfExists;
1108 
1109  FRI = (PFILE_RENAME_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
1110 
1111  if (TargetObject == NULL) {
1112 
1114 
1115  NewName.Buffer = FRI->FileName;
1117 
1118  while (NewName.Length > 0 && NewName.Buffer[NewName.Length/2 - 1] == L'\\') {
1119  NewName.Buffer[NewName.Length/2 - 1] = 0;
1120  NewName.Length -= 2;
1121  }
1122 
1123  while (NewName.Length > 0 && NewName.Buffer[NewName.Length/2 - 1] != L'\\') {
1124  NewName.Length -= 2;
1125  }
1126 
1129 
1130  FileName = NewName;
1131 
1132  TargetDcb = NULL;
1133  TargetMcb = Fcb->RfsdMcb->Parent;
1134 
1135  if (FileName.Length >= RFSD_NAME_LEN*sizeof(USHORT)) {
1137  goto errorout;
1138  }
1139 
1140  } else {
1141 
1142  TargetDcb = (PRFSD_FCB)(TargetObject->FsContext);
1143 
1144  if (!TargetDcb || TargetDcb->Vcb != Vcb) {
1145 
1146  DbgBreak();
1147 
1149  goto errorout;
1150  }
1151 
1152  TargetMcb = TargetDcb->RfsdMcb;
1153 
1154  FileName = TargetObject->FileName;
1155  }
1156 
1159  goto errorout;
1160  }
1161 
1162  if (TargetMcb->Inode == Fcb->RfsdMcb->Parent->Inode) {
1164  &(Fcb->RfsdMcb->ShortName),
1165  FALSE,
1166  NULL )) {
1168  goto errorout;
1169  }
1170  } else {
1171  bMove = TRUE;
1172  }
1173 
1174  TargetDcb = TargetMcb->RfsdFcb;
1175 
1176  if (!TargetDcb)
1177  TargetDcb = RfsdCreateFcbFromMcb(Vcb, TargetMcb);
1178 
1179  if ((TargetMcb->Inode != Fcb->RfsdMcb->Parent->Inode) &&
1180  (Fcb->RfsdMcb->Parent->RfsdFcb == NULL) ) {
1181  RfsdCreateFcbFromMcb(Vcb, Fcb->RfsdMcb->Parent);
1182  }
1183 
1184  if (!TargetDcb || !(Fcb->RfsdMcb->Parent->RfsdFcb)) {
1186 
1187  goto errorout;
1188  }
1189 
1190  Mcb = NULL;
1192  Vcb,
1193  &FileName,
1194  TargetMcb,
1195  &Mcb,
1196  &Inode );
1197 
1198  if (NT_SUCCESS(Status)) {
1199 
1200  if ( (!ReplaceIfExists) ||
1201  (IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) ||
1202  (IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_READONLY))) {
1204  goto errorout;
1205  }
1206 
1207  if (ReplaceIfExists) {
1209  goto errorout;
1210  }
1211  }
1212 
1213  if (IsDirectory(Fcb)) {
1214 
1215  Status = RfsdRemoveEntry( IrpContext, Vcb,
1216  Fcb->RfsdMcb->Parent->RfsdFcb,
1217  RFSD_FT_DIR,
1218  Fcb->RfsdMcb->Inode );
1219 
1220  if (!NT_SUCCESS(Status)) {
1221  DbgBreak();
1222 
1223  goto errorout;
1224  }
1225 
1226  Status = RfsdAddEntry( IrpContext, Vcb,
1227  TargetDcb,
1228  RFSD_FT_DIR,
1229  Fcb->RfsdMcb->Inode,
1230  &FileName );
1231 
1232  if (!NT_SUCCESS(Status)) {
1233 
1234  DbgBreak();
1235 
1236  RfsdAddEntry( IrpContext, Vcb,
1237  Fcb->RfsdMcb->Parent->RfsdFcb,
1238  RFSD_FT_DIR,
1239  Fcb->RfsdMcb->Inode,
1240  &Fcb->RfsdMcb->ShortName );
1241 
1242  goto errorout;
1243  }
1244 
1245  if( !RfsdSaveInode( IrpContext,
1246  Vcb,
1247  TargetMcb->Inode,
1248  TargetDcb->Inode)) {
1250 
1251  DbgBreak();
1252 
1253  goto errorout;
1254  }
1255 
1256  if( !RfsdSaveInode( IrpContext,
1257  Vcb,
1258  Fcb->RfsdMcb->Parent->Inode,
1259  Fcb->RfsdMcb->Parent->RfsdFcb->Inode)) {
1260 
1262 
1263  DbgBreak();
1264 
1265  goto errorout;
1266  }
1267 
1268  Status = RfsdSetParentEntry( IrpContext, Vcb, Fcb,
1269  Fcb->RfsdMcb->Parent->Inode,
1270  TargetDcb->RfsdMcb->Inode );
1271 
1272 
1273  if (!NT_SUCCESS(Status)) {
1274  DbgBreak();
1275  goto errorout;
1276  }
1277 
1278  } else {
1279 
1280  Status = RfsdRemoveEntry( IrpContext, Vcb,
1281  Fcb->RfsdMcb->Parent->RfsdFcb,
1282  RFSD_FT_REG_FILE,
1283  Fcb->RfsdMcb->Inode );
1284  if (!NT_SUCCESS(Status)) {
1285  DbgBreak();
1286  goto errorout;
1287  }
1288 
1289  Status = RfsdAddEntry( IrpContext,
1290  Vcb, TargetDcb,
1291  RFSD_FT_REG_FILE,
1292  Fcb->RfsdMcb->Inode,
1293  &FileName );
1294 
1295  if (!NT_SUCCESS(Status)) {
1296 
1297  DbgBreak();
1298 
1299  RfsdAddEntry( IrpContext, Vcb,
1300  Fcb->RfsdMcb->Parent->RfsdFcb,
1301  RFSD_FT_REG_FILE,
1302  Fcb->RfsdMcb->Inode,
1303  &Fcb->RfsdMcb->ShortName );
1304 
1305  goto errorout;
1306  }
1307  }
1308 
1309  if (NT_SUCCESS(Status)) {
1310 
1311  if (Fcb->RfsdMcb->ShortName.MaximumLength < (FileName.Length + 2)) {
1312 
1313  ExFreePool(Fcb->RfsdMcb->ShortName.Buffer);
1314  Fcb->RfsdMcb->ShortName.Buffer =
1316 
1317  if (!Fcb->RfsdMcb->ShortName.Buffer) {
1319  goto errorout;
1320  }
1321 
1322  Fcb->RfsdMcb->ShortName.MaximumLength = FileName.Length + 2;
1323  }
1324 
1325  {
1326  RtlZeroMemory( Fcb->RfsdMcb->ShortName.Buffer,
1327  Fcb->RfsdMcb->ShortName.MaximumLength);
1328 
1329  RtlCopyMemory( Fcb->RfsdMcb->ShortName.Buffer,
1330  FileName.Buffer, FileName.Length);
1331 
1332  Fcb->RfsdMcb->ShortName.Length = FileName.Length;
1333  }
1334 
1335 #if DBG
1336 
1337  Fcb->AnsiFileName.Length = (USHORT)
1339 
1340  if (Fcb->AnsiFileName.MaximumLength < FileName.Length) {
1341  ExFreePool(Fcb->AnsiFileName.Buffer);
1342 
1343  Fcb->AnsiFileName.Buffer =
1344  ExAllocatePoolWithTag(PagedPool, Fcb->AnsiFileName.Length + 1, RFSD_POOL_TAG);
1345 
1346  if (!Fcb->AnsiFileName.Buffer) {
1348  goto errorout;
1349  }
1350 
1351  RtlZeroMemory( Fcb->AnsiFileName.Buffer,
1352  Fcb->AnsiFileName.Length + 1);
1353  Fcb->AnsiFileName.MaximumLength =
1354  Fcb->AnsiFileName.Length + 1;
1355  }
1356 
1357  RfsdUnicodeToOEM( &(Fcb->AnsiFileName),
1358  &FileName );
1359 
1360 #endif
1361 
1362  if (bMove) {
1363 
1365  IrpContext,
1366  Vcb,
1367  Fcb,
1368  (IsDirectory(Fcb) ?
1372 
1373  } else {
1374 
1376  IrpContext,
1377  Vcb,
1378  Fcb,
1379  (IsDirectory(Fcb) ?
1383 
1384  }
1385 
1386  RfsdDeleteMcbNode(Vcb, Fcb->RfsdMcb->Parent, Fcb->RfsdMcb);
1387  RfsdAddMcbNode(Vcb, TargetMcb, Fcb->RfsdMcb);
1388 
1389  if (bMove) {
1390 
1392  IrpContext,
1393  Vcb,
1394  Fcb,
1395  (IsDirectory(Fcb) ?
1399  } else {
1400 
1402  IrpContext,
1403  Vcb,
1404  Fcb,
1405  (IsDirectory(Fcb) ?
1409 
1410  }
1411  }
1412 
1413 errorout:
1414 #endif // 0
1415  return 0;//Status;
1416 }
1417 
1418 NTSTATUS
1420  PRFSD_IRP_CONTEXT IrpContext,
1421  PRFSD_VCB Vcb,
1422  PRFSD_FCB Fcb )
1423 {
1424  BOOLEAN bRet = FALSE;
1426  PRFSD_FCB Dcb = NULL;
1428 
1429  PAGED_CODE();
1430 #if 0
1431  RfsdPrint((DBG_INFO, "RfsdDeleteFile: File %S (%xh) will be deleted!\n",
1432  Fcb->RfsdMcb->ShortName.Buffer, Fcb->RfsdMcb->Inode));
1433 
1435  return Status;
1436  }
1437 
1438  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
1439  if (!RfsdIsDirectoryEmpty(Vcb, Fcb)) {
1441 
1443  }
1444  }
1445 
1446  RfsdPrint((DBG_INFO, "RfsdDeleteFile: RFSDSB->S_FREE_BLOCKS = %xh .\n",
1447  Vcb->SuperBlock->s_free_blocks_count));
1448 
1449  if (IsDirectory(Fcb)) {
1450  if (Fcb->Inode->i_links_count <= 2) {
1451  } else {
1453  }
1454  } else {
1455  if (Fcb->Inode->i_links_count <= 1) {
1456  } else {
1458  }
1459  }
1460 
1461  if (!NT_SUCCESS(Status)) {
1462  DbgBreak();
1463  return Status;
1464  }
1465 
1466  if (Fcb->RfsdMcb->Parent->RfsdFcb) {
1467 
1469  IrpContext, Vcb,
1470  Fcb->RfsdMcb->Parent->RfsdFcb,
1471  (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY) ?
1472  RFSD_FT_DIR : RFSD_FT_REG_FILE),
1473  Fcb->RfsdMcb->Inode);
1474  } else {
1475 
1476  Dcb = RfsdCreateFcbFromMcb(Vcb, Fcb->RfsdMcb->Parent);
1477  if (Dcb) {
1479  IrpContext, Vcb, Dcb,
1480  (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY) ?
1481  RFSD_FT_DIR : RFSD_FT_REG_FILE),
1482  Fcb->RfsdMcb->Inode);
1483  }
1484  }
1485 
1486  if (NT_SUCCESS(Status)) {
1487 
1488  LARGE_INTEGER SysTime;
1489  KeQuerySystemTime(&SysTime);
1490 
1491  AllocationSize.QuadPart = (LONGLONG)0;
1492 
1493  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &AllocationSize);
1494 
1495  //
1496  // Update the inode's data length . It should be ZERO if succeeds.
1497  //
1498 
1499  if (Fcb->Header.FileSize.QuadPart > Fcb->Header.AllocationSize.QuadPart) {
1500 
1501  Fcb->Header.FileSize.QuadPart = Fcb->Header.AllocationSize.QuadPart;
1502  Fcb->Inode->i_size = Fcb->Header.AllocationSize.QuadPart;
1503  }
1504 
1505  Fcb->Inode->i_links_count = 0;
1506 
1507  RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, Fcb->Inode);
1508 
1509  if (IsDirectory(Fcb)) {
1510  bRet = RfsdFreeInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RFSD_FT_DIR);
1511  } else {
1512  bRet = RfsdFreeInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RFSD_FT_REG_FILE);
1513  }
1514 
1516  RfsdDeleteMcbNode(Vcb, Fcb->RfsdMcb->Parent, Fcb->RfsdMcb);
1517 
1518  } else {
1519  DbgBreak();
1520  RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, Fcb->Inode);
1521  }
1522 
1523  RfsdPrint((DBG_INFO, "RfsdDeleteFile: Succeed... RFSDSB->S_FREE_BLOCKS = %xh .\n",
1524  Vcb->SuperBlock->s_free_blocks_count));
1525 #endif // 0
1526  return Status;
1527 }
1528 
1529 #endif // !RFSD_READ_ONLY
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
struct _RFSD_CCB * PRFSD_CCB
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define RFSD_NAME_LEN
Definition: rfsd.h:45
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4724
struct _FILE_INTERNAL_INFORMATION * PFILE_INTERNAL_INFORMATION
struct _FILE_BASIC_INFORMATION * PFILE_BASIC_INFORMATION
NTSTATUS RfsdUnicodeToOEM(IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
Definition: misc.c:246
#define IN
Definition: typedefs.h:39
NTSTATUS RfsdAddEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode, IN PUNICODE_STRING FileName)
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
#define IsMounted(Vcb)
Definition: ext2fs.h:803
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
__u32 i_ctime
Definition: reiserfs.h:237
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define FILE_ACTION_RENAMED_OLD_NAME
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
USHORT MaximumLength
Definition: env_spec_w32.h:370
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
Definition: notify.c:1458
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
NTSTATUS RfsdSetParentEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG OldParent, IN ULONG NewParent)
#define CEILING_ALIGNED(T, A, B)
Definition: ext2fs.h:111
struct _FILE_DISPOSITION_INFORMATION * PFILE_DISPOSITION_INFORMATION
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
VOID RfsdNotifyReportChange(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb, IN ULONG Filter, IN ULONG Action)
Definition: dirctl.c:745
NTSTATUS RfsdLookupFileName(IN PRFSD_VCB Vcb, IN PUNICODE_STRING FullFileName, IN PRFSD_MCB ParentMcb, OUT PRFSD_MCB *RfsdMcb, IN OUT PRFSD_INODE Inode)
Definition: create.c:51
__drv_mustHoldCriticalRegion NTSTATUS RfsdSetInformation(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: fileinfo.c:459
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define RFSD_IS_ROOT_KEY(x)
Definition: rfsd.h:52
#define RFSD_POOL_TAG
Definition: rfsd.h:99
BOOLEAN RfsdDeleteMcbNode(PRFSD_VCB Vcb, PRFSD_MCB McbTree, PRFSD_MCB RfsdMcb)
Definition: memory.c:1057
#define FILE_NOTIFY_CHANGE_SIZE
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define FILE_NOTIFY_CHANGE_FILE_NAME
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
NTSTATUS RfsdQueueRequest(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: dispatch.c:29
BOOLEAN RfsdZeroHoles(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PFILE_OBJECT FileObject, IN LONGLONG Offset, IN LONGLONG Count)
Definition: write.c:204
#define FO_NO_INTERMEDIATE_BUFFERING
Definition: iotypes.h:1758
NTSTATUS RfsdDeleteFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
Definition: fileinfo.c:1419
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
NTSTATUS RfsdExpandInode(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, ULONG *dwRet)
#define FILE_NOTIFY_CHANGE_DIR_NAME
Definition: rfsd.h:323
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
Definition: name.c:464
#define FCB_DELETE_PENDING
Definition: ext2fs.h:879
LARGE_INTEGER AllocationSize
Definition: winternl.h:688
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
PDEVICE_OBJECT DeviceObject
Definition: rfsd.h:407
_SEH2_TRY
Definition: create.c:4226
Definition: rfsd.h:324
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
LARGE_INTEGER RfsdSysTime(IN ULONG i_time)
Definition: misc.c:47
#define FO_FILE_MODIFIED
Definition: iotypes.h:1768
while(1)
Definition: macro.lex.yy.c:740
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
#define FALSE
Definition: types.h:117
struct _FILE_ATTRIBUTE_TAG_INFORMATION * PFILE_ATTRIBUTE_TAG_INFORMATION
struct _FILE_NAME_INFORMATION * PFILE_NAME_INFORMATION
struct _FILE_ALL_INFORMATION FILE_ALL_INFORMATION
#define RfsdSetReadOnly(m)
Definition: rfsd.h:294
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
NTSTATUS RfsdSetDispositionInfo(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, BOOLEAN bDelete)
Definition: fileinfo.c:1008
#define FILE_ACTION_MODIFIED
__drv_mustHoldCriticalRegion NTSTATUS RfsdQueryInformation(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: fileinfo.c:35
struct _FILE_ALLOCATION_INFORMATION * PFILE_ALLOCATION_INFORMATION
unsigned char BOOLEAN
NTSTATUS RfsdTruncateInode(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ACTION_REMOVED
BOOLEAN RfsdIsDirectoryEmpty(IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
Definition: rfsd.h:326
Definition: bufpool.h:45
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:711
IN PDCB TargetDcb
Definition: fatprocs.h:788
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#define STATUS_FILE_DELETED
Definition: udferr_usr.h:172
#define SUPER_BLOCK
Definition: ext2fs.h:90
#define FILE_NOTIFY_CHANGE_CREATION
struct _FILE_END_OF_FILE_INFORMATION * PFILE_END_OF_FILE_INFORMATION
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
struct _RFSD_VCB * PRFSD_VCB
__u32 i_mtime
Definition: reiserfs.h:236
int64_t LONGLONG
Definition: typedefs.h:68
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
BOOLEAN NTAPI FsRtlAreNamesEqual(IN PCUNICODE_STRING Name1, IN PCUNICODE_STRING Name2, IN BOOLEAN IgnoreCase, IN PCWCH UpcaseTable OPTIONAL)
Definition: name.c:296
struct _FILE_RENAME_INFORMATION * PFILE_RENAME_INFORMATION
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
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:195
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4798
uint64_t ULONGLONG
Definition: typedefs.h:67
#define Vcb
Definition: cdprocs.h:1415
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
BOOLEAN RfsdSaveInode(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG inode, IN PRFSD_INODE Inode)
ULONG RfsdUnicodeToOEMSize(IN PUNICODE_STRING Unicode)
Definition: misc.c:233
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _FILE_EA_INFORMATION FILE_EA_INFORMATION
* PFILE_OBJECT
Definition: iotypes.h:1978
struct _FILE_ATTRIBUTE_TAG_INFORMATION FILE_ATTRIBUTE_TAG_INFORMATION
ULONG RfsdInodeTime(IN LARGE_INTEGER SysTime)
Definition: misc.c:59
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Flags
Definition: ntfs.h:532
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: rfsd.h:401
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PRFSD_FCB RfsdCreateFcbFromMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb)
Definition: memory.c:867
#define STATUS_CANNOT_DELETE
Definition: shellext.h:71
unsigned char UCHAR
Definition: xmlstorage.h:181
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
Status
Definition: gdiplustypes.h:24
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
static const WCHAR L[]
Definition: oid.c:1250
PRFSD_FCB RfsdFcb
Definition: rfsd.h:691
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FILE_ACTION_RENAMED_NEW_NAME
struct _FILE_EA_INFORMATION * PFILE_EA_INFORMATION
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:588
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
struct _FILE_STANDARD_INFORMATION * PFILE_STANDARD_INFORMATION
ERESOURCE MainResource
Definition: ntfs.h:524
NTSTATUS RfsdExpandFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:964
#define VCB_READ_ONLY
Definition: ext2fs.h:795
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
Definition: rfsd.h:325
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:319
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
struct _FileName FileName
Definition: fatprocs.h:893
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:3148
_SEH2_END
Definition: create.c:4400
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned short USHORT
Definition: pedump.c:61
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1770
#define FO_TEMPORARY_FILE
Definition: iotypes.h:1771
#define FILE_NOTIFY_CHANGE_ATTRIBUTES
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
Definition: fssup.c:356
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:343
NTSTATUS RfsdRemoveEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode)
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
_SEH2_FINALLY
Definition: create.c:4371
struct _FILE_NETWORK_OPEN_INFORMATION * PFILE_NETWORK_OPEN_INFORMATION
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
struct _FILE_NAME_INFORMATION FILE_NAME_INFORMATION
#define FCB_PAGE_FILE
Definition: ext2fs.h:872
#define IRP_PAGING_IO
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define FILE_ACTION_ADDED
#define FileStandardInformation
Definition: propsheet.cpp:61
#define FCB_FILE_DELETED
Definition: ffsdrv.h:635
NTSTATUS RfsdTruncateFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:991
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203
struct _FILE_POSITION_INFORMATION * PFILE_POSITION_INFORMATION
struct _FILE_ALL_INFORMATION * PFILE_ALL_INFORMATION
VOID RfsdAddMcbNode(PRFSD_VCB Vcb, PRFSD_MCB Parent, PRFSD_MCB Child)
Definition: memory.c:1023
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
__u32 i_atime
Definition: reiserfs.h:235
unsigned int ULONG
Definition: retypes.h:1
ERESOURCE PagingIoResource
Definition: ntfs.h:523
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PVCB Vcb
Definition: cdstruc.h:939
#define DbgBreak()
Definition: ext2fs.h:46
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
#define _SEH2_LEAVE
Definition: filesup.c:20
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
_In_ PFCB Fcb
Definition: cdprocs.h:159
NTSTATUS RfsdSetRenameInfo(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
Definition: fileinfo.c:1069
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define RfsdSetWritable(m)
Definition: rfsd.h:292
#define FILE_NOTIFY_CHANGE_LAST_ACCESS
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1114
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4137
ULONG Size
Definition: ntfs.h:96
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID _Out_ PIO_STATUS_BLOCK _In_ ULONG NotifyFilter
Definition: zwfuncs.h:500
BOOLEAN RfsdFreeInode(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Inode, ULONG Type)
LONGLONG QuadPart
Definition: typedefs.h:114
#define PAGED_CODE()
#define FILE_BASIC_INFORMATION
Definition: disk.h:53