ReactOS 0.4.15-dev-7842-g558ab78
resrcsup.c File Reference
#include "fatprocs.h"
Include dependency graph for resrcsup.c:

Go to the source code of this file.

Functions

 _Requires_lock_held_ (_Global_critical_region_)
 
 _Function_class_ (FAST_IO_ACQUIRE_FOR_CCFLUSH)
 
BOOLEAN NTAPI FatNoOpAcquire (IN PVOID Fcb, IN BOOLEAN Wait)
 
VOID NTAPI FatNoOpRelease (IN PVOID Fcb)
 

Function Documentation

◆ _Function_class_()

_Function_class_ ( FAST_IO_ACQUIRE_FOR_CCFLUSH  )

Definition at line 662 of file resrcsup.c.

670{
671 PFCB Fcb;
672 PCCB Ccb;
673 PVCB Vcb;
676
677 PAGED_CODE();
679
680 //
681 // Once again, the hack for making this look like
682 // a recursive call if needed. We cannot let ourselves
683 // verify under something that has resources held.
684 //
685 // This value is good. We should never try to acquire
686 // the file this way underneath of the cache.
687 //
688
690
691 if (IoGetTopLevelIrp() == NULL) {
692
694 }
695
696 //
697 // Time for some exposition.
698 //
699 // Lockorder for FAT is main->bcb->pagingio. Invert this at your obvious peril.
700 // The default logic for AcquireForCcFlush breaks this since in writethrough
701 // unpinrepinned we will grab the bcb then Mm will use the callback (which
702 // orders us with respect to the MmCollidedFlushEvent) to help us. If for
703 // directories/ea we then grab the main we are out of order.
704 //
705 // Fortunately, we do not need main. We only need paging - just look at the write
706 // path. This is basic pre-acquisition.
707 //
708 // Regular files require both resources, and are safe since we never pin them.
709 //
710
711 //
712 // Note that we do not need to disable APC delivery to guard
713 // against a rogue user issuing a suspend APC. That is because
714 // it is guaranteed that the caller is either in the system context,
715 // to which a user cannot deliver a suspend APC, or the caller has
716 // already disabled kernel APC delivery before calling. This is true
717 // for all the other pre-acquire routines as well.
718 //
719
722
723 if (Type < DirectoryFile) {
724
725 if (Header->Resource) {
726
727 if (!ExIsResourceAcquiredSharedLite( Header->Resource )) {
728
730
731 } else {
732
734 }
735 }
736 }
737
738 if (Header->PagingIoResource) {
739
740 ExAcquireResourceSharedLite( Header->PagingIoResource, TRUE );
741 }
742
743 return STATUS_SUCCESS;
744}
#define PAGED_CODE()
Type
Definition: Type.h:7
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
enum _TYPE_OF_OPEN TYPE_OF_OPEN
Definition: Header.h:9
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
struct _FSRTL_COMMON_FCB_HEADER * PFSRTL_COMMON_FCB_HEADER
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
Definition: filobsup.c:176
@ DirectoryFile
Definition: fatprocs.h:1046
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
if(dx< 0)
Definition: linetemp.h:194
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
Definition: resource.c:1663
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define Vcb
Definition: cdprocs.h:1415
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: cdstruc.h:1067
Definition: cdstruc.h:902
Definition: cdstruc.h:498
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define NT_ASSERT
Definition: rtlfuncs.h:3310

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

Definition at line 35 of file resrcsup.c.

66{
67 PAGED_CODE();
68
69#ifdef _MSC_VER
70#pragma prefast( suppress: 28137, "prefast wants the wait to be a constant, but that isn't possible for the way fastfat is designed" )
71#endif
72 if (ExAcquireResourceExclusiveLite( &Vcb->Resource, BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT))) {
73
74 if (!NoOpCheck) {
75
76 _SEH2_TRY {
77
78 FatVerifyOperationIsLegal( IrpContext );
79
81
83
84 FatReleaseVcb( IrpContext, Vcb );
85 }
86 } _SEH2_END;
87 }
88
89 return TRUE;
90 }
91
92 return FALSE;
93}
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1215
#define FALSE
Definition: types.h:117
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PVCB IN BOOLEAN NoOpCheck
Definition: fatprocs.h:1458
VOID FatVerifyOperationIsLegal(IN PIRP_CONTEXT IrpContext)
Definition: verfysup.c:1304
#define FatReleaseVcb(IRPCONTEXT, Vcb)
Definition: fatprocs.h:1640
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:160

◆ FatNoOpAcquire()

BOOLEAN NTAPI FatNoOpAcquire ( IN PVOID  Fcb,
IN BOOLEAN  Wait 
)

Definition at line 795 of file resrcsup.c.

819{
822
823 PAGED_CODE();
824
825 //
826 // This is a kludge because Cc is really the top level. We it
827 // enters the file system, we will think it is a resursive call
828 // and complete the request with hard errors or verify. It will
829 // have to deal with them, somehow....
830 //
831
833
835
836 return TRUE;
837}
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170

◆ FatNoOpRelease()

VOID NTAPI FatNoOpRelease ( IN PVOID  Fcb)

Definition at line 842 of file resrcsup.c.

863{
864 PAGED_CODE();
865
866 //
867 // Clear the kludge at this point.
868 //
869
871
873
875
876 return;
877}