Author: ros-arm-bringup Date: Sun Jul 13 02:16:24 2008 New Revision: 34451
URL: http://svn.reactos.org/svn/reactos?rev=34451&view=rev Log: - Remove incorrect check in RamdiskPnp -- we should only early-quit if the device is removed, not uninitialized, otherwise we'll never get initialized. - Add support for IRP_MN_SURPRISE_REMOVAL. - Handle IRP_MN_QUERY_ID for FDO (it is the first IRP we receive). - Handle IRP completion for FDOs and forward if necessary.
Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c
Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramdi... ============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Sun Jul 13 02:16:24 2008 @@ -36,8 +36,10 @@ { RamdiskStateUninitialized, RamdiskStateStarted, + RamdiskStatePaused, RamdiskStateStopped, - RamdiskStateRemoved + RamdiskStateRemoved, + RamdiskStateBusRemoved, } RAMDISK_DEVICE_STATE;
DEFINE_GUID(RamdiskBusInterface, @@ -281,9 +283,9 @@ Minor = IoStackLocation->MinorFunction;
// - // Check if the device is initialized - // - if (DeviceExtension->State == RamdiskStateUninitialized) + // Check if the bus is removed + // + if (DeviceExtension->State == RamdiskStateBusRemoved) { // // Only remove-device and query-id are allowed @@ -361,11 +363,23 @@ DPRINT1("PnP IRP: %lx\n", Minor); while (TRUE); break; + + case IRP_MN_SURPRISE_REMOVAL: + + DPRINT1("PnP IRP: %lx\n", Minor); + while (TRUE); + break;
case IRP_MN_QUERY_ID:
- DPRINT1("PnP IRP: %lx\n", Minor); - while (TRUE); + // + // Are we a PDO? + // + if (DeviceExtension->Type == RamdiskPdo) + { + DPRINT1("PnP IRP: %lx\n", Minor); + while (TRUE); + } break;
case IRP_MN_QUERY_BUS_INFORMATION: @@ -405,10 +419,27 @@ }
// + // Are we an FDO? + // + if (DeviceExtension->Type == RamdiskFdo) + { + // + // Do we have an attached device? + // + if (DeviceExtension->AttachedDevice) + { + // + // Forward the IRP + // + IoSkipCurrentIrpStackLocation(Irp); + Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp); + } + } + + // // Release the lock and return status // IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp); - while (TRUE); return Status; }