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

[RFC PATCH 1/6] Stop inlining the VPD page list in TargetInquiry00



Define a SupportedPages array containing all supported VPD pages so that
we could check its size later.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvbd/target.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
index a07fc45..5a6c7be 100644
--- a/src/xenvbd/target.c
+++ b/src/xenvbd/target.c
@@ -674,6 +674,14 @@ TargetInquiryStd(
     Srb->SrbStatus = SRB_STATUS_SUCCESS;
 }
 
+static const UCHAR SupportedPages[] = {
+    VPD_SUPPORTED_PAGES,
+    VPD_SERIAL_NUMBER,
+    VPD_DEVICE_IDENTIFIERS,
+    VPD_BLOCK_LIMITS,
+    VPD_BLOCK_DEVICE_CHARACTERISTICS,
+};
+
 static FORCEINLINE VOID
 TargetInquiry00(
     IN  PXENVBD_TARGET          Target,
@@ -691,17 +699,16 @@ TargetInquiry00(
         return;
     RtlZeroMemory(Data, Length);
 
-    if (Length < 9)
+    if (Length < sizeof(VPD_SUPPORTED_PAGES_PAGE) + sizeof(SupportedPages))
         return;
 
-    Data->PageLength = 5;
-    Data->SupportedPageList[0] = 0x00;
-    Data->SupportedPageList[1] = 0x80;
-    Data->SupportedPageList[2] = 0x83;
-    Data->SupportedPageList[3] = 0xB0;
-    Data->SupportedPageList[4] = 0xB1;
+    Data->PageLength = sizeof(SupportedPages);
+    RtlCopyMemory(Data->SupportedPageList,
+                  SupportedPages,
+                  sizeof(SupportedPages));
 
-    Srb->DataTransferLength = 9;
+    Srb->DataTransferLength = sizeof(VPD_SUPPORTED_PAGES_PAGE) +
+        Data->PageLength;
     Srb->SrbStatus = SRB_STATUS_SUCCESS;
 }
 
-- 
2.51.2.windows.1



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

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