mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
- Improve list looping to remove gotos.
- Dereference the device object in case of failure. - Add some optimizations to quickly skip invalid raw mounting. - Add support for VPB_RAW_MOUNT. - Allow raw mount if this is the only device on the list. - Make the success case go through shared exit, otherwise the device wasn't getting unlocked previously. svn path=/trunk/; revision=22763
This commit is contained in:
parent
320000e093
commit
93454acf2b
1 changed files with 66 additions and 51 deletions
|
@ -347,8 +347,31 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Now loop the fs list until one of the file systems accepts us */
|
/* Now loop the fs list until one of the file systems accepts us */
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
ListEntry = FsList->Flink;
|
ListEntry = FsList->Flink;
|
||||||
while (ListEntry != FsList)
|
while ((ListEntry != FsList) && !(NT_SUCCESS(Status)))
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If we're not allowed to mount this volume and this is our last
|
||||||
|
* (but not only) chance to mount it...
|
||||||
|
*/
|
||||||
|
if (!(AllowRawMount) &&
|
||||||
|
(ListEntry->Flink == FsList) &&
|
||||||
|
(ListEntry != FsList->Flink))
|
||||||
|
{
|
||||||
|
/* Then fail this mount request */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Also check if this is a raw mount and there are other file
|
||||||
|
* systems on the list.
|
||||||
|
*/
|
||||||
|
if ((DeviceObject->Vpb->Flags & VPB_RAW_MOUNT) &&
|
||||||
|
(ListEntry->Flink != FsList))
|
||||||
|
{
|
||||||
|
/* Then skip this entry */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the Device Object for this FS */
|
/* Get the Device Object for this FS */
|
||||||
FileSystemDeviceObject = CONTAINING_RECORD(ListEntry,
|
FileSystemDeviceObject = CONTAINING_RECORD(ListEntry,
|
||||||
DEVICE_OBJECT,
|
DEVICE_OBJECT,
|
||||||
|
@ -368,14 +391,6 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
FsStackOverhead++;
|
FsStackOverhead++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we are not allowed to mount this volume as a raw filesystem volume
|
|
||||||
then don't try this */
|
|
||||||
if (!AllowRawMount && RawFsIsRawFileSystemDeviceObject(FileSystemDeviceObject))
|
|
||||||
{
|
|
||||||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Clear the event */
|
/* Clear the event */
|
||||||
KeClearEvent(&Event);
|
KeClearEvent(&Event);
|
||||||
|
|
||||||
|
@ -418,7 +433,6 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
NULL);
|
NULL);
|
||||||
Status = IoStatusBlock.Status;
|
Status = IoStatusBlock.Status;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (Status)
|
switch (Status)
|
||||||
{
|
{
|
||||||
|
@ -435,9 +449,6 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
case STATUS_SUCCESS:
|
case STATUS_SUCCESS:
|
||||||
DeviceObject->Vpb->Flags = DeviceObject->Vpb->Flags |
|
DeviceObject->Vpb->Flags = DeviceObject->Vpb->Flags |
|
||||||
VPB_MOUNTED;
|
VPB_MOUNTED;
|
||||||
ExReleaseResourceLite(&FileSystemListLock);
|
|
||||||
KeLeaveCriticalRegion();
|
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
|
|
||||||
case STATUS_UNRECOGNIZED_VOLUME:
|
case STATUS_UNRECOGNIZED_VOLUME:
|
||||||
default:
|
default:
|
||||||
|
@ -445,8 +456,12 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Go to the next FS entry */
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dereference the device if we failed */
|
||||||
|
if (!NT_SUCCESS(Status)) ObDereferenceObject(AttachedDeviceObject);
|
||||||
}
|
}
|
||||||
else if (DeviceObject->Vpb->Flags & VPB_REMOVE_PENDING)
|
else if (DeviceObject->Vpb->Flags & VPB_REMOVE_PENDING)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue