Displaying 20 results from an estimated 29 matches for "plugin_free".
2018 Jul 01
2
[PATCH nbdkit] valgrind: Don't call dlclose when running under valgrind.
When valgrinding plugins, the following sequence can happen:
plugin_free
-> dlclose
-> unloads the plugin and symbol table
exit
-> valgrind prints failures
(the same applies to filters). When valgrind is printing the
failures, it looks up the addresses in the symbol table, but that has
been unloaded already so all you see are "???", res...
2018 Jan 17
0
[PATCH 4/9] backend: Add a .plugin_name method.
...ge) (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
2018 Jan 17
2
Re: [PATCH 4/9] backend: Add a .plugin_name method.
...an 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 Engineer
Red Hat, Inc. +1-9...
2019 Aug 30
0
[nbdkit PATCH 2/9] server: Consolidate common backend tasks into new backend.c
...index 34cc3cb5..0f70ede0 100644
--- a/server/plugins.c
+++ b/server/plugins.c
@@ -54,9 +54,6 @@
*/
struct backend_plugin {
struct backend backend;
- char *name; /* copy of plugin.name */
- char *filename;
- void *dl;
struct nbdkit_plugin plugin;
};
@@ -65,22 +62,7 @@ plugin_free (struct backend *b)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
- /* Acquiring this lock prevents any plugin callbacks from running
- * simultaneously.
- */
- lock_unload ();
-
- debug ("%s: unload", p->name);
- if (p->plugin.unload)
-...
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.
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...dl;
-static struct nbdkit_plugin plugin;
-
-void
-plugin_register (const char *_filename,
- void *_dl, struct nbdkit_plugin *(*plugin_init) (void))
+struct backend_plugin {
+ struct backend backend;
+ char *filename;
+ void *dl;
+ struct nbdkit_plugin plugin;
+};
+
+static void
+plugin_free (struct backend *b)
{
- const struct nbdkit_plugin *_plugin;
- size_t i, len, size;
-
- filename = strdup (_filename);
- if (filename == NULL) {
- perror ("strdup");
- exit (EXIT_FAILURE);
- }
- dl = _dl;
-
- debug ("registering %s", filename);
-
- /* Call the ini...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...dl;
-static struct nbdkit_plugin plugin;
-
-void
-plugin_register (const char *_filename,
- void *_dl, struct nbdkit_plugin *(*plugin_init) (void))
+struct backend_plugin {
+ struct backend backend;
+ char *filename;
+ void *dl;
+ struct nbdkit_plugin plugin;
+};
+
+static void
+plugin_free (struct backend *b)
{
- const struct nbdkit_plugin *_plugin;
- size_t i, len, size;
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
- filename = strdup (_filename);
- if (filename == NULL) {
- perror ("strdup");
- exit (EXIT_FAILURE);
- }
- d...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...dl;
-static struct nbdkit_plugin plugin;
-
-void
-plugin_register (const char *_filename,
- void *_dl, struct nbdkit_plugin *(*plugin_init) (void))
+struct backend_plugin {
+ struct backend backend;
+ char *filename;
+ void *dl;
+ struct nbdkit_plugin plugin;
+};
+
+static void
+plugin_free (struct backend *b)
{
- const struct nbdkit_plugin *_plugin;
- size_t i, len, size;
-
- filename = strdup (_filename);
- if (filename == NULL) {
- perror ("strdup");
- exit (EXIT_FAILURE);
- }
- dl = _dl;
-
- debug ("registering %s", filename);
-
- /* Call the ini...
2019 May 10
0
[nbdkit PATCH 1/9] server: Internal hooks for implementing NBD_CMD_CACHE
...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_pread,
.pwrite = plugin_p...
2019 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...= 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_fua,
.can_multi_conn =...
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 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...et_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_fua,
.can_multi_conn =...
2019 Mar 13
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...lags, 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_fua,
.can_multi_conn =...
2019 Mar 26
0
[PATCH nbdkit v4 01/15] server: Implement extents/can_extents calls for plugins and filters.
...&& 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_fua,
.can_multi_conn =...
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.
.../* 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_fua,
.can_multi_conn =...
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.
...&& 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_fua,
.can_multi_conn =...
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.
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 --