search for: nbd_simple_reply_mag

Displaying 20 results from an estimated 31 matches for "nbd_simple_reply_mag".

Did you mean: nbd_simple_reply_magic
2019 Mar 08
2
[PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...st { uint32_t count; /* Request length. */ } __attribute__((packed)); -/* Reply (server -> client). */ -struct reply { - uint32_t magic; /* NBD_REPLY_MAGIC. */ +/* Simple reply (server -> client). */ +struct 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)); -#define NBD_REQUEST_MAGIC 0x25609513 -#define NBD_REPLY_MAGIC 0x67446698 +/* Structured reply (server -> client). */ +struct structured_...
2019 Sep 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
.../* Opaque handle. */ uint64_t offset; /* Request offset. */ uint32_t count; /* Request length. */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; /* Simple reply (server -> client). */ 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)); +} NBD_ATTRIBUTE_PACKED; /* Structured reply (server -> client). */ struct nbd_structured_reply { @@ -187,23 +193,23 @@ struct nbd_stru...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
...read or memset on structured read */ *fd = -1; - if (read_full (h->fd, &rep, sizeof rep) < 0) + /* magic and handle overlap between simple and structured replies */ + if (read_full (h->fd, &rep, sizeof rep.simple)) return nbd_mark_dead (h); - if (be32toh (rep.magic) != NBD_SIMPLE_REPLY_MAGIC) + switch (be32toh (rep.simple.magic)) { + case NBD_SIMPLE_REPLY_MAGIC: + nbdkit_debug ("received simple reply for cookie %#" PRIx64 ", status %s", + rep.simple.handle, + name_of_nbd_error(be32toh (rep.simple.error))); + error = be32to...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
.../* Opaque handle. */ uint64_t offset; /* Request offset. */ uint32_t count; /* Request length. */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; /* Simple reply (server -> client). */ 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)); +} NBD_ATTRIBUTE_PACKED; /* Structured reply (server -> client). */ struct nbd_structured_reply { @@ -193,23 +193,23 @@ struct nbd_stru...
2023 Mar 03
3
[PATCH] docs: Prefer 'cookie' over 'handle'
...C`) C: 16 bits, command flags C: 16 bits, type -C: 64 bits, handle +C: 64 bits, cookie C: 64 bits, offset (unsigned) C: 32 bits, length (unsigned) C: (*length* bytes of data if the request is of type `NBD_CMD_WRITE`) @@ -366,7 +366,7 @@ follows: S: 32 bits, 0x67446698, magic (`NBD_SIMPLE_REPLY_MAGIC`; used to be `NBD_REPLY_MAGIC`) S: 32 bits, error (MAY be zero) -S: 64 bits, handle +S: 64 bits, cookie S: (*length* bytes of data if the request is of type `NBD_CMD_READ` and *error* is zero) @@ -381,7 +381,7 @@ server must initiate a hard disconnect). Second, there is no...
2019 Apr 23
0
[nbdkit PATCH 3/7] RFC: protocol: Only send EOVERFLOW when valid
...rror) return NBD_ESHUTDOWN; #endif case EOVERFLOW: - return NBD_EOVERFLOW; + if (flag_df) + return NBD_EOVERFLOW; + /* fallthrough */ case EINVAL: default: return NBD_EINVAL; @@ -368,7 +370,7 @@ send_simple_reply (struct connection *conn, reply.magic = htobe32 (NBD_SIMPLE_REPLY_MAGIC); reply.handle = handle; - reply.error = htobe32 (nbd_errno (error)); + reply.error = htobe32 (nbd_errno (error, false)); r = conn->send (conn, &reply, sizeof reply); if (r == -1) { @@ -573,7 +575,8 @@ send_structured_reply_block_status (struct connection *conn, static int s...
2019 Apr 23
12
[nbdkit PATCH 0/7] Implement structured replies in nbd plugin
I'm hoping to implement .extents for the nbd plugin; this is a prerequisite. I'm not sure about patch 3 - if we like it, I'll squash it to 2, if we don't, I think we are okay just dropping it. I'm also wondering if we have to worry about malicious plugins that don't populate the entire .pread buffer in an effort to get nbdkit to expose portions of the heap; my patch 7 loses
2019 Apr 25
6
[nbdkit PATCH v2 0/5] structured replies/.extents for nbd plugin
Updated based on other changes that have happened in the meantime: - rely more on cleanup.h (throughout) - split structured read for easier review (patch 2 and 3 were combined in v1) - rely on nbdkit not leaking a server's partial answer (patch 3) - add tests (patch 5) - other bug fixes I found while testing it - drop EOVERFLOW patch for now; it will be separate once upstream NBD protocol
2019 Mar 08
0
Re: [PATCH nbdkit] Minimal implementation of NBD Structured Replies.
...buf; > uint32_t count; > @@ -353,7 +353,7 @@ nbd_reply_raw (struct handle *h, int *fd) > *fd = -1; > if (read_full (h->fd, &rep, sizeof rep) < 0) > return nbd_mark_dead (h); > - if (be32toh (rep.magic) != NBD_REPLY_MAGIC) > + if (be32toh (rep.magic) != NBD_SIMPLE_REPLY_MAGIC) > return nbd_mark_dead (h); > nbdkit_debug ("received reply for cookie %#" PRIx64 ", status %s", > rep.handle, name_of_nbd_error(be32toh (rep.error))); Teaching the nbd plugin to negotiate structured replies as the client is obviously a sepa...
2019 Jun 07
0
[nbdkit PATCH v2 2/2] server: Group related transmission send()s
...r/protocol.c +++ b/server/protocol.c @@ -393,12 +393,13 @@ send_simple_reply (struct connection *conn, ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&conn->write_lock); struct simple_reply reply; int r; + int f = (cmd == NBD_CMD_READ && !error) ? SEND_MORE : 0; reply.magic = htobe32 (NBD_SIMPLE_REPLY_MAGIC); reply.handle = handle; reply.error = htobe32 (nbd_errno (error, false)); - r = conn->send (conn, &reply, sizeof reply, 0); + r = conn->send (conn, &reply, sizeof reply, f); if (r == -1) { nbdkit_error ("write reply: %s: %m", name_of_nbd_cmd (cmd));...
2019 Jun 18
0
[libnbd PATCH 2/8] states: Consolidate search for current reply's command
...(r == -1) { /* This should never happen because when we enter this state we @@ -69,16 +71,16 @@ return 0; REPLY.CHECK_SIMPLE_OR_STRUCTURED_REPLY: + struct command_in_flight *cmd; uint32_t magic; + uint64_t handle; magic = be32toh (h->sbuf.simple_reply.magic); if (magic == NBD_SIMPLE_REPLY_MAGIC) { SET_NEXT_STATE (%SIMPLE_REPLY.START); - return 0; } else if (magic == NBD_STRUCTURED_REPLY_MAGIC) { SET_NEXT_STATE (%STRUCTURED_REPLY.START); - return 0; } else { SET_NEXT_STATE (%.DEAD); /* We've probably lost synchronization. */ @@ -86,6 +88,29 @@ re...
2022 Nov 14
2
[PATCH v2 3/6] spec: Add NBD_OPT_EXTENDED_HEADERS
...y request other than `NBD_CMD_READ`, -but only if the reply has no data payload. The message looks as -follows: +but only if the reply has no data payload. If extended headers have +been negotiated, a simple reply MUST NOT be used. The message looks +as follows: S: 32 bits, 0x67446698, magic (`NBD_SIMPLE_REPLY_MAGIC`; used to be `NBD_REPLY_MAGIC`) S: 32 bits, error (MAY be zero) -S: 64 bits, handle +S: 64 bits, handle (MUST match the request) S: (*length* bytes of data if the request is of type `NBD_CMD_READ` and *error* is zero) @@ -416,9 +473,9 @@ on the chunks received. A structure...
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 Apr 23
3
Re: [nbdkit PATCH 3/7] RFC: protocol: Only send EOVERFLOW when valid
...OVERFLOW: > - return NBD_EOVERFLOW; > + if (flag_df) > + return NBD_EOVERFLOW; > + /* fallthrough */ > case EINVAL: > default: > return NBD_EINVAL; > @@ -368,7 +370,7 @@ send_simple_reply (struct connection *conn, > > reply.magic = htobe32 (NBD_SIMPLE_REPLY_MAGIC); > reply.handle = handle; > - reply.error = htobe32 (nbd_errno (error)); > + reply.error = htobe32 (nbd_errno (error, false)); > > r = conn->send (conn, &reply, sizeof reply); > if (r == -1) { > @@ -573,7 +575,8 @@ send_structured_reply_block_status (struc...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...nt16_t flags; /* Request flags. */ uint16_t type; /* Request type. */ @@ -161,14 +174,14 @@ struct request { } __attribute__((packed)); /* Simple reply (server -> client). */ -struct simple_reply { +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; /*...
2019 May 30
5
[nbdkit PATCH 0/4] Play with libnbd for nbdkit-add
Patch 1 played with an early draft of Rich's Fedora 30 libnbd package: https://bugzilla.redhat.com/show_bug.cgi?id=1713767#c17 Note that comment 21 provides a newer package 0.1.1-1 with a different API; and that libnbd has more unreleased API changes in the pipeline (whether that will be called 0.2 or 0.1.2); so we'll have to tweak things based on what is actually available in distros.
2019 Jun 02
5
[nbdkit PATCH v2 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.2-1 is now available in Fedora 29/30 updates-testing, although it was not compiled against libxml2 so it lacks uri support (I ended up testing patch 4 with a self-built libnbd). Diffs since v1 - rebase to master, bump from libnbd 0.1 to 0.1.2, add URI support, better timing results Still not done - patch 5 needs associated tests Eric Blake (5): nbd: Check for libnbd nbd:
2019 Aug 23
1
[nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO
...uint64_t handle, uint16_t cmd, + uint64_t handle, uint16_t cmd, uint16_t flags, const char *buf, uint32_t count, uint32_t error) { @@ -413,7 +440,7 @@ send_simple_reply (struct connection *conn, reply.magic = htobe32 (NBD_SIMPLE_REPLY_MAGIC); reply.handle = handle; - reply.error = htobe32 (nbd_errno (error, false)); + reply.error = htobe32 (nbd_errno (error, flags)); r = conn->send (conn, &reply, sizeof reply, f); if (r == -1) { @@ -640,7 +667,7 @@ send_structured_reply_error (struct connection *conn, } /*...
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
.../ - uint16_t errlen; - - *trans_out = NULL; - /* magic and handle overlap between simple and structured replies */ - if (read_full (h->fd, &rep, sizeof rep.simple)) - return nbdplug_mark_dead (h); - rep.simple.magic = be32toh (rep.simple.magic); - switch (rep.simple.magic) { - case NBD_SIMPLE_REPLY_MAGIC: - nbdkit_debug ("received simple reply for cookie %#" PRIx64 ", status %s", - rep.simple.handle, - name_of_nbd_error (be32toh (rep.simple.error))); - error = be32toh (rep.simple.error); - break; - case NBD_STRUCTURED_REPLY_MAGIC: -...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
.../ - uint16_t errlen; - - *trans_out = NULL; - /* magic and handle overlap between simple and structured replies */ - if (read_full (h->fd, &rep, sizeof rep.simple)) - return nbdplug_mark_dead (h); - rep.simple.magic = be32toh (rep.simple.magic); - switch (rep.simple.magic) { - case NBD_SIMPLE_REPLY_MAGIC: - nbdkit_debug ("received simple reply for cookie %#" PRIx64 ", status %s", - rep.simple.handle, - name_of_nbd_error (be32toh (rep.simple.error))); - error = be32toh (rep.simple.error); - break; - case NBD_STRUCTURED_REPLY_MAGIC: -...