Made CDROM and TAPE devices mountable.
svn path=/trunk/; revision=2837
-/* $Id: fsctl.c,v 1.1 2002/03/18 22:37:13 hbirr Exp $
+/* $Id: fsctl.c,v 1.2 2002/04/10 09:58:45 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
goto ByeBye;
}
- Status = VfatHasFileSystem (IrpContext->Stack->Parameters.Mount.DeviceObject, &RecognizedFS, NULL);
+ Status = VfatHasFileSystem (IrpContext->Stack->Parameters.MountVolume.DeviceObject, &RecognizedFS, NULL);
if (!NT_SUCCESS(Status))
{
goto ByeBye;
RtlZeroMemory(DeviceExt, sizeof(DEVICE_EXTENSION));
/* use same vpb as device disk */
- DeviceObject->Vpb = IrpContext->Stack->Parameters.Mount.DeviceObject->Vpb;
- Status = VfatMountDevice(DeviceExt, IrpContext->Stack->Parameters.Mount.DeviceObject);
+ DeviceObject->Vpb = IrpContext->Stack->Parameters.MountVolume.DeviceObject->Vpb;
+ Status = VfatMountDevice(DeviceExt, IrpContext->Stack->Parameters.MountVolume.DeviceObject);
if (!NT_SUCCESS(Status))
{
/* FIXME: delete device object */
}
#endif
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
- DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.Mount.DeviceObject);
+ DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.MountVolume.DeviceObject);
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
Fcb = vfatNewFCB(NULL);
return Status;
}
+
+static NTSTATUS
+VfatVerify (PVFAT_IRP_CONTEXT IrpContext)
+/*
+ * FUNCTION: Mount the filesystem
+ */
+{
+ DPRINT("VfatVerify(IrpContext %x)\n", IrpContext);
+
+ assert(IrpContext);
+
+ return(STATUS_INVALID_DEVICE_REQUEST);
+}
+
+
NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext)
/*
* FUNCTION: File system control
break;
case IRP_MN_VERIFY_VOLUME:
- DPRINT("VFAT FSC: IRP_MN_VERIFY_VOLUME\n");
- Status = STATUS_INVALID_DEVICE_REQUEST;
+ Status = VfatVerify(IrpContext);
break;
default:
#ifndef _INCLUDE_DDK_IOFUNCS_H
#define _INCLUDE_DDK_IOFUNCS_H
-/* $Id: iofuncs.h,v 1.29 2002/01/21 22:27:36 hbirr Exp $ */
+/* $Id: iofuncs.h,v 1.30 2002/04/10 09:55:10 ekohl Exp $ */
/* --- EXPORTED BY NTOSKRNL --- */
VOID
STDCALL
IoQueueThreadIrp (
- PVOID Unknown0
+ IN PIRP Irp
);
VOID
STDCALL
-/* $Id: iotypes.h,v 1.35 2002/03/25 21:53:27 ekohl Exp $
+/* $Id: iotypes.h,v 1.36 2002/04/10 09:55:10 ekohl Exp $
*
*/
{
struct _VPB* Vpb;
struct _DEVICE_OBJECT* DeviceObject;
- } Mount;
+ } MountVolume;
struct
{
struct _VPB* Vpb;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: io.h,v 1.17 2002/03/15 23:59:05 ekohl Exp $
+/* $Id: io.h,v 1.18 2002/04/10 09:58:02 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
NTSTATUS
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
- PDEVICE_NODE DeviceNode);
-VOID
+ PDEVICE_NODE DeviceNode);
+VOID
IoInitCancelHandling(VOID);
-VOID
+VOID
IoInitSymbolicLinkImplementation(VOID);
-VOID
+VOID
IoInitFileSystemImplementation(VOID);
-VOID
+VOID
IoInitVpbImplementation (VOID);
-NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject);
+NTSTATUS
+IoTryToMountStorageDevice(IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN AllowRawMount);
POBJECT IoOpenSymlink(POBJECT SymbolicLink);
POBJECT IoOpenFileOnDevice(POBJECT SymbolicLink, PWCHAR Name);
VOID IoShutdownRegisteredDevices(VOID);
VOID IoShutdownRegisteredFileSystems(VOID);
-NTSTATUS STDCALL
-IoPageRead (PFILE_OBJECT FileObject,
+NTSTATUS STDCALL
+IoPageRead(PFILE_OBJECT FileObject,
+ PMDL Mdl,
+ PLARGE_INTEGER Offset,
+ PIO_STATUS_BLOCK StatusBlock,
+ BOOLEAN PagingIo);
+NTSTATUS STDCALL
+IoPageWrite(PFILE_OBJECT FileObject,
PMDL Mdl,
PLARGE_INTEGER Offset,
PIO_STATUS_BLOCK StatusBlock,
BOOLEAN PagingIo);
-NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
- PMDL Mdl,
- PLARGE_INTEGER Offset,
- PIO_STATUS_BLOCK StatusBlock,
- BOOLEAN PagingIo);
NTSTATUS
IoCreateArcNames(VOID);
-/* $Id: buildirp.c,v 1.26 2002/03/17 17:21:44 hbirr Exp $
+/* $Id: buildirp.c,v 1.27 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* DeviceObject = Device object to send the request to
* UserEvent = Event used to notify the caller of completion
* IoStatusBlock (OUT) = Used to return the status of the operation
- * DeviceToMount = Device to mount (for the IRP_MN_MOUNT_DEVICE
- * request)
+ * DeviceToMount = Device to mount (for the IRP_MN_MOUNT_VOLUME
+ * or IRP_MN_VERIFY_VOLUME request)
*/
{
PIRP Irp;
break;
case IRP_MN_MOUNT_VOLUME:
- StackPtr->Parameters.Mount.Vpb = DeviceToMount->Vpb;
- StackPtr->Parameters.Mount.DeviceObject = DeviceToMount;
+ StackPtr->Parameters.MountVolume.Vpb = DeviceToMount->Vpb;
+ StackPtr->Parameters.MountVolume.DeviceObject = DeviceToMount;
break;
case IRP_MN_VERIFY_VOLUME:
+ StackPtr->Parameters.VerifyVolume.Vpb = DeviceToMount->Vpb;
+ StackPtr->Parameters.VerifyVolume.DeviceObject = DeviceToMount;
break;
case IRP_MN_LOAD_FILE_SYSTEM:
-/* $Id: create.c,v 1.55 2002/04/07 18:36:13 phreak Exp $
+/* $Id: create.c,v 1.56 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
NTSTATUS STDCALL
NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes)
{
- UNIMPLEMENTED;
+ UNIMPLEMENTED;
}
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
- PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) Parent;
- PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
- NTSTATUS Status;
-
- DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n",
- ObjectBody,
- Parent,
- RemainingPath);
-
- if (NULL == DeviceObject)
- {
- /* This is probably an attempt to create a meta fileobject (eg. for FAT)
- for the cache manager, so return STATUS_SUCCESS */
- DPRINT("DeviceObject was NULL\n");
- return (STATUS_SUCCESS);
- }
- if (IoDeviceObjectType != BODY_TO_HEADER(Parent)->ObjectType)
- {
- CPRINT("Parent is a %S which is not a device type\n",
- BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
- return (STATUS_UNSUCCESSFUL);
- }
- Status = ObReferenceObjectByPointer (DeviceObject,
- STANDARD_RIGHTS_REQUIRED,
- IoDeviceObjectType,
- UserMode);
- if (STATUS_SUCCESS != Status)
- {
- CHECKPOINT1;
- return (Status);
- }
-
- DeviceObject = IoGetAttachedDevice (DeviceObject);
-
- DPRINT("DeviceObject %x\n", DeviceObject);
-
- if (NULL == RemainingPath)
- {
- FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
- FileObject->FileName.Buffer = 0;
- FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
- }
- else
- {
- if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM)
- && (DeviceObject->DeviceType != FILE_DEVICE_DISK)
- && (DeviceObject->DeviceType != FILE_DEVICE_NETWORK)
- && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
- && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
- {
- CPRINT ("Device was wrong type\n");
- return (STATUS_UNSUCCESSFUL);
- }
-
- if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK
- && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
- && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
- {
- if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
- {
- DPRINT("Trying to mount storage device\n");
- Status = IoTryToMountStorageDevice (DeviceObject);
- DPRINT("Status %x\n", Status);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("Failed to mount storage device (status %x)\n",
- Status);
- return (Status);
- }
- DeviceObject = IoGetAttachedDevice(DeviceObject);
- }
- }
- RtlCreateUnicodeString(&(FileObject->FileName),
- RemainingPath);
- }
- DPRINT("FileObject->FileName.Buffer %S\n",
- FileObject->FileName.Buffer);
- FileObject->DeviceObject = DeviceObject;
- DPRINT("FileObject %x DeviceObject %x\n",
- FileObject,
- DeviceObject);
- FileObject->Vpb = DeviceObject->Vpb;
- FileObject->Type = InternalFileType;
-
- return (STATUS_SUCCESS);
+ PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) Parent;
+ PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
+ NTSTATUS Status;
+
+ DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n",
+ ObjectBody,
+ Parent,
+ RemainingPath);
+
+ if (NULL == DeviceObject)
+ {
+ /* This is probably an attempt to create a meta fileobject (eg. for FAT)
+ for the cache manager, so return STATUS_SUCCESS */
+ DPRINT("DeviceObject was NULL\n");
+ return(STATUS_SUCCESS);
+ }
+
+ if (IoDeviceObjectType != BODY_TO_HEADER(Parent)->ObjectType)
+ {
+ CPRINT("Parent is a %S which is not a device type\n",
+ BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
+ return(STATUS_UNSUCCESSFUL);
+ }
+
+ Status = ObReferenceObjectByPointer(DeviceObject,
+ STANDARD_RIGHTS_REQUIRED,
+ IoDeviceObjectType,
+ UserMode);
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("Failed to reference device object %x\n", DeviceObject);
+ return(Status);
+ }
+
+ DeviceObject = IoGetAttachedDevice(DeviceObject);
+ DPRINT("DeviceObject %x\n", DeviceObject);
+
+ if (NULL == RemainingPath)
+ {
+ FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
+ FileObject->FileName.Buffer = 0;
+ FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
+ }
+ else
+ {
+ if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM)
+ && (DeviceObject->DeviceType != FILE_DEVICE_DISK)
+ && (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM)
+ && (DeviceObject->DeviceType != FILE_DEVICE_TAPE)
+ && (DeviceObject->DeviceType != FILE_DEVICE_NETWORK)
+ && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
+ && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
+ {
+ CPRINT("Device was wrong type\n");
+ return(STATUS_UNSUCCESSFUL);
+ }
+
+ if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK
+ && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
+ && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
+ {
+ if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
+ {
+ DPRINT("Trying to mount storage device\n");
+ Status = IoTryToMountStorageDevice(DeviceObject, FALSE);
+ DPRINT("Status %x\n", Status);
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("Failed to mount storage device (status %x)\n",
+ Status);
+ return(Status);
+ }
+ DeviceObject = IoGetAttachedDevice(DeviceObject);
+ }
+ }
+ RtlCreateUnicodeString(&(FileObject->FileName),
+ RemainingPath);
+ }
+
+ DPRINT("FileObject->FileName %wZ\n",
+ &FileObject->FileName);
+ FileObject->DeviceObject = DeviceObject;
+ DPRINT("FileObject %x DeviceObject %x\n",
+ FileObject,
+ DeviceObject);
+ FileObject->Vpb = DeviceObject->Vpb;
+ FileObject->Type = InternalFileType;
+
+ return(STATUS_SUCCESS);
}
NTSTATUS Status;
DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",
- FileObject, DeviceObject);
-
- assert_irql (PASSIVE_LEVEL);
+ FileObject, DeviceObject);
+
+ assert_irql(PASSIVE_LEVEL);
- Status = ObCreateObject (&FileHandle,
- STANDARD_RIGHTS_REQUIRED,
- NULL,
- IoFileObjectType,
- (PVOID*)&CreatedFileObject);
+ Status = ObCreateObject(&FileHandle,
+ STANDARD_RIGHTS_REQUIRED,
+ NULL,
+ IoFileObjectType,
+ (PVOID*)&CreatedFileObject);
if (!NT_SUCCESS(Status))
{
DPRINT("Could not create FileObject\n");
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
// shouldn't we initialize the lock event, and several other things here too?
- KeInitializeEvent( &CreatedFileObject->Event, NotificationEvent, FALSE );
+ KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
- ZwClose (FileHandle);
+ ZwClose(FileHandle);
- return (CreatedFileObject);
+ return(CreatedFileObject);
}
-/* $Id: device.c,v 1.36 2002/03/24 15:30:44 ekohl Exp $
+/* $Id: device.c,v 1.37 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
UNIMPLEMENTED;
}
-NTSTATUS STDCALL
+
+NTSTATUS STDCALL
IopDefaultDispatchFunction(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(STATUS_NOT_IMPLEMENTED);
+ Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return(STATUS_NOT_IMPLEMENTED);
}
-NTSTATUS
+
+NTSTATUS
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject)
{
PDRIVER_OBJECT Object;
}
NTSTATUS
-IopInitializeDeviceNodeService(
- PDEVICE_NODE DeviceNode)
+IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING ImagePath;
HANDLE KeyHandle;
- NTSTATUS Status;
+ NTSTATUS Status;
Status = RtlpGetRegistryHandle(
RTL_REGISTRY_SERVICES,
&KeyHandle);
if (!NT_SUCCESS(Status))
{
- DPRINT("RtlpGetRegistryHandle() failed (Status %x)\n", Status);
- return Status;
+ DPRINT("RtlpGetRegistryHandle() failed (Status %x)\n", Status);
+ return(Status);
}
RtlZeroMemory(QueryTable, sizeof(QueryTable));
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
if (NT_SUCCESS(Status))
- {
- DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
+ {
+ DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
- Status = IopInitializeService(DeviceNode, &ImagePath);
+ Status = IopInitializeService(DeviceNode, &ImagePath);
- RtlFreeUnicodeString(&ImagePath);
- }
+ RtlFreeUnicodeString(&ImagePath);
+ }
- return Status;
+ return(Status);
}
-NTSTATUS
+NTSTATUS
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
- PDEVICE_NODE DeviceNode)
+ PDEVICE_NODE DeviceNode)
/*
* FUNCTION: Called to initalize a loaded driver
* ARGUMENTS:
Status = IopCreateDriverObject(&DriverObject);
if (!NT_SUCCESS(Status))
{
- return(Status);
+ return(Status);
}
DeviceNode->DriverObject = DriverObject;
if (DeviceNode->ServiceName.Buffer)
- {
- wcscpy(RegistryKeyBuffer, DRIVER_REGISTRY_KEY_BASENAME);
- wcscat(RegistryKeyBuffer, DeviceNode->ServiceName.Buffer);
- RtlInitUnicodeString(&RegistryKey, RegistryKeyBuffer);
- }
+ {
+ wcscpy(RegistryKeyBuffer, DRIVER_REGISTRY_KEY_BASENAME);
+ wcscat(RegistryKeyBuffer, DeviceNode->ServiceName.Buffer);
+ RtlInitUnicodeString(&RegistryKey, RegistryKeyBuffer);
+ }
else
- {
- RtlInitUnicodeString(&RegistryKey, NULL);
- }
+ {
+ RtlInitUnicodeString(&RegistryKey, NULL);
+ }
DPRINT("RegistryKey: %wZ\n", &RegistryKey);
DPRINT("Calling driver entrypoint at %08lx\n", DriverEntry);
Status = DriverEntry(DriverObject, &RegistryKey);
if (!NT_SUCCESS(Status))
{
- DeviceNode->DriverObject = NULL;
- ExFreePool(DriverObject->DriverExtension);
- ExFreePool(DriverObject);
- return(Status);
+ DeviceNode->DriverObject = NULL;
+ ExFreePool(DriverObject->DriverExtension);
+ ExFreePool(DriverObject);
+ return(Status);
}
Status = IopInitializeDevice(DeviceNode, TRUE);
return(Status);
}
+
NTSTATUS STDCALL
IoAttachDevice(PDEVICE_OBJECT SourceDevice,
PUNICODE_STRING TargetDevice,
* AttachedDevice (OUT) = Caller storage for the device attached to
*/
{
- UNIMPLEMENTED;
+ UNIMPLEMENTED;
}
+
NTSTATUS STDCALL
IopCreateDevice(PVOID ObjectBody,
PVOID Parent,
CreatedDeviceObject->NextDevice = DriverObject->DeviceObject;
DriverObject->DeviceObject = CreatedDeviceObject;
}
-
- CreatedDeviceObject->Type = DeviceType;
- CreatedDeviceObject->DriverObject = DriverObject;
- CreatedDeviceObject->CurrentIrp = NULL;
- CreatedDeviceObject->Flags = 0;
-
- CreatedDeviceObject->DeviceExtension =
- ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize,
- TAG_DEVICE_EXTENSION);
- if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
- {
- ExFreePool(CreatedDeviceObject);
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
+
+ CreatedDeviceObject->Type = DeviceType;
+ CreatedDeviceObject->DriverObject = DriverObject;
+ CreatedDeviceObject->CurrentIrp = NULL;
+ CreatedDeviceObject->Flags = 0;
+
+ CreatedDeviceObject->DeviceExtension =
+ ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize,
+ TAG_DEVICE_EXTENSION);
+ if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
+ {
+ ExFreePool(CreatedDeviceObject);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
if (DeviceExtensionSize > 0)
- {
- RtlZeroMemory(CreatedDeviceObject->DeviceExtension,
- DeviceExtensionSize);
- }
+ {
+ RtlZeroMemory(CreatedDeviceObject->DeviceExtension,
+ DeviceExtensionSize);
+ }
- CreatedDeviceObject->AttachedDevice = NULL;
- CreatedDeviceObject->DeviceType = DeviceType;
- CreatedDeviceObject->StackSize = 1;
- CreatedDeviceObject->AlignmentRequirement = 1;
- KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
-
- KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
- SynchronizationEvent,
- TRUE);
-
- if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK)
- {
- IoAttachVpb(CreatedDeviceObject);
- }
-
- *DeviceObject = CreatedDeviceObject;
-
- return(STATUS_SUCCESS);
+ CreatedDeviceObject->AttachedDevice = NULL;
+ CreatedDeviceObject->DeviceType = DeviceType;
+ CreatedDeviceObject->StackSize = 1;
+ CreatedDeviceObject->AlignmentRequirement = 1;
+ KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
+
+ KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
+ SynchronizationEvent,
+ TRUE);
+
+ /* FIXME: Do we need to add network drives too?! */
+ if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK ||
+ CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM ||
+ CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE)
+ {
+ IoAttachVpb(CreatedDeviceObject);
+ }
+
+ *DeviceObject = CreatedDeviceObject;
+
+ return(STATUS_SUCCESS);
}
DWORD Unknown4
)
{
- UNIMPLEMENTED;
- return (STATUS_NOT_IMPLEMENTED);
+ UNIMPLEMENTED;
+ return(STATUS_NOT_IMPLEMENTED);
}
DWORD Unknown1
)
{
- UNIMPLEMENTED;
- return 0;
+ UNIMPLEMENTED;
+ return 0;
}
* device, that is the target of the given thread's I/O request
*/
{
- return Thread->DeviceToVerify;
+ return(Thread->DeviceToVerify);
}
VOID STDCALL
-IoSetDeviceToVerify (IN PETHREAD Thread,
- IN PDEVICE_OBJECT DeviceObject)
+IoSetDeviceToVerify(IN PETHREAD Thread,
+ IN PDEVICE_OBJECT DeviceObject)
{
- Thread->DeviceToVerify = DeviceObject;
+ Thread->DeviceToVerify = DeviceObject;
}
IoSetHardErrorOrVerifyDevice(PIRP Irp,
PDEVICE_OBJECT DeviceObject)
{
- Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
+ Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
}
-/* $Id: fs.c,v 1.21 2002/04/07 18:36:13 phreak Exp $
+/* $Id: fs.c,v 1.22 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
return(Status);
}
-VOID IoInitFileSystemImplementation(VOID)
+
+VOID
+IoInitFileSystemImplementation(VOID)
{
InitializeListHead(&FileSystemListHead);
KeInitializeSpinLock(&FileSystemListLock);
KeInitializeSpinLock(&FsChangeNotifyListLock);
}
-VOID IoShutdownRegisteredFileSystems(VOID)
+
+VOID
+IoShutdownRegisteredFileSystems(VOID)
{
KIRQL oldlvl;
PLIST_ENTRY current_entry;
KeReleaseSpinLock(&FileSystemListLock,oldlvl);
}
-NTSTATUS IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
- PDEVICE_OBJECT DeviceToMount)
+
+NTSTATUS
+IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceToMount)
{
PIRP Irp;
IO_STATUS_BLOCK IoStatusBlock;
return(Status);
}
-NTSTATUS IoAskFileSystemToLoad(PDEVICE_OBJECT DeviceObject)
+
+NTSTATUS
+IoAskFileSystemToLoad(PDEVICE_OBJECT DeviceObject)
{
UNIMPLEMENTED;
}
-NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject)
+
+NTSTATUS
+IoTryToMountStorageDevice(IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN AllowRawMount)
/*
* FUNCTION: Trys to mount a storage device
* ARGUMENTS:
assert_irql(PASSIVE_LEVEL);
- DPRINT("IoTryToMountStorageDevice(DeviceObject %x)\n",DeviceObject);
+ DPRINT1("IoTryToMountStorageDevice(DeviceObject %x)\n",DeviceObject);
KeAcquireSpinLock(&FileSystemListLock,&oldlvl);
current_entry = FileSystemListHead.Flink;
return(STATUS_UNRECOGNIZED_VOLUME);
}
+
+/**********************************************************************
+ * NAME EXPORTED
+ * IoVerifyVolume
+ *
+ * DESCRIPTION
+ * Veriyfy the file system type and volume information or mount
+ * a file system.
+ *
+ * ARGUMENTS
+ * DeviceObject
+ * Device to verify or mount
+ *
+ * AllowRawMount
+ * ...
+ *
+ * RETURN VALUE
+ * Status
+ */
+NTSTATUS STDCALL
+IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN AllowRawMount)
+{
+#if 0
+ IO_STATUS_BLOCK IoStatusBlock,
+ KEVENT Event;
+ PIRP Irp;
+#endif
+ NTSTATUS Status;
+
+ DPRINT1("IoVerifyVolume(DeviceObject %x AllowRawMount %x)\n",
+ DeviceObject,
+ AllowRawMount);
+
+ Status = STATUS_SUCCESS;
+
+ KeWaitForSingleObject(&DeviceObject->DeviceLock,
+ Executive,
+ KernelMode,
+ FALSE,
+ NULL);
+
+ if (DeviceObject->Vpb->Flags & VPB_MOUNTED)
+ {
+ /* FIXME: Issue verify request to the FSD */
+#if 0
+ KeInitializeEvent(&Event,...);
+
+ Irp = IoBuildFilesystemControlRequest(IRP_MN_VERIFY_VOLUME,
+ DeviceObject,
+ &Event,
+ &IoStatusBlock,
+ &DeviceToMount)
+
+
+#endif
+
+ if (NT_SUCCESS(Status))
+ {
+ KeSetEvent(&DeviceObject->DeviceLock,
+ IO_NO_INCREMENT,
+ FALSE);
+ return(STATUS_SUCCESS);
+ }
+ }
+
+ if (Status == STATUS_WRONG_VOLUME)
+ {
+ /* FIXME: Replace existing VPB by a new one */
+
+ }
+
+ /* Start mount sequence */
+ Status = IoTryToMountStorageDevice(DeviceObject,
+ AllowRawMount);
+
+ KeSetEvent(&DeviceObject->DeviceLock,
+ IO_NO_INCREMENT,
+ FALSE);
+
+ return(Status);
+}
+
+
VOID STDCALL
IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
{
IopNotifyFileSystemChange(DeviceObject, TRUE);
}
+
VOID STDCALL
IoUnregisterFileSystem(PDEVICE_OBJECT DeviceObject)
{
-/* $Id: irp.c,v 1.39 2002/01/21 22:30:26 hbirr Exp $
+/* $Id: irp.c,v 1.40 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
VOID STDCALL
-IoFreeIrp (PIRP Irp)
+IoFreeIrp(PIRP Irp)
/*
* FUNCTION: Releases a caller allocated irp
* ARGUMENTS:
* Irp = Irp to free
*/
{
- ExFreePool(Irp);
+ ExFreePool(Irp);
}
PIRP STDCALL
-IoMakeAssociatedIrp (PIRP Irp, CCHAR StackSize)
+IoMakeAssociatedIrp(PIRP Irp,
+ CCHAR StackSize)
/*
* FUNCTION: Allocates and initializes an irp to associated with a master irp
* ARGUMENTS:
* RETURNS: The irp allocated
*/
{
- PIRP AssocIrp;
-
- AssocIrp = IoAllocateIrp(StackSize,FALSE);
- UNIMPLEMENTED;
+ PIRP AssocIrp;
+
+ AssocIrp = IoAllocateIrp(StackSize,FALSE);
+ UNIMPLEMENTED;
}
VOID STDCALL
-IoInitializeIrp (PIRP Irp, USHORT PacketSize, CCHAR StackSize)
+IoInitializeIrp(PIRP Irp,
+ USHORT PacketSize,
+ CCHAR StackSize)
/*
* FUNCTION: Initalizes an irp allocated by the caller
* ARGUMENTS:
* StackSize = Number of stack locations in the IRP
*/
{
- assert(Irp != NULL);
+ assert(Irp != NULL);
- memset(Irp, 0, PacketSize);
- Irp->Size = PacketSize;
- Irp->StackCount = StackSize;
- Irp->CurrentLocation = StackSize;
- Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize];
+ memset(Irp, 0, PacketSize);
+ Irp->Size = PacketSize;
+ Irp->StackCount = StackSize;
+ Irp->CurrentLocation = StackSize;
+ Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize];
}
NTSTATUS FASTCALL
-IofCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
+IofCallDriver(PDEVICE_OBJECT DeviceObject,
+ PIRP Irp)
/*
* FUNCTION: Sends an IRP to the next lower driver
*/
{
- NTSTATUS Status;
- PDRIVER_OBJECT DriverObject;
- PIO_STACK_LOCATION Param;
-
- DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
-
- assert(Irp);
- assert(DeviceObject);
-
- DriverObject = DeviceObject->DriverObject;
-
- assert(DriverObject);
-
- Param = IoGetNextIrpStackLocation(Irp);
-
- DPRINT("IrpSp 0x%X\n", Param);
-
- Irp->Tail.Overlay.CurrentStackLocation--;
- Irp->CurrentLocation--;
-
- DPRINT("MajorFunction %d\n", Param->MajorFunction);
- DPRINT("DriverObject->MajorFunction[Param->MajorFunction] %x\n",
- DriverObject->MajorFunction[Param->MajorFunction]);
- Status = DriverObject->MajorFunction[Param->MajorFunction](DeviceObject,
- Irp);
- return Status;
+ NTSTATUS Status;
+ PDRIVER_OBJECT DriverObject;
+ PIO_STACK_LOCATION Param;
+
+ DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
+
+ assert(Irp);
+ assert(DeviceObject);
+
+ DriverObject = DeviceObject->DriverObject;
+
+ assert(DriverObject);
+
+ Param = IoGetNextIrpStackLocation(Irp);
+
+ DPRINT("IrpSp 0x%X\n", Param);
+
+ Irp->Tail.Overlay.CurrentStackLocation--;
+ Irp->CurrentLocation--;
+
+ DPRINT("MajorFunction %d\n", Param->MajorFunction);
+ DPRINT("DriverObject->MajorFunction[Param->MajorFunction] %x\n",
+ DriverObject->MajorFunction[Param->MajorFunction]);
+ Status = DriverObject->MajorFunction[Param->MajorFunction](DeviceObject,
+ Irp);
+
+ return(Status);
}
STDCALL
IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
- return IofCallDriver (
- DeviceObject,
- Irp
- );
+ return(IofCallDriver(DeviceObject,
+ Irp));
}
-PIRP
-STDCALL
-IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
+PIRP STDCALL
+IoAllocateIrp(CCHAR StackSize,
+ BOOLEAN ChargeQuota)
/*
* FUNCTION: Allocates an IRP
* ARGUMENTS:
* RETURNS: Irp allocated
*/
{
- PIRP Irp;
+ PIRP Irp;
#if 0
- DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",
- StackSize,
- ChargeQuota);
- KeDumpStackFrames(0,8);
+ DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",
+ StackSize,
+ ChargeQuota);
+ KeDumpStackFrames(0,8);
#endif
-
- if (ChargeQuota)
- {
-// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
- Irp = ExAllocatePoolWithTag(NonPagedPool, IoSizeOfIrp(StackSize),
- TAG_IRP);
- }
- else
- {
- Irp = ExAllocatePoolWithTag(NonPagedPool,IoSizeOfIrp(StackSize),
- TAG_IRP);
- }
-
- if (Irp==NULL)
- {
- return(NULL);
- }
-
- IoInitializeIrp(Irp, IoSizeOfIrp(StackSize), StackSize);
-
-// DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation);
-
- return Irp;
+
+ if (ChargeQuota)
+ {
+// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
+ Irp = ExAllocatePoolWithTag(NonPagedPool,
+ IoSizeOfIrp(StackSize),
+ TAG_IRP);
+ }
+ else
+ {
+ Irp = ExAllocatePoolWithTag(NonPagedPool,
+ IoSizeOfIrp(StackSize),
+ TAG_IRP);
+ }
+
+ if (Irp==NULL)
+ {
+ return(NULL);
+ }
+
+ IoInitializeIrp(Irp,
+ IoSizeOfIrp(StackSize),
+ StackSize);
+
+// DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation);
+
+ return(Irp);
}
PVOID* SystemArgument1,
PVOID* SystemArgument2)
{
- DPRINT("IopCompleteRequest(Apc %x, SystemArgument1 %x, "
- "(*SystemArgument1) %x\n", Apc, SystemArgument1,
- *SystemArgument1);
- IoSecondStageCompletion((PIRP)(*SystemArgument1),
- (KPRIORITY)(*SystemArgument2));
+ DPRINT("IopCompleteRequest(Apc %x, SystemArgument1 %x, (*SystemArgument1) %x\n",
+ Apc,
+ SystemArgument1,
+ *SystemArgument1);
+ IoSecondStageCompletion((PIRP)(*SystemArgument1),
+ (KPRIORITY)(*SystemArgument2));
}
}
-VOID
-STDCALL
-IoCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
+VOID STDCALL
+IoCompleteRequest(PIRP Irp,
+ CCHAR PriorityBoost)
{
- IofCompleteRequest (
- Irp,
- PriorityBoost
- );
+ IofCompleteRequest(Irp,
+ PriorityBoost);
}
* RETURN VALUE
* TRUE if Irp's operation is synchronous; otherwise FALSE.
*/
-BOOLEAN
-STDCALL
-IoIsOperationSynchronous (
- IN PIRP Irp
- )
+BOOLEAN STDCALL
+IoIsOperationSynchronous(IN PIRP Irp)
{
- ULONG Flags = 0;
- PFILE_OBJECT FileObject = NULL;
-
- /*
- * Check the associated FILE_OBJECT's
- * flags first.
- */
- FileObject = Irp->Tail.Overlay.OriginalFileObject;
- if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
- {
- /* Check IRP's flags. */
- Flags = Irp->Flags;
- if (!( (IRP_SYNCHRONOUS_API | IRP_SYNCHRONOUS_PAGING_IO)
- & Flags
- ))
- {
- return FALSE;
- }
- }
- /*
- * Check more IRP's flags.
- */
- Flags = Irp->Flags;
- if ( !(IRP_MOUNT_COMPLETION & Flags)
- || (IRP_SYNCHRONOUS_PAGING_IO & Flags)
- )
+ PFILE_OBJECT FileObject = NULL;
+ ULONG Flags = 0;
+
+ /* Check the associated FILE_OBJECT's flags first. */
+ FileObject = Irp->Tail.Overlay.OriginalFileObject;
+ if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
+ {
+ /* Check IRP's flags. */
+ Flags = Irp->Flags;
+ if (!((IRP_SYNCHRONOUS_API | IRP_SYNCHRONOUS_PAGING_IO) & Flags))
{
- return TRUE;
+ return(FALSE);
}
- /*
- * Otherwise, it is an
- * asynchronous operation.
- */
- return FALSE;
+ }
+
+ /* Check more IRP's flags. */
+ Flags = Irp->Flags;
+ if (!(IRP_MOUNT_COMPLETION & Flags)
+ || (IRP_SYNCHRONOUS_PAGING_IO & Flags))
+ {
+ return(TRUE);
+ }
+
+ /* Otherwise, it is an asynchronous operation. */
+ return(FALSE);
}
-VOID
-STDCALL
-IoEnqueueIrp (
- PIRP Irp
- )
+VOID STDCALL
+IoEnqueueIrp(IN PIRP Irp)
{
- UNIMPLEMENTED;
+ UNIMPLEMENTED;
}
-VOID
-STDCALL
-IoSetTopLevelIrp (
- IN PIRP Irp
- )
+VOID STDCALL
+IoSetTopLevelIrp(IN PIRP Irp)
{
- PETHREAD Thread;
+ PETHREAD Thread;
- Thread = PsGetCurrentThread ();
- Thread->TopLevelIrp->TopLevelIrp = Irp;
+ Thread = PsGetCurrentThread();
+ Thread->TopLevelIrp->TopLevelIrp = Irp;
}
-PIRP
-STDCALL
-IoGetTopLevelIrp (
- VOID
- )
+PIRP STDCALL
+IoGetTopLevelIrp(VOID)
{
- return (PsGetCurrentThread ()->TopLevelIrp->TopLevelIrp);
+ return(PsGetCurrentThread()->TopLevelIrp->TopLevelIrp);
}
-VOID
-STDCALL
-IoQueueThreadIrp (
- PVOID Unknown0
- )
+VOID STDCALL
+IoQueueThreadIrp(IN PIRP Irp)
{
- UNIMPLEMENTED;
+ UNIMPLEMENTED;
}
/* EOF */
-/* $Id: vpb.c,v 1.14 2001/11/02 22:22:33 hbirr Exp $
+/* $Id: vpb.c,v 1.15 2002/04/10 09:57:31 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
Irql);
}
-
-NTSTATUS STDCALL
-IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
- IN BOOLEAN AllowRawMount)
-{
- UNIMPLEMENTED;
- return(STATUS_NOT_IMPLEMENTED);
-}
-
-
/* EOF */