summaryrefslogtreecommitdiff
path: root/nbd/nbd-internal.h
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-07-07 15:30:47 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2017-07-14 12:04:42 +0200
commit8ecaeae82241b6e317d19e5558e52f9e2f979f74 (patch)
tree68272b3eea7fef4e8dd0ad8bf1a1d78741272a3d /nbd/nbd-internal.h
parentf37708f6b8e0bef0dd85c6aad7fc2062071f8227 (diff)
downloadqemu-8ecaeae82241b6e317d19e5558e52f9e2f979f74.tar.gz
nbd: Implement NBD_OPT_GO on client
NBD_OPT_EXPORT_NAME is lousy: per the NBD protocol, any failure requires the server to close the connection rather than report an error to us. Therefore, upstream NBD recently added NBD_OPT_GO as the improved version of the option that does what we want [1]: it reports sane errors on failures, and on success provides at least as much info as NBD_OPT_EXPORT_NAME. [1] https://github.com/NetworkBlockDevice/nbd/blob/extension-info/doc/proto.md This is a first cut at use of the information types. Note that we do not need to use NBD_OPT_INFO, and that use of NBD_OPT_GO means we no longer have to use NBD_OPT_LIST to learn whether a server requires TLS (this requires servers that gracefully handle unknown NBD_OPT, many servers prior to qemu 2.5 were buggy, but I have patched qemu, upstream nbd, and nbdkit in the meantime, in part because of interoperability testing with this patch). We still fall back to NBD_OPT_LIST when NBD_OPT_GO is not supported on the server, as it is still one last chance for a nicer error message. Later patches will use further info, like NBD_INFO_BLOCK_SIZE. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20170707203049.534-8-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd/nbd-internal.h')
-rw-r--r--nbd/nbd-internal.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
index bf95601ff5..4065bc68ac 100644
--- a/nbd/nbd-internal.h
+++ b/nbd/nbd-internal.h
@@ -37,8 +37,11 @@
* https://github.com/yoe/nbd/blob/master/doc/proto.md
*/
+/* Size of all NBD_OPT_*, without payload */
#define NBD_REQUEST_SIZE (4 + 2 + 2 + 8 + 8 + 4)
+/* Size of all NBD_REP_* sent in answer to most NBD_OPT_*, without payload */
#define NBD_REPLY_SIZE (4 + 4 + 8)
+
#define NBD_REQUEST_MAGIC 0x25609513
#define NBD_REPLY_MAGIC 0x67446698
#define NBD_OPTS_MAGIC 0x49484156454F5054LL