summary refs log tree commit diff stats
path: root/include
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2023-08-29 12:58:29 -0500
committerEric Blake <eblake@redhat.com>2023-09-22 17:20:41 -0500
commit297365b40ff24c7e07d6f40ec8f9ac83229ace94 (patch)
treed899b893663c89ea507361c762e7d1095c3762bb /include
parentac132d0520c39f48a22e8666810792c5c9dd44b1 (diff)
downloadfocaccia-qemu-297365b40ff24c7e07d6f40ec8f9ac83229ace94.tar.gz
focaccia-qemu-297365b40ff24c7e07d6f40ec8f9ac83229ace94.zip
nbd/client: Pass mode through to nbd_send_request
Once the 64-bit headers extension is enabled, the data layout we send
over the wire for a client request depends on the mode negotiated with
the server.  Rather than adding a parameter to nbd_send_request, we
can add a member to struct NBDRequest, since it already does not
reflect on-wire format.  Some callers initialize it directly; many
others rely on a common initialization point during
nbd_co_send_request().  At this point, there is no semantic change.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20230829175826.377251-21-eblake@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/nbd.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 5322676457..e07b9f9bff 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -63,17 +63,19 @@ typedef enum NBDMode {
     /* TODO add NBD_MODE_EXTENDED */
 } NBDMode;
 
-/* Transmission phase structs
- *
- * Note: these are _NOT_ the same as the network representation of an NBD
- * request and reply!
+/* Transmission phase structs */
+
+/*
+ * Note: NBDRequest is _NOT_ the same as the network representation of an NBD
+ * request!
  */
 typedef struct NBDRequest {
     uint64_t cookie;
     uint64_t from;
     uint32_t len;
     uint16_t flags; /* NBD_CMD_FLAG_* */
-    uint16_t type; /* NBD_CMD_* */
+    uint16_t type;  /* NBD_CMD_* */
+    NBDMode mode;   /* Determines which network representation to use */
 } NBDRequest;
 
 typedef struct NBDSimpleReply {