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

[win-pv-devel] [PATCH 18/26] Refactor Inquiry 0x83 handle



From: Owen Smith <owen.smith@xxxxxxxxxx>

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/target.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
index 22193a9..7c93a1c 100644
--- a/src/xenvbd/target.c
+++ b/src/xenvbd/target.c
@@ -998,15 +998,19 @@ TargetInquiry83(
     PVPD_IDENTIFICATION_DESCRIPTOR  Descr;
 
     Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
-    if (Srb->DataTransferLength < sizeof(VPD_IDENTIFICATION_PAGE) - 1 +
-                                  sizeof(VPD_IDENTIFICATION_DESCRIPTOR) + 16)
+    if (Srb->DataTransferLength < sizeof(VPD_IDENTIFICATION_PAGE) - 1)
         return;
 
     RtlZeroMemory(Data, Srb->DataTransferLength);
     Data->PageCode = 0x83;
-    Data->PageLength = sizeof(VPD_IDENTIFICATION_DESCRIPTOR) + 16;
+    Data->PageLength = 0;
 
-    Descr = (PVPD_IDENTIFICATION_DESCRIPTOR)Data->Descriptors;
+    // Try VpdIdentifierTypeVendorId:VpdCodeSetAscii (String Identifier)
+    if (Srb->DataTransferLength < sizeof(VPD_IDENTIFICATION_PAGE) - 1 +
+                                  sizeof(VPD_IDENTIFICATION_DESCRIPTOR) + 16)
+        goto done;
+
+    Descr = (PVPD_IDENTIFICATION_DESCRIPTOR)((PUCHAR)Data->Descriptors);
     Descr->CodeSet          = VpdCodeSetAscii;
     Descr->IdentifierType   = VpdIdentifierTypeVendorId;
     Descr->IdentifierLength = 16;
@@ -1015,9 +1019,13 @@ TargetInquiry83(
                        "XEN:%u:%u",
                        Target->DeviceId,
                        Target->TargetId);
+    Data->PageLength += sizeof(VPD_IDENTIFICATION_DESCRIPTOR) + 
Descr->IdentifierLength;
+
+    // Append other identifiers as required
 
+done:
     Srb->DataTransferLength = sizeof(VPD_IDENTIFICATION_PAGE) - 1 +
-                              sizeof(VPD_IDENTIFICATION_DESCRIPTOR) + 16;
+                              Data->PageLength;
     Srb->SrbStatus = SRB_STATUS_SUCCESS;
 }
 
@@ -1592,7 +1600,7 @@ TargetStoreReadFeatures(
                           &Target->StoreInterface,
                           NULL,
                           Target->BackendPath,
-                          "discard-secure",
+                          "discard-granularity",
                           &Buffer);
     if (NT_SUCCESS(status)) {
         Target->DiscardGranularity = strtoul(Buffer, NULL, 10);
-- 
2.8.3


_______________________________________________
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®.