search for: nbd_new_version

Displaying 20 results from an estimated 34 matches for "nbd_new_version".

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 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...(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 */ uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ } NBD_ATTRIBUTE_PACKED; -#define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) +#define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) /* ASCII "IHAVEOPT" */ /* New-style handshake option (sent by the client to us). */ struct nbd_new_...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...N UINT64_C(0x420281861253) +#define NBD_OLD_VERSION UINT64_C(0x420281861253) /* New-style handshake. */ -struct new_handshake { +struct nbd_new_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ - uint64_t version; /* NEW_VERSION */ + uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ } __attribute__((packed)); -#define NEW_VERSION UINT64_C(0x49484156454F5054) +#define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) /* New-style handshake option (sent by the client to us). */ -struct new_option { +struct nbd_new_option {...
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...rator/states-magic.c b/generator/states-magic.c > index 944728d..2ad3a96 100644 > --- a/generator/states-magic.c > +++ b/generator/states-magic.c ... > @@ -42,8 +42,10 @@ STATE_MACHINE { > } > > version = be64toh (h->sbuf.new_handshake.version); > - if (version == NBD_NEW_VERSION) > + if (version == NBD_NEW_VERSION) { > + h->sbuf.option.option = 0; > SET_NEXT_STATE (%.NEWSTYLE.START); > + } > else if (version == NBD_OLD_VERSION) > SET_NEXT_STATE (%.OLDSTYLE.START); > else { What does this hunk do? > diff --git a/generator/st...
2020 Aug 11
3
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...s-magic.c >> index 944728d..2ad3a96 100644 >> --- a/generator/states-magic.c >> +++ b/generator/states-magic.c > ... >> @@ -42,8 +42,10 @@ STATE_MACHINE { >> } >> >> version = be64toh (h->sbuf.new_handshake.version); >> - if (version == NBD_NEW_VERSION) >> + if (version == NBD_NEW_VERSION) { >> + h->sbuf.option.option = 0; >> SET_NEXT_STATE (%.NEWSTYLE.START); >> + } >> else if (version == NBD_OLD_VERSION) >> SET_NEXT_STATE (%.OLDSTYLE.START); >> else { > > What does thi...
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...Hat Inc. + * Copyright (C) 2013-2020 Red Hat Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,8 +42,10 @@ STATE_MACHINE { } version = be64toh (h->sbuf.new_handshake.version); - if (version == NBD_NEW_VERSION) + if (version == NBD_NEW_VERSION) { + h->sbuf.option.option = 0; SET_NEXT_STATE (%.NEWSTYLE.START); + } else if (version == NBD_OLD_VERSION) SET_NEXT_STATE (%.OLDSTYLE.START); else { diff --git a/generator/states-newstyle-opt-go.c b/generator/states-newstyle-opt-go.c index...
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.
...zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -59,7 +65,7 @@ struct nbd_new_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) @@ -69,14 +75,14 @@ struct nbd_new_option { uint32_t option; /* NBD_OPT_* */ uint32_t optlen; /* option dat...
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...ack), so that I can also improve --list mode in nbdinfo.c. >>> +++ b/generator/states-magic.c >> ... >>> @@ -42,8 +42,10 @@ STATE_MACHINE { >>>     } >>> >>>     version = be64toh (h->sbuf.new_handshake.version); >>> -  if (version == NBD_NEW_VERSION) >>> +  if (version == NBD_NEW_VERSION) { >>> +    h->sbuf.option.option = 0; >>>       SET_NEXT_STATE (%.NEWSTYLE.START); >>> +  } >>>     else if (version == NBD_OLD_VERSION) >>>       SET_NEXT_STATE (%.OLDSTYLE.START); >>>     els...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -64,7 +65,7 @@ struct nbd_new_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) @@ -74,14 +75,14 @@ struct nbd_new_option { uint32_t option; /* NBD_OPT_* */ uint32_t optlen; /* option dat...
2020 Aug 14
0
[libnbd PATCH v2 06/13] api: Add nbd_opt_abort and nbd_aio_opt_abort
...Hat Inc. + * Copyright (C) 2013-2020 Red Hat Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,8 +42,10 @@ STATE_MACHINE { } version = be64toh (h->sbuf.new_handshake.version); - if (version == NBD_NEW_VERSION) + if (version == NBD_NEW_VERSION) { + assert (h->current_opt == 0); SET_NEXT_STATE (%.NEWSTYLE.START); + } else if (version == NBD_OLD_VERSION) SET_NEXT_STATE (%.OLDSTYLE.START); else { diff --git a/generator/states-newstyle-opt-go.c b/generator/states-newstyle-opt-go.c ind...
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...plugins report block - sizes, at which point we should request NBD_INFO_BLOCK_SIZE and - obey any sizes set by server. */ - uint16_t nrinfos = htobe16 (0); - struct nbd_fixed_new_option_reply reply; - - nbdkit_debug ("trying NBD_OPT_STRUCTURED_REPLY"); - opt.version = htobe64 (NBD_NEW_VERSION); - opt.option = htobe32 (NBD_OPT_STRUCTURED_REPLY); - opt.optlen = htobe32 (0); - if (write_full (h->fd, &opt, sizeof opt)) { - nbdkit_error ("unable to request NBD_OPT_STRUCTURED_REPLY: %m"); - return -1; - } - if (nbd_newstyle_recv_option_reply (h, NBD_OPT_STRUCTURED_...
2020 Jul 20
2
Re: [PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...uot;; s/being/begin/ > +++ b/generator/states-newstyle-opt-list.c > +STATE_MACHINE { > + NEWSTYLE.OPT_LIST.START: > + if (!h->list_exports) { > + SET_NEXT_STATE (%^OPT_STRUCTURED_REPLY.START); > + return 0; > + } > + > + h->sbuf.option.version = htobe64 (NBD_NEW_VERSION); > + h->sbuf.option.option = htobe32 (NBD_OPT_LIST); > + h->sbuf.option.optlen = 0; > + h->wbuf = &h->sbuf; > + h->wlen = sizeof (h->sbuf.option); > + SET_NEXT_STATE (%SEND); > + return 0; Is it worth enhancing the code to add another list mode where...
2020 Jul 20
0
Re: [PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...erator/states-newstyle-opt-list.c > > >+STATE_MACHINE { > >+ NEWSTYLE.OPT_LIST.START: > >+ if (!h->list_exports) { > >+ SET_NEXT_STATE (%^OPT_STRUCTURED_REPLY.START); > >+ return 0; > >+ } > >+ > >+ h->sbuf.option.version = htobe64 (NBD_NEW_VERSION); > >+ h->sbuf.option.option = htobe32 (NBD_OPT_LIST); > >+ h->sbuf.option.optlen = 0; > >+ h->wbuf = &h->sbuf; > >+ h->wlen = sizeof (h->sbuf.option); > >+ SET_NEXT_STATE (%SEND); > >+ return 0; > > Is it worth enhancing the co...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
2019 May 19
0
[libnbd PATCH 4/4] states: Add NBD_OPT_EXPORT_NAME handling
...not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* State machine for ending newstyle handshake with NBD_OPT_EXPORT_NAME. */ + +/* STATE MACHINE */ { + NEWSTYLE.OPT_EXPORT_NAME.START: + conn->sbuf.option.version = htobe64 (NBD_NEW_VERSION); + conn->sbuf.option.option = htobe32 (NBD_OPT_EXPORT_NAME); + conn->sbuf.option.optlen = strlen (h->export_name); + conn->wbuf = &conn->sbuf; + conn->wlen = sizeof conn->sbuf.option; + SET_NEXT_STATE (%SEND); + return 0; + + NEWSTYLE.OPT_EXPORT_NAME.SEND: + switch...
2019 Sep 04
2
[libnbd PATCH] api: Add way to avoid structured replies
...t-structured-reply.c +++ b/generator/states-newstyle-opt-structured-reply.c @@ -20,6 +20,11 @@ /* STATE MACHINE */ { NEWSTYLE.OPT_STRUCTURED_REPLY.START: + if (!h->request_sr) { + SET_NEXT_STATE (%^OPT_SET_META_CONTEXT.START); + return 0; + } + h->sbuf.option.version = htobe64 (NBD_NEW_VERSION); h->sbuf.option.option = htobe32 (NBD_OPT_STRUCTURED_REPLY); h->sbuf.option.optlen = htobe32 (0); diff --git a/lib/handle.c b/lib/handle.c index f8cc83a..c23ef01 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -63,6 +63,7 @@ nbd_create (void) h->unique = 1; h->tls_verify_p...
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.
2020 Sep 28
0
[libnbd PATCH 3/3] api: Add nbd_opt_list_meta_context
...>request_meta_contexts) == 0) { + SET_NEXT_STATE (%^OPT_GO.START); + return 0; + } } assert (h->meta_contexts == NULL); @@ -44,7 +54,7 @@ STATE_MACHINE { len += 4 /* length of query */ + strlen (h->request_meta_contexts[i]); h->sbuf.option.version = htobe64 (NBD_NEW_VERSION); - h->sbuf.option.option = htobe32 (NBD_OPT_SET_META_CONTEXT); + h->sbuf.option.option = htobe32 (opt); h->sbuf.option.optlen = htobe32 (len); h->wbuf = &h->sbuf; h->wlen = sizeof (h->sbuf.option); @@ -98,7 +108,8 @@ STATE_MACHINE { return 0; NEWSTYLE.OPT_...
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):