search for: nbd_unlocked_get_debug

Displaying 20 results from an estimated 21 matches for "nbd_unlocked_get_debug".

2019 Aug 13
1
Re: [PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
...bug_callback>). If not s/not/no/ > +callback was associated this does nothing."; > }; > > "set_handle_name", { > diff --git a/lib/debug.c b/lib/debug.c > index ad4d9cb..c1decb2 100644 > --- a/lib/debug.c > +++ b/lib/debug.c > @@ -38,13 +38,24 @@ nbd_unlocked_get_debug (struct nbd_handle *h) > return h->debug; > } > > +int > +nbd_unlocked_clear_debug_callback (struct nbd_handle *h) > +{ > + if (h->debug_callback) > + /* ignore return value */ > + h->debug_callback (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL...
2019 Jul 24
1
Re: [PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...nsition to DEAD but the handle is still around), it is still probably worth tweaking nbd_close's use of free_cmd_list() to still call FREE on any pending callbacks on commands stranded by abrupt close to allow the user to still avoid memory leaks. > +++ b/lib/debug.c > @@ -40,9 +40,11 @@ nbd_unlocked_get_debug (struct nbd_handle *h) > > int > nbd_unlocked_set_debug_callback (struct nbd_handle *h, > - int (*debug_fn) (void *, const char *, const char *), > - void *data) > + debug_fn debug_...
2019 Aug 13
0
[PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
...viously associated +with the handle (with C<nbd_set_debug_callback>). If not +callback was associated this does nothing."; }; "set_handle_name", { diff --git a/lib/debug.c b/lib/debug.c index ad4d9cb..c1decb2 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -38,13 +38,24 @@ nbd_unlocked_get_debug (struct nbd_handle *h) return h->debug; } +int +nbd_unlocked_clear_debug_callback (struct nbd_handle *h) +{ + if (h->debug_callback) + /* ignore return value */ + h->debug_callback (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL); + h->debug_callback = NULL; + h->d...
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...king you have to spin a v3, since our mails have crossed. > + > free (cmd); > > /* If the command was successful, return true. */ > diff --git a/lib/debug.c b/lib/debug.c > index 12c10f7..56a9455 100644 > --- a/lib/debug.c > +++ b/lib/debug.c > @@ -40,9 +40,12 @@ nbd_unlocked_get_debug (struct nbd_handle *h) > > int > nbd_unlocked_set_debug_callback (struct nbd_handle *h, > - int (*debug_fn) (void *, const char *, const char *), > + int (*debug_fn) (int, void *, const char *, const char *), >...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...ut thinking about this a bit more, maybe we should call VALID|FREE here and set cmd->cb.fn.read = NULL afterwards. [...] > > diff --git a/lib/debug.c b/lib/debug.c > > index 12c10f7..56a9455 100644 > > --- a/lib/debug.c > > +++ b/lib/debug.c > > @@ -40,9 +40,12 @@ nbd_unlocked_get_debug (struct nbd_handle *h) > > > > int > > nbd_unlocked_set_debug_callback (struct nbd_handle *h, > > - int (*debug_fn) (void *, const char *, const char *), > > + int (*debug_fn) (int, void *, const char...
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...d->cb.fn.chunk.free (cmd->cb.fn.chunk.user_data); + if (cmd->cb.completion.free) + cmd->cb.completion.free (cmd->cb.completion.user_data); free (cmd); } diff --git a/lib/debug.c b/lib/debug.c index eec2051..a0e6636 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -41,7 +41,9 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_clear_debug_callback (struct nbd_handle *h) { - FREE_CALLBACK (h->debug_callback); + if (h->debug_callback.free) + h->debug_callback.free (h->debug_callback.user_data); + memset (&h->debug_callback, 0, sizeof h->debug_callback);...
2019 Aug 13
7
[PATCH libnbd v2 0/3] Implement OClosures.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00168.html I pushed uncontroversial patches 1-4 v2: - The implementation of OClosure (new patch 1) in Python is fixed. - Patch 2 (old patch 5) is unchanged. - I added a new API for removing debug callbacks. I think this approach has some advantages over using OClosure. - I didn't yet do any work on changing the
2019 Aug 13
0
[PATCH libnbd 3/4] lib: Add FREE_CALLBACK macro.
...E_CALLBACK (cmd->cb.fn.extent); + if (cmd->type == NBD_CMD_READ) + FREE_CALLBACK (cmd->cb.fn.chunk); + FREE_CALLBACK (cmd->cb.completion); free (cmd); } diff --git a/lib/debug.c b/lib/debug.c index 1dd6240..e1ec675 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -41,11 +41,7 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_clear_debug_callback (struct nbd_handle *h) { - if (h->debug_callback.callback) - if (h->debug_callback.free) - /* ignore return value */ - h->debug_callback.free (h->debug_callback.user_data); - h->debug_callback.callback = N...
2019 Aug 15
0
Re: [libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...ata); > + if (cmd->cb.completion.free) > + cmd->cb.completion.free (cmd->cb.completion.user_data); > > free (cmd); > } > diff --git a/lib/debug.c b/lib/debug.c > index eec2051..a0e6636 100644 > --- a/lib/debug.c > +++ b/lib/debug.c > @@ -41,7 +41,9 @@ nbd_unlocked_get_debug (struct nbd_handle *h) > int > nbd_unlocked_clear_debug_callback (struct nbd_handle *h) > { > - FREE_CALLBACK (h->debug_callback); > + if (h->debug_callback.free) > + h->debug_callback.free (h->debug_callback.user_data); > + memset (&h->debug_callbac...
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...data, const char *metacontext, uint64_t offset, fprintf (stderr, "unexpected context %s\n", metacontext); exit (EXIT_FAILURE); } + + return 0; } int diff --git a/lib/debug.c b/lib/debug.c index 8e2ff76..02d49f7 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -41,7 +41,7 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, void *data, - void (*debug_fn) (void *, const char *, const char *)) + int (*debug_fn) (void *, const char *, const c...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...izeof rbuf, 2048, read_cb, &data, 0) != -1) { fprintf (stderr, "unexpected pread callback success\n"); exit (EXIT_FAILURE); diff --git a/lib/debug.c b/lib/debug.c index 02d49f7..12c10f7 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -40,8 +40,8 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, - void *data, - int (*debug_fn) (void *, const char *, const char *)) + int (*debug_fn) (void *, const char *, const c...
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...ULL, 0, 0, 0, NULL); + if (cmd->cb.completion) + cmd->cb.completion (LIBNBD_CALLBACK_FREE, cmd->cb.user_data, + NULL); free (cmd); } diff --git a/lib/debug.c b/lib/debug.c index 7784bd9..f4b374d 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -40,12 +40,12 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, - debug_fn debug_fn, void *data) + nbd_debug_callback debug_callback, void *data) { - if (h->debug_fn) + if (h->debug_callback) /* igno...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...+ cmd->cb.callback (LIBNBD_CALLBACK_FREE, cmd->cb.user_data, + 0, NULL); + free (cmd); /* If the command was successful, return true. */ diff --git a/lib/debug.c b/lib/debug.c index 12c10f7..56a9455 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -40,9 +40,12 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, - int (*debug_fn) (void *, const char *, const char *), + int (*debug_fn) (int, void *, const char *, const char *),...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...+ cmd->cb.callback (LIBNBD_CALLBACK_FREE, cmd->cb.user_data, + 0, NULL); + free (cmd); /* If the command was successful, return true. */ diff --git a/lib/debug.c b/lib/debug.c index 12c10f7..7784bd9 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -40,9 +40,11 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, - int (*debug_fn) (void *, const char *, const char *), - void *data) + debug_fn debug_fn, void *data) { + if (h-&g...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...;cb.completion.callback (LIBNBD_CALLBACK_FREE, + cmd->cb.completion.user_data, + NULL); free (cmd); } diff --git a/lib/debug.c b/lib/debug.c index c1decb2..7753394 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -41,23 +41,22 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_clear_debug_callback (struct nbd_handle *h) { - if (h->debug_callback) + if (h->debug_callback.callback) /* ignore return value */ - h->debug_callback (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL); - h->debug_callback = NULL;...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...h->cmds_done = cmd->next; - free (cmd); + nbd_internal_retire_and_free_command (cmd); /* If the command was successful, return true. */ if (error == 0) diff --git a/lib/debug.c b/lib/debug.c index 12c10f7..7784bd9 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -40,9 +40,11 @@ nbd_unlocked_get_debug (struct nbd_handle *h) int nbd_unlocked_set_debug_callback (struct nbd_handle *h, - int (*debug_fn) (void *, const char *, const char *), - void *data) + debug_fn debug_fn, void *data) { + if (h-&g...
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
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