3 * Copyright (C) 2008 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 * COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS kernel
21 * FILE: drivers/filesystem/ntfs/dispatch.c
22 * PURPOSE: NTFS filesystem driver
23 * PROGRAMMER: Pierre Schweitzer
27 /* INCLUDES *****************************************************************/
34 /* FUNCTIONS ****************************************************************/
38 NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext
)
40 PIRP Irp
= IrpContext
->Irp
;
41 NTSTATUS Status
= STATUS_UNSUCCESSFUL
;
43 TRACE_(NTFS
, "NtfsDispatch()\n");
45 FsRtlEnterFileSystem();
47 NtfsIsIrpTopLevel(Irp
);
49 switch (IrpContext
->MajorFunction
)
51 case IRP_MJ_QUERY_VOLUME_INFORMATION
:
52 Status
= NtfsQueryVolumeInformation(IrpContext
);
55 case IRP_MJ_SET_VOLUME_INFORMATION
:
56 Status
= NtfsSetVolumeInformation(IrpContext
);
59 case IRP_MJ_QUERY_INFORMATION
:
60 Status
= NtfsQueryInformation(IrpContext
);
63 case IRP_MJ_DIRECTORY_CONTROL
:
64 Status
= NtfsDirectoryControl(IrpContext
);
68 Status
= NtfsRead(IrpContext
);
71 case IRP_MJ_DEVICE_CONTROL
:
72 Status
= NtfsDeviceControl(IrpContext
);
76 Status
= NtfsWrite(IrpContext
);
80 ASSERT((!(IrpContext
->Flags
& IRPCONTEXT_COMPLETE
) && !(IrpContext
->Flags
& IRPCONTEXT_QUEUE
)) ||
81 ((IrpContext
->Flags
& IRPCONTEXT_COMPLETE
) && !(IrpContext
->Flags
& IRPCONTEXT_QUEUE
)) ||
82 (!(IrpContext
->Flags
& IRPCONTEXT_COMPLETE
) && (IrpContext
->Flags
& IRPCONTEXT_QUEUE
)));
84 if (IrpContext
->Flags
& IRPCONTEXT_COMPLETE
)
86 Irp
->IoStatus
.Status
= Status
;
87 IoCompleteRequest(Irp
, IrpContext
->PriorityBoost
);
91 ExFreePoolWithTag(IrpContext
, 'PRIN');
93 IoSetTopLevelIrp(NULL
);
94 FsRtlExitFileSystem();
100 * FUNCTION: This function manages IRP for various major functions
102 * DriverObject = object describing this driver
103 * Irp = IRP to be passed to internal functions
104 * RETURNS: Status of I/O Request
108 NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject
,
111 PNTFS_IRP_CONTEXT IrpContext
= NULL
;
114 TRACE_(NTFS
, "NtfsFsdDispatch()\n");
116 IrpContext
= NtfsAllocateIrpContext(DeviceObject
, Irp
);
117 if (IrpContext
== NULL
)
119 Status
= STATUS_INSUFFICIENT_RESOURCES
;
120 Irp
->IoStatus
.Status
= Status
;
121 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
125 Status
= NtfsDispatch(IrpContext
);