ReactOS 0.4.16-dev-197-g92996da
fastio.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYRIGHT.TXT
3 * PROJECT: Ext2 File System Driver for WinNT/2K/XP
4 * FILE: fastio.c
5 * PROGRAMMER: Matt Wu <mattwu@163.com>
6 * HOMEPAGE: http://www.ext2fsd.com
7 * UPDATE HISTORY:
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include "ext2fs.h"
13
14/* GLOBALS ***************************************************************/
15
17
18/* DEFINITIONS *************************************************************/
19
20#define FASTIO_DEBUG_LEVEL DL_NVR
21
22
23#ifdef ALLOC_PRAGMA
24
25#pragma alloc_text(PAGE, Ext2FastIoRead)
26#pragma alloc_text(PAGE, Ext2FastIoWrite)
27#pragma alloc_text(PAGE, Ext2FastIoCheckIfPossible)
28#pragma alloc_text(PAGE, Ext2FastIoQueryBasicInfo)
29#pragma alloc_text(PAGE, Ext2FastIoQueryStandardInfo)
30#pragma alloc_text(PAGE, Ext2FastIoQueryNetworkOpenInfo)
31#pragma alloc_text(PAGE, Ext2FastIoLock)
32#pragma alloc_text(PAGE, Ext2FastIoUnlockSingle)
33#pragma alloc_text(PAGE, Ext2FastIoUnlockAll)
34#pragma alloc_text(PAGE, Ext2FastIoUnlockAll)
35#endif
36
40)
41{
43
44 if (!Fcb || !FsRtlOplockIsFastIoPossible(&Fcb->Oplock))
45 return IsPossible;
46
47 IsPossible = FastIoIsQuestionable;
48
49 if (!FsRtlAreThereCurrentFileLocks(&Fcb->FileLockAnchor)) {
50 if (!IsVcbReadOnly(Fcb->Vcb) && !FlagOn(Fcb->Vcb->Flags, VCB_VOLUME_LOCKED)) {
51 IsPossible = FastIoIsPossible;
52 }
53 }
54
55 return IsPossible;
56}
57
58
59#ifdef __REACTOS__
61#else
63#endif
73)
74{
75 BOOLEAN bPossible = FastIoIsNotPossible;
78 LARGE_INTEGER lLength;
79
80 lLength.QuadPart = Length;
81
82 _SEH2_TRY {
83
85
86 _SEH2_TRY {
87
90 }
91
92 Fcb = (PEXT2_FCB) FileObject->FsContext;
93 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
95 }
96
98 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
99
100 /* do nothing if target fie was deleted */
103 }
104
105 if (IsDirectory(Fcb)) {
107 }
108
109 Ccb = (PEXT2_CCB) FileObject->FsContext2;
110 if (Ccb == NULL) {
112 }
113
115
116 bPossible = FsRtlFastCheckLockForRead(
117 &Fcb->FileLockAnchor,
119 &lLength,
120 LockKey,
123
124 } else {
125
126 if (!IsVcbReadOnly(Fcb->Vcb)) {
127 bPossible = FsRtlFastCheckLockForWrite(
128 &Fcb->FileLockAnchor,
130 &lLength,
131 LockKey,
134 }
135 }
136
137#if EXT2_DEBUG
138 DEBUG(DL_INF, ("Ext2FastIIOCheckPossible: %s %s %wZ\n",
140 "FASTIO_CHECK_IF_POSSIBLE",
141 &Fcb->Mcb->FullName
142 ));
143
144 DEBUG(DL_INF, (
145 "Ext2FastIIOCheckPossible: Offset: %I64xg Length: %xh Key: %u %s %s\n",
146 FileOffset->QuadPart,
147 Length,
148 LockKey,
149 (CheckForReadOperation ? "CheckForReadOperation:" :
150 "CheckForWriteOperation:"),
151 (bPossible ? "Succeeded" : "Failed")));
152#endif
153
155 bPossible = FastIoIsNotPossible;
156 } _SEH2_END;
157
158 } _SEH2_FINALLY {
159
161 } _SEH2_END;
162
163 return bPossible;
164}
165
166
167#ifdef __REACTOS__
169#else
171#endif
180{
183
184 Fcb = (PEXT2_FCB) FileObject->FsContext;
185 if (Fcb == NULL) {
186 return FALSE;
187 }
188
190 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
191
195
196 DEBUG(DL_IO, ("Ext2FastIoRead: %wZ Offset: %I64xh Length: %xh Key: %u Status: %d\n",
197 &Fcb->Mcb->ShortName, FileOffset->QuadPart, Length, LockKey, Status));
198
199 return Status;
200}
201
202#ifdef __REACTOS__
204#else
206#endif
216{
220
221 Fcb = (PEXT2_FCB) FileObject->FsContext;
222 if (Fcb == NULL)
223 return FALSE;
224
225 _SEH2_TRY {
226
228
230 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
231
232 if (IsVcbReadOnly(Fcb->Vcb)) {
234 }
235
236 if (!ExAcquireResourceSharedLite(Fcb->Header.Resource, Wait)) {
238 }
239 Locked = TRUE;
240
242 Fcb->Header.ValidDataLength.QuadPart < FileOffset->QuadPart + Length ||
243 Fcb->Header.FileSize.QuadPart < FileOffset->QuadPart + Length ) {
244 Status = FALSE;
246 }
247
248 if (Locked) {
250 Locked = FALSE;
251 }
252
255 if (Status) {
256 if (IoStatus)
257 Length = (ULONG)IoStatus->Information;
258 }
259
260 } _SEH2_FINALLY {
261
262 if (Locked) {
264 }
265
267 } _SEH2_END;
268
269 DEBUG(DL_IO, ("Ext2FastIoWrite: %wZ Offset: %I64xh Length: %xh Key: %xh Status=%d\n",
270 &Fcb->Mcb->ShortName, FileOffset->QuadPart, Length, LockKey, Status));
271
272 return Status;
273}
274
275#ifdef __REACTOS__
277#else
279#endif
286{
291 BOOLEAN FcbMainResourceAcquired = FALSE;
292
293 _SEH2_TRY {
294
296
297 _SEH2_TRY {
298
302 }
303
304 Fcb = (PEXT2_FCB) FileObject->FsContext;
305 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
308 }
309 Ccb = (PEXT2_CCB) FileObject->FsContext2;
310 Mcb = Fcb->Mcb;
312 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
313#if EXT2_DEBUG
314 DEBUG(DL_INF, (
315 "Ext2FastIoQueryBasicInfo: %s %s %wZ\n",
317 "FASTIO_QUERY_BASIC_INFO",
318 &Fcb->Mcb->FullName
319 ));
320#endif
324 Wait)) {
326 }
327 FcbMainResourceAcquired = TRUE;
328 }
329
331
332 /*
333 typedef struct _FILE_BASIC_INFORMATION {
334 LARGE_INTEGER CreationTime;
335 LARGE_INTEGER LastAccessTime;
336 LARGE_INTEGER LastWriteTime;
337 LARGE_INTEGER ChangeTime;
338 ULONG FileAttributes;
339 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
340 */
341
342 Buffer->CreationTime = Mcb->CreationTime;
343 Buffer->LastAccessTime = Mcb->LastAccessTime;
344 Buffer->LastWriteTime = Mcb->LastWriteTime;
345 Buffer->ChangeTime = Mcb->ChangeTime;
346 Buffer->FileAttributes = Mcb->FileAttr;
347 if (Buffer->FileAttributes == 0) {
348 Buffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
349 }
350
351 IoStatus->Information = sizeof(FILE_BASIC_INFORMATION);
352 IoStatus->Status = STATUS_SUCCESS;
353
354 Status = TRUE;
355
358 } _SEH2_END;
359
360 } _SEH2_FINALLY {
361
362 if (FcbMainResourceAcquired) {
364 }
365
367 } _SEH2_END;
368
369#if EXT2_DEBUG
370
371 if (Status == FALSE) {
372
373 DEBUG(DL_ERR, ("Ext2FastIoQueryBasicInfo: %s %s Status: FALSE ***\n",
375 "FASTIO_QUERY_BASIC_INFO"));
376
377 } else if (IoStatus->Status != STATUS_SUCCESS) {
378
379 DEBUG(DL_ERR, (
380 "Ext2FastIoQueryBasicInfo: %s %s Status: %#x ***\n",
382 "FASTIO_QUERY_BASIC_INFO",
383 IoStatus->Status
384 ));
385 }
386#endif
387
388 return Status;
389}
390
391#ifdef __REACTOS__
393#else
395#endif
402)
403{
404
408 BOOLEAN FcbMainResourceAcquired = FALSE;
409
410 _SEH2_TRY {
411
413
414 _SEH2_TRY {
415
419 }
420
421 Fcb = (PEXT2_FCB) FileObject->FsContext;
422 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
425 }
426
428 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
429
430#if EXT2_DEBUG
431 DEBUG(DL_INF, (
432 "Ext2FastIoQueryStandardInfo: %s %s %wZ\n",
434 "FASTIO_QUERY_STANDARD_INFO",
435 &Fcb->Mcb->FullName ));
436#endif
437 Vcb = Fcb->Vcb;
438
442 Wait )) {
444 }
445 FcbMainResourceAcquired = TRUE;
446 }
447
449
450 /*
451 typedef struct _FILE_STANDARD_INFORMATION {
452 LARGE_INTEGER AllocationSize;
453 LARGE_INTEGER EndOfFile;
454 ULONG NumberOfLinks;
455 BOOLEAN DeletePending;
456 BOOLEAN Directory;
457 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
458 */
459
460 Buffer->NumberOfLinks = Fcb->Inode->i_nlink;
461 Buffer->DeletePending = IsFlagOn(Fcb->Flags, FCB_DELETE_PENDING);
462
463 if (IsDirectory(Fcb)) {
464 Buffer->Directory = IsDirectory(Fcb);
465 Buffer->AllocationSize.QuadPart = 0;
466 Buffer->EndOfFile.QuadPart = 0;
467 } else {
468 Buffer->Directory = FALSE;
469 Buffer->AllocationSize = Fcb->Header.AllocationSize;
470 Buffer->EndOfFile = Fcb->Header.FileSize;
471 }
472
473 IoStatus->Information = sizeof(FILE_STANDARD_INFORMATION);
474 IoStatus->Status = STATUS_SUCCESS;
475#if EXT2_DEBUG
476 DEBUG(DL_INF, ( "Ext2FastIoQueryStandInfo: AllocatieonSize = %I64xh FileSize = %I64xh\n",
477 Buffer->AllocationSize.QuadPart, Buffer->EndOfFile.QuadPart));
478#endif
479 Status = TRUE;
480
483 } _SEH2_END;
484
485 } _SEH2_FINALLY {
486
487 if (FcbMainResourceAcquired) {
489 }
490
492 } _SEH2_END;
493
494#if EXT2_DEBUG
495 if (Status == FALSE) {
496 DEBUG(DL_INF, (
497 "Ext2FastIoQueryStandardInfo: %s %s Status: FALSE ***\n",
499 "FASTIO_QUERY_STANDARD_INFO" ));
500 } else if (IoStatus->Status != STATUS_SUCCESS) {
501 DEBUG(DL_INF, (
502 "Ext2FastIoQueryStandardInfo: %s %s Status: %#x ***\n",
504 "FASTIO_QUERY_STANDARD_INFO",
505 IoStatus->Status ));
506 }
507#endif
508
509 return Status;
510}
511
512#ifdef __REACTOS__
514#else
516#endif
522 IN ULONG Key,
527)
528{
531
532 _SEH2_TRY {
533
535
536 _SEH2_TRY {
537
541 }
542
543 Fcb = (PEXT2_FCB) FileObject->FsContext;
544 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
547 }
548
550 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
551
552 if (IsDirectory(Fcb)) {
553 DbgBreak();
556 }
557#if EXT2_DEBUG
558 DEBUG(DL_INF, (
559 "Ext2FastIoLock: %s %s %wZ\n",
561 "FASTIO_LOCK",
562 &Fcb->Mcb->FullName ));
563
564 DEBUG(DL_INF, (
565 "Ext2FastIoLock: Offset: %I64xh Length: %I64xh Key: %u %s%s\n",
566 FileOffset->QuadPart,
567 Length->QuadPart,
568 Key,
569 (FailImmediately ? "FailImmediately " : ""),
570 (ExclusiveLock ? "ExclusiveLock " : "") ));
571#endif
572
573 if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
575 }
576
578 &Fcb->FileLockAnchor,
581 Length,
582 Process,
583 Key,
586 IoStatus,
587 NULL,
588 FALSE);
589
590 if (Status) {
591 Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
592 }
593
596 } _SEH2_END;
597
598 } _SEH2_FINALLY {
599
601 } _SEH2_END;
602
603#if EXT2_DEBUG
604 if (Status == FALSE) {
605 DEBUG(DL_ERR, (
606 "Ext2FastIoLock: %s %s *** Status: FALSE ***\n",
608 "FASTIO_LOCK"
609 ));
610 } else if (IoStatus->Status != STATUS_SUCCESS) {
611 DEBUG(DL_ERR, (
612 "Ext2FastIoLock: %s %s *** Status: %s (%#x) ***\n",
614 "FASTIO_LOCK",
616 IoStatus->Status
617 ));
618 }
619#endif
620
621 return Status;
622}
623
624#ifdef __REACTOS__
626#else
628#endif
634 IN ULONG Key,
637)
638{
641
642 _SEH2_TRY {
643
645
646 _SEH2_TRY {
647
651 }
652
653 Fcb = (PEXT2_FCB) FileObject->FsContext;
654 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
655 DbgBreak();
658 }
659
661 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
662
663 if (IsDirectory(Fcb)) {
664 DbgBreak();
667 }
668
669#if EXT2_DEBUG
670 DEBUG(DL_INF, (
671 "Ext2FastIoUnlockSingle: %s %s %wZ\n",
673 "FASTIO_UNLOCK_SINGLE",
674 &Fcb->Mcb->FullName ));
675
676 DEBUG(DL_INF, (
677 "Ext2FastIoUnlockSingle: Offset: %I64xh Length: %I64xh Key: %u\n",
678 FileOffset->QuadPart,
679 Length->QuadPart,
680 Key ));
681#endif
682
683 if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
685 }
686
688 &Fcb->FileLockAnchor,
691 Length,
692 Process,
693 Key,
694 NULL,
695 FALSE);
696
697 IoStatus->Information = 0;
698 Status = TRUE;
699
700 Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
701
704 } _SEH2_END;
705
706 } _SEH2_FINALLY {
707
709 } _SEH2_END;
710
711#if EXT2_DEBUG
712 if (Status == FALSE) {
713
714 DEBUG(DL_ERR, (
715 "Ext2FastIoUnlockSingle: %s %s *** Status: FALSE ***\n",
717 "FASTIO_UNLOCK_SINGLE" ));
718 } else if (IoStatus->Status != STATUS_SUCCESS) {
719 DEBUG(DL_ERR, (
720 "Ext2FastIoUnlockSingle: %s %s *** Status: %s (%#x) ***\n",
722 "FASTIO_UNLOCK_SINGLE",
724 IoStatus->Status ));
725 }
726#endif
727
728 return Status;
729}
730
731#ifdef __REACTOS__
733#else
735#endif
741{
744
745 _SEH2_TRY {
746
748
749 _SEH2_TRY {
750
754 }
755
756 Fcb = (PEXT2_FCB) FileObject->FsContext;
757 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
758 DbgBreak();
761 }
762
764 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
765
766 if (IsDirectory(Fcb)) {
767 DbgBreak();
770 }
771#if EXT2_DEBUG
772 DEBUG(DL_INF, (
773 "Ext2FastIoUnlockSingle: %s %s %wZ\n",
775 "FASTIO_UNLOCK_ALL",
776 &Fcb->Mcb->FullName
777 ));
778#endif
779
780 if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
782 }
783
785 &Fcb->FileLockAnchor,
787 Process,
788 NULL );
789
790 IoStatus->Information = 0;
791 Status = TRUE;
792
793 Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
794
797 } _SEH2_END;
798
799 } _SEH2_FINALLY {
800
802 } _SEH2_END;
803
804#if EXT2_DEBUG
805 if (Status == FALSE) {
806
807 DEBUG(DL_ERR, (
808 "Ext2FastIoUnlockSingle: %s %s *** Status: FALSE ***\n",
810 "FASTIO_UNLOCK_ALL"
811 ));
812 } else if (IoStatus->Status != STATUS_SUCCESS) {
813 DEBUG(DL_ERR, (
814 "Ext2FastIoUnlockSingle: %s %s *** Status: %s (%#x) ***\n",
816 "FASTIO_UNLOCK_ALL",
818 IoStatus->Status
819 ));
820 }
821#endif
822
823 return Status;
824}
825
826#ifdef __REACTOS__
828#else
830#endif
833#ifdef __REACTOS__
835#else
837#endif
838 IN ULONG Key,
841)
842{
845
846 _SEH2_TRY {
847
849
850 _SEH2_TRY {
851
855 }
856
857 Fcb = (PEXT2_FCB) FileObject->FsContext;
858 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
859 DbgBreak();
862 }
863
865 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
866
867 if (IsDirectory(Fcb)) {
868 DbgBreak();
871 }
872
873#if EXT2_DEBUG
874 DEBUG(DL_INF, (
875 "Ext2FastIoUnlockAllByKey: %s %s %wZ\n",
877 "FASTIO_UNLOCK_ALL_BY_KEY",
878 &Fcb->Mcb->FullName
879 ));
880
881 DEBUG(DL_INF, (
882 "Ext2FastIoUnlockAllByKey: Key: %u\n",
883 Key
884 ));
885#endif
886
887 if (!FsRtlOplockIsFastIoPossible(&Fcb->Oplock)) {
889 }
890
892 &Fcb->FileLockAnchor,
894 Process,
895 Key,
896 NULL
897 );
898
899 IoStatus->Information = 0;
900 Status = TRUE;
901
902 Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
903
906 } _SEH2_END;
907
908 } _SEH2_FINALLY {
909
911 } _SEH2_END;
912
913#if EXT2_DEBUG
914 if (Status == FALSE) {
915
916 DEBUG(DL_ERR, (
917 "Ext2FastIoUnlockAllByKey: %s %s *** Status: FALSE ***\n",
919 "FASTIO_UNLOCK_ALL_BY_KEY"
920 ));
921 } else if (IoStatus->Status != STATUS_SUCCESS) {
922
923 DEBUG(DL_ERR, (
924 "Ext2FastIoUnlockAllByKey: %s %s *** Status: %s (%#x) ***\n",
926 "FASTIO_UNLOCK_ALL_BY_KEY",
928 IoStatus->Status
929 ));
930 }
931#endif
932
933 return Status;
934}
935
936
937#ifdef __REACTOS__
939#else
941#endif
948)
949{
953
954 BOOLEAN bResult = FALSE;
955 BOOLEAN FcbResourceAcquired = FALSE;
956
957 _SEH2_TRY {
958
960
964 }
965
966 Fcb = (PEXT2_FCB) FileObject->FsContext;
967 if (Fcb == NULL || Fcb->Identifier.Type == EXT2VCB) {
968 DbgBreak();
971 }
972
974 (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
975 Ccb = (PEXT2_CCB) FileObject->FsContext2;
976 Mcb = Fcb->Mcb;
977
978#if EXT2_DEBUG
979 DEBUG(DL_INF, (
980 "%-31s %wZ\n",
981 "FASTIO_QUERY_NETWORK_OPEN_INFO",
982 &Fcb->Mcb->FullName
983 ));
984#endif
985
986 if (!Ccb) {
988 }
989
991
994 Wait
995 )) {
997 }
998
999 FcbResourceAcquired = TRUE;
1000 }
1001
1002 if (IsDirectory(Fcb)) {
1003 PFNOI->AllocationSize.QuadPart = 0;
1004 PFNOI->EndOfFile.QuadPart = 0;
1005 } else {
1006 PFNOI->AllocationSize = Fcb->Header.AllocationSize;
1007 PFNOI->EndOfFile = Fcb->Header.FileSize;
1008 }
1009
1010 PFNOI->FileAttributes = Mcb->FileAttr;
1011 if (PFNOI->FileAttributes == 0) {
1012 PFNOI->FileAttributes = FILE_ATTRIBUTE_NORMAL;
1013 }
1014
1015 PFNOI->CreationTime = Mcb->CreationTime;
1016 PFNOI->LastAccessTime = Mcb->LastAccessTime;
1017 PFNOI->LastWriteTime = Mcb->LastWriteTime;
1018 PFNOI->ChangeTime = Mcb->ChangeTime;
1019
1020 bResult = TRUE;
1021
1022 IoStatus->Status = STATUS_SUCCESS;
1023 IoStatus->Information = sizeof(FILE_NETWORK_OPEN_INFORMATION);
1024
1025 } _SEH2_FINALLY {
1026
1027 if (FcbResourceAcquired) {
1029 }
1030
1032 } _SEH2_END;
1033
1034 return bResult;
1035}
1036
1037
1038#ifdef __REACTOS__
1039VOID NTAPI
1040#else
1041VOID
1042#endif
1045)
1046
1047{
1048 PEXT2_FCB Fcb = FileObject->FsContext;
1049
1050 if (Fcb->Header.Resource != NULL) {
1052 }
1053
1054 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2AcquireForCreateSection: Fcb=%p\n", Fcb));
1055}
1056
1057#ifdef __REACTOS__
1058VOID NTAPI
1059#else
1060VOID
1061#endif
1064)
1065{
1066 PEXT2_FCB Fcb = FileObject->FsContext;
1067
1068 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2ReleaseForCreateSection: Fcb=%p\n", Fcb));
1069
1070 if (Fcb->Header.Resource != NULL) {
1071 ExReleaseResourceLite(Fcb->Header.Resource);
1072 }
1073}
1074
1075
1076#ifdef __REACTOS__
1078#else
1080#endif
1086)
1087
1088{
1089 BOOLEAN ResourceAcquired = FALSE;
1090
1091 PEXT2_FCB Fcb = FileObject->FsContext;
1092
1093 *ResourceToRelease = Fcb->Header.Resource;
1095 if (!ResourceAcquired) {
1097 }
1098
1099 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2AcquireFileForModWrite: Fcb=%p Acquired=%d\n",
1100 Fcb, ResourceAcquired));
1101
1102 return (ResourceAcquired ? STATUS_SUCCESS : STATUS_CANT_WAIT);
1103}
1104
1105#ifdef __REACTOS__
1107#else
1109#endif
1114)
1115{
1116 PEXT2_FCB Fcb = FileObject->FsContext;
1117
1118 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2ReleaseFileForModWrite: Fcb=%p\n", Fcb));
1119
1120 if (ResourceToRelease != NULL) {
1121 ASSERT(ResourceToRelease == Fcb->Header.Resource);
1123 } else {
1124 DbgBreak();
1125 }
1126
1127 return STATUS_SUCCESS;
1128}
1129
1130#ifdef __REACTOS__
1132#else
1134#endif
1138)
1139{
1140 PEXT2_FCB Fcb = FileObject->FsContext;
1141
1142 if (Fcb->Header.Resource != NULL) {
1144 }
1145
1146 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2AcquireFileForCcFlush: Fcb=%p\n", Fcb));
1147
1148 return STATUS_SUCCESS;
1149}
1150
1151#ifdef __REACTOS__
1153#else
1155#endif
1159)
1160{
1161 PEXT2_FCB Fcb = FileObject->FsContext;
1162
1163 DEBUG(FASTIO_DEBUG_LEVEL, ("Ext2ReleaseFileForCcFlush: Fcb=%p\n", Fcb));
1164
1165 if (Fcb->Header.Resource != NULL) {
1166 ExReleaseResourceLite(Fcb->Header.Resource);
1167 }
1168
1169 return STATUS_SUCCESS;
1170}
1171
1172
1173#ifdef __REACTOS__
1175#else
1177#endif
1180 OUT PVOID *cc
1181 )
1182{
1183 PEXT2_FCB Fcb = (PEXT2_FCB)cd->FileObject->FsContext;
1185
1188 if (cd->Parameters.AcquireForSectionSynchronization.SyncType != SyncTypeCreateSection) {
1190 } else if (Fcb->ShareAccess.Writers == 0) {
1192 } else {
1194 }
1195
1196 return status;
1197}
unsigned char BOOLEAN
InitDirComponents & cd
LONG NTSTATUS
Definition: precomp.h:26
#define DEBUG(args)
Definition: rdesktop.h:129
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOLEAN Ext2FastIoRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:172
BOOLEAN Ext2FastIoLock(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN BOOLEAN FailImmediately, IN BOOLEAN ExclusiveLock, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:517
BOOLEAN Ext2FastIoQueryBasicInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:280
BOOLEAN Ext2FastIoUnlockAllByKey(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:831
BOOLEAN Ext2FastIoWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:207
NTSTATUS Ext2ReleaseFileForModWrite(IN PFILE_OBJECT FileObject, IN PERESOURCE ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1110
VOID Ext2AcquireForCreateSection(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1043
PEXT2_GLOBAL Ext2Global
Definition: init.c:16
BOOLEAN Ext2FastIoQueryStandardInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:396
NTSTATUS Ext2ReleaseFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1156
NTSTATUS Ext2PreAcquireForCreateSection(IN PFS_FILTER_CALLBACK_DATA cd, OUT PVOID *cc)
Definition: fastio.c:1178
NTSTATUS Ext2AcquireFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1135
BOOLEAN Ext2FastIoQueryNetworkOpenInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN OUT PFILE_NETWORK_OPEN_INFORMATION PFNOI, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:942
BOOLEAN Ext2FastIoUnlockAll(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:736
BOOLEAN Ext2FastIoCheckIfPossible(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN BOOLEAN CheckForReadOperation, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:64
VOID Ext2ReleaseForCreateSection(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1062
#define FASTIO_DEBUG_LEVEL
Definition: fastio.c:20
BOOLEAN Ext2FastIoUnlockSingle(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:629
NTSTATUS Ext2AcquireFileForModWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER EndingOffset, OUT PERESOURCE *ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1081
FAST_IO_POSSIBLE Ext2IsFastIoPossible(IN PEXT2_FCB Fcb)
Definition: fastio.c:38
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
ERESOURCE * PERESOURCE
Definition: env_spec_w32.h:595
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
#define Ext2GetCurrentProcessName()
Definition: ext2fs.h:1489
#define VCB_VOLUME_LOCKED
Definition: ext2fs.h:789
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
@ EXT2FCB
Definition: ext2fs.h:463
@ EXT2VCB
Definition: ext2fs.h:462
#define IsDirectory(Fcb)
Definition: ext2fs.h:283
#define IsVcbReadOnly(Vcb)
Definition: ext2fs.h:814
#define IsExt2FsDevice(DO)
Definition: ext2fs.h:616
#define DL_INF
Definition: ext2fs.h:1436
#define FCB_PAGE_FILE
Definition: ext2fs.h:881
ULONG ProcessNameOffset
#define FCB_DELETE_PENDING
Definition: ext2fs.h:888
#define DbgBreak()
Definition: ext2fs.h:46
struct _EXT2_FCB EXT2_FCB
#define IsWritingToEof(Pos)
Definition: ext2fs.h:280
struct _EXT2_CCB * PEXT2_CCB
#define DL_ERR
Definition: ext2fs.h:1434
struct _EXT2_FCB * PEXT2_FCB
#define DL_IO
Definition: ext2fs.h:1450
#define EXT2_DEBUG
Definition: ext2fs.h:34
PUCHAR Ext2NtStatusToString(IN NTSTATUS Status)
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2666
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
Definition: fatprocs.h:2715
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
Definition: fatprocs.h:2667
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
Definition: fatprocs.h:2714
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:349
BOOLEAN NTAPI FsRtlFastCheckLockForWrite(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
Definition: filelock.c:782
NTSTATUS NTAPI FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL, IN BOOLEAN AlreadySynchronized)
Definition: filelock.c:825
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
Definition: filelock.c:1025
BOOLEAN NTAPI FsRtlFastCheckLockForRead(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
Definition: filelock.c:748
NTSTATUS NTAPI FsRtlFastUnlockAllByKey(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL)
Definition: filelock.c:1086
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define _SEH2_LEAVE
Definition: filesup.c:20
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
#define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)
Definition: fsrtlfuncs.h:1581
@ FastIoIsQuestionable
Definition: fsrtltypes.h:242
@ FastIoIsNotPossible
Definition: fsrtltypes.h:240
@ FastIoIsPossible
Definition: fsrtltypes.h:241
enum _FAST_IO_POSSIBLE FAST_IO_POSSIBLE
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
uint32_t cc
Definition: isohybrid.c:75
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FILE_BASIC_INFORMATION
Definition: disk.h:53
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:209
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
BOOLEAN NTAPI FsRtlCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:64
BOOLEAN NTAPI FsRtlCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:264
#define STATUS_FILE_LOCKED_WITH_ONLY_READERS
Definition: ntstatus.h:111
#define STATUS_CANT_WAIT
Definition: ntstatus.h:452
#define STATUS_FILE_LOCKED_WITH_WRITERS
Definition: ntstatus.h:112
#define STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY
Definition: ntstatus.h:110
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1564
#define Vcb
Definition: cdprocs.h:1415
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG Type
Definition: ntfs.h:95
ULONG Size
Definition: ntfs.h:96
ULONG Flags
Definition: ntfs.h:536
PVCB Vcb
Definition: cdstruc.h:933
SHARE_ACCESS ShareAccess
Definition: cdstruc.h:1009
CD_MCB Mcb
Definition: cdstruc.h:1016
NTFSIDENTIFIER Identifier
Definition: ntfs.h:515
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:925
ERESOURCE MainResource
Definition: ntfs.h:528
ULONG Writers
Definition: iotypes.h:527
Definition: ps.c:97
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_In_ PLARGE_INTEGER _Out_ struct _ERESOURCE ** ResourceToRelease
Definition: iotypes.h:1598
@ SyncTypeCreateSection
Definition: iotypes.h:7365
* PFILE_OBJECT
Definition: iotypes.h:1998
_In_ PLARGE_INTEGER EndingOffset
Definition: iotypes.h:1597
#define FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION
Definition: iotypes.h:7398
#define PsGetCurrentProcess
Definition: psfuncs.h:17