[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/2] Revert "Remove PdoPnpSrb, since StorPort doesn't call for targets"



This reverts commit 0f9f5421099d1dabed11d988b3144fb8f6bfed3b.

It appears that this code is called when determining if Windows
can remove a PV disk.  Without it Windows will not know the
disk is removable and will refuse to allow it to be removed

Signed-off-by: Ben.Chalmers@xxxxxxxxxx
---
 src/xenvbd/fdo.c | 21 +++++++++++++++++++++
 src/xenvbd/pdo.c | 28 ++++++++++++++++++++++++++++
 src/xenvbd/pdo.h |  6 ++++++
 3 files changed, 55 insertions(+)

diff --git a/src/xenvbd/fdo.c b/src/xenvbd/fdo.c
index a4fbd3d..5f1778b 100644
--- a/src/xenvbd/fdo.c
+++ b/src/xenvbd/fdo.c
@@ -1839,6 +1839,23 @@ FdoFindAdapter(
     return SP_RETURN_FOUND;
 }
 
+static FORCEINLINE VOID
+__FdoSrbPnp(
+    __in PXENVBD_FDO                 Fdo,
+    __in PSCSI_PNP_REQUEST_BLOCK     Srb
+    )
+{
+    if (!(Srb->SrbPnPFlags & SRB_PNP_FLAGS_ADAPTER_REQUEST)) {
+        PXENVBD_PDO     Pdo;
+
+        Pdo = __FdoGetPdo(Fdo, Srb->TargetId);
+        if (Pdo) {
+            PdoSrbPnp(Pdo, Srb);
+            PdoDereference(Pdo);
+        }
+    }
+}
+
 BOOLEAN 
 FdoBuildIo(
     __in PXENVBD_FDO                 Fdo,
@@ -1856,6 +1873,10 @@ FdoBuildIo(
         return TRUE;
 
         // dont pass to StartIo
+    case SRB_FUNCTION_PNP:
+        __FdoSrbPnp(Fdo, (PSCSI_PNP_REQUEST_BLOCK)Srb);
+        Srb->SrbStatus = SRB_STATUS_SUCCESS;
+        break;
     case SRB_FUNCTION_ABORT_COMMAND:
         Srb->SrbStatus = SRB_STATUS_ABORT_FAILED;
         break;
diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c
index 3565cc6..3ca5440 100644
--- a/src/xenvbd/pdo.c
+++ b/src/xenvbd/pdo.c
@@ -2237,6 +2237,34 @@ PdoReset(
 
     Trace("Target[%d] <==== (Irql=%d)\n", PdoGetTargetId(Pdo), 
KeGetCurrentIrql());
 }
+    
+    
+VOID
+PdoSrbPnp(
+    __in PXENVBD_PDO             Pdo,
+    __in PSCSI_PNP_REQUEST_BLOCK Srb
+    )
+{
+    switch (Srb->PnPAction) {
+    case StorQueryCapabilities: {
+        PSTOR_DEVICE_CAPABILITIES DeviceCaps = Srb->DataBuffer;
+        PXENVBD_CAPS    Caps = FrontendGetCaps(Pdo->Frontend);
+
+        if (Caps->Removable)
+            DeviceCaps->Removable = 1;
+        if (Caps->Removable)
+            DeviceCaps->EjectSupported = 1;
+        if (Caps->SurpriseRemovable)
+            DeviceCaps->SurpriseRemovalOK = 1;
+    
+        DeviceCaps->UniqueID = 1;
+
+        } break;
+
+    default:
+        break;
+    }
+}
 
 //=============================================================================
 // PnP Handler
diff --git a/src/xenvbd/pdo.h b/src/xenvbd/pdo.h
index 946c34f..6e3eca5 100644
--- a/src/xenvbd/pdo.h
+++ b/src/xenvbd/pdo.h
@@ -204,6 +204,12 @@ PdoStartIo(
     __in PSCSI_REQUEST_BLOCK     Srb
     );
 
+extern VOID
+PdoSrbPnp(
+    __in PXENVBD_PDO             Pdo,
+    __in PSCSI_PNP_REQUEST_BLOCK Srb
+    );
+
 // PnP Handler
 __checkReturn
 extern NTSTATUS
-- 
2.7.0.windows.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.