search for: nbdsourc

Displaying 16 results from an estimated 16 matches for "nbdsourc".

Did you mean: nbdsource
2019 Jul 15
2
[PATCH libnbd] examples: Include an example of integrating with the glibc main loop.
** NOT WORKING ** This patch shows how to integrate libnbd and the glib main loop. Posted mainly as a point of discussion as it doesn't quite work yet. Rich.
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...lib-main-loop + * + * For debugging, do: + * + * LIBNBD_DEBUG=1 ./examples/glib-main-loop + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <stdint.h> +#include <assert.h> + +#include <libnbd.h> + +#include <glib.h> + +struct NBDSource; +typedef void (*connecting_callback_t) (struct NBDSource *); +typedef void (*connected_callback_t) (struct NBDSource *); + +/* This is the derived GSource type. */ +struct NBDSource { + /* The base type. This MUST be the first element in this struct. */ + GSource source; + + /* The underlying...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...ugging, do: + * + * LIBNBD_DEBUG=1 ./examples/glib-main-loop + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <stdint.h> +#include <inttypes.h> +#include <assert.h> + +#include <libnbd.h> + +#include <glib.h> + +struct NBDSource; +typedef void (*connecting_callback_t) (struct NBDSource *); +typedef void (*connected_callback_t) (struct NBDSource *); + +/* This is the derived GSource type. */ +struct NBDSource { + /* The base type. This MUST be the first element in this struct. */ + GSource source; + + /* The underlying...
2019 Jul 17
2
[PATCH libnbd v2] examples: Include an example of integrating with glib main loop.
This is working now, and incorporates all of the changes in Eric's review, *except* that it still doesn't retire commands (although this seems to make no obvious difference, except possibly a performance and memory impact). Rich.
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...am | 22 ++ > examples/glib-main-loop.c | 501 ++++++++++++++++++++++++++++++++++++++ > 5 files changed, 535 insertions(+) > Rough review (since I've never used a glib main loop before)... > +static gboolean > +prepare (GSource *sp, gint *timeout_) > +{ > + struct NBDSource *source = (struct NBDSource *) sp; > + > + /* When the NBD handle moves out of the created state (which means > + * that it first has a socket associated with it) we must initialize > + * and register the pollfd. > + */ > + if (!source->poll_registered && !nbd_...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...d to call C<nbd_aio_command_completed>); for any other diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index 826651e..05a59e3 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -268,11 +268,9 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (unsigned valid_flag, void *vp, - int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, int *error); static gboolean write_data (gpointer user_data); -st...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...to C<error> does not have an effect. =head1 SEE ALSO diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index 05a59e3..216eb5e 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -268,9 +268,9 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (unsigned valid_flag, void *vp, int *error); +static int finished_read (void *vp, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (unsigned valid_flag, void *vp, int *erro...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...safe for the callback to call any C<nbd_*> APIs on the diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index c633c1d..9d61923 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -272,9 +272,11 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (int valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...to C<error> does not have an effect. =head1 SEE ALSO diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index a8e8ceb..9c279d3 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -268,9 +268,9 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (unsigned valid_flag, void *vp, int *error); +static int finished_read (void *vp, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (unsigned valid_flag, void *vp, int *erro...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...safe for the callback to call any C<nbd_*> APIs on the diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index c633c1d..b7c496f 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -272,9 +272,11 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...safe for the callback to call any C<nbd_*> APIs on the diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index 2230077..2d192e6 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -274,9 +274,11 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review. Some of the highlights: - Callbacks should be freed reliably along all exit paths. - There's a simple test of closure lifetimes. - I've tried to use VALID|FREE in all the places where I'm confident that it's safe and correct to do. There may be more places. Note this is an optimization and shouldn't
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is