ReactOS  0.4.14-dev-1233-gf5658fd
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 TRUE
Definition: types.h:120
Type
Definition: Type.h:6
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:908
Definition: cdstruc.h:1073
Definition: cdstruc.h:504
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
Definition: Header.h:8
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define Vcb
Definition: cdprocs.h:1425
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
Definition: resource.c:1658
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
return STATUS_SUCCESS
Definition: btrfs.c:2938
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
Definition: filobsup.c:176
struct _FSRTL_COMMON_FCB_HEADER * PFSRTL_COMMON_FCB_HEADER
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ _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 
80  } _SEH2_FINALLY {
81 
82  if ( _SEH2_AbnormalTermination() ) {
83 
84  FatReleaseVcb( IrpContext, Vcb );
85  }
86  } _SEH2_END;
87  }
88 
89  return TRUE;
90  }
91 
92  return FALSE;
93 }
#define TRUE
Definition: types.h:120
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PVCB IN BOOLEAN NoOpCheck
Definition: fatprocs.h:1447
VOID FatVerifyOperationIsLegal(IN PIRP_CONTEXT IrpContext)
Definition: verfysup.c:1308
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
#define Vcb
Definition: cdprocs.h:1425
_SEH2_END
Definition: create.c:4424
_SEH2_FINALLY
Definition: create.c:4395
#define FatReleaseVcb(IRPCONTEXT, Vcb)
Definition: fatprocs.h:1631

◆ 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 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
IN BOOLEAN Wait
Definition: fatprocs.h:1529
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ 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 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
#define NT_ASSERT
Definition: rtlfuncs.h:3312