search for: plugin_open

Displaying 20 results from an estimated 60 matches for "plugin_open".

2020 Jul 22
1
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
On Tue, Jul 21, 2020 at 07:41:21PM -0500, Eric Blake wrote: > On 7/21/20 3:47 PM, Richard W.M. Jones wrote: > >+++ b/server/plugins.c > >@@ -278,12 +278,30 @@ plugin_preconnect (struct backend *b, int readonly) > > } > > static void * > >-plugin_open (struct backend *b, int readonly) > >+plugin_open (struct backend *b, int readonly, const char *exportname) > > { > >+ GET_CONN; > > struct backend_plugin *p = container_of (b, struct backend_plugin, backend); > > assert (p->plugin.open != NULL); > >+...
2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...} else { + error "unknown parameter $key=$value" + } +} + +# Check the file parameter was passed. +proc config_complete {} { + global file + + if { ![info exists file] } { + error "file parameter missing" + } +} + +# Open a new client connection. +proc plugin_open {readonly} { + global file + + # Open the file. + if { $readonly } { + set flags "r" + } else { + set flags "r+" + } + set fh [open $file $flags] + + # Stop Tcl from trying to convert to and from UTF-8. + fconfigure $fh -translation binary +...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...L; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) == -1) + if (backend->open (backend, conn, readonly) == -1) goto done; - threadlocal_set_name (plugin_name ()); + threadlocal_set_name (backend->name (backend)); /* Handshake. */ if (negotiate_handshake (conn) == -1) @@ -251,7 +252,8 @@ _handle_single_connec...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...L; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) == -1) + if (backend->open (backend, conn, readonly) == -1) goto done; - threadlocal_set_name (plugin_name ()); + threadlocal_set_name (backend->name (backend)); /* Handshake. */ if (negotiate_handshake (conn) == -1) @@ -251,7 +252,8 @@ _handle_single_connec...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...L; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) == -1) + if (backend->open (backend, conn, readonly) == -1) goto done; - threadlocal_set_name (plugin_name ()); + threadlocal_set_name (backend->name (backend)); /* Handshake. */ if (negotiate_handshake (conn) == -1) @@ -251,7 +252,8 @@ _handle_single_connec...
2016 Sep 27
1
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...t_ lock any other calls into the plugin. Due to that, the following calls are neither locked against each other nor are they locked against client requests: plugin_register (const char *_filename, plugin_cleanup (void) plugin_config (const char *key, const char *value) plugin_config_complete (void) plugin_open (struct connection *conn, int readonly) plugin_close (struct connection *conn) plugin_get_size (struct connection *conn) plugin_can_write (struct connection *conn) plugin_can_flush (struct connection *conn) plugin_is_rotational (struct connection *conn) plugin_can_trim (struct connection *conn) Th...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are called. This patch is in preparation for adding a second backend subtype for filters. Rich.
2020 Jul 21
4
[PATCH nbdkit] server: Pass the export name through filter .open calls.
...e) == -1) handle = NULL; else handle = NBDKIT_HANDLE_NOT_NEEDED; diff --git a/server/plugins.c b/server/plugins.c index 285569bb..8449b1d9 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -278,12 +278,30 @@ plugin_preconnect (struct backend *b, int readonly) } static void * -plugin_open (struct backend *b, int readonly) +plugin_open (struct backend *b, int readonly, const char *exportname) { + GET_CONN; struct backend_plugin *p = container_of (b, struct backend_plugin, backend); assert (p->plugin.open != NULL); + /* Save the exportname since the lifetime of the str...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...on *conn); extern void connection_set_crypto_session (struct connection *conn, void *session); extern void *connection_get_crypto_session (struct connection *conn); diff --git a/src/plugins.c b/src/plugins.c index f0fe864..e732587 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -238,7 +238,7 @@ plugin_open (struct backend *b, struct connection *conn, int readonly) struct backend_plugin *p = container_of (b, struct backend_plugin, backend); void *handle; - assert (connection_get_handle (conn) == NULL); + assert (connection_get_handle (conn, 0) == NULL); assert (p->plugin.open != NULL);...
2020 Jul 22
0
Re: [PATCH nbdkit] server: Pass the export name through filter .open calls.
...n; > > + char *exportname_from_set_meta_context; > + char *exportname; Interesting switch from array to pointer, but it should work. > +++ b/server/plugins.c > @@ -278,12 +278,30 @@ plugin_preconnect (struct backend *b, int readonly) > } > > static void * > -plugin_open (struct backend *b, int readonly) > +plugin_open (struct backend *b, int readonly, const char *exportname) > { > + GET_CONN; > struct backend_plugin *p = container_of (b, struct backend_plugin, backend); > > assert (p->plugin.open != NULL); > > + /* Save...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...on *conn); extern void connection_set_crypto_session (struct connection *conn, void *session); extern void *connection_get_crypto_session (struct connection *conn); diff --git a/src/plugins.c b/src/plugins.c index 4442a50..137bae3 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -238,7 +238,7 @@ plugin_open (struct backend *b, struct connection *conn, int readonly) struct backend_plugin *p = container_of (b, struct backend_plugin, backend); void *handle; - assert (connection_get_handle (conn) == NULL); + assert (connection_get_handle (conn, 0) == NULL); assert (p->plugin.open != NULL);...
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...t backend *b) +{ + struct backend_plugin *p = container_of (b, struct backend_plugin, backend); + + debug ("%s: ready_to_serve", b->name); + + if (!p->plugin.ready_to_serve) + return; + + if (p->plugin.ready_to_serve () == -1) + exit (EXIT_FAILURE); +} + static void * plugin_open (struct backend *b, struct connection *conn, int readonly) { @@ -656,6 +671,7 @@ static struct backend plugin_functions = { .config = plugin_config, .config_complete = plugin_config_complete, .magic_config_key = plugin_magic_config_key, + .ready_to_serve = plugin_ready_to_serve, .open...
2017 Feb 06
0
[PATCH 1/2] Define .errno_is_preserved constant instead of a .errno_is_reliable callback.
...ockout); @@ -141,10 +140,10 @@ extern void plugin_lock_connection (void); extern void plugin_unlock_connection (void); extern void plugin_lock_request (struct connection *conn); extern void plugin_unlock_request (struct connection *conn); +extern int plugin_errno_is_preserved (void); extern int plugin_open (struct connection *conn, int readonly); extern void plugin_close (struct connection *conn); extern int64_t plugin_get_size (struct connection *conn); -extern int plugin_errno_is_reliable (struct connection *conn); extern int plugin_can_write (struct connection *conn); extern int plugin_can_flu...
2020 Aug 07
0
[nbdkit PATCH 1/3] server: Implement nbdkit_is_tls for use during .open
...nanosleep; nbdkit_parse_bool; nbdkit_parse_int8_t; diff --git a/server/plugins.c b/server/plugins.c index d4364cd2..bc57623a 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -292,7 +292,8 @@ plugin_list_exports (struct backend *b, int readonly, int default_only, } static void * -plugin_open (struct backend *b, int readonly, const char *exportname) +plugin_open (struct backend *b, int readonly, const char *exportname, + int is_tls) { GET_CONN; struct backend_plugin *p = container_of (b, struct backend_plugin, backend); @@ -302,11 +303,14 @@ plugin_open (struct backen...
2001 Mar 03
1
libao: alsa plugin won't compile
...\" -DVERSION=\"0.6.0\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_SYS_SOUNDCARD_H=1 -I. -I. -I../../.. -I../../../include -O20 -ffast-math -D_REENTRANT -fsigned-char -DAO_PLUGIN_PATH=\"/usr/lib/ao\" -c ao_alsa.c -fPIC -DPIC -o ao_alsa.lo ao_alsa.c: In function `plugin_open': ao_alsa.c:86: `snd_pcm_channel_params_t' undeclared (first use in this function) ao_alsa.c:86: (Each undeclared identifier is reported only once ao_alsa.c:86: for each function it appears in.) ao_alsa.c:86: parse error before `param' ao_alsa.c:89: `param' undeclared (first use in...
2017 Feb 06
3
[PATCH nbdkit 0/2] Change .errno_is_reliable function to .errno_is_preserved constant.
See patch 1 for rationale.
2019 Aug 30
0
[nbdkit PATCH v2 2/2] server: Remember .open(readonly) status
...rn 0; } else - return b->next->open (b->next, conn, readonly); + return backend_open (b->next, conn, readonly); } static void diff --git a/server/plugins.c b/server/plugins.c index 1dec4008..1c4b5f50 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -241,8 +241,6 @@ plugin_open (struct backend *b, struct connection *conn, int readonly) assert (connection_get_handle (conn, 0) == NULL); assert (p->plugin.open != NULL); - debug ("%s: open readonly=%d", b->name, readonly); - handle = p->plugin.open (readonly); if (!handle) return -1; --...
2020 Aug 25
0
[nbdkit PATCH 1/5] api: Add .default_export
...* +plugin_default_export (struct backend *b, int readonly, int is_tls) +{ + struct backend_plugin *p = container_of (b, struct backend_plugin, backend); + + if (!p->plugin.default_export) + return ""; + + return p->plugin.default_export (readonly, is_tls); +} + static void * plugin_open (struct backend *b, int readonly, const char *exportname, int is_tls) @@ -757,6 +772,7 @@ static struct backend plugin_functions = { .after_fork = plugin_after_fork, .preconnect = plugin_preconnect, .list_exports = plugin_list_exports, + .default_export = plugin_default_expo...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...id plugin_lock_connection (void); -extern void plugin_unlock_connection (void); -extern void plugin_lock_request (struct connection *conn); -extern void plugin_unlock_request (struct connection *conn); -extern bool plugin_is_parallel (void); extern int plugin_errno_is_preserved (void); extern int plugin_open (struct connection *conn, int readonly); extern void plugin_close (struct connection *conn); @@ -169,6 +165,14 @@ extern int plugin_flush (struct connection *conn); extern int plugin_trim (struct connection *conn, uint32_t count, uint64_t offset); extern int plugin_zero (struct connection *conn,...