/* Handle an IRP. */ static NTSTATUS WvFilediskIrpDispatch( IN PDEVICE_OBJECT dev_obj, IN PIRP irp ) { PIO_STACK_LOCATION io_stack_loc; WV_SP_FILEDISK_T filedisk; NTSTATUS status; io_stack_loc = IoGetCurrentIrpStackLocation(irp); filedisk = dev_obj->DeviceExtension; switch (io_stack_loc->MajorFunction) { case IRP_MJ_SCSI: return WvlDiskScsi(dev_obj, irp, filedisk->disk); case IRP_MJ_PNP: status = WvlDiskPnp(dev_obj, irp, filedisk->disk); /* Note any state change. */ filedisk->Dev->OldState = filedisk->disk->OldState; filedisk->Dev->State = filedisk->disk->State; if (filedisk->Dev->State == WvlDiskStateNotStarted) { if (!filedisk->Dev->BusNode.Linked) { /* Unlinked _and_ deleted */ DBG("Deleting filedisk PDO: %p", dev_obj); IoDeleteDevice(dev_obj); } } return status; case IRP_MJ_DEVICE_CONTROL: return WvlDiskDevCtl( filedisk->disk, irp, io_stack_loc->Parameters.DeviceIoControl.IoControlCode ); case IRP_MJ_POWER: return WvlDiskPower(dev_obj, irp, filedisk->disk); case IRP_MJ_CREATE: case IRP_MJ_CLOSE: /* Always succeed with nothing to do. */ return WvlIrpComplete(irp, 0, STATUS_SUCCESS); case IRP_MJ_SYSTEM_CONTROL: return WvlDiskSysCtl(dev_obj, irp, filedisk->disk); default: DBG("Unhandled IRP_MJ_*: %d\n", io_stack_loc->MajorFunction); } return WvlIrpComplete(irp, 0, STATUS_NOT_SUPPORTED); }
NTSTATUS STDCALL WvDiskPnp( IN WV_SP_DEV_T dev, IN PIRP irp, IN UCHAR code ) { NTSTATUS status; WVL_SP_DISK_T disk = disk__get_ptr(dev); status = WvlDiskPnp(dev->Self, irp, disk); /* Note any state change. */ dev->OldState = disk->OldState; dev->State = disk->State; return status; }