From 47b892354b1aded28b15038fea2259e7da58338c Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 10 Feb 2008 11:20:29 +0000 Subject: [PATCH] =?UTF-8?q?NTFS=20driver=20improvments=20:=20-=20Implement?= =?UTF-8?q?ed=20NtfsFsdDispatch=20to=20dispatch=20some=20IO=20requests=20(?= =?UTF-8?q?use=20it=20with=20implemented=20functions=20that=20need=20it)?= =?UTF-8?q?=20-=20Implemented=20NtfsIsIrpTopLevel=20(From=20Rajeev=20Nagar?= =?UTF-8?q?),=20NtfsAllocateIrpContext=20-=20Added=20more=20checks=20-=20R?= =?UTF-8?q?enamed=20functions=20that=20are=20called=20by=20IO=20to=20NtfsF?= =?UTF-8?q?sd*=20(similar=20to=20Windows=20NTFS=20driver)=20-=20Use=20NTAP?= =?UTF-8?q?I=20instead=20of=20STDCALL=20to=20have=20MSVC=20compatibility,?= =?UTF-8?q?=20thanks=20to=20Herv=C3=A9=20-=20Reorganized=20functions=20ord?= =?UTF-8?q?er=20with=20increasing=20index=20-=20Updated=20files=20headers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=32253 --- reactos/drivers/filesystems/ntfs/attrib.c | 4 +- reactos/drivers/filesystems/ntfs/blockdev.c | 4 +- reactos/drivers/filesystems/ntfs/close.c | 8 +- reactos/drivers/filesystems/ntfs/create.c | 8 +- reactos/drivers/filesystems/ntfs/dirctl.c | 8 +- reactos/drivers/filesystems/ntfs/dispatch.c | 90 +++++++++++++++++++ reactos/drivers/filesystems/ntfs/fcb.c | 4 +- reactos/drivers/filesystems/ntfs/finfo.c | 12 ++- reactos/drivers/filesystems/ntfs/fsctl.c | 6 +- reactos/drivers/filesystems/ntfs/mft.c | 4 +- reactos/drivers/filesystems/ntfs/misc.c | 93 ++++++++++++++++++++ reactos/drivers/filesystems/ntfs/ntfs.c | 24 +++-- reactos/drivers/filesystems/ntfs/ntfs.h | 82 ++++++++++------- reactos/drivers/filesystems/ntfs/ntfs.rbuild | 2 + reactos/drivers/filesystems/ntfs/rw.c | 12 ++- reactos/drivers/filesystems/ntfs/volinfo.c | 32 ++++--- 16 files changed, 291 insertions(+), 102 deletions(-) create mode 100644 reactos/drivers/filesystems/ntfs/dispatch.c create mode 100644 reactos/drivers/filesystems/ntfs/misc.c diff --git a/reactos/drivers/filesystems/ntfs/attrib.c b/reactos/drivers/filesystems/ntfs/attrib.c index 862487c1432..e596afb6a31 100644 --- a/reactos/drivers/filesystems/ntfs/attrib.c +++ b/reactos/drivers/filesystems/ntfs/attrib.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: drivers/fs/ntfs/attrib.c + * FILE: drivers/filesystem/ntfs/attrib.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl * Updated by Valentin Verkhovsky 2003/09/12 diff --git a/reactos/drivers/filesystems/ntfs/blockdev.c b/reactos/drivers/filesystems/ntfs/blockdev.c index dc2bd8f7b14..5b9e25fa2d2 100644 --- a/reactos/drivers/filesystems/ntfs/blockdev.c +++ b/reactos/drivers/filesystems/ntfs/blockdev.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/blockdev.c + * FILE: drivers/filesystem/ntfs/blockdev.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ diff --git a/reactos/drivers/filesystems/ntfs/close.c b/reactos/drivers/filesystems/ntfs/close.c index b91e9878c6f..6fe5b2fdc42 100755 --- a/reactos/drivers/filesystems/ntfs/close.c +++ b/reactos/drivers/filesystems/ntfs/close.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/close.c + * FILE: drivers/filesystem/ntfs/close.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Art Yerkes * UPDATE HISTORY: @@ -79,8 +77,8 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt, } -NTSTATUS STDCALL -NtfsClose(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdClose(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PDEVICE_EXTENSION DeviceExtension; diff --git a/reactos/drivers/filesystems/ntfs/create.c b/reactos/drivers/filesystems/ntfs/create.c index d46f09ef139..69cf7fc634f 100644 --- a/reactos/drivers/filesystems/ntfs/create.c +++ b/reactos/drivers/filesystems/ntfs/create.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/create.c + * FILE: drivers/filesystem/ntfs/create.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -205,8 +203,8 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject, } -NTSTATUS STDCALL -NtfsCreate(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PDEVICE_EXTENSION DeviceExt; diff --git a/reactos/drivers/filesystems/ntfs/dirctl.c b/reactos/drivers/filesystems/ntfs/dirctl.c index 2983a33a9b1..50c4afbda2b 100644 --- a/reactos/drivers/filesystems/ntfs/dirctl.c +++ b/reactos/drivers/filesystems/ntfs/dirctl.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: drivers/fs/ntfs/dirctl.c + * FILE: drivers/filesystem/ntfs/dirctl.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -670,8 +668,8 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject, -NTSTATUS STDCALL -NtfsDirectoryControl(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PIO_STACK_LOCATION Stack; diff --git a/reactos/drivers/filesystems/ntfs/dispatch.c b/reactos/drivers/filesystems/ntfs/dispatch.c new file mode 100644 index 00000000000..d96c4496ee5 --- /dev/null +++ b/reactos/drivers/filesystems/ntfs/dispatch.c @@ -0,0 +1,90 @@ +/* + * ReactOS kernel + * Copyright (C) 2008 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/filesystem/ntfs/dispatch.c + * PURPOSE: NTFS filesystem driver + * PROGRAMMER: Pierre Schweitzer + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include "ntfs.h" + +#define NDEBUG +#include + +/* GLOBALS *****************************************************************/ + + +/* FUNCTIONS ****************************************************************/ + +/* + * FUNCTION: This function manages IRP for various major functions + * ARGUMENTS: + * DriverObject = object describing this driver + * Irp = IRP to be passed to internal functions + * RETURNS: Status of I/O Request + */ +NTSTATUS NTAPI +NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PNTFS_IRP_CONTEXT IrpContext = NULL; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + TRACE_(NTFS, "NtfsFsdDispatch()\n"); + + FsRtlEnterFileSystem(); + ASSERT(DeviceObject); + ASSERT(Irp); + + NtfsIsIrpTopLevel(Irp); + + IrpContext = NtfsAllocateIrpContext(DeviceObject, Irp); + if (IrpContext) + { + switch (IrpContext->MajorFunction) + { + case IRP_MJ_QUERY_VOLUME_INFORMATION: + { + Status = NtfsQueryVolumeInformation(IrpContext); + break; + } + case IRP_MJ_SET_VOLUME_INFORMATION: + { + Status = NtfsSetVolumeInformation(IrpContext); + break; + } + } + } + else + Status = STATUS_INSUFFICIENT_RESOURCES; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + if (IrpContext) + ExFreePoolWithTag(IrpContext, TAG('N', 'I', 'R', 'P')); + + IoSetTopLevelIrp(NULL); + FsRtlExitFileSystem(); + return Status; +} diff --git a/reactos/drivers/filesystems/ntfs/fcb.c b/reactos/drivers/filesystems/ntfs/fcb.c index 1876147ae57..fbba5473df0 100644 --- a/reactos/drivers/filesystems/ntfs/fcb.c +++ b/reactos/drivers/filesystems/ntfs/fcb.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/fcb.c + * FILE: drivers/filesystem/ntfs/fcb.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ diff --git a/reactos/drivers/filesystems/ntfs/finfo.c b/reactos/drivers/filesystems/ntfs/finfo.c index 1aec06de83c..60783b74422 100644 --- a/reactos/drivers/filesystems/ntfs/finfo.c +++ b/reactos/drivers/filesystems/ntfs/finfo.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/dirctl.c + * FILE: drivers/filesystem/ntfs/dirctl.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -147,8 +145,8 @@ NtfsGetNameInformation(PFILE_OBJECT FileObject, NameInfo->FileNameLength = NameLength; memcpy(NameInfo->FileName, - Fcb->PathName, - NameLength + sizeof(WCHAR)); + Fcb->PathName, + NameLength + sizeof(WCHAR)); // wcscpy(NameInfo->FileName, L"\\"); *BufferLength -= @@ -180,8 +178,8 @@ NtfsGetInternalInformation(PFCB Fcb, } -NTSTATUS STDCALL -NtfsQueryInformation(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp) /* * FUNCTION: Retrieve the specified file information diff --git a/reactos/drivers/filesystems/ntfs/fsctl.c b/reactos/drivers/filesystems/ntfs/fsctl.c index ed6f1bfb03d..1103329f8e3 100644 --- a/reactos/drivers/filesystems/ntfs/fsctl.c +++ b/reactos/drivers/filesystems/ntfs/fsctl.c @@ -15,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -448,8 +446,8 @@ NtfsVerifyVolume(PDEVICE_OBJECT DeviceObject, } -NTSTATUS STDCALL -NtfsFileSystemControl(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PIO_STACK_LOCATION Stack; diff --git a/reactos/drivers/filesystems/ntfs/mft.c b/reactos/drivers/filesystems/ntfs/mft.c index f1c976080c7..df0bf34ba94 100644 --- a/reactos/drivers/filesystems/ntfs/mft.c +++ b/reactos/drivers/filesystems/ntfs/mft.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/mft.c + * FILE: drivers/filesystem/ntfs/mft.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl * Updated by Valentin Verkhovsky 2003/09/12 diff --git a/reactos/drivers/filesystems/ntfs/misc.c b/reactos/drivers/filesystems/ntfs/misc.c new file mode 100644 index 00000000000..3a017d3a56f --- /dev/null +++ b/reactos/drivers/filesystems/ntfs/misc.c @@ -0,0 +1,93 @@ +/* + * ReactOS kernel + * Copyright (C) 2008 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: drivers/filesystem/ntfs/misc.c + * PURPOSE: NTFS filesystem driver + * PROGRAMMER: Pierre Schweitzer + * UPDATE HISTORY: + */ + +/* INCLUDES *****************************************************************/ + +#include "ntfs.h" + +#define NDEBUG +#include + +/* GLOBALS *****************************************************************/ + + +/* FUNCTIONS ****************************************************************/ + +/* + * FUNCTION: Used with IRP to set them to TopLevelIrp field + * ARGUMENTS: + * Irp = The IRP to set + * RETURNS: TRUE if top level was null, else FALSE + */ +BOOLEAN +NtfsIsIrpTopLevel(PIRP Irp) +{ + BOOLEAN ReturnCode = FALSE; + + TRACE_(NTFS, "NtfsIsIrpTopLevel()\n"); + + if (IoGetTopLevelIrp() == NULL) + { + IoSetTopLevelIrp(Irp); + ReturnCode = TRUE; + } + + return ReturnCode; +} + +/* + * FUNCTION: Allocate and fill an NTFS_IRP_CONTEXT struct in order to use it for IRP + * ARGUMENTS: + * DeviceObject = Used to fill in struct + * Irp = The IRP that need IRP_CONTEXT struct + * RETURNS: NULL or PNTFS_IRP_CONTEXT + */ +PNTFS_IRP_CONTEXT +NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PNTFS_IRP_CONTEXT IrpContext; + PIO_STACK_LOCATION IoStackLocation; + + TRACE_(NTFS, "NtfsAllocateIrpContext()\n"); + + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + + IrpContext = (PNTFS_IRP_CONTEXT)ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_IRP_CONTEXT), TAG('N', 'I', 'R', 'P')); + if (IrpContext == NULL) + return NULL; + + RtlZeroMemory(IrpContext, sizeof(NTFS_IRP_CONTEXT)); + IrpContext->Identifier.Type = NTFS_TYPE_IRP_CONTEST; + IrpContext->Identifier.Size = sizeof(NTFS_IRP_CONTEXT); + IrpContext->Irp = Irp; + IrpContext->MajorFunction = IoStackLocation->MajorFunction; + IrpContext->MinorFunction = IoStackLocation->MinorFunction; + IrpContext->DeviceObject = DeviceObject; + IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp); + + return IrpContext; +} diff --git a/reactos/drivers/filesystems/ntfs/ntfs.c b/reactos/drivers/filesystems/ntfs/ntfs.c index 51fabded26f..d449ec43a05 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.c +++ b/reactos/drivers/filesystems/ntfs/ntfs.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/ntfs.c + * FILE: drivers/filesystem/ntfs/ntfs.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl * Pierre Schweitzer @@ -42,7 +40,7 @@ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL; NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) + PUNICODE_STRING RegistryPath) /* * FUNCTION: Called by the system to initalize the driver * ARGUMENTS: @@ -120,15 +118,15 @@ NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject) * RETURNS: Nothing */ { - DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsClose; - DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsCreate; - DriverObject->MajorFunction[IRP_MJ_READ] = NtfsRead; - DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsWrite; - DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = NtfsFileSystemControl; - DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = NtfsDirectoryControl; - DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NtfsQueryInformation; - DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = NtfsQueryVolumeInformation; - DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = NtfsSetVolumeInformation; + DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsFsdCreate; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsFsdClose; + DriverObject->MajorFunction[IRP_MJ_READ] = NtfsFsdRead; + DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsFsdWrite; + DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NtfsFsdQueryInformation; + DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = NtfsFsdDispatch; + DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = NtfsFsdDispatch; + DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = NtfsFsdDirectoryControl; + DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = NtfsFsdFileSystemControl; return; } diff --git a/reactos/drivers/filesystems/ntfs/ntfs.h b/reactos/drivers/filesystems/ntfs/ntfs.h index 1d9fe2d48dc..3523d6e6829 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.h +++ b/reactos/drivers/filesystems/ntfs/ntfs.h @@ -153,6 +153,7 @@ typedef struct _CCB #define TAG_CCB TAG('I', 'C', 'C', 'B') +#define NTFS_TYPE_IRP_CONTEST TAG('F','S',0,6) #define NTFS_TYPE_GLOBAL_DATA TAG('F','S',0,7) typedef struct @@ -317,6 +318,19 @@ typedef struct ULONG Unknown2; } VOLINFO_ATTRIBUTE, *PVOLINFO_ATTRIBUTE; +typedef struct +{ + NTFSIDENTIFIER Identifier; + ULONG Flags; + UCHAR MajorFunction; + UCHAR MinorFunction; + WORK_QUEUE_ITEM WorkQueueItem; + PIRP Irp; + BOOLEAN IsTopLevel; + PDEVICE_OBJECT DeviceObject; + NTSTATUS SavedExceptionCode; +} NTFS_IRP_CONTEXT, *PNTFS_IRP_CONTEXT; + extern PNTFS_GLOBAL_DATA NtfsGlobalData; @@ -363,26 +377,32 @@ NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, /* close.c */ -DRIVER_DISPATCH NtfsClose; -NTSTATUS STDCALL -NtfsClose(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdClose; +NTSTATUS NTAPI +NtfsFsdClose(PDEVICE_OBJECT DeviceObject, PIRP Irp); /* create.c */ -DRIVER_DISPATCH NtfsCreate; -NTSTATUS STDCALL -NtfsCreate(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdCreate; +NTSTATUS NTAPI +NtfsFsdCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp); /* dirctl.c */ -DRIVER_DISPATCH NtfsDirectoryControl; -NTSTATUS STDCALL -NtfsDirectoryControl(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdDirectoryControl; +NTSTATUS NTAPI +NtfsFsdDirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); +/* dispatch.c */ +DRIVER_DISPATCH NtfsFsdDispatch; +NTSTATUS NTAPI +NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject, + PIRP Irp); + /* fcb.c */ PFCB @@ -437,17 +457,17 @@ NtfsGetFCBForFile(PDEVICE_EXTENSION Vcb, /* finfo.c */ -DRIVER_DISPATCH NtfsQueryInformation; -NTSTATUS STDCALL -NtfsQueryInformation(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdQueryInformation; +NTSTATUS NTAPI +NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp); /* fsctl.c */ -DRIVER_DISPATCH NtfsFileSystemControl; -NTSTATUS STDCALL -NtfsFileSystemControl(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdFileSystemControl; +NTSTATUS NTAPI +NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); @@ -510,9 +530,15 @@ EnumerAttribute(PFILE_RECORD_HEADER file, PDEVICE_EXTENSION Vcb, PDEVICE_OBJECT DeviceObject); -#if 0 /* misc.c */ +BOOLEAN +NtfsIsIrpTopLevel(PIRP Irp); +PNTFS_IRP_CONTEXT +NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject, + PIRP Irp); + +#if 0 BOOLEAN wstrcmpjoki(PWSTR s1, PWSTR s2); @@ -532,28 +558,24 @@ CdfsFileFlagsToAttributes(PFCB Fcb, /* rw.c */ -DRIVER_DISPATCH NtfsRead; -NTSTATUS STDCALL -NtfsRead(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdRead; +NTSTATUS NTAPI +NtfsFsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp); -DRIVER_DISPATCH NtfsWrite; -NTSTATUS STDCALL -NtfsWrite(PDEVICE_OBJECT DeviceObject, +DRIVER_DISPATCH NtfsFsdWrite; +NTSTATUS NTAPI +NtfsFsdWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp); /* volinfo.c */ -DRIVER_DISPATCH NtfsQueryVolumeInformation; -NTSTATUS STDCALL -NtfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, - PIRP Irp); +NTSTATUS +NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext); -DRIVER_DISPATCH NtfsSetVolumeInformation; -NTSTATUS STDCALL -NtfsSetVolumeInformation(PDEVICE_OBJECT DeviceObject, - PIRP Irp); +NTSTATUS +NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext); /* ntfs.c */ diff --git a/reactos/drivers/filesystems/ntfs/ntfs.rbuild b/reactos/drivers/filesystems/ntfs/ntfs.rbuild index a6799c442dd..09d0d099a2c 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.rbuild +++ b/reactos/drivers/filesystems/ntfs/ntfs.rbuild @@ -10,10 +10,12 @@ close.c create.c dirctl.c + dispatch.c fcb.c finfo.c fsctl.c mft.c + misc.c ntfs.c rw.c volinfo.c diff --git a/reactos/drivers/filesystems/ntfs/rw.c b/reactos/drivers/filesystems/ntfs/rw.c index 4edf35723a4..3cc95453951 100755 --- a/reactos/drivers/filesystems/ntfs/rw.c +++ b/reactos/drivers/filesystems/ntfs/rw.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/cdfs/rw.c + * FILE: drivers/filesystem/ntfs/rw.c * PURPOSE: CDROM (ISO 9660) filesystem driver * PROGRAMMER: Art Yerkes * UPDATE HISTORY: @@ -131,8 +129,8 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt, } -NTSTATUS STDCALL -NtfsRead(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp) { PDEVICE_EXTENSION DeviceExt; @@ -183,8 +181,8 @@ NtfsRead(PDEVICE_OBJECT DeviceObject, } -NTSTATUS STDCALL -NtfsWrite(PDEVICE_OBJECT DeviceObject, +NTSTATUS NTAPI +NtfsFsdWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp) { DPRINT("NtfwWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp); diff --git a/reactos/drivers/filesystems/ntfs/volinfo.c b/reactos/drivers/filesystems/ntfs/volinfo.c index a425d82791f..03ff8790521 100644 --- a/reactos/drivers/filesystems/ntfs/volinfo.c +++ b/reactos/drivers/filesystems/ntfs/volinfo.c @@ -15,12 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: services/fs/ntfs/volume.c + * FILE: drivers/filesystem/ntfs/volume.c * PURPOSE: NTFS filesystem driver * PROGRAMMER: Eric Kohl */ @@ -165,10 +163,11 @@ NtfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, -NTSTATUS STDCALL -NtfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, - PIRP Irp) +NTSTATUS +NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext) { + PIRP Irp; + PDEVICE_OBJECT DeviceObject; FS_INFORMATION_CLASS FsInformationClass; PIO_STACK_LOCATION Stack; NTSTATUS Status = STATUS_SUCCESS; @@ -177,6 +176,10 @@ NtfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, DPRINT("NtfsQueryVolumeInformation() called\n"); + ASSERT(IrpContext); + + Irp = IrpContext->Irp; + DeviceObject = IrpContext->DeviceObject; Stack = IoGetCurrentIrpStackLocation(Irp); FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass; BufferLength = Stack->Parameters.QueryVolume.Length; @@ -215,29 +218,30 @@ NtfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, Status = STATUS_NOT_SUPPORTED; } - Irp->IoStatus.Status = Status; if (NT_SUCCESS(Status)) Irp->IoStatus.Information = Stack->Parameters.QueryVolume.Length - BufferLength; else Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return(Status); + return Status; } -NTSTATUS STDCALL -NtfsSetVolumeInformation(PDEVICE_OBJECT DeviceObject, - PIRP Irp) +NTSTATUS +NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext) { + PIRP Irp; + DPRINT("NtfsSetVolumeInformation() called\n"); + ASSERT(IrpContext); + + Irp = IrpContext->Irp; Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return(STATUS_NOT_SUPPORTED); + return STATUS_NOT_SUPPORTED; } /* EOF */