Displaying 20 results from an estimated 20 matches for "connection_set_handle".
Did you mean:
connection_get_handle
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...nworkers;
+ void **handles;
+ size_t nr_handles;
+
uint64_t exportsize;
int readonly;
int can_flush;
@@ -100,16 +102,37 @@ static void raw_close (struct connection *);
/* Accessors for public fields in the connection structure.
* Everything else is private to this file.
*/
-void
-connection_set_handle (struct connection *conn, void *handle)
+int
+connection_set_handle (struct connection *conn, size_t i, void *handle)
{
- conn->handle = handle;
+ size_t j;
+
+ if (i < conn->nr_handles)
+ conn->handles[i] = handle;
+ else {
+ j = conn->nr_handles;
+ conn->nr_handles...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...t nworkers;
+ void **handles;
+ size_t nr_handles;
+
uint64_t exportsize;
int readonly;
int can_flush;
@@ -100,16 +102,37 @@ static void raw_close (struct connection *);
/* Accessors for public fields in the connection structure.
* Everything else is private to this file.
*/
-void
-connection_set_handle (struct connection *conn, void *handle)
+int
+connection_set_handle (struct connection *conn, size_t i, void *handle)
{
- conn->handle = handle;
+ size_t j;
+
+ if (i < conn->nr_handles)
+ conn->handles[i] = handle;
+ else {
+ j = conn->nr_handles;
+ conn->nr_handles...
2019 Aug 30
0
[nbdkit PATCH 1/9] server: Fewer dereferences in filter
...nn };
void *handle;
debug ("%s: open readonly=%d", f->name, readonly);
@@ -245,24 +239,24 @@ filter_open (struct backend *b, struct connection *conn, int readonly)
handle = f->filter.open (next_open, &nxdata, readonly);
if (handle == NULL)
return -1;
- connection_set_handle (conn, f->backend.i, handle);
+ connection_set_handle (conn, b->i, handle);
return 0;
}
else
- return f->backend.next->open (f->backend.next, conn, readonly);
+ return b->next->open (b->next, conn, readonly);
}
static void
filter_close (struct backend...
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 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...nection *,
+ const void *buf, size_t len)
+ __attribute__((__nonnull__ (1, 2)));
+typedef void (*connection_close_function) (struct connection *)
+ __attribute__((__nonnull__ (1)));
extern int handle_single_connection (int sockin, int sockout);
-extern int connection_set_handle (struct connection *conn, size_t i, void *handle);
-extern void *connection_get_handle (struct connection *conn, size_t i);
-extern pthread_mutex_t *connection_get_request_lock (struct connection *conn);
-extern void connection_set_crypto_session (struct connection *conn, void *session);
-extern vo...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html
In v2 I have provided two patches:
The first patch extends attribute((nonnull)) to most internal
functions, but not to the external API.
The second patch uses a macro so that attribute((format)) is only used
in the public API on GCC or Clang. At least in theory these headers
could be used by a C compiler which
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
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
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status
implementation. While the patches (especially the second one) are
very large they are really just elementary code motion.
Rich.
2018 Jan 17
0
[PATCH 7/9] Implement filters.
...struct backend_filter *f = container_of (b, struct backend_filter, backend);
+ void *handle = NULL;
+
+ debug ("%s: open readonly=%d", f->filename, readonly);
+
+ if (f->filter.open) {
+ handle = f->filter.open (readonly);
+ if (handle == NULL)
+ return -1;
+ }
+ connection_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_g...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...l);
+ struct backend_plugin *p = (struct backend_plugin *) b;
+
assert (connection_get_handle (conn));
debug ("close");
- if (plugin.close)
- plugin.close (connection_get_handle (conn));
+ if (p->plugin.close)
+ p->plugin.close (connection_get_handle (conn));
connection_set_handle (conn, NULL);
}
-int64_t
-plugin_get_size (struct connection *conn)
+static int64_t
+plugin_get_size (struct backend *b, struct connection *conn)
{
- assert (dl);
+ struct backend_plugin *p = (struct backend_plugin *) b;
+
assert (connection_get_handle (conn));
- assert (plugin.get_size !...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
..._plugin *p = container_of (b, struct backend_plugin, backend);
+
assert (connection_get_handle (conn));
debug ("close");
- if (plugin.close)
- plugin.close (connection_get_handle (conn));
+ if (p->plugin.close)
+ p->plugin.close (connection_get_handle (conn));
connection_set_handle (conn, NULL);
}
-int64_t
-plugin_get_size (struct connection *conn)
+static int64_t
+plugin_get_size (struct backend *b, struct connection *conn)
{
- assert (dl);
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
+
assert (connection_get_handle (conn));
- asse...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
..._plugin *p = container_of (b, struct backend_plugin, backend);
+
assert (connection_get_handle (conn));
debug ("close");
- if (plugin.close)
- plugin.close (connection_get_handle (conn));
+ if (p->plugin.close)
+ p->plugin.close (connection_get_handle (conn));
connection_set_handle (conn, NULL);
}
-int64_t
-plugin_get_size (struct connection *conn)
+static int64_t
+plugin_get_size (struct backend *b, struct connection *conn)
{
- assert (dl);
+ struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
+
assert (connection_get_handle (conn));
- asse...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2:
- Fixed everything mentioned in the review.
Rich.
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 19
0
[PATCH nbdkit filters-v2 2/5] Introduce filters.
...struct backend_filter *f = container_of (b, struct backend_filter, backend);
+ void *handle = NULL;
+
+ debug ("%s: open readonly=%d", f->filename, readonly);
+
+ if (f->filter.open) {
+ handle = f->filter.open (readonly);
+ if (handle == NULL)
+ return -1;
+ }
+ connection_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_g...
2018 Jan 19
0
[PATCH nbdkit filters-v3 3/7] Introduce filters.
...ruct b_conn nxdata = { .b = f->backend.next, .conn = conn };
+ void *handle;
+
+ debug ("%s: open readonly=%d", f->filename, readonly);
+
+ if (f->filter.open) {
+ handle = f->filter.open (next_open, &nxdata, readonly);
+ if (handle == NULL)
+ return -1;
+ connection_set_handle (conn, f->backend.i, handle);
+ return 0;
+ }
+ else
+ 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);...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...| 515 +++++++++++
server/Makefile.am | 4 +
7 files changed, 1389 insertions(+), 1188 deletions(-)
diff --git a/server/internal.h b/server/internal.h
index 8427401..d40a82d 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -194,6 +194,28 @@ extern int connection_set_handle (struct connection *conn,
__attribute__((__nonnull__ (1 /* not 3 */)));
extern void *connection_get_handle (struct connection *conn, size_t i)
__attribute__((__nonnull__ (1)));
+extern int connection_get_status (struct connection *conn)
+ __attribute__((__nonnull__ (1)));
+extern int connec...
2018 Jan 19
9
[PATCH nbdkit filters-v3 0/7] Introduce filters.
This is still tentative and needs a lot of work, but:
- partition filter works, supporting MBR & GPT
- prepare and finalize methods fixed
- open method can now be changed (allowing readonly flag to be modified)
- thread_model can be limited
I believe I made most of the changes which were previously suggested
in email. I think the only one I didn't was preventing inclusion of
both
2018 Jan 19
10
[PATCH nbdkit filters-v2 0/5] Introduce filters.
Rebased filters patch. Requires current git master + the locks /
thread model fix
(https://www.redhat.com/archives/libguestfs/2018-January/msg00128.html)
So a few changes here since last time:
The "introduce filters" and "implement filters" patches are
squashed together.
I introduced a concept of .prepare and .finalize. These run before
and after the data serving phase