search for: nbd_fixed_new_option_reply

Displaying 20 results from an estimated 29 matches for "nbd_fixed_new_option_reply".

2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
..._option_reply { + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* optional zeroes */ +} __attribute__((packed));; + /* Fixed newstyle handshake reply message. */ -struct fixed_new_option_reply { +struct nbd_fixed_new_option_reply { uint64_t magic; /* NBD_REP_MAGIC */ uint32_t option; /* option we are replying to */ uint32_t reply; /* NBD_REP_* */ @@ -110,33 +119,37 @@ struct fixed_new_option_reply { #define NBD_REP_ERR(val) (0x80000000 | (val)) #define NBD_REP_IS_ERR(val) (!!((v...
2019 Sep 25
0
[nbdkit PATCH 2/2] common/protocol: Declare additional constants
...ommon/protocol/nbd-protocol.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/protocol/nbd-protocol.h b/common/protocol/nbd-protocol.h index 9bf7171e..bdd1ef21 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -98,8 +98,8 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) /* Global flags. */ -#define NBD_FLAG_FIXED_NEWSTYLE 1 -#define NBD_FLAG_NO_ZEROES 2 +#define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) +#define NBD_FLAG_NO_ZEROES (1 << 1) /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS...
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...ional zeroes */ + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* optional zeroes, unless NBD_FLAG_NO_ZEROES */ } NBD_ATTRIBUTE_PACKED; /* Fixed newstyle handshake reply message. */ @@ -95,8 +98,8 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) /* Global flags. */ -#define NBD_FLAG_FIXED_NEWSTYLE 1 -#define NBD_FLAG_NO_ZEROES 2 +#define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) +#define NBD_FLAG_NO_ZEROES (1 << 1) /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS...
2019 Sep 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
...rt_name_option_reply { uint64_t exportsize; /* size of export */ uint16_t eflags; /* per-export flags */ char zeroes[124]; /* optional zeroes */ -} __attribute__((packed));; +} NBD_ATTRIBUTE_PACKED;; /* Fixed newstyle handshake reply message. */ struct nbd_fixed_new_option_reply { @@ -84,7 +90,7 @@ struct nbd_fixed_new_option_reply { uint32_t option; /* option we are replying to */ uint32_t reply; /* NBD_REP_* */ uint32_t replylen; -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) @@ -1...
2019 Sep 25
3
[nbdkit PATCH 0/2] more protocol.h tweaks
More nbd-protocol.h improvements Eric Blake (2): common/protocol: Switch nbdmagic to uint64_t common/protocol: Declare additional constants common/protocol/nbd-protocol.h | 16 ++++++++++------ server/protocol-handshake-newstyle.c | 2 +- server/protocol-handshake-oldstyle.c | 2 +- plugins/nbd/nbd-standalone.c | 2 +- tests/test-layers.c | 2 +- 5 files
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...rt_name_option_reply { uint64_t exportsize; /* size of export */ uint16_t eflags; /* per-export flags */ char zeroes[124]; /* optional zeroes */ -} __attribute__((packed));; +} NBD_ATTRIBUTE_PACKED;; /* Fixed newstyle handshake reply message. */ struct nbd_fixed_new_option_reply { @@ -89,14 +90,13 @@ struct nbd_fixed_new_option_reply { uint32_t option; /* option we are replying to */ uint32_t reply; /* NBD_REP_* */ uint32_t replylen; -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) -/*...
2019 Sep 24
11
[PATCH nbdkit 0/4] common/protocol: Unify public <nbd-protocol.h>
We should have only one NBD protocol file. Let's make nbdkit's version the canonical one, and use it in libnbd. Rich.
2019 Jun 28
0
[libnbd PATCH] opt-go: Better decoding of known errors
...n reply from NBD_OPT_GO: 0x%" PRIx32, + reply); + } + } SET_NEXT_STATE (%.DEAD); return -1; } diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index 405af3e..3e3fb4e 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -123,15 +123,19 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_ERR(val) (0x80000000 | (val)) #define NBD_REP_IS_ERR(val) (!!((val) & 0x80000000)) -#define NBD_REP_ACK 1 -#define NBD_REP_SERVER 2 -#define NBD_REP_INFO 3 -#define NBD_REP_META_CONTEXT 4 -#define NBD_REP_ERR_UNSUP NBD_REP_ERR (1) -#define NBD_REP_...
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
...hould always be + * != 0, and we set the other fields at the same time. */ uint64_t exportsize; uint16_t eflags; + uint16_t initflags; /* Flags set by the state machine to tell what protocol and whether * TLS was negotiated. @@ -159,6 +160,7 @@ struct nbd_handle { struct nbd_fixed_new_option_reply option_reply; union { struct nbd_fixed_new_option_reply_info_export export; + struct nbd_fixed_new_option_reply_info_init init; struct { struct nbd_fixed_new_option_reply_meta_context context; char str[NBD_MAX_STRING]; diff --git a/lib/nbd-proto...
2020 Sep 29
1
[nbdkit PATCH] server: Adjust limit on max NBD_OPT_* from client
...yle_option_reply (uint32_t option, uint32_t reply) /* Reply to NBD_OPT_LIST with the plugin's list of export names. */ static int -send_newstyle_option_reply_exportnames (uint32_t option) +send_newstyle_option_reply_exportnames (uint32_t option, size_t *nr_options) { GET_CONN; struct nbd_fixed_new_option_reply fixed_new_option_reply; - size_t i; + size_t i, list_len; CLEANUP_EXPORTS_FREE struct nbdkit_exports *exps = NULL; + int r; exps = nbdkit_exports_new (); if (exps == NULL) @@ -91,7 +95,8 @@ send_newstyle_option_reply_exportnames (uint32_t option) if (backend_list_exports (top, read_...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...} payload; } __attribute__((packed)) sr; + uint16_t gflags; uint32_t cflags; uint32_t len; uint16_t nrinfos; diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index 04e93d3..699aa22 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -93,9 +93,10 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) -/* Global flags. */ +/* Global flags. Exposed by the generator as LIBNBD_HANDSHAKE_FLAG_* instead #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 + */ /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS (1 <&lt...
2019 May 19
0
[libnbd PATCH 4/4] states: Add NBD_OPT_EXPORT_NAME handling
...ssage. */ +struct nbd_export_name_option_reply { + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* optional zeroes */ +} __attribute__((packed));; + /* Fixed newstyle handshake reply message. */ struct nbd_fixed_new_option_reply { uint64_t magic; /* NBD_REP_MAGIC */ -- 2.20.1
2019 Aug 23
1
[libnbd PATCH 1/1] api: Add support for FAST_ZERO flag
...+- tests/Makefile.am | 20 ++++++++++++++++++++ tests/eflags-plugin.sh | 5 +++++ 7 files changed, 71 insertions(+), 7 deletions(-) diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index 3e3fb4e..04e93d3 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -108,6 +108,7 @@ struct nbd_fixed_new_option_reply { #define NBD_FLAG_SEND_DF (1 << 7) #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) #define NBD_FLAG_SEND_CACHE (1 << 10) +#define NBD_FLAG_SEND_FAST_ZERO (1 << 11) /* NBD options (new style handshake only). */ #define NBD_OPT_EXPORT_NAME 1 @@ -2...
2020 Sep 21
0
[nbdkit PATCH v3 03/14] server: Respond to NBD_INFO_NAME request
...0; } +/* Can be used for NBD_INFO_NAME and NBD_INFO_DESCRIPTION. */ +static int +send_newstyle_option_reply_info_str (uint32_t option, uint32_t reply, + uint16_t info, const char *str, + size_t len) +{ + GET_CONN; + struct nbd_fixed_new_option_reply fixed_new_option_reply; + struct nbd_fixed_new_option_reply_info_name_or_desc name; + + if (len == -1) + len = strlen (str); + assert (len <= NBD_MAX_STRING); + + fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC); + fixed_new_option_reply.option = htobe32 (option); + fixed_new_opti...
2019 May 19
5
[libnbd PATCH 0/4] Various interop fixes
Some of these affect attempts to connect to older qemu-nbd versions, some of them were triggered by manual edits to qemu-nbd source code to provoke various other compliant (if uncommon) server behaviors. Eric Blake (4): starttls: Skip error payload if falling back to unencrypted states: Reject payload to NBD_REP_ACK meta-context: Skip error payload if server lacks meta_context states: Add
2020 Jul 20
0
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...@@ struct nbd_handle { int uri_allow_tls; bool uri_allow_local_file; + /* List exports mode. */ + bool list_exports; + size_t nr_exports; + char **exports; + /* Global flags from the server. */ uint16_t gflags; @@ -158,6 +163,10 @@ struct nbd_handle { struct { struct nbd_fixed_new_option_reply option_reply; union { + struct { + struct nbd_fixed_new_option_reply_server server; + char str[NBD_MAX_STRING]; + } __attribute__((packed)) server; struct nbd_fixed_new_option_reply_info_export export; struct { struct nbd_fixed_new...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...to @reply, and consume any - payload. If @payload is non-NULL, caller must free *payload. Return - 0 on success, or -1 if communication to server is no longer - possible. */ -static int -nbd_newstyle_recv_option_reply (struct handle *h, uint32_t option, - struct nbd_fixed_new_option_reply *reply, - void **payload) -{ - CLEANUP_FREE char *buffer = NULL; - - if (payload) - *payload = NULL; - if (read_full (h->fd, reply, sizeof *reply)) { - nbdkit_error ("unable to read option reply: %m"); - return -1; - } - reply->magic = be...
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...le.c @@ -49,9 +49,9 @@ /* Receive newstyle options. */ static int -send_newstyle_option_reply (struct connection *conn, - uint32_t option, uint32_t reply) +send_newstyle_option_reply (uint32_t option, uint32_t reply) { + struct connection *conn = GET_CONN; struct nbd_fixed_new_option_reply fixed_new_option_reply; fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC); @@ -59,8 +59,7 @@ send_newstyle_option_reply (struct connection *conn, fixed_new_option_reply.reply = htobe32 (reply); fixed_new_option_reply.replylen = htobe32 (0); - if (conn->send (conn, -...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html v2 replaces struct connection *conn = GET_CONN; with GET_CONN; which sets conn implicitly and asserts that it is non-NULL. If we actually want to test if conn is non-NULL or behave differently, then you must use threadlocal_get_conn() instead, and some existing uses do that. Rich.
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.