search for: structured_reply

Displaying 20 results from an estimated 127 matches for "structured_reply".

2023 Jun 09
4
[libnbd PATCH v4 0/4] Saner reply header layout
This was v3 patch 2/22, reworked to address the confusion about how a structured reply header is read in two pieces before getting to the payload portion. I'm still working on rebasing the rest of my v3 series (patches 1, 3-22) from other comments given, but this seemed independent enough that it's worth posting now rather than holding it up for the rest of the series. Eric Blake (4):
2019 Jun 18
0
[libnbd PATCH 1/8] states: Add state for structured reply completion
...| 7 +++++ generator/states-reply-structured.c | 43 ++++++++++------------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/generator/generator b/generator/generator index a289741..4c81859 100755 --- a/generator/generator +++ b/generator/generator @@ -798,6 +798,13 @@ and structured_reply_state_machine = [ comment = "Receive a structured reply block-status payload"; external_events = [ NotifyRead, "" ]; }; + + State { + default_state with + name = "FINISH"; + comment = "Finish receiving a structured reply"; + external...
2019 Jun 18
0
[libnbd PATCH 2/8] states: Consolidate search for current reply's command
..."server sent unexpected simple reply for read"); diff --git a/generator/states-reply-structured.c b/generator/states-reply-structured.c index 2125e41..9bb165b 100644 --- a/generator/states-reply-structured.c +++ b/generator/states-reply-structured.c @@ -43,7 +43,7 @@ return 0; REPLY.STRUCTURED_REPLY.CHECK: - struct command_in_flight *cmd; + struct command_in_flight *cmd = h->reply_cmd; uint16_t flags, type; uint64_t handle; uint32_t length; @@ -53,20 +53,8 @@ handle = be64toh (h->sbuf.sr.structured_reply.handle); length = be32toh (h->sbuf.sr.structured_reply.length);...
2019 Sep 11
1
Re: [PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.
...ebug: nbd5: nbd_connect_uri: transition: NEWSTYLE.CHECK_GFLAGS -> NEWSTYLE.SEND_CFLAGS libnbd: debug: nbd5: nbd_connect_uri: transition: NEWSTYLE.SEND_CFLAGS -> NEWSTYLE.OPT_STARTTLS.START nbdkit: libnbd: debug: nbd5: nbd_connect_uri: transition: NEWSTYLE.OPT_STARTTLS.START -> NEWSTYLE.OPT_STRUCTURED_REPLY.START fulllibnbd: debug: nbd5: nbd_connect_uri: transition: NEWSTYLE.OPT_STRUCTURED_REPLY.START -> NEWSTYLE.OPT_STRUCTURED_REPLY.SEND [1]: libnbd: debug: nbd5: nbd_connect_uri: transition: NEWSTYLE.OPT_STRUCTURED_REPLY.SEND -> NEWSTYLE.OPT_STRUCTURED_REPLY.RECV_REPLY debug: newstyle negotiati...
2019 Sep 11
4
[PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.
Very much a work in progress as there are still many tests using qemu-io which are candidates for conversion. You'll notice at the end of test-full.sh that the new test has some duplicated code which looks as if it ought to be refactored into a Python function. When I tried to do that, I got loads of strange Python problems which may indicate bugs in nbdsh itself or problems with my
2019 Jun 14
1
[libnbd PATCH] states: Validate error message size
...tured.c | 64 ++++++++++++++++++++++++++++- lib/internal.h | 1 + 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/generator/generator b/generator/generator index 3b0ca82..deb77f0 100755 --- a/generator/generator +++ b/generator/generator @@ -771,6 +771,13 @@ and structured_reply_state_machine = [ external_events = [ NotifyRead, "" ]; }; + State { + default_state with + name = "RECV_ERROR_TAIL"; + comment = "Receive a structured reply error tail"; + external_events = [ NotifyRead, "" ]; + }; + State { de...
2023 Jun 20
1
[libnbd PATCH v4 4/4] internal: Refactor layout of replies in sbuf
...sbuf | > | +---------------------+------------------------------+ | > | | struct simple_reply | struct sr | | > | | +-----------------+ | +--------------------------+ | | > | | | | | | struct structured_reply | | | > | | | | | | +----------------------+ | | | > | 0 | | uint32_t magic | | | | uint32_t magic | | | | > | 4 | | uint32_t error | | | | uint16_t flags | | | | > | 6 | | | | | | uint16_t type | | | | > | 8 | | uint6...
2019 Jun 18
17
[libnbd PATCH 0/8] Add nbd_pread_callback
I've mentioned this topic before (in fact, the idea of adding NBD_CMD_FLAG_DF was first mentioned at [1]), but finally finished enough of an implementation to feel confident in posting it. I'd still like to add something under examples/ that uses the new API to implement strict checking of a server's structured replies read implementation (ensure that a server never sends data after
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...2e327ce..58e83d4 100644 --- a/generator/states-reply-structured.c +++ b/generator/states-reply-structured.c @@ -295,7 +295,6 @@ } if (cmd->type == NBD_CMD_READ && cmd->cb.fn.chunk.callback) { int scratch = error; - uint16_t flags = be16toh (h->sbuf.sr.structured_reply.flags); /* Different from successful reads: inform the callback about the * current error rather than any earlier one. If the callback fails @@ -307,8 +306,6 @@ &scratch) == -1) if (cmd->error == 0) cmd->error = scrat...
2019 Mar 23
1
Re: [PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
...| 7 ++ > server/protocol.h | 15 +++ > server/protocol-handshake-newstyle.c | 81 ++++++++++++++- > server/protocol.c | 141 ++++++++++++++++++++++++--- > 4 files changed, 229 insertions(+), 15 deletions(-) > > +static int > +send_structured_reply_block_status (struct connection *conn, > + uint64_t handle, > + uint16_t cmd, uint16_t flags, > + uint32_t count, uint64_t offset, > + struct nbdki...
2019 Aug 15
0
Re: [libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
.../generator/states-reply-structured.c > +++ b/generator/states-reply-structured.c > @@ -295,7 +295,6 @@ > } > if (cmd->type == NBD_CMD_READ && cmd->cb.fn.chunk.callback) { > int scratch = error; > - uint16_t flags = be16toh (h->sbuf.sr.structured_reply.flags); > > /* Different from successful reads: inform the callback about the > * current error rather than any earlier one. If the callback fails > @@ -307,8 +306,6 @@ > &scratch) == -1) > if (cmd->error == 0) >...
2019 Jun 25
0
Re: [libnbd PATCH] states: Never block state machine inside REPLY
...> default_state with > name = "RECV_READ_PAYLOAD"; > comment = "Receiving the read payload for a simple reply"; > - external_events = [ NotifyRead, "" ]; > + external_events = []; > }; > ] > > @@ -740,7 +740,7 @@ and structured_reply_state_machine = [ > default_state with > name = "RECV_REMAINING"; > comment = "Receiving the remaining part of a structured reply"; > - external_events = [ NotifyRead, "" ]; > + external_events = []; > }; > > State {...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
2019 Jun 19
4
[libnbd PATCH] states: Never block state machine inside REPLY
...+723,7 @@ and simple_reply_state_machine = [ default_state with name = "RECV_READ_PAYLOAD"; comment = "Receiving the read payload for a simple reply"; - external_events = [ NotifyRead, "" ]; + external_events = []; }; ] @@ -740,7 +740,7 @@ and structured_reply_state_machine = [ default_state with name = "RECV_REMAINING"; comment = "Receiving the remaining part of a structured reply"; - external_events = [ NotifyRead, "" ]; + external_events = []; }; State { @@ -754,49 +754,49 @@ and structured_rep...
2019 Mar 20
0
[PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
...MD_BLOCK_STATUS: + if (flags & NBD_CMD_FLAG_REQ_ONE) + f |= NBDKIT_FLAG_REQ_ONE; + if (backend->extents (backend, conn, count, offset, f, + extents, &err) == -1) + return err; + break; + default: abort (); } @@ -359,6 +399,64 @@ send_structured_reply_read (struct connection *conn, return 1; /* command processed ok */ } +static int +send_structured_reply_block_status (struct connection *conn, + uint64_t handle, + uint16_t cmd, uint16_t flags, +...
2019 Mar 08
2
[PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...NBD_OPT_INFO 6 -#define NBD_OPT_GO 7 +#define NBD_OPT_EXPORT_NAME 1 +#define NBD_OPT_ABORT 2 +#define NBD_OPT_LIST 3 +#define NBD_OPT_STARTTLS 5 +#define NBD_OPT_INFO 6 +#define NBD_OPT_GO 7 +#define NBD_OPT_STRUCTURED_REPLY 8 extern const char *name_of_nbd_rep (int); #define NBD_REP_ACK 1 @@ -144,15 +145,49 @@ struct request { uint32_t count; /* Request length. */ } __attribute__((packed)); -/* Reply (server -> client). */ -struct reply { - uint32_t magic; /* NBD_RE...
2019 Mar 19
0
[PATCH nbdkit 3/9] server: Implement Block Status requests to read allocation status.
...map, + copy_extents, &data, + foreach_flags, + offset, (uint64_t) count) == -1) + return errno; + + return 0; +} + static int skip_over_write_buffer (int sock, size_t count) { @@ -359,6 +490,60 @@ send_structured_reply_read (struct connection *conn, return 1; /* command processed ok */ } +static int +send_structured_reply_block_status (struct connection *conn, + uint64_t handle, + uint16_t cmd, uint16_t flags, +...
2019 Jul 25
0
[libnbd PATCH] lib: Reduce number of read/block_status callbacks
...states-reply-structured.c +++ b/generator/states-reply-structured.c @@ -18,6 +18,19 @@ /* State machine for parsing structured replies from the server. */ +static unsigned +valid_flags (struct nbd_handle *h) +{ + unsigned valid = LIBNBD_CALLBACK_VALID; + uint16_t flags = be16toh (h->sbuf.sr.structured_reply.flags); + + if (flags & NBD_REPLY_FLAG_DONE) + valid |= LIBNBD_CALLBACK_FREE; + return valid; +} + +/*----- End of prologue. -----*/ + /* STATE MACHINE */ { REPLY.STRUCTURED_REPLY.START: /* We've only read the simple_reply. The structured_reply is longer, @@ -293,16 +306,19 @@...
2019 Mar 08
1
[PATCH nbdkit] server: Implement minimal implementation of set/list metadata contexts.
...supported>. diff --git a/server/protocol.h b/server/protocol.h index 0aadd46..b03555e 100644 --- a/server/protocol.h +++ b/server/protocol.h @@ -105,6 +105,8 @@ extern const char *name_of_nbd_opt (int); #define NBD_OPT_INFO 6 #define NBD_OPT_GO 7 #define NBD_OPT_STRUCTURED_REPLY 8 +#define NBD_OPT_LIST_META_CONTEXT 9 +#define NBD_OPT_SET_META_CONTEXT 10 extern const char *name_of_nbd_rep (int); #define NBD_REP_ACK 1 diff --git a/server/connections.c b/server/connections.c index aeb27f8..7e32f00 100644 --- a/server/connections.c +++ b/server/connections.c...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...{ +struct nbd_simple_reply { uint32_t magic; /* NBD_SIMPLE_REPLY_MAGIC. */ uint32_t error; /* NBD_SUCCESS or one of NBD_E*. */ uint64_t handle; /* Opaque handle. */ } __attribute__((packed)); /* Structured reply (server -> client). */ -struct structured_reply { +struct nbd_structured_reply { uint32_t magic; /* NBD_STRUCTURED_REPLY_MAGIC. */ uint16_t flags; /* NBD_REPLY_FLAG_* */ uint16_t type; /* NBD_REPLY_TYPE_* */ @@ -176,15 +189,20 @@ struct structured_reply { uint32_t length; /* Len...