* [Qemu-devel] [PATCH] nbd: simplify the nbd_request and nbd_reply structs
@ 2016-06-13 9:43 Paolo Bonzini
2016-06-13 12:27 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-06-13 9:43 UTC (permalink / raw)
To: qemu-devel; +Cc: eblake, peter.maydell
These structs are never used to represent the bytes that go over the
network. The big-endian network data is built into a uint8_t array
in nbd_{receive,send}_{request,reply}. Remove the unused magic field,
reorder the struct to avoid holes, and remove the packed attribute.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/block/nbd.h | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/block/nbd.h b/include/block/nbd.h
index b86a976..747bb0a 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -25,19 +25,20 @@
#include "io/channel-socket.h"
#include "crypto/tlscreds.h"
+/* Note: these are _NOT_ the same as the network representation of an NBD
+ * request and reply!
+ */
struct nbd_request {
- uint32_t magic;
- uint32_t type;
uint64_t handle;
uint64_t from;
uint32_t len;
-} QEMU_PACKED;
+ uint32_t type;
+};
struct nbd_reply {
- uint32_t magic;
- uint32_t error;
uint64_t handle;
-} QEMU_PACKED;
+ uint32_t error;
+};
#define NBD_FLAG_HAS_FLAGS (1 << 0) /* Flags are there */
#define NBD_FLAG_READ_ONLY (1 << 1) /* Device is read-only */
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] nbd: simplify the nbd_request and nbd_reply structs
2016-06-13 9:43 [Qemu-devel] [PATCH] nbd: simplify the nbd_request and nbd_reply structs Paolo Bonzini
@ 2016-06-13 12:27 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2016-06-13 12:27 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: peter.maydell
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
On 06/13/2016 03:43 AM, Paolo Bonzini wrote:
> These structs are never used to represent the bytes that go over the
> network. The big-endian network data is built into a uint8_t array
> in nbd_{receive,send}_{request,reply}. Remove the unused magic field,
> reorder the struct to avoid holes, and remove the packed attribute.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/block/nbd.h | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-13 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 9:43 [Qemu-devel] [PATCH] nbd: simplify the nbd_request and nbd_reply structs Paolo Bonzini
2016-06-13 12:27 ` Eric Blake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).