ReactOS  0.4.14-dev-98-gb0d4763
io_x.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static __inline NTSTATUS IopLockFileObject (_In_ PFILE_OBJECT FileObject, _In_ KPROCESSOR_MODE WaitMode)
 
static __inline VOID IopUnlockFileObject (IN PFILE_OBJECT FileObject)
 
FORCEINLINE VOID IopQueueIrpToThread (IN PIRP Irp)
 
FORCEINLINE VOID IopUnQueueIrpFromThread (IN PIRP Irp)
 
static __inline VOID IopUpdateOperationCount (IN IOP_TRANSFER_TYPE Type)
 
static __inline VOID IopUpdateTransferCount (IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount)
 
static __inline BOOLEAN IopValidateOpenPacket (IN POPEN_PACKET OpenPacket)
 

Function Documentation

◆ IopLockFileObject()

static __inline NTSTATUS IopLockFileObject ( _In_ PFILE_OBJECT  FileObject,
_In_ KPROCESSOR_MODE  WaitMode 
)
static

Definition at line 12 of file io_x.h.

15 {
16  BOOLEAN LockFailed;
17 
18  /* Lock the FO and check for contention */
20  {
22  return STATUS_SUCCESS;
23  }
24  else
25  {
27  WaitMode,
29  &LockFailed);
30  }
31 }
#define TRUE
Definition: types.h:120
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
unsigned char BOOLEAN
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define InterlockedExchange
Definition: armddk.h:54
#define FO_ALERTABLE_IO
Definition: iotypes.h:1734
#define ObReferenceObject
Definition: obfuncs.h:204
NTSTATUS NTAPI IopAcquireFileObjectLock(_In_ PFILE_OBJECT FileObject, _In_ KPROCESSOR_MODE AccessMode, _In_ BOOLEAN Alertable, _Out_ PBOOLEAN LockFailed)
Definition: file.c:2449
return STATUS_SUCCESS
Definition: btrfs.c:2966
signed int * PLONG
Definition: retypes.h:5

Referenced by IopCloseFile(), IopDeviceFsIoControl(), IopGetSetSecurityObject(), IopQueryDeviceInformation(), IoSetInformation(), NtFlushBuffersFile(), NtLockFile(), NtNotifyChangeDirectoryFile(), NtQueryDirectoryFile(), NtQueryInformationFile(), NtQueryVolumeInformationFile(), NtReadFile(), NtSetInformationFile(), NtSetVolumeInformationFile(), NtUnlockFile(), and NtWriteFile().

◆ IopQueueIrpToThread()

FORCEINLINE VOID IopQueueIrpToThread ( IN PIRP  Irp)

Definition at line 49 of file io_x.h.

50 {
51  KIRQL OldIrql;
52 
53  /* Raise to APC Level */
55 
56  /* Insert it into the list */
57  InsertHeadList(&Irp->Tail.Overlay.Thread->IrpList, &Irp->ThreadListEntry);
58 
59  /* Lower irql */
61 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_In_ PIRP Irp
Definition: csq.h:116
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by IoCancelFileOpen(), IopCloseFile(), IopDeleteFile(), IopGetFileInformation(), IopGetSetSecurityObject(), IopParseDevice(), IopPerformSynchronousRequest(), IopQueryDeviceInformation(), IoQueueThreadIrp(), IoSetInformation(), NtQueryInformationFile(), and NtSetInformationFile().

◆ IopUnlockFileObject()

static __inline VOID IopUnlockFileObject ( IN PFILE_OBJECT  FileObject)
static

Definition at line 36 of file io_x.h.

37 {
38  /* Unlock the FO and wake any waiters up */
40  if (FileObject->Waiters)
41  {
43  }
45 }
#define TRUE
Definition: types.h:120
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3289
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define InterlockedExchange
Definition: armddk.h:54
#define IO_NO_INCREMENT
Definition: iotypes.h:566
signed int * PLONG
Definition: retypes.h:5

Referenced by IopCleanupAfterException(), IopCleanupFailedIrp(), IopCloseFile(), IopDeviceFsIoControl(), IopGetSetSecurityObject(), IopPerformSynchronousRequest(), IopQueryDeviceInformation(), IoSetInformation(), NtQueryInformationFile(), NtQueryVolumeInformationFile(), NtReadFile(), NtSetInformationFile(), and NtWriteFile().

◆ IopUnQueueIrpFromThread()

FORCEINLINE VOID IopUnQueueIrpFromThread ( IN PIRP  Irp)

Definition at line 65 of file io_x.h.

66 {
67  /* Remove it from the list and reset it */
68  if (IsListEmpty(&Irp->ThreadListEntry))
69  return;
70  RemoveEntryList(&Irp->ThreadListEntry);
71  InitializeListHead(&Irp->ThreadListEntry);
72 }
_In_ PIRP Irp
Definition: csq.h:116
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by IoCancelFileOpen(), IopCloseFile(), IopCompleteRequest(), IopDeleteFile(), and IopParseDevice().

◆ IopUpdateOperationCount()

static __inline VOID IopUpdateOperationCount ( IN IOP_TRANSFER_TYPE  Type)
static

Definition at line 77 of file io_x.h.

78 {
79  PLARGE_INTEGER CountToChange;
80 
81  /* Make sure I/O operations are being counted */
83  {
84  if (Type == IopReadTransfer)
85  {
86  /* Increase read count */
88  CountToChange = &PsGetCurrentProcess()->ReadOperationCount;
89  }
90  else if (Type == IopWriteTransfer)
91  {
92  /* Increase write count */
94  CountToChange = &PsGetCurrentProcess()->WriteOperationCount;
95  }
96  else
97  {
98  /* Increase other count */
100  CountToChange = &PsGetCurrentProcess()->OtherOperationCount;
101  }
102 
103  /* Increase the process-wide count */
104  ExInterlockedAddLargeStatistic(CountToChange, 1);
105  }
106 }
Type
Definition: Type.h:6
NTKERNELAPI VOID FASTCALL ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend, IN ULONG Increment)
Definition: interlocked.c:103
ULONG IoWriteOperationCount
Definition: iomgr.c:41
ULONG IoReadOperationCount
Definition: iomgr.c:39
#define PsGetCurrentProcess
Definition: psfuncs.h:17
BOOLEAN IoCountOperations
Definition: iomgr.c:38
ULONG IoOtherOperationCount
Definition: iomgr.c:43

