Use NT-compatible (VPB-based) mounting mechanism.

svn path=/trunk/; revision=2974
This commit is contained in:
Eric Kohl 2002-05-23 09:53:26 +00:00
parent e5423f156b
commit 02fd65a6dc
6 changed files with 237 additions and 175 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: fsctl.c,v 1.6 2002/05/15 18:01:30 ekohl Exp $ /* $Id: fsctl.c,v 1.7 2002/05/23 09:52:00 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -35,7 +35,6 @@
#include "cdfs.h" #include "cdfs.h"
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static VOID static VOID
@ -295,19 +294,15 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
goto ByeBye; goto ByeBye;
#if 0
NewDeviceObject->StackSize = DeviceToMount->StackSize;
Vpb->DeviceObject = NewDeviceObject;
DeviceExt->Vpb = Vpb;
DeviceExt->StorageDevice = DeviceToMount;
#endif
NewDeviceObject->Vpb = DeviceToMount->Vpb; NewDeviceObject->Vpb = DeviceToMount->Vpb;
NewDeviceObject->Vpb->Flags |= VPB_MOUNTED;
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(NewDeviceObject, DeviceExt->StorageDevice = DeviceToMount;
DeviceToMount); DeviceExt->StorageDevice->Vpb->DeviceObject = NewDeviceObject;
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
DeviceExt->StorageDevice); DeviceExt->StorageDevice);

View file

@ -104,8 +104,14 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO; DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
DeviceExt = (PVOID)DeviceObject->DeviceExtension; DeviceExt = (PVOID)DeviceObject->DeviceExtension;
DPRINT("DeviceExt %x\n",DeviceExt); DPRINT("DeviceExt %x\n",DeviceExt);
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject,
DeviceToMount); DeviceExt->StorageDevice = DeviceToMount;
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
DPRINT("DeviceExt->StorageDevice %x\n", DeviceExt->StorageDevice); DPRINT("DeviceExt->StorageDevice %x\n", DeviceExt->StorageDevice);
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject); DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
DeviceExt->superblock = superblock; DeviceExt->superblock = superblock;

View file

@ -58,8 +58,13 @@ VOID MinixMount(PDEVICE_OBJECT DeviceToMount)
MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf); MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf);
DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf); DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf);
DeviceExt->AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject, DeviceExt->StorageDevice = DeviceToMount;
DeviceToMount); DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject); DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
} }

View file

@ -1,4 +1,23 @@
/* /*
* ReactOS kernel
* Copyright (C) 2002 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.
*/
/* $Id: template.c,v 1.3 2002/05/23 09:52:56 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: services/fs/template/template.c * FILE: services/fs/template/template.c
@ -19,7 +38,7 @@ typedef struct
PDEVICE_OBJECT StorageDevice; PDEVICE_OBJECT StorageDevice;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION; } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/* GLOBALS *****************************************************************/ /* GLOBALS ******************************************************************/
static PDRIVER_OBJECT DriverObject; static PDRIVER_OBJECT DriverObject;
@ -35,6 +54,7 @@ FsdCloseFile(PDEVICE_EXTENSION DeviceExt,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS NTSTATUS
FsdOpenFile(PDEVICE_EXTENSION DeviceExt, FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject, PFILE_OBJECT FileObject,
@ -46,6 +66,7 @@ FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
BOOLEAN BOOLEAN
FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount) FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
/* /*
@ -56,6 +77,7 @@ FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
return(TRUE); return(TRUE);
} }
NTSTATUS NTSTATUS
FsdMountDevice(PDEVICE_EXTENSION DeviceExt, FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
PDEVICE_OBJECT DeviceToMount) PDEVICE_OBJECT DeviceToMount)
@ -99,6 +121,7 @@ FsdClose(PDEVICE_OBJECT DeviceObject,
return(Status); return(Status);
} }
NTSTATUS STDCALL NTSTATUS STDCALL
FsdCreate(PDEVICE_OBJECT DeviceObject, FsdCreate(PDEVICE_OBJECT DeviceObject,
PIRP Irp) PIRP Irp)
@ -176,11 +199,17 @@ FsdMount(PDEVICE_OBJECT DeviceToMount)
FsdMountDevice(DeviceExt, FsdMountDevice(DeviceExt,
DeviceToMount); DeviceToMount);
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, DeviceExt->StorageDevice = DeviceToMount;
DeviceToMount); DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL NTSTATUS STDCALL
FsdFileSystemControl(PDEVICE_OBJECT DeviceObject, FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp) PIRP Irp)
@ -206,6 +235,7 @@ FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
return(Status); return(Status);
} }
NTSTATUS STDCALL NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT _DriverObject, DriverEntry(PDRIVER_OBJECT _DriverObject,
PUNICODE_STRING RegistryPath) PUNICODE_STRING RegistryPath)
@ -236,7 +266,7 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
&DeviceObject); &DeviceObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(ret); return(Status);
} }
DeviceObject->Flags=0; DeviceObject->Flags=0;
@ -253,3 +283,4 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
/* EOF */

View file

@ -1,4 +1,22 @@
/* $Id: fsctl.c,v 1.3 2002/05/05 20:19:14 hbirr Exp $ /*
* ReactOS kernel
* Copyright (C) 2002 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.
*/
/* $Id: fsctl.c,v 1.4 2002/05/23 09:53:26 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -254,8 +272,15 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
DbgPrint("RootCluster: %d\n", DeviceExt->FatInfo.RootCluster); DbgPrint("RootCluster: %d\n", DeviceExt->FatInfo.RootCluster);
} }
#endif #endif
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.MountVolume.DeviceObject); DeviceExt->StorageDevice = IrpContext->Stack->Parameters.MountVolume.DeviceObject;
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
DPRINT("FsDeviceObject %lx\n", DeviceObject);
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice); DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
Fcb = vfatNewFCB(NULL); Fcb = vfatNewFCB(NULL);
@ -334,7 +359,6 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
ReadVolumeLabel(DeviceExt, DeviceObject->Vpb); ReadVolumeLabel(DeviceExt, DeviceObject->Vpb);
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
ByeBye: ByeBye:
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.57 2002/05/15 09:39:02 ekohl Exp $ /* $Id: create.c,v 1.58 2002/05/23 09:51:11 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -139,8 +139,9 @@ IopCreateFile(PVOID ObjectBody,
Status); Status);
return(Status); return(Status);
} }
DeviceObject = IoGetAttachedDevice(DeviceObject);
} }
DeviceObject = DeviceObject->Vpb->DeviceObject;
DPRINT("FsDeviceObject %lx\n", DeviceObject);
} }
RtlCreateUnicodeString(&(FileObject->FileName), RtlCreateUnicodeString(&(FileObject->FileName),
RemainingPath); RemainingPath);
@ -211,7 +212,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
DPRINT("DeviceObject %x\n", DeviceObject); DPRINT("DeviceObject %x\n", DeviceObject);
CreatedFileObject->DeviceObject = DeviceObject; CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject;
CreatedFileObject->Vpb = DeviceObject->Vpb; CreatedFileObject->Vpb = DeviceObject->Vpb;
CreatedFileObject->Type = InternalFileType; CreatedFileObject->Type = InternalFileType;
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN; CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
@ -332,7 +333,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
(PVOID*)&FileObject); (PVOID*)&FileObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("ObCreateObject() failed!\n"); DPRINT("ObCreateObject() failed! (Status %lx)\n", Status);
return(Status); return(Status);
} }
if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT) if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT)