Displaying 20 results from an estimated 79 matches for "connection_get_handl".
Did you mean:
connection_get_handle
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...conn->nr_handles * sizeof (void *));
+ if (conn->handles == NULL) {
+ perror ("realloc");
+ conn->nr_handles = 0;
+ return -1;
+ }
+ for (; j < i; ++j)
+ conn->handles[j] = NULL;
+ conn->handles[i] = handle;
+ }
+ return 0;
}
void *
-connection_get_handle (struct connection *conn)
+connection_get_handle (struct connection *conn, size_t i)
{
- return conn->handle;
+ if (i < conn->nr_handles)
+ return conn->handles[i];
+ else
+ return NULL;
}
pthread_mutex_t *
@@ -341,7 +364,7 @@ free_connection (struct connection *conn)...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...conn->nr_handles * sizeof (void *));
+ if (conn->handles == NULL) {
+ perror ("realloc");
+ conn->nr_handles = 0;
+ return -1;
+ }
+ for (; j < i; ++j)
+ conn->handles[j] = NULL;
+ conn->handles[i] = handle;
+ }
+ return 0;
}
void *
-connection_get_handle (struct connection *conn)
+connection_get_handle (struct connection *conn, size_t i)
{
- return conn->handle;
+ if (i < conn->nr_handles)
+ return conn->handles[i];
+ else
+ return NULL;
}
pthread_mutex_t *
@@ -341,7 +364,7 @@ free_connection (struct connection *conn)...
2019 Aug 30
0
[nbdkit PATCH 1/9] server: Fewer dereferences in filter
...;backend.next->open (f->backend.next, conn, readonly);
+ return b->next->open (b->next, conn, readonly);
}
static void
filter_close (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);
+ void *handle = connection_get_handle (conn, b->i);
debug ("%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);
}...
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
...ds 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
server: Fix backend range check
server: Refactor to drop connection_get_handle()
server/internal.h | 66 +++++++------
server/backend.c | 53 ++++++----
server/connections.c | 2 +-
server/filters.c | 70 +++++--------
server/plugins.c | 142 ++++++++++-----------------
serv...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...;
+ return p->plugin.errno_is_preserved;
}
-int
-plugin_open (struct connection *conn, int readonly)
+static int
+plugin_open (struct backend *b, struct connection *conn, int readonly)
{
+ struct backend_plugin *p = (struct backend_plugin *) b;
void *handle;
- assert (dl);
assert (connection_get_handle (conn) == NULL);
- assert (plugin.open != NULL);
+ assert (p->plugin.open != NULL);
- debug ("%s: open readonly=%d", filename, readonly);
+ debug ("%s: open readonly=%d", p->filename, readonly);
- handle = plugin.open (readonly);
+ handle = p->plugin.open (re...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...gin.errno_is_preserved;
}
-int
-plugin_open (struct connection *conn, int readonly)
+static int
+plugin_open (struct backend *b, struct connection *conn, int readonly)
{
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
void *handle;
- assert (dl);
assert (connection_get_handle (conn) == NULL);
- assert (plugin.open != NULL);
+ assert (p->plugin.open != NULL);
- debug ("%s: open readonly=%d", filename, readonly);
+ debug ("%s: open readonly=%d", p->filename, readonly);
- handle = plugin.open (readonly);
+ handle = p->plugin.open (re...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...gin.errno_is_preserved;
}
-int
-plugin_open (struct connection *conn, int readonly)
+static int
+plugin_open (struct backend *b, struct connection *conn, int readonly)
{
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
void *handle;
- assert (dl);
assert (connection_get_handle (conn) == NULL);
- assert (plugin.open != NULL);
+ assert (p->plugin.open != NULL);
- debug ("%s: open readonly=%d", filename, readonly);
+ debug ("%s: open readonly=%d", p->filename, readonly);
- handle = plugin.open (readonly);
+ handle = p->plugin.open (re...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...+ HAS (_pwrite_old);
+ HAS (_flush_old);
+ HAS (_trim_old);
+ HAS (_zero_old);
+ HAS (can_fua);
HAS (pread);
HAS (pwrite);
HAS (flush);
@@ -301,7 +307,7 @@ plugin_can_write (struct backend *b, struct connection *conn)
if (p->plugin.can_write)
return p->plugin.can_write (connection_get_handle (conn, 0));
else
- return p->plugin.pwrite != NULL;
+ return p->plugin.pwrite || p->plugin._pwrite_old;
}
static int
@@ -316,7 +322,7 @@ plugin_can_flush (struct backend *b, struct connection *conn)
if (p->plugin.can_flush)
return p->plugin.can_flush (connection_...
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 30
15
[nbdkit PATCH 0/9] can_FOO caching, more filter validation
It's easy to use the sh script to demonstrate that nbdkit is
inefficiently calling into .get_size, .can_fua, and friends more than
necessary. We've also commented on the list in the past that it would
be nice to ensure that when filters call into next_ops, they are not
violating constraints (as we've have to fix several bugs in the past
where we did not have such checking to protect
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 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 --
2018 Aug 01
0
[PATCH v2 nbdkit 3/6] filters: Print filter name in debugging messages.
...;, f->name, readonly);
if (f->filter.open) {
handle = f->filter.open (next_open, &nxdata, readonly);
@@ -239,7 +239,7 @@ filter_close (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);
- 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->...
2019 Oct 03
2
Re: [nbdkit PATCH 3/4] server: Close backends if a filter's .open fails
$ ./nbdkit -s memory 1M < fuzzing/testcase_dir/newstyle-cflags
NBDMAGICIHAVEOPTnbdkit: plugins.c:274: plugin_close: Assertion `connection_get_handle (conn, 0)' failed.
Aborted (core dumped)
git bisect implicates this patch:
2f80ce1209d5898cb9a567c0b29e7736ff4d03eb is the first bad commit
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordp...
2018 Jan 19
16
[nbdkit PATCH v2 00/13] Add filters + FUA support to nbdkit
A combination of the work that both Rich and I have been doing
lately, where filters use only the new API with flags on every
command that the client can send over the wire (we can then
add support for more flags in nbdkit without having to add new
callbacks, as NBD adds more flags upstream).
Eric Blake (4):
protocol: Split flags from cmd field in requests
backend: Pass flags argument through
2019 Aug 30
0
[nbdkit PATCH 2/9] server: Consolidate common backend tasks into new backend.c
...t;, b->name, readonly);
if (f->filter.open) {
handle = f->filter.open (next_open, &nxdata, readonly);
@@ -252,7 +226,7 @@ filter_close (struct backend *b, struct connection *conn)
struct backend_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,...
2018 Feb 01
0
[nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...t;backend.next->errno_is_preserved (f->backend.next);
-}
-
static const char *
plugin_name (struct backend *b)
{
@@ -463,17 +455,23 @@ filter_pread (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 };
+ int r;
assert (flags == 0);
debug ("pread count=%" PRIu32 " offset=%" PRIu64, count, offset);
- if (f->filter.pread)
- return f->filter.pread (&next_ops, &...
2018 Jan 16
9
[nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
Tested via:
term1$ qemu-nbd -k $PWD/sock -t -f raw -x foo junk --trace=nbd_\*
term2$ ./nbdkit -f -v -e bar nbd socket=$PWD/sock export=foo
term3$ qemu-io -t none -f raw nbd://localhost:10809/bar --trace=nbd_\*
and checking the traces to see that 'w 0 1' vs. 'w -f 0 1' was able
to influence whether the FUA flag showed up at the server in term1.
Still to go: figure out how to
2018 Jan 17
0
[PATCH 7/9] Implement filters.
...n_set_handle (conn, f->backend.i, handle);
+ return f->backend.next->open (f->backend.next, conn, readonly);
+}
+
+static void
+filter_close (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);
+
+ debug ("close");
+
+ if (f->filter.close)
+ f->filter.close (handle);
+ f->backend.next->close (f->backend.next, conn);
+}
+
+/* The next_functions structure contains pointers to backend
+ * functions. However because these functions are...
2019 Sep 19
0
[nbdkit PATCH 1/4] server: Fix regression for NBD_OPT_INFO before NBD_OPT_GO
...dle == NULL);
conn->handles[b->i].handle = handle;
}
diff --git a/server/connections.c b/server/connections.c
index 819f7b86..3c4296ea 100644
--- a/server/connections.c
+++ b/server/connections.c
@@ -369,7 +369,7 @@ free_connection (struct connection *conn)
*/
if (!quit && connection_get_handle (conn, 0)) {
lock_request (conn);
- backend->close (backend, conn);
+ backend_close (backend, conn);
unlock_request (conn);
}
diff --git a/server/filters.c b/server/filters.c
index 1ee62829..1091c2dd 100644
--- a/server/filters.c
+++ b/server/filters.c
@@ -225,12 +225,9 @@ f...