Referenced by IopCloseFile(), IopCreateFile(), IopGetSetSecurityObject(), IopPerformSynchronousRequest(), IopQueryAttributesFile(), NtCancelIoFile(), NtDeleteFile(), NtQueryInformationFile(), NtReadFile(), NtSetInformationFile(), and NtWriteFile().

◆ IopUpdateTransferCount()

static __inline VOID IopUpdateTransferCount ( IN IOP_TRANSFER_TYPE  Type,
IN ULONG  TransferCount 
)
static

Definition at line 111 of file io_x.h.

112 {
113  PLARGE_INTEGER CountToChange;
114  PLARGE_INTEGER TransferToChange;
115 
116  /* Make sure I/O operations are being counted */
117  if (IoCountOperations)
118  {
119  if (Type == IopReadTransfer)
120  {
121  /* Increase read count */
122  CountToChange = &PsGetCurrentProcess()->ReadTransferCount;
123  TransferToChange = &IoReadTransferCount;
124  }
125  else if (Type == IopWriteTransfer)
126  {
127  /* Increase write count */
128  CountToChange = &PsGetCurrentProcess()->WriteTransferCount;
129  TransferToChange = &IoWriteTransferCount;
130  }
131  else
132  {
133  /* Increase other count */
134  CountToChange = &PsGetCurrentProcess()->OtherTransferCount;
135  TransferToChange = &IoOtherTransferCount;
136  }
137 
138  /* Increase the process-wide count */
139  ExInterlockedAddLargeStatistic(CountToChange, TransferCount);
140 
141  /* Increase global count */
142  ExInterlockedAddLargeStatistic(TransferToChange, TransferCount);
143  }
144 }
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
Type
Definition: Type.h:6
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
NTKERNELAPI VOID FASTCALL ExInterlockedAddLargeStatistic(IN PLARGE_INTEGER Addend, IN ULONG Increment)
Definition: interlocked.c:103
#define PsGetCurrentProcess
Definition: psfuncs.h:17
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
BOOLEAN IoCountOperations
Definition: iomgr.c:38

Referenced by IopCompleteRequest(), NtReadFile(), NtSetInformationFile(), and NtWriteFile().

◆ IopValidateOpenPacket()

static __inline BOOLEAN IopValidateOpenPacket ( IN POPEN_PACKET  OpenPacket)
static

Definition at line 149 of file io_x.h.

150 {
151  /* Validate the packet */
152  if (!(OpenPacket) ||
153  (OpenPacket->Type != IO_TYPE_OPEN_PACKET) ||
154  (OpenPacket->Size != sizeof(OPEN_PACKET)))
155  {
156  /* Fail */
157  return FALSE;
158  }
159 
160  /* Good packet */
161  return TRUE;
162 }
#define TRUE
Definition: types.h:120
#define IO_TYPE_OPEN_PACKET

Referenced by IopParseDevice(), and IopParseFile().