search for: _struct_size

Displaying 20 results from an estimated 37 matches for "_struct_size".

Did you mean: struct_size
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...ed against an older nbdkit needs to be aware of any new entry points (and other upcoming changes, such as adding FUA flag support); conversely, a filter compiled against a newer nbdkit is liable to try to use new pointers in nbdkit_next_ops that are not part of the current nbdkit, and while we have _struct_size to protect what we call in the filter, we do not have a similar mechanism to protect what the filter can call back in our code. As such, this patch can keep the public interface logically grouped by inserting members in the middle of the struct, rather than worrying about having to stick additions...
2018 Jan 24
8
[nbdkit PATCH 0/3] Add nozero filter
I still need to add testsuite coverage. Perhaps it might be easier if I create a new '--filter=log logfile=foo' filter that produces a log of which commands a client sent, then compare the log using a known client that uses write_zeroes (qemu-io works well) both with and without --filter=nozero to prove that the change in advertisement changes the commands sent over the wire (that would
2019 Jun 11
3
[nbdkit PATCH 0/2] Few rust plugin fixups/nitpicks
There are few more things that could be cleaned up related to the coding style and other things, like explicitly specifying the abi style after "extern" (i.e. `extern "C" fn` instead of `extern fn`), but since those are configurable in rustfmt config, I'm not sure whether the config needs to be added or complying with the defaults should be the priority. But this was just
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...s: plugin is incompatible with this version of nbdkit (_api_version = %d)\n", - program_name, filename, _plugin->_api_version); - exit (EXIT_FAILURE); - } - - /* Since the plugin might be much older than the current version of - * nbdkit, only copy up to the self-declared _struct_size of the - * plugin and zero out the rest. If the plugin is much newer then - * we'll only call the "old" fields. - */ - size = sizeof plugin; /* our struct */ - memset (&plugin, 0, size); - if (size > _plugin->_struct_size) - size = _plugin->_struct_si...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...e, filename, _plugin->_api_version); - exit (EXIT_FAILURE); - } + debug ("%s: unload", p->filename); + if (p->plugin.unload) + p->plugin.unload (); - /* Since the plugin might be much older than the current version of - * nbdkit, only copy up to the self-declared _struct_size of the - * plugin and zero out the rest. If the plugin is much newer then - * we'll only call the "old" fields. - */ - size = sizeof plugin; /* our struct */ - memset (&plugin, 0, size); - if (size > _plugin->_struct_size) - size = _plugin->_struct_si...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...;, - program_name, filename, _plugin->_api_version); - exit (EXIT_FAILURE); - } + struct backend_plugin *p = container_of (b, struct backend_plugin, backend); - /* Since the plugin might be much older than the current version of - * nbdkit, only copy up to the self-declared _struct_size of the - * plugin and zero out the rest. If the plugin is much newer then - * we'll only call the "old" fields. + /* Acquiring this lock prevents any plugin callbacks from running + * simultaneously. */ - size = sizeof plugin; /* our struct */ - memset (&plug...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2019 Aug 16
0
[nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...ib.rs b/plugins/rust/src/lib.rs index 25af2fe6..e369ecbe 100644 --- a/plugins/rust/src/lib.rs +++ b/plugins/rust/src/lib.rs @@ -36,6 +36,7 @@ use std::os::raw::{c_char, c_int, c_void}; // function must return. #[repr(C)] pub struct Plugin { + // Do not modify these three fields directly. _struct_size: u64, _api_version: c_int, _thread_model: c_int, @@ -102,8 +103,11 @@ pub struct Plugin { pub cache: Option<extern fn (h: *mut c_void, count: u32, offset: u64, flags: u32) -> c_int>, + + pub thread_model:...
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.
2019 Aug 16
1
Re: [nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...af2fe6..e369ecbe 100644 > --- a/plugins/rust/src/lib.rs > +++ b/plugins/rust/src/lib.rs > @@ -36,6 +36,7 @@ use std::os::raw::{c_char, c_int, c_void}; > // function must return. > #[repr(C)] > pub struct Plugin { > + // Do not modify these three fields directly. > _struct_size: u64, > _api_version: c_int, > _thread_model: c_int, > @@ -102,8 +103,11 @@ pub struct Plugin { > pub cache: Option<extern fn (h: *mut c_void, > count: u32, offset: u64, > flags: u32) -> c_int...
2019 Aug 16
7
[nbdkit PATCH 0/2] rust: Implement some missing v2 callbacks
Similar to what I just did for OCaml (this IS an API break, requiring recompilation of any existing Rust plugin), and done because I want to add fast_zero support to both languages as part of my upcoming fast zero series. Figuring out how to get extents working was hard enough that I punted that, still. Eric Blake (2): rust: Implement can_cache rust: Add support for dynamic .thread_model
2018 Jan 24
0
Re: [nbdkit PATCH 0/3] Add nozero filter
...no sizing limits in the other > direction to prevent a newer filter to know that it cannot call > beyond the end of our smaller nbdkit_next_ops. Hmm, yes, this is a good point that I didn't think about. Probably we're going to have to forget about the filter._api_version and filter._struct_size fields and instead encode the version of nbdkit it was compiled against and check that rigorously. It seems like maintaining a filter ABI is hopeless. Rich. > Eric Blake (3): > connections: Don't advertise TRIM on readonly connection > filter: Add .can_zero/.can_fua overrides &g...
2018 Jan 16
2
[nbdkit] Proposed (new) filter API
..._trim); }; struct nbdkit_filter { /* Do not set these fields directly; use NBDKIT_REGISTER_FILTER. * They exist so that we can support filters 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; /* New fields will only be added at the end of the struct. */ const char *name; const char *longname; const char *version; const char *description; void (*load) (void); void (*unload) (void); int (*config) (nbdkit_next_config *next, void *nxdata,...
2018 Jan 17
0
[PATCH 7/9] Implement filters.
...lter is incompatible with this version of nbdkit (_api_version = %d)\n", + program_name, f->filename, filter->_api_version); + exit (EXIT_FAILURE); + } + + /* Since the filter might be much older than the current version of + * nbdkit, only copy up to the self-declared _struct_size of the + * filter and zero out the rest. If the filter is much newer then + * we'll only call the "old" fields. + */ + size = sizeof f->filter; /* our struct */ + memset (&f->filter, 0, size); + if (size > filter->_struct_size) + size = filter->_st...
2018 Jan 16
0
Re: [nbdkit] Proposed (new) filter API
...er { > /* Do not set these fields directly; use NBDKIT_REGISTER_FILTER. > * They exist so that we can support filters 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; > > /* New fields will only be added at the end of the struct. */ > const char *name; > const char *longname; > const char *version; > const char *description; > > void (*load) (void); > void (*unload) (void); > > int (*c...
2018 Jan 17
14
[PATCH 0/9] Add filters to nbdkit.
The first three patches are identical to: https://www.redhat.com/archives/libguestfs/2018-January/msg00079.html "[PATCH nbdkit v2 0/3] Refactor plugin_* functions into a backend" The rest of the patches add filters using the new filter API previously described here: https://www.redhat.com/archives/libguestfs/2018-January/msg00073.html This needs a lot more testing -- and tests --
2019 Feb 08
0
[PATCH nbdkit] Add support for writing plugins in Rust.
...+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + +extern crate libc; + +use libc::*; +use std::os::raw::c_int; +use std::mem; + +// This struct describes the plugin ABI which your plugin_init() +// function must return. +#[repr(C)] +pub struct Plugin { + _struct_size: uint64_t, + _api_version: c_int, + _thread_model: c_int, + + pub name: *const c_char, + pub longname: *const c_char, + pub version: *const c_char, + pub description: *const c_char, + + pub load: Option<extern fn ()>, + pub unload: Option<extern fn ()>, + + pu...
2018 Jan 19
0
[PATCH nbdkit filters-v2 2/5] Introduce filters.
...}; + +struct nbdkit_filter { + /* Do not set these fields directly; use NBDKIT_REGISTER_FILTER. + * They exist so that we can support filters 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; + + /* New fields will only be added at the end of the struct. */ + const char *name; + const char *longname; + const char *version; + const char *description; + + void (*load) (void); + void (*unload) (void); + + int (*config) (nbdkit_next_config *next, void *nxdata,...
2018 Jan 19
0
[PATCH nbdkit filters-v3 3/7] Introduce filters.
...}; + +struct nbdkit_filter { + /* Do not set these fields directly; use NBDKIT_REGISTER_FILTER. + * They exist so that we can support filters 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; + + /* New fields will only be added at the end of the struct. */ + const char *name; + const char *longname; + const char *version; + const char *description; + + void (*load) (void); + void (*unload) (void); + + int (*limit_thread_model) (void); + + int (*config) (n...
2019 Aug 15
2
[nbdkit PATCH] ocaml: Add support for dynamic .thread_model
...or lock in OCaml, callbacks are never truly concurrent. diff --git a/plugins/ocaml/ocaml.c b/plugins/ocaml/ocaml.c index f664a7fb..01f4448f 100644 --- a/plugins/ocaml/ocaml.c +++ b/plugins/ocaml/ocaml.c @@ -72,6 +72,7 @@ static void remove_roots (void); static struct nbdkit_plugin plugin = { ._struct_size = sizeof (plugin), ._api_version = NBDKIT_API_VERSION, + ._thread_model = NBDKIT_THREAD_MODEL_PARALLEL, /* The following field is used as a canary to detect whether the * OCaml code started up and called us back successfully. If it's @@ -131,6 +132,8 @@ static value extents_fn; st...