[disk/dev_ctl,driver] Rename disk_dev_ctl__dispatch()
authorShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sun, 9 Jan 2011 11:21:51 +0000 (06:21 -0500)
committerShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sun, 9 Jan 2011 11:21:51 +0000 (06:21 -0500)
To WvlDiskDevCtl().  It was also made independent of
WV_S_DEV_T, so that meant adding a WvDiskDevCtl()
function to the WinVBlock driver, in order for its
IRP major function handler tables to have something to
work with.

src/aoe/driver.c
src/include/disk.h
src/include/driver.h
src/winvblock/disk/dev_ctl.c
src/winvblock/disk/disk.c
src/winvblock/driver.c
src/winvblock/filedisk/filedisk.c
src/winvblock/ramdisk/ramdisk.c

index 251d8f0..f20f18f 100644 (file)
@@ -1877,8 +1877,8 @@ static NTSTATUS AoeIrpDevCtl_(
     if (!dev || dev->State == WvDevStateDeleted)
       return WvlIrpComplete(irp, 0, STATUS_NO_SUCH_DEVICE);
     /* Use the disk routine. */
-    return disk_dev_ctl__dispatch(
-        dev,
+    return WvlDiskDevCtl(
+        AoeDiskFromDev_(dev)->disk,
         irp,
         io_stack_loc->Parameters.DeviceIoControl.IoControlCode
       );
index 1e7c5b5..b5e68a9 100644 (file)
@@ -192,7 +192,11 @@ extern WVL_M_LIB WV_SP_DISK_T disk__create(void);
 extern WVL_M_LIB WV_F_DEV_DISPATCH WvDiskIrpPower;
 extern WVL_M_LIB WV_F_DEV_DISPATCH WvDiskIrpSysCtl;
 /* IRP_MJ_DEVICE_CONTROL dispatcher from disk/dev_ctl.c */
-extern WVL_M_LIB WV_F_DEV_CTL disk_dev_ctl__dispatch;
+extern WVL_M_LIB NTSTATUS STDCALL WvlDiskDevCtl(
+    IN WV_SP_DISK_T,
+    IN PIRP,
+    IN ULONG POINTER_ALIGNMENT
+  );
 /* IRP_MJ_SCSI dispatcher from disk/scsi.c */
 extern WVL_M_LIB WV_F_DEV_SCSI disk_scsi__dispatch;
 /* IRP_MJ_PNP dispatcher from disk/pnp.c */
index 6027a0d..8d8a5b6 100644 (file)
@@ -51,6 +51,11 @@ extern NTSTATUS STDCALL WvDriverGetDevCapabilities(
     IN PDEVICE_OBJECT,
     IN PDEVICE_CAPABILITIES
   );
+extern NTSTATUS STDCALL WvDiskDevCtl(
+    IN struct WV_DEV_T *,
+    IN PIRP,
+    IN ULONG POINTER_ALIGNMENT
+  );
 /* From bus.c */
 extern WVL_M_LIB PDEVICE_OBJECT WvBusFdo(void);
 
index 3a9a7e6..032e283 100644 (file)
@@ -182,23 +182,28 @@ static NTSTATUS STDCALL WvlDiskDevCtlScsiGetAddr_(
     return WvlIrpComplete(irp, (ULONG_PTR) copy_size, STATUS_SUCCESS);
   }
 
-WVL_M_LIB NTSTATUS STDCALL disk_dev_ctl__dispatch(
-    IN WV_SP_DEV_T dev,
-    IN PIRP irp,
-    IN ULONG POINTER_ALIGNMENT code
+/**
+ * Handle a disk IRP_MJ_DEVICE_CONTROL IRP.
+ *
+ * @v Disk              The disk to process with the IRP.
+ * @v Irp               The IRP to process with the disk.
+ * @v Code              The device control code.
+ * @ret NTSTATUS        The status of the operation.
+ */
+WVL_M_LIB NTSTATUS STDCALL WvlDiskDevCtl(
+    IN WV_SP_DISK_T Disk,
+    IN PIRP Irp,
+    IN ULONG POINTER_ALIGNMENT Code
   ) {
-    WV_SP_DISK_T disk = disk__get_ptr(dev);
-    NTSTATUS status;
-
-    switch (code) {
+    switch (Code) {
         case IOCTL_STORAGE_QUERY_PROPERTY:
-          return WvlDiskDevCtlStorageQueryProp_(disk, irp);
+          return WvlDiskDevCtlStorageQueryProp_(Disk, Irp);
 
         case IOCTL_DISK_GET_DRIVE_GEOMETRY:
-          return WvlDiskDevCtlGetGeom_(disk, irp);
+          return WvlDiskDevCtlGetGeom_(Disk, Irp);
 
         case IOCTL_SCSI_GET_ADDRESS:
-          return WvlDiskDevCtlScsiGetAddr_(disk, irp);
+          return WvlDiskDevCtlScsiGetAddr_(Disk, Irp);
 
         /* Some cases that pop up on Windows Server 2003. */
         #if 0
@@ -206,17 +211,9 @@ WVL_M_LIB NTSTATUS STDCALL disk_dev_ctl__dispatch(
         case IOCTL_MOUNTDEV_LINK_CREATED:
         case IOCTL_MOUNTDEV_QUERY_STABLE_GUID:
         case IOCTL_VOLUME_ONLINE:
-          irp->IoStatus.Information = 0;
-          status = STATUS_SUCCESS;
-          break;
+          return WvlIrpComplete(Irp, 0, STATUS_SUCCESS);
         #endif
-
-        default:
-          irp->IoStatus.Information = 0;
-          status = STATUS_INVALID_PARAMETER;
       }
 
-    irp->IoStatus.Status = status;
-    IoCompleteRequest(irp, IO_NO_INCREMENT);
-    return status;
+    return WvlIrpComplete(Irp, 0, STATUS_INVALID_PARAMETER);
   }
index 054f76d..b2f0121 100644 (file)
@@ -60,7 +60,7 @@ static WV_F_DISK_CLOSE WvDiskDefaultClose_;
 static WV_S_DEV_IRP_MJ WvDiskIrpMj_ = {
     WvDiskIrpPower,
     WvDiskIrpSysCtl,
-    disk_dev_ctl__dispatch,
+    WvDiskDevCtl,
     disk_scsi__dispatch,
     disk_pnp__dispatch,
   };
index cfd20ed..2127582 100644 (file)
@@ -440,6 +440,16 @@ NTSTATUS STDCALL WvDriverGetDevCapabilities(
     return status;
   }
 
+NTSTATUS STDCALL WvDiskDevCtl(
+    IN WV_SP_DEV_T dev,
+    IN PIRP irp,
+    IN ULONG POINTER_ALIGNMENT code
+  ) {
+    WV_SP_DISK_T disk = disk__get_ptr(dev);
+
+    return WvlDiskDevCtl(disk, irp, code);
+  }
+
 /**
  * Miscellaneous: Grouped memory allocation functions.
  */
index c9ede8b..c65f797 100644 (file)
@@ -310,7 +310,7 @@ WV_SP_FILEDISK_T STDCALL WvFilediskCreatePdo(
     static WV_S_DEV_IRP_MJ irp_mj = {
         WvDiskIrpPower,
         WvDiskIrpSysCtl,
-        disk_dev_ctl__dispatch,
+        WvDiskDevCtl,
         disk_scsi__dispatch,
         disk_pnp__dispatch,
       };
index 5779483..327256a 100644 (file)
@@ -169,7 +169,7 @@ WV_SP_RAMDISK_T STDCALL WvRamdiskCreatePdo(
     static WV_S_DEV_IRP_MJ irp_mj = {
         WvDiskIrpPower,
         WvDiskIrpSysCtl,
-        disk_dev_ctl__dispatch,
+        WvDiskDevCtl,
         disk_scsi__dispatch,
         disk_pnp__dispatch,
       };