search for: nbdkit_export_name

Displaying 20 results from an estimated 71 matches for "nbdkit_export_name".

2019 Sep 10
1
Re: [PATCH nbdkit] server: Add nbdkit_export_name() to allow export name to be read.
...PORT NAME > + > +If the client negotiated an NBD export name with nbdkit then plugins > +may read this from any connected callbacks. Nbdkit's normal behaviour > +is to accept any export name passed by the client, log it in debug > +output, but otherwise ignore it. By using C<nbdkit_export_name> > +plugins may choose to filter by export name or serve different > +content. We may want to add text here and/or in .can_multi_conn to clarify that advertising multi-conn only matters to clients connecting to the SAME export name; it is safe to advertise multi-conn even when serving dif...
2019 Sep 10
0
[PATCH nbdkit] server: Add nbdkit_export_name() to allow export name to be read.
...as an error. +=head1 EXPORT NAME + +If the client negotiated an NBD export name with nbdkit then plugins +may read this from any connected callbacks. Nbdkit's normal behaviour +is to accept any export name passed by the client, log it in debug +output, but otherwise ignore it. By using C<nbdkit_export_name> +plugins may choose to filter by export name or serve different +content. + +=head2 C<nbdkit_export_name> + + const char *nbdkit_export_name (void); + +Return the optional NBD export name if one was negotiated with the +current client (this uses thread-local magic so no parameter is +requ...
2019 Sep 10
2
[PATCH nbdkit] server: Add nbdkit_export_name() to allow export name to be read.
This is the sort of thing I had in mind for option (1) here: https://www.redhat.com/archives/libguestfs/2019-September/msg00047.html It does reveal that the way we currently list exports is naive to say the least ... Rich.
2019 Sep 10
3
[nbdkit] Access export name from plugins
...hould make this available to plugins, in case they wish to serve different content to different clients based on the export name. Note I'm not suggesting that we use this feature in any existing plugins. If we wanted to do this there seem like two possible ways to do it: (1) Add a call, like nbdkit_export_name, which plugins could call from any connected method to get the current export name, eg: static void * myplugin_open (int readonly) { const char *export = nbdkit_export_name (); ... Do something based on the export name ... } The implementation of this is straightforward. It simply reads the...
2019 Sep 12
0
[PATCH nbdkit v2 3/3] tests: Add a simple test of nbdkit_export_name.
--- tests/Makefile.am | 3 ++ tests/test-export-name.sh | 86 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index b5806bb..f54597b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -395,6 +395,9 @@ endif HAVE_LIBGUESTFS # Test export flags. TESTS += test-eflags.sh +# Test export name. +TESTS +=
2019 Sep 12
3
Re: [PATCH nbdkit v2 3/3] tests: Add a simple test of nbdkit_export_name.
On 9/12/19 4:01 PM, Richard W.M. Jones wrote: > --- > tests/Makefile.am | 3 ++ > tests/test-export-name.sh | 86 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 89 insertions(+) > +# Create a sh plugin which echos the export name back in the device. echoes? One of those weird words with dual acceptable spellings, where it depends on who you ask for which
2020 Jul 22
1
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
...truct backend_plugin *p = container_of (b, struct backend_plugin, backend); > > assert (p->plugin.open != NULL); > >+ /* Save the exportname since the lifetime of the string passed in > >+ * here is likely to be brief. In addition this provides a place > >+ * for nbdkit_export_name to retrieve it if called from the plugin. > >+ * > >+ * In API V3 we propose to pass the exportname as an extra parameter > >+ * to the (new) plugin.open and deprecate nbdkit_export_name for V3 > >+ * users. Even then we will still need to save it in the handle >...
2019 Sep 12
4
[PATCH nbdkit v2 0/3] Access export name from plugins.
.../www.redhat.com/archives/libguestfs/2019-September/msg00049.html based on earlier discussion here: https://www.redhat.com/archives/libguestfs/2019-September/msg00047.html In v2: - The previous patch was incomplete. This version completes it by adding tests and extending nbdkit-sh-plugin. - nbdkit_export_name now returns NULL for error, setting nbdkit_error. The only possible error currently is if we're not called from a connected callback. - For oldstyle protocol, "" is returned. - Add some clarifying text to docs for can_multi_conn. - Use strcpy in one place instead of memcp...
2020 Jul 21
4
[PATCH nbdkit] server: Pass the export name through filter .open calls.
...and filters that need to hang on to it must take a copy. The filter must pass the exportname parameter down to the next layer (or potentially modify it). The plugin .open callback is unchanged, but the binding to it in server/plugins.c takes a copy of the exportname in the handle and this is what nbdkit_export_name returns to plugins. Eventually we will deprecate that function and the V3 .open callback in plugins will have the extra parameter, but this is not implemented yet. nbdkit_export_name can only be called from plugins, not filters. Filters should use the .open(...exportname) parameter if they need t...
2020 Jul 22
0
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
...on to it must take > a copy. The filter must pass the exportname parameter down to the > next layer (or potentially modify it). > > The plugin .open callback is unchanged, but the binding to it in > server/plugins.c takes a copy of the exportname in the handle and this > is what nbdkit_export_name returns to plugins. Eventually we will > deprecate that function and the V3 .open callback in plugins will have > the extra parameter, but this is not implemented yet. > > nbdkit_export_name can only be called from plugins, not filters. > Filters should use the .open(...exportname)...
2020 Aug 07
0
[nbdkit PATCH 1/3] server: Implement nbdkit_is_tls for use during .open
...ording to whether the client has authenticated. For internal code and filters, this means adding a new parameter; the sh plugin can do likewise. For plugins, we can't add a parameter until the V3 protocol, so in the meantime, we add nbdkit_is_tls(), even though it will be deprecated alongside nbdkit_export_name() when we do get to V3. Signed-off-by: Eric Blake <eblake@redhat.com> --- docs/nbdkit-filter.pod | 12 ++++++++---- docs/nbdkit-plugin.pod | 32 +++++++++++++++++++++++++++---- docs/nbdkit-tls.pod | 5 ++++- filters/log/nbdkit-log-filter.pod | 2 +- plu...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 5/5] server: Indirect slow path, non-self-contained functions through the server.
...e_t index, @@ -515,6 +517,11 @@ extern void *threadlocal_buffer (size_t size); extern void threadlocal_set_conn (struct connection *conn); extern struct connection *threadlocal_get_conn (void); +/* public.c */ +extern int do_nbdkit_nanosleep (unsigned sec, unsigned nsec); +extern const char *do_nbdkit_export_name (void); +extern int do_nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + /* Macro which sets local variable struct connection *conn from * thread-local storage, asserting that it is non-NULL. If you want * to check if conn could be NULL (eg. outside a connection context) diff --...
2019 Sep 10
0
Re: [nbdkit] Access export name from plugins
...wish to serve different content to different clients based on the > export name. Note I'm not suggesting that we use this feature in any > existing plugins. > > If we wanted to do this there seem like two possible ways to do it: at least two ways. > > (1) Add a call, like nbdkit_export_name, which plugins could call from > any connected method to get the current export name, eg: > > static void * > myplugin_open (int readonly) > { > const char *export = nbdkit_export_name (); > > ... Do something based on the export name ... > } I would also consider...
2020 Jul 21
3
Extending nbdkit to support listing exports
...of tar file Y? tar filter ---> file plugin tar-exportname=on exportname=on directory=/my-files ---> directory of tar files It gets worse! At the moment filters and plugins can read the export name sent by the client by calling the global function nbdkit_export_name(). I'm not so worried about filters, but plugins must be able to continue to use this global function. In the scenario above both the tar filter and the file plugin would see the same string (if we did nothing), and it would only make sense to one or the other but never to both. Listing expo...
2020 Jul 21
0
Re: Extending nbdkit to support listing exports
...---> file plugin > tar-exportname=on exportname=on > directory=/my-files ---> directory of tar files > > It gets worse! At the moment filters and plugins can read the export > name sent by the client by calling the global function > nbdkit_export_name(). I'm not so worried about filters, but plugins > must be able to continue to use this global function. In the scenario > above both the tar filter and the file plugin would see the same > string (if we did nothing), and it would only make sense to one or the > other but never to...
2020 Feb 11
0
[PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...socket detects POLLRDHUP/POLLHUP/POLLERR */ - struct connection *conn = threadlocal_get_conn (); + struct connection *conn = GET_CONN; struct pollfd fds[] = { [0].fd = quit_fd, [0].events = POLLIN, @@ -595,7 +595,7 @@ nbdkit_nanosleep (unsigned sec, unsigned nsec) const char * nbdkit_export_name (void) { - struct connection *conn = threadlocal_get_conn (); + struct connection *conn = GET_CONN; if (!conn) { nbdkit_error ("no connection in this thread"); @@ -608,7 +608,7 @@ nbdkit_export_name (void) int nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen) {...
2020 Mar 24
2
Re: nbdkit / mingw support
On 3/24/20 3:12 PM, Eric Blake wrote: >> (For non-mingw platforms) this breaks the source API promises rather >> seriously, so if I understand your proposal correctly I don't think >> this is a good idea.  It's possibly something we can consider for >> internal plugins, or for the V3 API. > > How does it break API to request that someone link against a
2020 Mar 25
2
Re: nbdkit / mingw support
...how we might implement libnbdkit.so. Some functions > are obviously self-contained (eg. nbdkit_parse_*, nbdkit_realpath, > nbdkit_debug, nbdkit_error, nbdkit_*extents). > > Unfortunately some functions depend themselves on internals > of the server: > > * nbdkit_nanosleep, nbdkit_export_name, nbdkit_peer_name call > threadlocal_get_conn > * nbdkit_set_error calls threadlocal_set_error > * nbdkit_shutdown must set the quit global (or call a server function) Yeah, there's some awkward dependencies to figure out. It's obvious the library has to export public nbd...
2020 Mar 25
0
Re: nbdkit / mingw support
...ource API break. I had a look into how we might implement libnbdkit.so. Some functions are obviously self-contained (eg. nbdkit_parse_*, nbdkit_realpath, nbdkit_debug, nbdkit_error, nbdkit_*extents). Unfortunately some functions depend themselves on internals of the server: * nbdkit_nanosleep, nbdkit_export_name, nbdkit_peer_name call threadlocal_get_conn * nbdkit_set_error calls threadlocal_set_error * nbdkit_shutdown must set the quit global (or call a server function) I guess we can deal with the first ones by moving threadlocal.c into the same library, although it's a bit awkward. The quit f...
2019 Sep 15
0
[PATCH nbdkit 3/4] server: Add nbdkit_peer_name() to return the client address.
...errno.h> +#include <sys/socket.h> #include <nbdkit-version.h> @@ -87,6 +88,7 @@ extern int nbdkit_read_password (const char *value, char **password); extern char *nbdkit_realpath (const char *path); extern int nbdkit_nanosleep (unsigned sec, unsigned nsec); extern const char *nbdkit_export_name (void); +extern int nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); struct nbdkit_extents; extern int nbdkit_add_extent (struct nbdkit_extents *, diff --git a/server/nbdkit.syms b/server/nbdkit.syms index 1fb1315..d792a5f 100644 --- a/server/nbdkit.syms +++ b/server/nbdkit.syms @@...