Displaying 20 results from an estimated 42 matches for "nbd_flag_has_flags".
2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...ons(-)
diff --git a/src/connections.c b/src/connections.c
index 8dc1925..f9edea7 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -237,13 +237,57 @@ free_connection (struct connection *conn)
}
static int
+compute_eflags (struct connection *conn, uint16_t *flags)
+{
+ uint16_t eflags = NBD_FLAG_HAS_FLAGS;
+ int fl;
+
+ fl = plugin_can_write (conn);
+ if (fl == -1)
+ return -1;
+ if (readonly || !fl) {
+ eflags |= NBD_FLAG_READ_ONLY;
+ conn->readonly = 1;
+ }
+ if (!conn->readonly) {
+ eflags |= NBD_FLAG_SEND_WRITE_ZEROES;
+ }
+
+ fl = plugin_can_flush (conn);
+ if (fl ==...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...-155,7 +155,7 @@
struct old_handshake handshake;
int64_t r;
uint64_t exportsize;
- uint16_t gflags, eflags;
+ uint32_t flags;
int fl;
r = plugin_get_size (conn);
@@ -169,14 +169,13 @@
exportsize = (uint64_t) r;
conn->exportsize = exportsize;
- gflags = 0;
- eflags = NBD_FLAG_HAS_FLAGS;
+ flags = NBD_FLAG_HAS_FLAGS;
fl = plugin_can_write (conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
- eflags |= NBD_FLAG_READ_ONLY;
+ flags |= NBD_FLAG_READ_ONLY;
conn->readonly = 1;
}
@@ -184,7 +183,7 @@
if (fl == -1)
return -1;
if (fl) {
-...
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
The upstream protocol recently promoted NBD_CMD_WRITE_ZEROES from
experimental to a documented extension. Exposing support for this
allows plugin writers to create sparse files when driven by a
client that knows how to use the extension; meanwhile, even if a
plugin does not support this extension, the server benefits from
less network traffic from the client.
Eric Blake (5):
protocol: Support
2019 Sep 24
0
[PATCH nbdkit 2/4] common/protocol: Remove protostrings.sed, use bash+sed instead.
...from nbd-protocol.h by protostrings.sed. */\
-\#include "nbd-protocol.h"\
+#include "nbd-protocol.h"
+EOF
-# Match the precise sections of the source file.
-/^extern const char \*name_of_/,/^$/ {
+declare -A functions=(
+ [global_flag]=NBD_FLAG_FIXED_NEWSTYLE
+ [flag]=NBD_FLAG_HAS_FLAGS
+ [opt]=NBD_OPT_EXPORT_NAME
+ [rep]=NBD_REP_ACK
+ [info]=NBD_INFO_EXPORT
+ [reply]=NBD_REPLY_FLAG_DONE
+ [reply_type]=NBD_REPLY_TYPE_NONE
+ [cmd]=NBD_CMD_READ
+ [cmd_flag]=NBD_CMD_FLAG_FUA
+ [error]=NBD_SUCCESS
+)
- # Convert extern function prototype into a definition.
-...
2019 Sep 25
0
[nbdkit PATCH 2/2] common/protocol: Declare additional constants
...ed_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 (1 << 0)
@@ -143,6 +143,9 @@ struct nbd_fixed_new_option_reply {
#define NBD_REP_ERR_TOO_BIG NBD_REP_ERR (9)
#define NBD_INFO_EXPORT 0
+#define NBD_INFO_NAME 1
+#define NBD_INFO_DESCRIPTION 2
+#define NBD_INFO_BLOCK_SIZE 3
/* NBD_INFO_EXPORT reply (follows f...
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...ed_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 (1 << 0)
@@ -140,6 +143,9 @@ struct nbd_fixed_new_option_reply {
#define NBD_REP_ERR_TOO_BIG NBD_REP_ERR (9)
#define NBD_INFO_EXPORT 0
+#define NBD_INFO_NAME 1
+#define NBD_INFO_DESCRIPTION 2
+#define NBD_INFO_BLOCK_SIZE 3
/* NBD_INFO_EXPORT reply (follows f...
2020 Feb 10
0
[libnbd PATCH 1/1] generator: Add support for NBD_INFO_INIT_STATE extension
...nd/or
* modify it under the terms of the GNU Lesser General Public
@@ -97,12 +97,13 @@ struct nbd_handle {
uint16_t gflags;
/* Export size and per-export flags, received during handshake. NB:
- * These are *both* *only* valid if eflags != 0. This is because
- * all servers should set NBD_FLAG_HAS_FLAGS, so eflags should
- * always be != 0, and we set both fields at the same time.
+ * These are *only* valid if eflags != 0. This is because all
+ * servers should set NBD_FLAG_HAS_FLAGS, so eflags should always be
+ * != 0, and we set the other fields at the same time.
*/
uint64_t exp...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...@@ 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 << 0)
@@ -238,10 +239,12 @@ struct nbd_structured_reply_error {
#define NBD_CMD_WRITE_ZEROES 6
#define NBD_CMD_BLOCK_STATUS 7
+/* Command flags. Exposed by the generator as LIBNBD_CMD_FLAG_* instead
#define NBD_CMD_FLAG_FUA (1<<0)
#define NBD_CMD_FLAG_NO_H...
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
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...t fixed_new_option_reply {
#define NBD_REP_MAGIC UINT64_C(0x3e889045565a9)
/* Global flags. */
+extern const char *name_of_nbd_global_flag (int);
#define NBD_FLAG_FIXED_NEWSTYLE 1
#define NBD_FLAG_NO_ZEROES 2
/* Per-export flags. */
+extern const char *name_of_nbd_flag (int);
#define NBD_FLAG_HAS_FLAGS (1 << 0)
#define NBD_FLAG_READ_ONLY (1 << 1)
#define NBD_FLAG_SEND_FLUSH (1 << 2)
@@ -94,6 +96,7 @@ struct fixed_new_option_reply {
#define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6)
/* NBD options (new style handshake only). */
+extern const char *name...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...((packed));
+} NBD_ATTRIBUTE_PACKED;
#define NBD_REP_MAGIC UINT64_C(0x3e889045565a9)
-/* 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
- */
/* Per-export flags. */
#define NBD_FLAG_HAS_FLAGS (1 << 0)
@@ -146,19 +146,19 @@ struct nbd_fixed_new_option_reply_info_export {
uint16_t info; /* NBD_INFO_EXPORT */
uint64_t exportsize; /* size of export */
uint16_t eflags; /* per-export flags */
-} __attribute__((packed));
+} NBD_ATTRIB...
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.
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far.
Rich.
2019 Aug 30
0
[nbdkit PATCH 6/9] server: Cache per-connection can_FOO flags
...zero != -1);
}
diff --git a/server/protocol-handshake.c b/server/protocol-handshake.c
index 4d12b3dc..16261c34 100644
--- a/server/protocol-handshake.c
+++ b/server/protocol-handshake.c
@@ -51,87 +51,72 @@ protocol_compute_eflags (struct connection *conn, uint16_t *flags)
{
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
+ bool can_write = true;
fl = backend_can_write (backend, conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
eflags |= NBD_FLAG_READ_ONLY;
- conn->readonly = true;
+ can_write = false;
}
- if (!conn->readonly) {
- fl = backend_can_zero (backen...
2018 Dec 06
10
[PATCH nbdkit 0/5] protocol: Generate map functions from NBD protocol flags to printable strings.
With some crufty sed scripts we can generate functions that map from
NBD protocol flags (eg. NBD_CMD_READ) to strings ("NBD_CMD_READ").
This works on GNU sed and with FreeBSD, also with GNU sed's --posix
option, so I guess the sed code is POSIX-compatible.
Rich.
2019 Aug 30
3
[nbdkit PATCH v2 0/2] caching .can_write
This is a subset of the last half of the larger 9-patch series. The
uncontroversial first half of that series is pushed, but here, I tried
to reduce the size of the patches by splitting out some of the more
complex changes, so that the rest of the changes remaining in the
series are more mechanical. In turn, it forced me to write timing
tests, which let me spot another spot where we are wasting
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...- ret = get_status (conn);
+ ret = connection_get_status (conn);
done:
free_connection (conn);
return ret;
@@ -335,1161 +317,6 @@ free_connection (struct connection *conn)
free (conn);
}
-static int
-compute_eflags (struct connection *conn, uint16_t *flags)
-{
- uint16_t eflags = NBD_FLAG_HAS_FLAGS;
- int fl;
-
- fl = backend->can_write (backend, conn);
- if (fl == -1)
- return -1;
- if (readonly || !fl) {
- eflags |= NBD_FLAG_READ_ONLY;
- conn->readonly = true;
- }
- if (!conn->readonly) {
- fl = backend->can_zero (backend, conn);
- if (fl == -1)
- retur...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...-340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
@@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
eflags |= NBD_FLAG_SEND_WRITE_ZEROES;
}
- fl = plugin_can...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...-340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
@@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
eflags |= NBD_FLAG_SEND_WRITE_ZEROES;
}
- fl = plugin_can...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...-340,7 +342,7 @@ free_connection (struct connection *conn)
*/
if (!quit) {
if (conn->handle)
- plugin_close (conn);
+ backend->close (backend, conn);
}
free (conn);
@@ -352,7 +354,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
uint16_t eflags = NBD_FLAG_HAS_FLAGS;
int fl;
- fl = plugin_can_write (conn);
+ fl = backend->can_write (backend, conn);
if (fl == -1)
return -1;
if (readonly || !fl) {
@@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
eflags |= NBD_FLAG_SEND_WRITE_ZEROES;
}
- fl = plugin_can...