Module Name:    src
Committed By:   bouyer
Date:           Sun Apr  7 12:23:54 UTC 2019

Modified Files:
        src/sys/arch/xen/include: xenring.h

Log Message:
blkif_x86_{32,64}_* are not identical to blkif_*, internal fields have
different alignements and this change their sizes. Copy them back from
their netbsd-8 definitions.
Fixes PR port-xen/54099


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/include/xenring.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/include/xenring.h
diff -u src/sys/arch/xen/include/xenring.h:1.3 src/sys/arch/xen/include/xenring.h:1.4
--- src/sys/arch/xen/include/xenring.h:1.3	Sat Feb  2 15:09:32 2019
+++ src/sys/arch/xen/include/xenring.h	Sun Apr  7 12:23:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: xenring.h,v 1.3 2019/02/02 15:09:32 cherry Exp $ */
+/* $NetBSD: xenring.h,v 1.4 2019/04/07 12:23:54 bouyer Exp $ */
 
 /*
  * Glue goop for xbd ring request/response protocol structures.
@@ -32,14 +32,46 @@
  * Define ring types. These were previously part of the public API.
  * Not anymore.
  */
-DEFINE_RING_TYPES(blkif_x86_32, struct blkif_request, struct blkif_response);
-DEFINE_RING_TYPES(blkif_x86_64, struct blkif_request, struct blkif_response);
+/* i386 requests/responses */
+struct blkif_x86_32_request {
+    uint8_t        operation;    /* BLKIF_OP_???                         */
+    uint8_t        nr_segments;  /* number of segments                   */
+    blkif_vdev_t   handle;       /* only for read/write requests         */
+    uint64_t       id;           /* private guest value, echoed in resp  */
+    blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+} __packed;
+typedef struct blkif_x86_32_request blkif_x86_32_request_t;
+
+struct blkif_x86_32_response {
+    uint64_t        id;              /* copied from request */
+    uint8_t         operation;       /* copied from request */
+    uint8_t         _pad;
+    int16_t         status;          /* BLKIF_RSP_???       */
+} __packed;
+typedef struct blkif_x86_32_response blkif_x86_32_response_t;
+
+/* amd64-type requests/responses (always used in frontends ) */
+
+struct blkif_x86_64_request {
+    uint8_t        operation;    /* BLKIF_OP_???                         */
+    uint8_t        nr_segments;  /* number of segments                   */
+    blkif_vdev_t   handle;       /* only for read/write requests         */
+    uint64_t __attribute__((__aligned__(8))) id;/* private guest value, echoed in resp  */
+    blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
+    struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+};
+typedef struct blkif_x86_64_request blkif_x86_64_request_t;
 
-typedef struct blkif_request blkif_x86_64_request_t;
-typedef struct blkif_response blkif_x86_64_response_t;
-typedef struct blkif_request blkif_x86_32_request_t;
-typedef struct blkif_response blkif_x86_32_response_t;
+struct blkif_x86_64_response {
+    uint64_t __attribute__((__aligned__(8))) id; /* copied from request */
+    uint8_t         operation;       /* copied from request */
+    int16_t         status;          /* BLKIF_RSP_???       */
+};
+typedef struct blkif_x86_64_response blkif_x86_64_response_t;
 
+DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, struct blkif_x86_32_response);
+DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, struct blkif_x86_64_response);
 
 union blkif_back_ring_proto {
 	blkif_back_ring_t ring_n; /* native/common members */

Reply via email to