ReactOS 0.4.16-dev-251-ga17b6e9
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}
unsigned char BOOLEAN
#define InterlockedExchange
Definition: armddk.h:54
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
NTSTATUS NTAPI IopAcquireFileObjectLock(_In_ PFILE_OBJECT FileObject, _In_ KPROCESSOR_MODE AccessMode, _In_ BOOLEAN Alertable, _Out_ PBOOLEAN LockFailed)
Definition: file.c:2450
#define STATUS_SUCCESS
Definition: shellext.h:65
int32_t * PLONG
Definition: typedefs.h:58
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define FO_ALERTABLE_IO
Definition: iotypes.h:1777
#define ObReferenceObject
Definition: obfuncs.h:204

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 PETHREAD Thread = Irp->Tail.Overlay.Thread;
52
53 /* Disable special kernel APCs so we can't race with IopCompleteRequest.
54 * IRP's thread must be the current thread */
56
57 /* Insert it into the list */
58 InsertHeadList(&Thread->IrpList, &Irp->ThreadListEntry);
59
60 /* Leave the guarded region */
62}
_In_ PIRP Irp
Definition: csq.h:116
#define InsertHeadList(ListHead, Entry)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define KeEnterGuardedRegionThread(_Thread)
Definition: ke_x.h:27
#define KeLeaveGuardedRegionThread(_Thread)
Definition: ke_x.h:48
KTHREAD Tcb
Definition: pstypes.h:1104
LIST_ENTRY IrpList
Definition: pstypes.h:1145

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 KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define ObDereferenceObject
Definition: obfuncs.h:203
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3304

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 66 of file io_x.h.

67{
68 /* Special kernel APCs must be disabled so we can't race with
69 * IopCompleteRequest (or because we are called from there) */
71
72 /* Remove it from the list and reset it */
73 if (IsListEmpty(&Irp->ThreadListEntry))
74 return;
75 RemoveEntryList(&Irp->ThreadListEntry);
76 InitializeListHead(&Irp->ThreadListEntry);
77}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN NTAPI KeAreAllApcsDisabled(VOID)
Definition: apc.c:985

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

◆ IopUpdateOperationCount()

static __inline VOID IopUpdateOperationCount ( IN IOP_TRANSFER_TYPE  Type)
static

Definition at line 82 of file io_x.h.

83{
84 PLARGE_INTEGER CountToChange;
85
86 /* Make sure I/O operations are being counted */
88 {
89 if (Type == IopReadTransfer)
90 {
91 /* Increase read count */
93 CountToChange = &PsGetCurrentProcess()->ReadOperationCount;
94 }
95 else if (Type == IopWriteTransfer)
96 {
97 /* Increase write count */
99 CountToChange = &PsGetCurrentProcess()->WriteOperationCount;
100 }
101 else
102 {
103 /* Increase other count */
105 CountToChange = &PsGetCurrentProcess()->OtherOperationCount;
106 }
107
108 /* Increase the process-wide count */
109 ExInterlockedAddLargeStatistic(CountToChange, 1);
110 }
111}
Type
Definition: Type.h:7
ULONG IoWriteOperationCount
Definition: iomgr.c:41
ULONG IoOtherOperationCount
Definition: iomgr.c:43
ULONG IoReadOperationCount
Definition: iomgr.c:39
@ IopWriteTransfer
Definition: io.h:262
@ IopReadTransfer
Definition: io.h:261
BOOLEAN IoCountOperations
Definition: iomgr.c:38
#define ExInterlockedAddLargeStatistic(Addend, Increment)
Definition: exfuncs.h:850
#define PsGetCurrentProcess
Definition: psfuncs.h:17

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 116 of file io_x.h.

117{
118 PLARGE_INTEGER CountToChange;
119 PLARGE_INTEGER TransferToChange;
120
121 /* Make sure I/O operations are being counted */
123 {
124 if (Type == IopReadTransfer)
125 {
126 /* Increase read count */
127 CountToChange = &PsGetCurrentProcess()->ReadTransferCount;
128 TransferToChange = &IoReadTransferCount;
129 }
130 else if (Type == IopWriteTransfer)
131 {
132 /* Increase write count */
133 CountToChange = &PsGetCurrentProcess()->WriteTransferCount;
134 TransferToChange = &IoWriteTransferCount;
135 }
136 else
137 {
138 /* Increase other count */
139 CountToChange = &PsGetCurrentProcess()->OtherTransferCount;
140 TransferToChange = &IoOtherTransferCount;
141 }
142
143 /* Increase the process-wide count */
144 ExInterlockedAddLargeStatistic(CountToChange, TransferCount);
145
146 /* Increase global count */
147 ExInterlockedAddLargeStatistic(TransferToChange, TransferCount);
148 }
149}
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44

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

◆ IopValidateOpenPacket()

static __inline BOOLEAN IopValidateOpenPacket ( IN POPEN_PACKET  OpenPacket)
static

Definition at line 154 of file io_x.h.

155{
156 /* Validate the packet */
157 if (!(OpenPacket) ||
158 (OpenPacket->Type != IO_TYPE_OPEN_PACKET) ||
159 (OpenPacket->Size != sizeof(OPEN_PACKET)))
160 {
161 /* Fail */
162 return FALSE;
163 }
164
165 /* Good packet */
166 return TRUE;
167}
#define IO_TYPE_OPEN_PACKET

Referenced by IopParseDevice(), and IopParseFile().