search for: nbd_flag_no_zero

Displaying 20 results from an estimated 49 matches for "nbd_flag_no_zero".

Did you mean: nbd_flag_no_zeroes
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
.../* size of export */ - uint16_t eflags; /* per-export flags */ - char zeroes[124]; /* optional zeroes */ + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* optional zeroes, unless NBD_FLAG_NO_ZEROES */ } NBD_ATTRIBUTE_PACKED; /* Fixed newstyle handshake reply message. */ @@ -95,8 +98,8 @@ struct nbd_fixed_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_NE...
2018 Aug 06
3
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
There's no substantial difference over v1, I simply fixed a few whitespace issues, moved one struct around and tidied up the comments. Rich.
2018 Aug 06
0
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
...et (&handshake_finish, 0, sizeof handshake_finish); + handshake_finish.exportsize = htobe64 (conn->exportsize); + handshake_finish.eflags = htobe16 (conn->eflags); + + if (conn->send (conn, + &handshake_finish, + (conn->cflags & NBD_FLAG_NO_ZEROES) + ? offsetof (struct new_handshake_finish, zeroes) + : sizeof handshake_finish) == -1) { + nbdkit_error ("write: %m"); + return -1; + } + } + /* The client is buggy. The last option must be NBD_OPT_GO or + * NBD_OPT_EXPORT_NAME. +...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...--- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -93,9 +93,10 @@ 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 #...
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
...nsion. 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 NBD_FLAG_NO_ZEROES protocol: Validate request flags plugins: Add callback for writing zeroes protocol: Implement NBD_CMD_WRITE_ZEROES file: Support punching holes for write zero docs/nbdkit-plugin.pod | 19 +++++++++++++++++++ include/nbdkit-plugin.h | 1 + plugins/file/file.c | 32 +++++++++++++++++...
2019 Sep 25
0
[nbdkit PATCH 2/2] common/protocol: Declare additional constants
.../protocol/nbd-protocol.h index 9bf7171e..bdd1ef21 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -98,8 +98,8 @@ struct nbd_fixed_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)...
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
2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...m = 1; - } debug ("oldstyle negotiation: flags: global 0x%x export 0x%x", gflags, eflags); @@ -552,7 +561,6 @@ _negotiate_handshake_newstyle (struct connection *conn) int64_t r; uint64_t exportsize; uint16_t eflags; - int fl; gflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES; @@ -596,42 +604,8 @@ _negotiate_handshake_newstyle (struct connection *conn) exportsize = (uint64_t) r; conn->exportsize = exportsize; - eflags = NBD_FLAG_HAS_FLAGS; - - fl = plugin_can_write (conn); - if (fl == -1) + if (compute_eflags (conn, &eflags) < 0) return -1;...
2018 Aug 04
3
[PATCH nbdkit] protocol: Implement NBD_OPT_GO.
This is only lightly tested (against just qemu NBD client), and the code might be structured a little better as the _negotiate_handshake_newstyle_options function has now grown to be huge. Anyway works for me. Rich.
2019 Sep 12
0
[nbdkit PATCH 2/2] server: Add --mask-handshake option for integration testing
...ke-newstyle.c index 486d416f..9801f7c2 100644 --- a/server/protocol-handshake-newstyle.c +++ b/server/protocol-handshake-newstyle.c @@ -673,7 +673,7 @@ protocol_handshake_newstyle (struct connection *conn) struct new_handshake handshake; uint16_t gflags; - gflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES; + gflags = (NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES) & mask_handshake; debug ("newstyle negotiation: flags: global 0x%x", gflags); @@ -694,7 +694,7 @@ protocol_handshake_newstyle (struct connection *conn) /* ... which we check for accuracy. */ debug ("newstyle...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
.../* NBD_REP_* */ uint32_t replylen; -} __attribute__((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;...
2019 Apr 23
0
[nbdkit PATCH 6/7] nbd: Implement NBD_OPT_GO client request
...export); - goto err; + /* Prefer NBD_OPT_GO if possible */ + if (gflags & NBD_FLAG_FIXED_NEWSTYLE) { + int rc = nbd_newstyle_haggle (h); + if (rc < 0) + goto err; + if (!rc) + goto export_name; } - expect = sizeof finish; - if (gflags & NBD_FLAG_NO_ZEROES) - expect -= sizeof finish.zeroes; - if (read_full (h->fd, &finish, expect)) { - nbdkit_error ("unable to read new handshake: %m"); - goto err; + else { + export_name: + /* Option haggling untried or failed, use older NBD_OPT_EXPORT_NAME */ + nbd...
2019 Sep 12
3
[nbdkit PATCH 0/2] Make client fallback testing easier
This is similar to the recent --no-sr option - it's a change that is unlikely to ever be used except by someone testing whether a client is compliant to the protocol, but in that niche case, it can be quite handy (it's a lot nicer to be able to purposefully cripple a server from the command line than from a one-off compile, when testing if a client's fallback for a spec-compliant but
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...on, NEW_VERSION); + version, NBD_NEW_VERSION); return -1; } @@ -296,7 +296,7 @@ negotiate_handshake_newstyle_options (struct connection *conn) if (conn->send (conn, &handshake_finish, (conn->cflags & NBD_FLAG_NO_ZEROES) - ? offsetof (struct new_handshake_finish, zeroes) + ? offsetof (struct nbd_new_handshake_finish, zeroes) : sizeof handshake_finish, 0) == -1) { nbdkit_error ("write: %s: %m", optname); return -1; @@ -67...
2017 Aug 25
0
ANNOUNCE: nbdkit 1.1.13 - NBD server toolkit with stable API and permissive license
...ay implement (Eric Blake). - Allow plugins to declare whether errno is preserved for more accurate error reporting (Eric Blake). - ‘nbdkit_read_password’ core API to provide a uniform way for plugins to read and parse password. - The ‘file’ plugin can now serve device files. - Support NBD_FLAG_NO_ZEROES which slightly optimizes the NBD feature negotiation stage (Eric Blake). - Fix Perl module so that Perl extensions written in C can be imported into plugins (Eric Blake). - Fix build on RHEL 5 (Eric Blake). - Build fails hard if there are POD errors in the documentation (Eric Blake...
2019 Sep 24
0
Re: [PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...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 should add a compile-time assertion that NBD_FLAG_FIXED_NEWSTYLE == LIBNBD_FLAG_FIXED_NEWSTYLE (ie. that our generator produces public constants in <libnbd.h> that match the NBD protocol constants)....
2020 Jul 22
0
[PATCH nbdkit] PROPOSED: server: Implement list_exports.
...ugins could read the client requested export name using -C<nbdkit_export_name()> and serve different content. +C<nbdkit_export_name()> and serve different content. In nbdkit +1.21.20, plugins could implement C<.list_exports> to answer +C<NBD_OPT_LIST> queries. =item C<NBD_FLAG_NO_ZEROES> -- 2.27.0
2020 Jul 22
0
[PATCH nbdkit v2] PROPOSED: server: Implement list_exports.
...ugins could read the client requested export name using -C<nbdkit_export_name()> and serve different content. +C<nbdkit_export_name()> and serve different content. In nbdkit +1.21.20, plugins could implement C<.list_exports> to answer +C<NBD_OPT_LIST> queries. =item C<NBD_FLAG_NO_ZEROES> -- 2.27.0
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...otocol.h index 0444641..6709ddc 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -81,10 +81,12 @@ struct 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_FLA...
2020 Jul 31
0
[nbdkit PATCH 3/4] server: Implement list_exports.
...lugins could read the client requested export name using -C<nbdkit_export_name()> and serve different content. +C<nbdkit_export_name()> and serve different content. In nbdkit +1.21.20, plugins could implement C<.list_exports> to answer +C<NBD_OPT_LIST> queries. =item C<NBD_FLAG_NO_ZEROES> diff --git a/include/nbdkit-plugin.h b/include/nbdkit-plugin.h index c6c1256c..86b8565d 100644 --- a/include/nbdkit-plugin.h +++ b/include/nbdkit-plugin.h @@ -139,6 +139,9 @@ struct nbdkit_plugin { int (*get_ready) (void); int (*after_fork) (void); + + int (*list_exports) (int readon...