search for: nbdkit_next_open

Displaying 20 results from an estimated 108 matches for "nbdkit_next_open".

2020 Jul 21
4
[PATCH nbdkit] server: Pass the export name through filter .open calls.
...h @@ -65,13 +65,14 @@ typedef int nbdkit_next_config_complete (nbdkit_backend *nxdata); typedef int nbdkit_next_get_ready (nbdkit_backend *nxdata); typedef int nbdkit_next_after_fork (nbdkit_backend *nxdata); typedef int nbdkit_next_preconnect (nbdkit_backend *nxdata, int readonly); -typedef int nbdkit_next_open (nbdkit_backend *nxdata, int readonly); +typedef int nbdkit_next_open (nbdkit_backend *nxdata, + int readonly, const char *exportname); struct nbdkit_next_ops { /* Performs close + open on the underlying chain. * Used by the retry filter. */ - int (*reope...
2020 Aug 07
0
[nbdkit PATCH 1/3] server: Implement nbdkit_is_tls for use during .open
...d, 109 insertions(+), 50 deletions(-) diff --git a/docs/nbdkit-filter.pod b/docs/nbdkit-filter.pod index 12343dbf..b6ed5504 100644 --- a/docs/nbdkit-filter.pod +++ b/docs/nbdkit-filter.pod @@ -403,7 +403,7 @@ Returns a copy of the C<i>'th export. =head2 C<.open> void * (*open) (nbdkit_next_open *next, void *nxdata, - int readonly, const char *exportname); + int readonly, const char *exportname, int is_tls); This is called when a new client connection is opened and can be used to allocate any per-connection data structures needed by the filter. @@ -420,8...
2020 Jul 22
0
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
...ave a glitch if compiled under a different locale than the end binary runs in, but these days, it's uncommon to find someone running in a single-byte locale instead of UTF-8. > +++ b/filters/ext2/ext2.c > /* Create the per-connection handle. */ > static void * > -ext2_open (nbdkit_next_open *next, void *nxdata, int readonly) > +ext2_open (nbdkit_next_open *next, void *nxdata, > + int readonly, const char *exportname) > + > + /* If file == NULL (ie. using exportname) then don't > + * pass the client exportname to the lower layers. > + */ > + ex...
2020 Jul 22
1
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
...d.c to start storing the name passed into backend_open(). > >> +++ b/filters/log/log.c >> @@ -227,11 +227,12 @@ output_return (struct handle *h, const char >> *act, uint64_t id, int r, int *err) >>   /* Open a connection. */ >>   static void * >> -log_open (nbdkit_next_open *next, void *nxdata, int readonly) >> +log_open (nbdkit_next_open *next, void *nxdata, >> +          int readonly, const char *exportname) >>   { >>     struct handle *h; >> -  if (next (nxdata, readonly) == -1) >> +  if (next (nxdata, readonly, exportname) == -1...
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...NEXT PLUGIN -F<nbdkit-filter.h> defines three function types -(C<nbdkit_next_config>, C<nbdkit_next_config_complete>, +F<nbdkit-filter.h> defines four function types (C<nbdkit_next_config>, +C<nbdkit_next_config_complete>, C<nbdkit_ready_to_serve>, C<nbdkit_next_open>) and a structure called C<struct nbdkit_next_ops>. These abstract the next plugin or filter in the chain. There is also an opaque pointer C<nxdata> which must be passed along when calling @@ -135,9 +135,10 @@ these functions. =head2 Next config, open and close -The filter’s...
2020 Aug 07
7
[nbdkit PATCH 0/3] Content differentiation during --tls=on
Patch 3 still needs tests added, but it is at least working from my simple command line tests. Eric Blake (3): server: Implement nbdkit_is_tls for use during .open server: Expose final thread_model to filter's .get_ready tlsdummy: New filter docs/nbdkit-filter.pod | 21 +- docs/nbdkit-plugin.pod | 34 ++- docs/nbdkit-tls.pod
2023 Jan 27
2
[nbdkit PATCH 1/2] retry: Add in retry support during .open
...-2021 Red Hat Inc. + * Copyright (C) 2019-2023 Red Hat Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -113,45 +113,6 @@ struct retry_handle { bool open; }; -static void * -retry_open (nbdkit_next_open *next, nbdkit_context *nxdata, - int readonly, const char *exportname, int is_tls) -{ - struct retry_handle *h; - - if (next (nxdata, readonly, exportname) == -1) - return NULL; - - h = malloc (sizeof *h); - if (h == NULL) { - nbdkit_error ("malloc: %m"); - return...
2019 Apr 27
0
[nbdkit PATCH 1/4] filters: Drop useless .open callbacks
...(-) diff --git a/filters/cache/cache.c b/filters/cache/cache.c index b3fef42..19ce555 100644 --- a/filters/cache/cache.c +++ b/filters/cache/cache.c @@ -186,15 +186,6 @@ cache_config_complete (nbdkit_next_config_complete *next, void *nxdata) return next (nxdata); } -static void * -cache_open (nbdkit_next_open *next, void *nxdata, int readonly) -{ - if (next (nxdata, readonly) == -1) - return NULL; - - return NBDKIT_HANDLE_NOT_NEEDED; -} - /* Get the file size and ensure the cache is the correct size. */ static int64_t cache_get_size (struct nbdkit_next_ops *next_ops, void *nxdata, @@ -476,7 +467...
2019 Jan 01
0
[PATCH nbdkit] plugins, filters: Define and use NBDKIT_HANDLE_NOT_NEEDED.
...+ #ifdef __cplusplus } #endif diff --git a/filters/cache/cache.c b/filters/cache/cache.c index 67dde23..dc7ceab 100644 --- a/filters/cache/cache.c +++ b/filters/cache/cache.c @@ -177,15 +177,10 @@ cache_config_complete (nbdkit_next_config_complete *next, void *nxdata) static void * cache_open (nbdkit_next_open *next, void *nxdata, int readonly) { - /* We don't use the handle, so this just provides a non-NULL - * pointer that we can return. - */ - static int handle; - if (next (nxdata, readonly) == -1) return NULL; - return &handle; + return NBDKIT_HANDLE_NOT_NEEDED; } /* Ge...
2020 Aug 27
0
[nbdkit PATCH 2/2] ext2: Supply .list_exports and .default_export
.... + */ + if (file) + return NULL; + + /* Otherwise, we don't care about export name, so keeping things at + * "" is fine, regardless of the underlying plugin's default. + */ + return ""; +} + /* Create the per-connection handle. */ static void * ext2_open (nbdkit_next_open *next, void *nxdata, @@ -133,9 +164,8 @@ ext2_open (nbdkit_next_open *next, void *nxdata, } /* Save the client exportname in the handle. */ - h->exportname = strdup (exportname); + h->exportname = nbdkit_strdup_intern (exportname); if (h->exportname == NULL) { - nbdkit_error...
2020 Feb 12
2
[nbdkit PATCH] filters: Remove most next_* wrappers
...pedef int nbdkit_next_config (void *nxdata, +typedef int nbdkit_next_config (backend *nxdata, const char *key, const char *value); -typedef int nbdkit_next_config_complete (void *nxdata); -typedef int nbdkit_next_preconnect (void *nxdata, int readonly); -typedef int nbdkit_next_open (void *nxdata, int readonly); +typedef int nbdkit_next_config_complete (backend *nxdata); +typedef int nbdkit_next_preconnect (backend *nxdata, int readonly); +typedef int nbdkit_next_open (backend *nxdata, int readonly); struct nbdkit_next_ops { /* Performs close + open on the underlying chai...
2023 Jan 28
1
[nbdkit PATCH 1/2] retry: Add in retry support during .open
...3 Red Hat Inc. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are > @@ -113,45 +113,6 @@ struct retry_handle { > bool open; > }; > > -static void * > -retry_open (nbdkit_next_open *next, nbdkit_context *nxdata, > - int readonly, const char *exportname, int is_tls) > -{ > - struct retry_handle *h; > - > - if (next (nxdata, readonly, exportname) == -1) > - return NULL; > - > - h = malloc (sizeof *h); > - if (h == NULL) { > - n...
2020 Aug 25
0
[nbdkit PATCH 1/5] api: Add .default_export
...lt;.open>, and may be changed by the filter when calling into the +plugin. The C<is_tls> parameter informs the filter whether TLS +negotiation has been completed by the client, but is not passed on to +C<next> because it cannot be altered. + =head2 C<.open> void * (*open) (nbdkit_next_open *next, void *nxdata, diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod index 5c641e83..64e3197b 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -245,6 +245,12 @@ Early in option negotiation the client may try to list the exports served by the plugin, and plugins can...
2023 Jan 27
2
[nbdkit PATCH 0/2] retry: add support for retrying .open
In https://bugzilla.redhat.com/show_bug.cgi?id=1841820, it was pointed out that the retry filter not retrying .open means that an ssh connection (such as in a vmx+ssh v2v conversion) fails when the ssh connection itself cannot be retried. A year ago, this was an inherent limitation of our retry implementation; but in the meantime, my work to allow filters to open independent backends has made it
2020 Feb 22
2
Re: Plans for nbdkit 1.18 release?
Eric: Did you want to take this one any further? It might be one that we save for > 1.18: https://www.redhat.com/archives/libguestfs/2020-February/thread.html#00206 Another thing I've been thinking about for some time is splitting .config_complete into .config_complete + .get_ready (new name TBD). At the moment .config_complete is both the place where we finish processing config, and
2020 Aug 27
4
[nbdkit PATCH 0/2] ext2 export list tweaks
Applies on top of my pending series for the exportname filter, addressing one of the todo's in that cover letter. Eric Blake (2): filters: Add .export_description wrappers ext2: Supply .list_exports and .default_export filters/ext2/nbdkit-ext2-filter.pod | 3 +- tests/Makefile.am | 16 +++- filters/ext2/ext2.c | 125 +++++++++++++++++++---------
2019 Apr 27
8
[nbdkit PATCH 0/4] Fix truncate handling of real_size
While working on adding assertions to pthread_mutex_lock calls, I noticed that the truncate filter's use of mutex didn't really protect us, and isn't really necessary. Cleaning that up also spotted a couple of other potential cleanups. Eric Blake (4): filters: Drop useless .open callbacks truncate: Fix corruption when plugin changes per-connection size truncate: Test for safe
2020 Aug 06
6
[nbdkit PATCH v2 0/5] .list_exports
Since v1: - patch 1: check size limits - patch 2: better handling of default export name canonicalization - patch 3: support filters as well as plugins - patch 4: new - patch 5: rewrite sh parser, fix testsuite to actually work and cover more cases (now that libnbd.git is fixed) Eric Blake (4): server: Add exports list functions server: Prepare to use export list from plugin log: Add
2020 Feb 22
1
Re: Plans for nbdkit 1.18 release?
....a9dffb56 100644 --- a/docs/nbdkit-filter.pod +++ b/docs/nbdkit-filter.pod @@ -127,22 +127,24 @@ which is required. =head1 NEXT PLUGIN F<nbdkit-filter.h> defines some function types (C<nbdkit_next_config>, -C<nbdkit_next_config_complete>, C<nbdkit_next_preconnect>, -C<nbdkit_next_open>) and a structure called C<struct nbdkit_next_ops>. -These abstract the next plugin or filter in the chain. There is also -an opaque pointer C<nxdata> which must be passed along when calling -these functions. The value of C<nxdata> passed to C<.open> has a -stable lifet...
2018 Dec 28
1
[PATCH nbdkit] common: Improve pseudo-random number generation.
...nbdkit_next_config *next, void *nxdata, " Apply settings only to read/write/trim/zero" struct handle { -#ifdef __GNU_LIBRARY__ - struct random_data rd; - char rd_state[32]; -#endif + struct random_state random_state; }; static void * error_open (nbdkit_next_open *next, void *nxdata, int readonly) { struct handle *h; - time_t t; if (next (nxdata, readonly) == -1) return NULL; @@ -242,11 +240,7 @@ error_open (nbdkit_next_open *next, void *nxdata, int readonly) nbdkit_error ("malloc: %m"); return NULL; } -#ifdef __GNU_LIB...