search for: nbdkit_register_plugin

Displaying 20 results from an estimated 105 matches for "nbdkit_register_plugin".

2019 Aug 02
0
[nbdkit PATCH v2 10/17] plugins: Add .fork_safe field
...pected fds between fork and exec). On platforms where +this is 0 and nbdkit cannot atomically set C<FD_CLOEXEC>, the thread +model will be restricted to +C<NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS> to avoid leaking file +descriptors. + =back =head1 THREADS @@ -942,8 +954,9 @@ C<NBDKIT_REGISTER_PLUGIN>). Additionally, a plugin may implement the C<.thread_model> callback, called right after C<.config_complete> to make a runtime decision on which thread model to use. The nbdkit server chooses the most restrictive model between the plugin's -C<THREAD_MODEL>, the C<....
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 02
23
[nbdkit PATCH v2 00/17] fd leak safety
This is a major rewrite compared to my v1 series, where I've tried a lot harder to ensure that we still accommodate building on Haiku (although I have not actually yet fired up a Haiku VM to try it for myself). I also managed to make the sh plugin fully parallel, on capable platforms. See also my question on patch 10 on whether I've picked the best naming convention. Eric Blake (17):
2017 Jan 27
0
[nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins
...Red Hat Inc. + * Copyright (C) 2013-2017 Red Hat Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,10 +47,19 @@ #define NBDKIT_API_VERSION 1 struct nbdkit_plugin { + /* Do not set these fields directly; use NBDKIT_REGISTER_PLUGIN. + * They exist so that we can support plugins compiled against + * one version of the header with a runtime compiled against a + * different version with more (or fewer) fields. + */ uint64_t _struct_size; int _api_version; int _thread_model; + /* Plugins are responsible for the...
2017 Feb 06
0
[PATCH 1/2] Define .errno_is_preserved constant instead of a .errno_is_reliable callback.
...SET(flush) SET(trim) -/* We can't guarantee that errno is stable across language binding - * glue code, so this callback is implemented in C only, and not - * exposed in OCaml. - */ -static int -plugin_ocaml_errno_is_reliable (void *handle) -{ - return 0; -} - /* We can't directly use NBDKIT_REGISTER_PLUGIN(). */ struct nbdkit_plugin * plugin_init (void) @@ -517,6 +507,5 @@ plugin_init (void) fprintf (stderr, "error: OCaml code did not call NBDKit.register_plugin\n"); exit (EXIT_FAILURE); } - plugin.errno_is_reliable = plugin_ocaml_errno_is_reliable; return &plugin; }...
2019 May 20
0
[nbdkit PATCH 1/2] plugins: Add .thread_model callback
...=head2 C<.open> void *open (int readonly); @@ -898,9 +917,14 @@ error message, and C<nbdkit_set_error> to record an appropriate error =head1 THREADS -Each nbdkit plugin must declare its thread safety model by defining -the C<THREAD_MODEL> macro. (This macro is used by -C<NBDKIT_REGISTER_PLUGIN>). +Each nbdkit plugin must declare its maximum thread safety model by +defining the C<THREAD_MODEL> macro. (This macro is used by +C<NBDKIT_REGISTER_PLUGIN>). Additionally, a plugin may implement the +C<.thread_model> callback, called right after C<.config_complete> to...
2018 Jan 19
1
Re: [PATCH nbdkit filters-v2 2/5] Introduce filters.
...not the other in a given nbdkit release (and if so, it makes for our next release to have PLUGIN version 2 but FILTER version 1, once filters and FUA flags settle, where the highest version in each file shares the same backend semantics). Does it ever make sense for a single .so file to call both NBDKIT_REGISTER_PLUGIN() and NBDKIT_REGISTER_FILTER() in the same library? If not, one benefit of having the common code in a separate nbdkit-common.h is that we could do things like: nbdkit-common.h: #if !defined NBDKIT_PLUGIN_H || !defined NBDKIT_FILTER_H #error this file should not be directly included #endif nbdki...
2019 Jan 18
1
Re: [PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...using 0 is strictly portable, so I'm fine with it. > + "ansic", > + 0, > + PACKAGE_VERSION, > + 0, > + ansi_c_load, > + 0, > + 0, 0, 0, > + ansi_c_open, > + 0, > + ansi_c_get_size, > + 0, 0, 0, 0, > + ansi_c_pread > +}; > + > +NBDKIT_REGISTER_PLUGIN(plugin) > +++ b/tests/Makefile.am > > +# This builds a plugin using an ANSI (ISO C90) compiler to ensure that > +# the header file is compatible. The plugin does nothing very > +# interesting, it's mainly a compile test. > +TESTS += \ > + test-ansi-c.sh > +# check_L...
2018 Mar 08
0
[nbdkit PATCH v3 15/15] RFC: plugins: Add back-compat for new plugin with old nbdkit
...== 1 int (*_unused1) (void *, void *, uint32_t, uint64_t); int (*_unused2) (void *, const void *, uint32_t, uint64_t, uint32_t); int (*_unused3) (void *, uint32_t); @@ -125,6 +129,7 @@ struct nbdkit_plugin { extern void nbdkit_set_error (int err); +#if NBDKIT_PLUGIN_LEVEL == 1 #define NBDKIT_REGISTER_PLUGIN(plugin) \ NBDKIT_CXX_LANG_C \ struct nbdkit_plugin * \ @@ -136,6 +141,58 @@ extern void nbdkit_set_error (int err); return &(plugin);...
2020 Mar 23
0
[PATCH nbdkit 1/3] include: Function indirection for PE DLL
...4 @@ struct nbdkit_plugin { int (*get_ready) (void); }; +#if defined(NBDKIT_INTERNAL) || !defined(WINDOWS_COMPAT) extern void nbdkit_set_error (int err); +#else +static void nbdkit_set_error (int err) +{ + _nbdkit_functions.set_error (err); +} +#endif +#if defined(WINDOWS_COMPAT) +#define NBDKIT_REGISTER_PLUGIN(plugin) \ + NBDKIT_CXX_LANG_C __declspec(dllexport) \ + struct nbdkit_plugin * \ + plugin_init (void) \ + {...
2019 May 20
3
[nbdkit PATCH 0/2] More on .thread_model
Rich pointed out that making thread_model dynamic even for plugins makes some sense, so here is the code for doing it for 'sh'. I'm less confident on how to do it for OCaml and Rust (not to mention that those allow the plugin to already compile in their model, rather than the language binding glue forcing a model). The other languages (lua, perl, python, ruby) still need to be
2017 Jan 27
6
[nbdkit PATCH v3 0/4] bind .zero to Python
This cleans up the existing code base with regards to implicit use of errno from language bindings, then rebases the previous work in python on top of that. I'm still playing with the perl bindings, but got further after reading 'perldoc perlembed'. Eric Blake (4): plugins: Don't use bogus errno from non-C plugins plugins: Add new nbdkit_set_error() utility function python:
2019 Nov 22
0
[PATCH nbdkit v2 06/10] python: Implement cache.
...n 0; +} + static int boolean_callback (void *handle, const char *can_fn, const char *plain_fn) { @@ -768,6 +801,7 @@ static struct nbdkit_plugin plugin = { .flush = py_flush, .trim = py_trim, .zero = py_zero, + .cache = py_cache, }; NBDKIT_REGISTER_PLUGIN (plugin) -- 2.23.0
2019 Nov 21
0
[PATCH nbdkit 6/8] python: Implement cache, can_cache.
...y_can_flush, .can_trim = py_can_trim, + .can_cache = py_can_cache, .pread = py_pread, .pwrite = py_pwrite, .flush = py_flush, .trim = py_trim, .zero = py_zero, + .cache = py_cache, }; NBDKIT_REGISTER_PLUGIN (plugin) -- 2.23.0
2017 Feb 01
0
[PATCH] Really fix C++ support in the <nbdkit-plugin.h> header file (RHBZ#1418328).
...rn void nbdkit_vdebug (const char *msg, va_list args); extern char *nbdkit_absolute_path (const char *path); extern int64_t nbdkit_parse_size (const char *str); +#ifdef __cplusplus +#define NBDKIT_CXX_LANG_C extern "C" +#else +#define NBDKIT_CXX_LANG_C /* nothing */ +#endif + #define NBDKIT_REGISTER_PLUGIN(plugin) \ + NBDKIT_CXX_LANG_C \ struct nbdkit_plugin * \ plugin_init (void) \ {...
2017 Feb 01
1
[PATCH nbdkit v2] Really fix C++ support in the <nbdkit-plugin.h>
This version uses Eric's subtype suggestion: https://bugzilla.redhat.com/show_bug.cgi?id=1418328#c6 Rich.
2017 Feb 01
1
[PATCH nbdkit v3] Really fix C++ support in the <nbdkit-plugin.h>
This version uses a static initializer function (https://bugzilla.redhat.com/show_bug.cgi?id=1418328#c9). Rich.
2019 Aug 02
1
[nbdkit PATCH] server: Restrict thread model when no atomic CLOEXEC
...test-parallel-file.sh | 3 +++ tests/test-parallel-nbd.sh | 5 ++++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod index fe9ada87..9510253f 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -942,8 +942,16 @@ C<NBDKIT_REGISTER_PLUGIN>). Additionally, a plugin may implement the C<.thread_model> callback, called right after C<.config_complete> to make a runtime decision on which thread model to use. The nbdkit server chooses the most restrictive model between the plugin's -C<THREAD_MODEL>, the C<....
2019 Aug 02
0
[nbdkit PATCH v2 14/17] sh: Use pipe2 with CLOEXEC when possible
...61,9 @@ static struct nbdkit_plugin plugin = { .cache = sh_cache, .errno_is_preserved = 1, - .fork_safe = 0, /* use of fork() is not yet safe from fd leaks */ +#ifdef HAVE_PIPE2 + .fork_safe = 1, /* use of fork() is only safe with atomic CLOEXEC */ +#endif }; NBDKIT_REGISTER_PLUGIN(plugin) -- 2.20.1
2017 Jan 24
4
[nbdkit PATCH 0/2] bind .zero to more languages
Begin the language binding followups to my new .zero callback, since Rich was indeed correct that we want them. I'm more familiar with python and perl (at least to the point that I was able to modify the appropriate example files and prove to myself that the bindings worked), so I've started with those. I'm less familiar with ruby and ocaml, so I've left those for tomorrow (it