search for: nbd_attribute_packed

Displaying 18 results from an estimated 18 matches for "nbd_attribute_packed".

2019 Sep 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
...int.h> /* Note that all NBD fields are sent on the wire in network byte - * order, so we must use beXXtoh or htobeXX when reading or writing + * order, so you must use beXXtoh or htobeXX when reading or writing * these structures. */ +#if defined(__GNUC__) || defined(__clang__) +#define NBD_ATTRIBUTE_PACKED __attribute__((__packed__)) +#else +#define NBD_ATTRIBUTE_PACKED +#endif + #define NBD_MAX_STRING 4096 /* Maximum length of a string field */ /* Old-style handshake. */ @@ -50,7 +56,7 @@ struct nbd_old_handshake { uint16_t gflags; /* global flags */ uint16_t eflags;...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...int.h> /* Note that all NBD fields are sent on the wire in network byte - * order, so we must use beXXtoh or htobeXX when reading or writing + * order, so you must use beXXtoh or htobeXX when reading or writing * these structures. */ +#if defined(__GNUC__) || defined(__clang__) +#define NBD_ATTRIBUTE_PACKED __attribute__((__packed__)) +#else +#define NBD_ATTRIBUTE_PACKED +#endif + #define NBD_MAX_STRING 4096 /* Maximum length of a string field */ /* Old-style handshake. */ @@ -55,7 +56,7 @@ struct nbd_old_handshake { uint16_t gflags; /* global flags */ uint16_t eflags;...
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...IC" */ + uint64_t nbdmagic; /* NBD_MAGIC */ uint64_t version; /* NBD_OLD_VERSION */ uint64_t exportsize; uint16_t gflags; /* global flags */ @@ -58,30 +58,33 @@ struct nbd_old_handshake { char zeroes[124]; /* must be sent as zero bytes */ } NBD_ATTRIBUTE_PACKED; +#define NBD_MAGIC UINT64_C(0x4e42444d41474943) /* ASCII "NBDMAGIC" */ #define NBD_OLD_VERSION UINT64_C(0x420281861253) /* New-style handshake. */ struct nbd_new_handshake { - char nbdmagic[8]; /* "NBDMAGIC" */ + uint64_t nbdmagic; /* NBD_MAGIC *...
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 Sep 25
2
Re: [PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...ead of this. > > @@ -167,7 +167,7 @@ struct nbd_new_handshake_finish { > > uint64_t exportsize; > > uint16_t eflags; /* per-export flags */ > > char zeroes[124]; /* must be sent as zero bytes */ > > -} __attribute__((packed)); > > +} NBD_ATTRIBUTE_PACKED; > > Redundant type. Indeed, we don't actually use this anywhere (for obvious reasons of course). As I was only synchronizing the two headers I didn't notice. I'll remove it instead. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read...
2019 Sep 24
0
Re: [PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...OPT_EXPORT_NAME reply message. */ > 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));; > +} NBD_ATTRIBUTE_PACKED;; Double ;; > > -/* Global flags. Exposed by the generator as LIBNBD_HANDSHAKE_FLAG_* instead > +/* Global flags. */ > #define NBD_FLAG_FIXED_NEWSTYLE 1 > #define NBD_FLAG_NO_ZEROES 2 > - */ We won't be using these names in the rest of libnbd, except maybe we shou...
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
2020 Jul 20
2
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
Proposal for new APIs to list exports. The general shape of the API can probably best be seen from the examples/list-exports.c example. Rich.
2019 Sep 25
0
Re: [PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...-167,7 +167,7 @@ struct nbd_new_handshake_finish { > > > uint64_t exportsize; > > > uint16_t eflags; /* per-export flags */ > > > char zeroes[124]; /* must be sent as zero bytes */ > > > -} __attribute__((packed)); > > > +} NBD_ATTRIBUTE_PACKED; > > > > Redundant type. > > Indeed, we don't actually use this anywhere (for obvious reasons of > course). As I was only synchronizing the two headers I didn't notice. > I'll remove it instead. Oh I spoke too soon - we do use it in nbdkit. Rich. -- Richar...
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
...ine NBD_INFO_BLOCK_SIZE 3 +#define NBD_INFO_INIT_STATE 4 /* NBD_INFO_EXPORT reply (follows fixed_new_option_reply). */ struct nbd_fixed_new_option_reply_info_export { @@ -154,6 +155,16 @@ struct nbd_fixed_new_option_reply_info_export { uint16_t eflags; /* per-export flags */ } NBD_ATTRIBUTE_PACKED; +/* NBD_INFO_INIT_STATE reply. */ +struct nbd_fixed_new_option_reply_info_init { + uint16_t info; /* NBD_INFO_INIT_STATE */ + uint16_t flags; /* per-export init flags */ +} NBD_ATTRIBUTE_PACKED; + +/* Constants for use in reply to NBD_INFO_INIT_STATE. */ +#define NB...
2020 Jul 24
4
[libnbd PATCH 0/3] Expose server block size constraints
Necessary when writing a client that wants to avoid unnecessary EINVAL errors from sending unaligned requests. At some point, we may want to add synchronous convenience API wrappers that do request splitting or read-modify-write to obey server constraints while still appearing to the library client as accepting any possible request. But such a wrapper should only be synchronous and not copied to
2020 Jul 20
0
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...new_option_reply_meta_context context; diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index df0b4c6..90fdbd2 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -154,6 +154,12 @@ struct nbd_fixed_new_option_reply_info_export { uint16_t eflags; /* per-export flags */ } NBD_ATTRIBUTE_PACKED; +/* NBD_REP_SERVER reply (follows fixed_new_option_reply). */ +struct nbd_fixed_new_option_reply_server { + uint32_t export_name_len; /* length of export name */ + /* followed by a string export name and description*/ +} NBD_ATTRIBUTE_PACKED; + /* NBD_REP_META_CONTEXT reply (follows fixed...
2020 Jul 20
2
Re: [PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...n't completed its listing in X number of responses (perhaps where X is 1 million, or determined by the user, or...)? > +++ b/lib/nbd-protocol.h > @@ -154,6 +154,12 @@ struct nbd_fixed_new_option_reply_info_export { > uint16_t eflags; /* per-export flags */ > } NBD_ATTRIBUTE_PACKED; > > +/* NBD_REP_SERVER reply (follows fixed_new_option_reply). */ > +struct nbd_fixed_new_option_reply_server { > + uint32_t export_name_len; /* length of export name */ > + /* followed by a string export name and description*/ > +} NBD_ATTRIBUTE_PACKED; > + > /*...
2023 Mar 15
1
[libnbd PATCH v4 1/3] lib/utils: introduce xwritel() as a more robust and convenient write()
On Wed, Mar 15, 2023 at 03:30:12PM +0100, Laszlo Ersek wrote: > On 3/15/23 15:01, Eric Blake wrote: > > > [...] > > Thanks for the thorough review; I'm glad all the fine points I sought to > put in the patch were received -- and well-received! :) > > One question: > > > The only change I recommend is the addition of the __attribute__; but > > with
2023 Jun 20
1
[libnbd PATCH v4 4/4] internal: Refactor layout of replies in sbuf
...union { > uint64_t align_; /* Start sr.payload on an 8-byte alignment */ > struct nbd_structured_reply_offset_data offset_data; > @@ -250,7 +260,7 @@ struct nbd_handle { > uint64_t offset; /* Only used for NBD_REPLY_TYPE_ERROR_OFFSET */ > } NBD_ATTRIBUTE_PACKED error; > } payload; > - } sr; > + } reply; > uint16_t gflags; > uint32_t cflags; > uint32_t len; > diff --git a/generator/states-reply.c b/generator/states-reply.c > index bd6336a8..af5f6135 100644 > --- a/generator/states-reply.c > +++ b/ge...
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
I will be following up to this email with four separate threads each addressed to the appropriate single list, with proposed changes to: - the NBD protocol - qemu: both server and client - libnbd: client - nbdkit: server The feature in question adds a new optional NBD_INFO_ packet to the NBD_OPT_GO portion of handshake, adding up to 16 bits of information that the server can advertise to the
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):
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a single nbd connection for all cases when reading the heads of the file is not required), but I'm happy with patches 1-11, and 12-13 show where I'm headed for getting NBD_OPT_INFO to work. Posting now to see if some of the earlier patches are ready to commit while I continue working on the latter half. Eric Blake (13):