Displaying 20 results from an estimated 40 matches for "filter_prepare".
2018 Aug 01
0
[PATCH v2 nbdkit 1/6] filters: Call all .prepare and .finalize methods, not just the first one.
...filters when you layer multiple filters in
front of a plugin.
---
src/filters.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/filters.c b/src/filters.c
index 18948bc..67f06d6 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -367,10 +367,17 @@ filter_prepare (struct backend *b, struct connection *conn)
debug ("prepare");
- if (f->filter.prepare)
- return f->filter.prepare (&next_ops, &nxdata, handle);
- else
- return f->backend.next->prepare (f->backend.next, conn);
+ /* Call these in order starting from...
2019 Oct 03
0
[nbdkit PATCH 4/4] server: Better documentation of .open ordering
...lter *f = container_of (b, struct backend_filter, backend);
void *handle = connection_get_handle (conn, b->i);
+ /* outer-to-inner order, opposite .open */
if (handle && f->filter.close)
f->filter.close (handle);
backend_close (b->next, conn);
@@ -409,7 +413,7 @@ filter_prepare (struct backend *b, struct connection *conn, int readonly)
struct b_conn nxdata = { .b = b->next, .conn = conn };
/* Call these in order starting from the filter closest to the
- * plugin.
+ * plugin, similar to typical .open order.
*/
if (backend_prepare (b->next, conn) ==...
2018 Aug 01
0
[PATCH v2 nbdkit 3/6] filters: Print filter name in debugging messages.
...uct backend_filter *f = container_of (b, struct backend_filter, backend);
void *handle = connection_get_handle (conn, f->backend.i);
- debug ("close");
+ debug ("%s: close", f->name);
if (f->filter.close)
f->filter.close (handle);
@@ -365,7 +365,7 @@ filter_prepare (struct backend *b, struct connection *conn)
void *handle = connection_get_handle (conn, f->backend.i);
struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
- debug ("prepare");
+ debug ("%s: prepare", f->name);
/* Call these in order starting f...
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...(void *nxdata, int readonly)
{
@@ -668,6 +691,7 @@ static struct backend filter_functions = {
.config = filter_config,
.config_complete = filter_config_complete,
.magic_config_key = plugin_magic_config_key,
+ .ready_to_serve = filter_ready_to_serve,
.open = filter_open,
.prepare = filter_prepare,
.finalize = filter_finalize,
diff --git a/server/internal.h b/server/internal.h
index 167da59..4c9419d 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -312,6 +312,7 @@ struct backend {
void (*config) (struct backend *, const char *key, const char *value);
void (*config_complete)...
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
I still don't have .prepare/.finalize working cleanly across reopen,
but did find a nasty bug where a botched assertion means we failed to
notice reads beyond EOF in both the xz and retry filter.
Refactoring backend.c will make .finalize work easier.
Eric Blake (5):
xz: Avoid reading beyond EOF
retry: Check size before transactions
tests: Test retry when get_size values change
2020 Feb 11
1
[nbdkit PATCH] filters: Make nxdata persistent
...r.close (handle);
+ if (handle && f->filter.close) {
+ assert (nxdata->b == b->next && nxdata->conn == conn);
+ f->filter.close (nxdata->handle);
+ free (nxdata);
+ }
}
/* The next_functions structure contains pointers to backend
@@ -421,10 +441,11 @@ filter_prepare (struct backend *b, struct connection *conn, void *handle,
int readonly)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- struct b_conn nxdata = { .b = b->next, .conn = conn };
+ struct b_conn *nxdata = handle;
+ assert (nxdata->b == b-...
2020 Feb 12
0
[PATCH nbdkit 3/3] server: filters: Remove struct b_h.
...int32_t flags, int *err)
{
- struct b_h *b_h = nxdata;
- return backend_cache (b_h->b, count, offset, flags, err);
+ struct backend *b_next = nxdata;
+ return backend_cache (b_next, count, offset, flags, err);
}
static struct nbdkit_next_ops next_ops = {
@@ -439,11 +408,9 @@ static int
filter_prepare (struct backend *b, void *handle, int readonly)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- struct b_h *nxdata = handle;
- assert (nxdata->b == b->next);
if (f->filter.prepare &&
- f->filter.prepare (&next_ops, nxdata, nxd...
2020 Feb 22
2
Re: Plans for nbdkit 1.18 release?
Eric:
Did you want to take this one any further? It might be one that we
save for > 1.18:
https://www.redhat.com/archives/libguestfs/2020-February/thread.html#00206
Another thing I've been thinking about for some time is splitting
.config_complete into .config_complete + .get_ready (new name TBD).
At the moment .config_complete is both the place where we finish
processing config, and
2020 Feb 22
1
Re: Plans for nbdkit 1.18 release?
...ly)
{
@@ -493,6 +515,7 @@ static struct backend filter_functions = {
.config = filter_config,
.config_complete = filter_config_complete,
.magic_config_key = plugin_magic_config_key,
+ .get_ready = filter_get_ready,
.preconnect = filter_preconnect,
.open = filter_open,
.prepare = filter_prepare,
diff --git a/server/main.c b/server/main.c
index 3bc59781..b3d8e5bf 100644
--- a/server/main.c
+++ b/server/main.c
@@ -691,6 +691,11 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
+ /* Tell the plugin that we are about to start serving. This must be
+ * called before we chan...
2019 Oct 03
7
[nbdkit PATCH 0/4] More work with retry safety
I'm still working on another set of patches to have reopen call
.finalize/.prepare (so that another filter can safely appear between
retry and the plugin), but for tonight, these are the patches I think
are ready to go.
Eric Blake (4):
retry: Handle can_fua and can_fast_zero changes
tests: Test retry with different fua/fast-zero flags
server: Close backends if a filter's .open fails
2019 Aug 30
0
[nbdkit PATCH 1/9] server: Fewer dereferences in filter
...uot;%s: close", f->name);
if (f->filter.close)
f->filter.close (handle);
- f->backend.next->close (f->backend.next, conn);
+ b->next->close (b->next, conn);
}
/* The next_functions structure contains pointers to backend
@@ -459,15 +453,15 @@ static int
filter_prepare (struct backend *b, struct connection *conn)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- void *handle = connection_get_handle (conn, f->backend.i);
- struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
+ void *handle = connection_get_hand...
2020 Aug 25
0
[nbdkit PATCH 1/5] api: Add .default_export
...har *exportname,
int is_tls)
@@ -555,6 +566,7 @@ static struct backend filter_functions = {
.after_fork = filter_after_fork,
.preconnect = filter_preconnect,
.list_exports = filter_list_exports,
+ .default_export = filter_default_export,
.open = filter_open,
.prepare = filter_prepare,
.finalize = filter_finalize,
diff --git a/server/plugins.c b/server/plugins.c
index 218764da..924533cb 100644
--- a/server/plugins.c
+++ b/server/plugins.c
@@ -162,6 +162,7 @@ plugin_dump_fields (struct backend *b)
HAS (after_fork);
HAS (preconnect);
HAS (list_exports);
+ HAS (default...
2020 Sep 21
0
[nbdkit PATCH v3 06/14] api: Add .export_description
...tion)
+ return f->filter.export_description (&next_ops, b->next, handle);
+ else
+ return backend_export_description (b->next);
+}
+
static int64_t
filter_get_size (struct backend *b, void *handle)
{
@@ -571,6 +583,7 @@ static struct backend filter_functions = {
.prepare = filter_prepare,
.finalize = filter_finalize,
.close = filter_close,
+ .export_description = filter_export_description,
.get_size = filter_get_size,
.can_write = filter_can_write,
.can_flush = filter_can_flush,
diff --git a/server/plugins.c b/server/plugins.c
index 69835d32..010595c7 100644
--- a/s...
2019 Aug 30
0
[nbdkit PATCH 2/9] server: Consolidate common backend tasks into new backend.c
...ckend_filter *f = container_of (b, struct backend_filter, backend);
void *handle = connection_get_handle (conn, b->i);
- debug ("%s: close", f->name);
+ debug ("%s: close", b->name);
if (f->filter.close)
f->filter.close (handle);
@@ -456,7 +430,7 @@ filter_prepare (struct backend *b, struct connection *conn)
void *handle = connection_get_handle (conn, b->i);
struct b_conn nxdata = { .b = b->next, .conn = conn };
- debug ("%s: prepare", f->name);
+ debug ("%s: prepare", b->name);
/* Call these in order starting fro...
2018 Aug 01
12
[PATCH v2 nbdkit 0/6] Add truncate filter and other fixes.
I have dropped the map filter from this series for now while I try to
get it working.
However I think the truncate filter is in a good shape. This
incorporates all feedback from Eric's review.
Also there are three small fixes to the filter code, all revealed when
I was testing using multiple filters which we'd not done much of
before.
Rich.
2018 Jan 19
0
[PATCH nbdkit filters-v2 2/5] Introduce filters.
....get_size = next_get_size,
+ .can_write = next_can_write,
+ .can_flush = next_can_flush,
+ .is_rotational = next_is_rotational,
+ .can_trim = next_can_trim,
+ .pread = next_pread,
+ .pwrite = next_pwrite,
+ .flush = next_flush,
+ .trim = next_trim,
+ .zero = next_zero,
+};
+
+static int
+filter_prepare (struct backend *b, struct connection *conn)
+{
+ struct backend_filter *f = container_of (b, struct backend_filter, backend);
+ void *handle = connection_get_handle (conn, f->backend.i);
+ struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
+
+ debug ("prepare");
+
+...
2018 Jan 19
0
[PATCH nbdkit filters-v3 3/7] Introduce filters.
....get_size = next_get_size,
+ .can_write = next_can_write,
+ .can_flush = next_can_flush,
+ .is_rotational = next_is_rotational,
+ .can_trim = next_can_trim,
+ .pread = next_pread,
+ .pwrite = next_pwrite,
+ .flush = next_flush,
+ .trim = next_trim,
+ .zero = next_zero,
+};
+
+static int
+filter_prepare (struct backend *b, struct connection *conn)
+{
+ struct backend_filter *f = container_of (b, struct backend_filter, backend);
+ void *handle = connection_get_handle (conn, f->backend.i);
+ struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
+
+ debug ("prepare");
+
+...
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...backend_cache (b_conn->b, b_conn->conn, count, offset, flags, err);
+ struct b_h *b_h = nxdata;
+ return backend_cache (b_h->b, count, offset, flags, err);
}
static struct nbdkit_next_ops next_ops = {
@@ -437,13 +436,12 @@ static struct nbdkit_next_ops next_ops = {
};
static int
-filter_prepare (struct backend *b, struct connection *conn, void *handle,
- int readonly)
+filter_prepare (struct backend *b, void *handle, int readonly)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- struct b_conn *nxdata = handle;
+ struct b_h *nxdata = han...
2018 Feb 01
0
[nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...truct backend filter_functions = {
@@ -567,7 +589,6 @@ static struct backend filter_functions = {
.dump_fields = filter_dump_fields,
.config = filter_config,
.config_complete = filter_config_complete,
- .errno_is_preserved = plugin_errno_is_preserved,
.open = filter_open,
.prepare = filter_prepare,
.finalize = filter_finalize,
diff --git a/src/plugins.c b/src/plugins.c
index dba3e24..c49c0f0 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -227,14 +227,6 @@ plugin_config_complete (struct backend *b)
exit (EXIT_FAILURE);
}
-static int
-plugin_errno_is_preserved (struct backend *b)...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here:
https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html
v2 replaces
struct connection *conn = GET_CONN;
with
GET_CONN;
which sets conn implicitly and asserts that it is non-NULL.
If we actually want to test if conn is non-NULL or behave
differently, then you must use threadlocal_get_conn() instead,
and some existing uses do that.
Rich.