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
* 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
* PROJECT: ReactOS kernel
@ -35,7 +35,6 @@
#include "cdfs.h"
/* FUNCTIONS ****************************************************************/
static VOID
@ -295,19 +294,15 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
if (!NT_SUCCESS(Status))
goto ByeBye;
#if 0
NewDeviceObject->StackSize = DeviceToMount->StackSize;
Vpb->DeviceObject = NewDeviceObject;
DeviceExt->Vpb = Vpb;
DeviceExt->StorageDevice = DeviceToMount;
#endif
NewDeviceObject->Vpb = DeviceToMount->Vpb;
NewDeviceObject->Vpb->Flags |= VPB_MOUNTED;
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(NewDeviceObject,
DeviceToMount);
DeviceExt->StorageDevice = 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->StorageDevice);

View file

@ -104,8 +104,14 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
DeviceExt = (PVOID)DeviceObject->DeviceExtension;
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);
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
DeviceExt->superblock = superblock;

View file

@ -58,8 +58,13 @@ VOID MinixMount(PDEVICE_OBJECT DeviceToMount)
MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf);
DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf);
DeviceExt->AttachedDevice = 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;
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
* PROJECT: ReactOS kernel
* FILE: services/fs/template/template.c
@ -19,7 +38,7 @@ typedef struct
PDEVICE_OBJECT StorageDevice;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/* GLOBALS *****************************************************************/
/* GLOBALS ******************************************************************/
static PDRIVER_OBJECT DriverObject;
@ -35,6 +54,7 @@ FsdCloseFile(PDEVICE_EXTENSION DeviceExt,
return(STATUS_SUCCESS);
}
NTSTATUS
FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
@ -46,6 +66,7 @@ FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
return(STATUS_SUCCESS);
}
BOOLEAN
FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
/*
@ -56,6 +77,7 @@ FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
return(TRUE);
}
NTSTATUS
FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
PDEVICE_OBJECT DeviceToMount)
@ -99,6 +121,7 @@ FsdClose(PDEVICE_OBJECT DeviceObject,
return(Status);
}
NTSTATUS STDCALL
FsdCreate(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@ -176,11 +199,17 @@ FsdMount(PDEVICE_OBJECT DeviceToMount)
FsdMountDevice(DeviceExt,
DeviceToMount);
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;
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL
FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@ -206,6 +235,7 @@ FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
return(Status);
}
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT _DriverObject,
PUNICODE_STRING RegistryPath)
@ -236,7 +266,7 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
&DeviceObject);
if (!NT_SUCCESS(Status))
{
return(ret);
return(Status);
}
DeviceObject->Flags=0;
@ -253,3 +283,4 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
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
* PROJECT: ReactOS kernel
@ -254,8 +272,15 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
DbgPrint("RootCluster: %d\n", DeviceExt->FatInfo.RootCluster);
}
#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);
Fcb = vfatNewFCB(NULL);
@ -334,7 +359,6 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
ReadVolumeLabel(DeviceExt, DeviceObject->Vpb);
Status = STATUS_SUCCESS;
ByeBye:
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
* PROJECT: ReactOS kernel
@ -139,8 +139,9 @@ IopCreateFile(PVOID ObjectBody,
Status);
return(Status);
}
DeviceObject = IoGetAttachedDevice(DeviceObject);
}
DeviceObject = DeviceObject->Vpb->DeviceObject;
DPRINT("FsDeviceObject %lx\n", DeviceObject);
}
RtlCreateUnicodeString(&(FileObject->FileName),
RemainingPath);
@ -211,7 +212,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
DPRINT("DeviceObject %x\n", DeviceObject);
CreatedFileObject->DeviceObject = DeviceObject;
CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject;
CreatedFileObject->Vpb = DeviceObject->Vpb;
CreatedFileObject->Type = InternalFileType;
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
@ -332,8 +333,8 @@ IoCreateFile(OUT PHANDLE FileHandle,
(PVOID*)&FileObject);
if (!NT_SUCCESS(Status))
{
DPRINT("ObCreateObject() failed!\n");
return (Status);
DPRINT("ObCreateObject() failed! (Status %lx)\n", Status);
return(Status);
}
if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT)
{