ReactOS  0.4.13-dev-563-g0561610
lock.c File Reference
#include "ext2fs.h"
Include dependency graph for lock.c:

Go to the source code of this file.

Functions

NTSTATUS Ext2LockControl (IN PEXT2_IRP_CONTEXT IrpContext)
 

Variables

PEXT2_GLOBAL Ext2Global
 

Function Documentation

◆ Ext2LockControl()

NTSTATUS Ext2LockControl ( IN PEXT2_IRP_CONTEXT  IrpContext)

Definition at line 25 of file lock.c.

26 {
29  PEXT2_FCB Fcb = NULL;
30  PIRP Irp = NULL;
31 
33  BOOLEAN CompleteContext = TRUE;
35  BOOLEAN bFcbAcquired = FALSE;
36 
37  _SEH2_TRY {
38 
39  ASSERT(IrpContext != NULL);
40 
41  ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
42  (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
43 
44  DeviceObject = IrpContext->DeviceObject;
45 
49  }
50 
51  FileObject = IrpContext->FileObject;
52 
53  Fcb = (PEXT2_FCB) FileObject->FsContext;
54  ASSERT(Fcb != NULL);
55  if (Fcb->Identifier.Type == EXT2VCB) {
58  }
59 
61  (Fcb->Identifier.Size == sizeof(EXT2_FCB)));
62 
63  if (FlagOn(Fcb->Mcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
66  }
67 
69  bFcbAcquired = TRUE;
70 
71  Irp = IrpContext->Irp;
72 
74 
75  Status = FsRtlCheckOplock( &Fcb->Oplock,
76  Irp,
77  IrpContext,
79  NULL );
80 
81  if (Status != STATUS_SUCCESS) {
82  CompleteContext = FALSE;
84  }
85 
86  //
87  // FsRtlProcessFileLock acquires FileObject->FsContext->Resource while
88  // modifying the file locks and calls IoCompleteRequest when it's done.
89  //
90 
92  &Fcb->FileLockAnchor,
93  Irp,
94  NULL );
95 #if EXT2_DEBUG
96  if (!NT_SUCCESS(Status)) {
97  DEBUG(DL_ERR, (
98  "Ext2LockControl: %-16.16s %-31s Status: %#x ***\n",
100  "IRP_MJ_LOCK_CONTROL",
101  Status ));
102  }
103 #endif
104  Fcb->Header.IsFastIoPossible = Ext2IsFastIoPossible(Fcb);
105 
106  } _SEH2_FINALLY {
107 
108  if (bFcbAcquired) {
110  }
111 
112  if (!IrpContext->ExceptionInProgress) {
113 
114  if (!CompleteIrp) {
115  IrpContext->Irp = NULL;
116  }
117 
118  if (CompleteContext) {
119  Ext2CompleteIrpContext(IrpContext, Status);
120  }
121  }
122  } _SEH2_END;
123 
124  return Status;
125 }
struct _EXT2_FCB * PEXT2_FCB
#define TRUE
Definition: types.h:120
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define Ext2GetCurrentProcessName()
Definition: ext2fs.h:1452
VOID CompleteIrp(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: pnp.c:12
_SEH2_TRY
Definition: create.c:4250
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
FAST_IO_POSSIBLE Ext2IsFastIoPossible(IN PEXT2_FCB Fcb)
Definition: fastio.c:38
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1954
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
CD_MCB Mcb
Definition: cdstruc.h:1022
NTSTATUS Ext2CompleteIrpContext(IN PEXT2_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:32
ULONG Type
Definition: ntfs.h:95
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
ERESOURCE MainResource
Definition: ntfs.h:512
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1153
Status
Definition: gdiplustypes.h:24
#define DL_ERR
Definition: ext2fs.h:1397
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_SEH2_END
Definition: create.c:4424
_SEH2_FINALLY
Definition: create.c:4395
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define IsExt2FsDevice(DO)
Definition: ext2fs.h:607
#define DEBUG(args)
Definition: rdesktop.h:129
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
Definition: oplock.c:1172
#define _SEH2_LEAVE
Definition: filesup.c:20
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2777
VOID NTAPI Ext2OplockComplete(IN PVOID Context, IN PIRP Irp)
Definition: dispatch.c:41
ULONG Size
Definition: ntfs.h:96

Referenced by Ext2DispatchRequest().

Variable Documentation

◆ Ext2Global

PEXT2_GLOBAL Ext2Global

Definition at line 16 of file init.c.