search for: nbd_old_handshake

Displaying 10 results from an estimated 10 matches for "nbd_old_handshake".

2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...+++++------------------- generator/states-magic.c | 2 +- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index fe4d451..bdd1ef2 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -50,7 +50,7 @@ /* Old-style handshake. */ struct nbd_old_handshake { - char nbdmagic[8]; /* "NBDMAGIC" */ + 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...
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
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...l/nbd-protocol.h index 60d35d0..724ffb6 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -40,37 +40,46 @@ * these structures. */ +#define NBD_MAX_STRING 4096 /* Maximum length of a string field */ + /* Old-style handshake. */ -struct old_handshake { +struct nbd_old_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ - uint64_t version; /* OLD_VERSION */ + uint64_t version; /* NBD_OLD_VERSION */ uint64_t exportsize; uint16_t gflags; /* global flags */ uint16_t eflags; /* per-export flags */ char z...
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 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
...* 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; /* per-export flags */ char zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -59,7 +65,7 @@ stru...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...sizeof (int)) == -1) { - nbdkit_error ("cannot set TCP_NODELAY option: %m"); - close (fd); - return -1; - } - return fd; -} - -/* Create the shared or per-connection handle. */ -static struct handle * -nbd_open_handle (int readonly) -{ - struct handle *h; - struct nbd_old_handshake old; - uint64_t version; - unsigned long retries = retry; - - h = calloc (1, sizeof *h); - if (h == NULL) { - nbdkit_error ("malloc: %m"); - return NULL; - } - - retry: - if (sockname) - h->fd = nbd_connect_unix (); - else - h->fd = nbd_connect_tcp (); - if (h-&g...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...* 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; /* per-export flags */ char zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -64,7 +65,7 @@ stru...
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...4 100644 --- a/server/protocol-handshake-oldstyle.c +++ b/server/protocol-handshake-oldstyle.c @@ -44,8 +44,9 @@ #include "nbd-protocol.h" int -protocol_handshake_oldstyle (struct connection *conn) +protocol_handshake_oldstyle (void) { + struct connection *conn = GET_CONN; struct nbd_old_handshake handshake; uint64_t exportsize; uint16_t gflags, eflags; @@ -55,7 +56,7 @@ protocol_handshake_oldstyle (struct connection *conn) /* With oldstyle, our only option if .open or friends fail is to * disconnect, as we cannot report the problem to the client. */ - if (protocol_common_o...
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.