search for: plugin_functions

Displaying 20 results from an estimated 65 matches for "plugin_functions".

2019 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...*extents == NULL) { + *err = errno; + nbdkit_error ("calloc"); + return -1; + } + (*extents)[0].offset = offset; + (*extents)[0].length = count; + (*extents)[0].type = NBDKIT_EXTENT_TYPE_DATA; + *nr_extents = 1; + return 0; + } +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +740,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2018 Jan 17
0
[PATCH 4/9] backend: Add a .plugin_name method.
...struct backend *); void (*usage) (struct backend *); const char *(*version) (struct backend *); void (*dump_fields) (struct backend *); diff --git a/src/plugins.c b/src/plugins.c index 6a2ef66..f0fe864 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -465,6 +465,7 @@ static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, .name = plugin_name, + .plugin_name = plugin_name, .usage = plugin_usage, .version = plugin_version, .dump_fields = plugin_dump_fields, -- 2.15.1
2019 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...if (r == -1) + *err = get_error (p); + return r; + } + else { + /* By default we assume that everything in the range is allocated. */ + return nbdkit_extent_add (extents_map, offset, count, + NBDKIT_EXTENT_TYPE_DATA); + } +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +731,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2019 May 10
0
[nbdkit PATCH 1/9] server: Internal hooks for implementing NBD_CMD_CACHE
...ection_get_handle (conn, 0)); + assert (!flags); + + debug ("cache count=%" PRIu32 " offset=%" PRIu64, count, offset); + + /* FIXME: assert plugin->cache and call it */ + assert (false); + + if (r == -1) + *err = get_error (p); + return r; +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -717,12 +749,14 @@ static struct backend plugin_functions = { .can_extents = plugin_can_extents, .can_fua = plugin_can_fua, .can_multi_conn = plugin_can_multi_conn, + .can_cache = plugin_can_cache, .pread = plugin_p...
2019 Mar 13
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...t, + flags, extents_map); + if (r == -1) + *err = get_error (p); + return r; + } + else { + /* By default we assume that everything in the range is allocated. */ + return nbdkit_extent_add (extents_map, offset, count, 0); + } +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +730,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2018 Jan 17
2
Re: [PATCH 4/9] backend: Add a .plugin_name method.
...--- Just as .name and .plugin_name can differ for filters, should we also have a way to report independent version numbers (via .version) for the filter, compared to the version of the underlying plugin (via .plugin_version)? > +++ b/src/plugins.c > @@ -465,6 +465,7 @@ static struct backend plugin_functions = { > .free = plugin_free, > .thread_model = plugin_thread_model, > .name = plugin_name, > + .plugin_name = plugin_name, > .usage = plugin_usage, > .version = plugin_version, > .dump_fields = plugin_dump_fields, > -- Eric Blake, Principal Software Engin...
2019 Mar 26
0
[PATCH nbdkit v4 01/15] server: Implement extents/can_extents calls for plugins and filters.
...lags, extents); + if (r >= 0 && nbdkit_extents_count (extents) < 1) { + nbdkit_error ("extents: plugin must return at least one extent"); + nbdkit_set_error (EINVAL); + r = -1; + } + if (r == -1) + *err = get_error (p); + return r; +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +722,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2019 Mar 12
4
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
This tentative commit implements extents/can_extents, roughly as discussed in the previous thread here: https://www.redhat.com/archives/libguestfs/2019-March/msg00017.html I can't say that I'm a big fan of having the plugin allocate an extents array. There are no other plugin callbacks currently where we require the plugin to allocate complex data structures (or indeed do any allocation
2019 Mar 20
0
[PATCH nbdkit 1/8] server: Implement extents/can_extents calls for plugins and filters.
...return r; + } + else { + /* By default we assume that everything in the range is allocated. */ + errno = 0; + r = nbdkit_add_extent (extents, offset, count, 0 /* allocated data */); + if (r == -1) + *err = errno ? errno : EINVAL; + return r; + } +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +729,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2019 Mar 13
2
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
I'm not sure which version we're up to now. Anyway I believe this addresses all the points that Eric raised in: https://www.redhat.com/archives/libguestfs/2019-March/msg00038.html https://www.redhat.com/archives/libguestfs/2019-March/msg00040.html In particular: - default state of extents_map is all allocated disk - support hole + non-zero - you can now iterate with bounds -
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 01/19] server: Implement extents/can_extents calls for plugins and filters.
...lags, extents); + if (r >= 0 && nbdkit_extents_count (extents) < 1) { + nbdkit_error ("extents: plugin must return at least one extent"); + nbdkit_set_error (EINVAL); + r = -1; + } + if (r == -1) + *err = get_error (p); + return r; +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +722,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2019 Mar 12
2
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
Second version based on nbdkit_extent* calls, as discussed here: https://www.redhat.com/archives/libguestfs/2019-March/msg00033.html Note in particular there is some subtlety about how filters would work in this implementation. See docs/nbdkit-filter.pod for the details. Rich.
2019 Mar 19
0
[PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...*err = get_error (p); + return r; + } + else { + /* By default we assume that everything in the range is allocated. + * However as that is the default state for the empty extents_map + * we don't need to do anything here. + */ + return 0; + } +} + static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, @@ -672,6 +724,7 @@ static struct backend plugin_functions = { .is_rotational = plugin_is_rotational, .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, + .can_extents = plugin_can_extents, .can_fua = plugin_can...
2019 Aug 30
0
[nbdkit PATCH 2/9] server: Consolidate common backend tasks into new backend.c
...LL); - debug ("%s: open readonly=%d", p->name, readonly); + debug ("%s: open readonly=%d", b->name, readonly); handle = p->plugin.open (readonly); if (!handle) @@ -744,7 +724,6 @@ plugin_cache (struct backend *b, struct connection *conn, static struct backend plugin_functions = { .free = plugin_free, .thread_model = plugin_thread_model, - .name = plugin_name, .plugin_name = plugin_name, .usage = plugin_usage, .version = plugin_version, @@ -782,23 +761,16 @@ plugin_register (size_t index, const char *filename, { struct backend_plugin *p; const stru...
2019 Jan 04
0
[PATCH nbdkit 1/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
...(p->plugin.can_multi_conn) + return p->plugin.can_multi_conn (connection_get_handle (conn, 0)); + else + return 0; /* assume false */ +} + /* Plugins and filters can call this to set the true errno, in cases * where !errno_is_preserved. */ @@ -656,6 +672,7 @@ static struct backend plugin_functions = { .can_trim = plugin_can_trim, .can_zero = plugin_can_zero, .can_fua = plugin_can_fua, + .can_multi_conn = plugin_can_multi_conn, .pread = plugin_pread, .pwrite = plugin_pwrite, .flush = plugin_flush, diff --git a/tests/test-layers-filter.c b/tests/test-layers-filter.c index c5...
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...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 = plugin_open, .prepare = plugin_prepare, .finalize = plugin_finalize, diff --git a/tests/test-layers-filter.c b/t...
2018 Jan 17
0
[PATCH 7/9] Implement filters.
...ame) printf (" (%s)", p->plugin.longname); printf ("\n"); + printf ("(%s)", p->filename); if (p->plugin.description) { printf ("\n"); printf ("%s\n", p->plugin.description); @@ -489,7 +490,7 @@ static struct backend plugin_functions = { /* Register and load a plugin. */ struct backend * -plugin_register (const char *filename, +plugin_register (size_t index, const char *filename, void *dl, struct nbdkit_plugin *(*plugin_init) (void)) { struct backend_plugin *p; @@ -504,11 +505,13 @@ plugin_register (co...
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...en, this copies + // can_flush, since that's how we emulate FUA + return plugin_can_flush (b, conn); +} + static int plugin_pread (struct backend *b, struct connection *conn, void *buf, uint32_t count, uint64_t offset, uint32_t flags) @@ -535,6 +555,8 @@ static struct backend plugin_functions = { .flush = plugin_flush, .trim = plugin_trim, .zero = plugin_zero, + .can_zero = plugin_can_zero, + .can_fua = plugin_can_fua, }; /* Register and load a plugin. */ -- 2.14.3
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...+ result = p->plugin.pwrite (connection_get_handle (conn), + buf, limit, offset); if (result < 0) break; count -= limit; @@ -538,3 +462,134 @@ plugin_zero (struct connection *conn, errno = err; return result; } + +static struct backend plugin_functions = { + .free = plugin_free, + .thread_model = plugin_thread_model, + .name = plugin_name, + .usage = plugin_usage, + .version = plugin_version, + .dump_fields = plugin_dump_fields, + .config = plugin_config, + .config_complete = plugin_config_complete, + .errno_is_preserved = plugin_errno_i...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...+ result = p->plugin.pwrite (connection_get_handle (conn), + buf, limit, offset); if (result < 0) break; count -= limit; @@ -538,3 +460,134 @@ plugin_zero (struct connection *conn, errno = err; return result; } + +static struct backend plugin_functions = { + .free = plugin_free, + .thread_model = plugin_thread_model, + .name = plugin_name, + .usage = plugin_usage, + .version = plugin_version, + .dump_fields = plugin_dump_fields, + .config = plugin_config, + .config_complete = plugin_config_complete, + .errno_is_preserved = plugin_errno_i...