ReactOS 0.4.16-dev-340-g0540c21
dispatch.c File Reference
#include "ntfs.h"
#include <debug.h>
Include dependency graph for dispatch.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS NtfsQueueRequest (PNTFS_IRP_CONTEXT IrpContext)
 
static NTSTATUS NtfsDispatch (PNTFS_IRP_CONTEXT IrpContext)
 
static VOID NTAPI NtfsDoRequest (PVOID IrpContext)
 
NTSTATUS NTAPI NtfsFsdDispatch (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 

Variables

static LONG QueueCount = 0
 
static WORKER_THREAD_ROUTINE NtfsDoRequest
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 31 of file dispatch.c.

Function Documentation

◆ NtfsDispatch()

static NTSTATUS NtfsDispatch ( PNTFS_IRP_CONTEXT  IrpContext)
static

Definition at line 59 of file dispatch.c.

60{
61 PIRP Irp = IrpContext->Irp;
63
64 TRACE_(NTFS, "NtfsDispatch()\n");
65
67
69
70 switch (IrpContext->MajorFunction)
71 {
74 break;
75
77 Status = NtfsSetVolumeInformation(IrpContext);
78 break;
79
81 Status = NtfsQueryInformation(IrpContext);
82 break;
83
86 {
87 DPRINT1("NTFS write-support is EXPERIMENTAL and is disabled by default!\n");
89 }
90 else
91 {
92 Status = NtfsSetInformation(IrpContext);
93 }
94 break;
95
97 Status = NtfsDirectoryControl(IrpContext);
98 break;
99
100 case IRP_MJ_READ:
101 Status = NtfsRead(IrpContext);
102 break;
103
105 Status = NtfsDeviceControl(IrpContext);
106 break;
107
108 case IRP_MJ_WRITE:
110 {
111 DPRINT1("NTFS write-support is EXPERIMENTAL and is disabled by default!\n");
113 }
114 else
115 {
116 Status = NtfsWrite(IrpContext);
117 }
118 break;
119
120 case IRP_MJ_CLOSE:
121 Status = NtfsClose(IrpContext);
122 break;
123
124 case IRP_MJ_CLEANUP:
125 Status = NtfsCleanup(IrpContext);
126 break;
127
128 case IRP_MJ_CREATE:
129 Status = NtfsCreate(IrpContext);
130 break;
131
133 Status = NtfsFileSystemControl(IrpContext);
134 break;
135 }
136
137 ASSERT((!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) ||
138 ((IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) ||
139 (!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && (IrpContext->Flags & IRPCONTEXT_QUEUE)));
140
141 if (IrpContext->Flags & IRPCONTEXT_COMPLETE)
142 {
143 Irp->IoStatus.Status = Status;
144 IoCompleteRequest(Irp, IrpContext->PriorityBoost);
145 }
146
147 if (IrpContext->Flags & IRPCONTEXT_QUEUE)
148 {
149 /* Reset our status flags before queueing the IRP */
150 IrpContext->Flags |= IRPCONTEXT_COMPLETE;
151 IrpContext->Flags &= ~IRPCONTEXT_QUEUE;
152 Status = NtfsQueueRequest(IrpContext);
153 }
154 else
155 {
156 ExFreeToNPagedLookasideList(&NtfsGlobalData->IrpContextLookasideList, IrpContext);
157 }
158
161
162 return Status;
163}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
ARC_STATUS NtfsClose(ULONG FileId)
Definition: ntfs.c:760
ARC_STATUS NtfsRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: ntfs.c:831
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRACE_(x)
Definition: compat.h:76
NTSTATUS NtfsCleanup(PNTFS_IRP_CONTEXT IrpContext)
Definition: cleanup.c:89
NTSTATUS NtfsCreate(PNTFS_IRP_CONTEXT IrpContext)
Definition: create.c:622
static NTSTATUS NtfsQueueRequest(PNTFS_IRP_CONTEXT IrpContext)
Definition: dispatch.c:42
BOOLEAN NtfsIsIrpTopLevel(PIRP Irp)
Definition: misc.c:43
PNTFS_GLOBAL_DATA NtfsGlobalData
Definition: ntfs.c:36
#define IRPCONTEXT_QUEUE
Definition: ntfs.h:476
#define IRPCONTEXT_COMPLETE
Definition: ntfs.h:475
NTSTATUS NtfsWrite(PNTFS_IRP_CONTEXT IrpContext)
Definition: rw.c:537
NTSTATUS NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: volinfo.c:343
NTSTATUS NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: volinfo.c:420
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
NTSTATUS NtfsDeviceControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: devctl.c:36
NTSTATUS NtfsDirectoryControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: dirctl.c:590
NTSTATUS NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:420
NTSTATUS NtfsSetInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:719
NTSTATUS NtfsFileSystemControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: fsctl.c:963
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
BOOLEAN EnableWriteSupport
Definition: ntfs.h:155
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: ntfs.h:152
UCHAR MajorFunction
Definition: ntfs.h:483
ULONG Flags
Definition: ntfs.h:481
CCHAR PriorityBoost
Definition: ntfs.h:491
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SET_VOLUME_INFORMATION
#define IRP_MJ_CLEANUP

Referenced by NtfsDoRequest(), and NtfsFsdDispatch().

◆ NtfsDoRequest()

static VOID NTAPI NtfsDoRequest ( PVOID  IrpContext)
static

Definition at line 168 of file dispatch.c.

169{
171 DPRINT("NtfsDoRequest(IrpContext %p), MajorFunction %x, %d\n",
172 IrpContext, ((PNTFS_IRP_CONTEXT)IrpContext)->MajorFunction, QueueCount);
173 NtfsDispatch((PNTFS_IRP_CONTEXT)IrpContext);
174}
#define InterlockedDecrement
Definition: armddk.h:52
static LONG QueueCount
Definition: dispatch.c:34
static NTSTATUS NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext)
Definition: dispatch.c:59
#define DPRINT
Definition: sndvol32.h:73
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697

◆ NtfsFsdDispatch()

NTSTATUS NTAPI NtfsFsdDispatch ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 185 of file dispatch.c.

187{
188 PNTFS_IRP_CONTEXT IrpContext = NULL;
190
191 TRACE_(NTFS, "NtfsFsdDispatch()\n");
192
194 if (IrpContext == NULL)
195 {
197 Irp->IoStatus.Status = Status;
199 }
200 else
201 {
202 Status = NtfsDispatch(IrpContext);
203 }
204
205 return Status;
206}
PNTFS_IRP_CONTEXT NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: misc.c:66
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ NtfsQueueRequest()

static NTSTATUS NtfsQueueRequest ( PNTFS_IRP_CONTEXT  IrpContext)
static

Definition at line 42 of file dispatch.c.

43{
45 DPRINT("NtfsQueueRequest(IrpContext %p), %d\n", IrpContext, QueueCount);
46
47 ASSERT(!(IrpContext->Flags & IRPCONTEXT_QUEUE) &&
48 (IrpContext->Flags & IRPCONTEXT_COMPLETE));
49 IrpContext->Flags |= IRPCONTEXT_CANWAIT;
50 IoMarkIrpPending(IrpContext->Irp);
51 ExInitializeWorkItem(&IrpContext->WorkQueueItem, NtfsDoRequest, IrpContext);
53
54 return STATUS_PENDING;
55}
#define InterlockedIncrement
Definition: armddk.h:53
#define STATUS_PENDING
Definition: d3dkmdt.h:43
static WORKER_THREAD_ROUTINE NtfsDoRequest
Definition: dispatch.c:38
#define IRPCONTEXT_CANWAIT
Definition: ntfs.h:474
IoMarkIrpPending(Irp)
WORK_QUEUE_ITEM WorkQueueItem
Definition: ntfs.h:485
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
@ CriticalWorkQueue
Definition: extypes.h:189

Referenced by NtfsDispatch().

Variable Documentation

◆ NtfsDoRequest

WORKER_THREAD_ROUTINE NtfsDoRequest
static

Definition at line 38 of file dispatch.c.

Referenced by NtfsQueueRequest().

◆ QueueCount

LONG QueueCount = 0
static

Definition at line 34 of file dispatch.c.

Referenced by FxIoQueue::GetState(), NtfsDoRequest(), and NtfsQueueRequest().