Displaying 13 results from an estimated 13 matches for "nbd_unlocked_clear_debug_callback".
2019 Aug 13
0
[PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
...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->debug_data = NULL;
+ return 0;
+}
+
int
nbd_unlocked_set_debug_callback (struct nbd_handl...
2019 Aug 13
1
Re: [PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
...gt;
> "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->debug_data = NULL;
> + return 0;
> +}
Is it worth retu...
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
2020 Sep 07
0
[libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
.../lib/debug.c
@@ -1,5 +1,5 @@
/* NBD client library in userspace
- * Copyright (C) 2013-2019 Red Hat Inc.
+ * Copyright (C) 2013-2020 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,12 +48,12 @@ nbd_unlocked_clear_debug_callback (struct nbd_handle *h)
int
nbd_unlocked_set_debug_callback (struct nbd_handle *h,
- nbd_debug_callback debug_callback)
+ nbd_debug_callback *debug_callback)
{
/* This can't fail at the moment - see implementation above. */...
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...a);
+ 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);
return 0;
}
--
2.20.1
2020 Sep 07
4
[libnbd PATCH 0/2] Fix memory leak with closures
As promised in my earlier thread on libnbd completion callback question.
Eric Blake (2):
generator: Refactor handling of closures in unlocked functions
generator: Free closures on failure
docs/libnbd.pod | 2 +-
generator/C.ml | 48 +++++++++++------
generator/C.mli | 1 +
lib/debug.c | 7 +--
lib/opt.c | 31 ++++++-----
2019 Aug 13
0
[PATCH libnbd 3/4] lib: Add FREE_CALLBACK macro.
...pe == 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 = NULL;
+ FREE_CALLBACK (h->debug_callback);
return 0;
}...
2019 Aug 15
0
Re: [libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
...t;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);
> return 0;
> }
>
>...
2020 Sep 07
0
[libnbd PATCH 2/2] generator: Free closures on failure
...>public_state != get_next_state (h))\n";
pr " h->public_state = get_next_state (h);\n";
diff --git a/lib/debug.c b/lib/debug.c
index 1b503d9..b598ad3 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -54,6 +54,7 @@ nbd_unlocked_set_debug_callback (struct nbd_handle *h,
nbd_unlocked_clear_debug_callback (h);
h->debug_callback = *debug_callback;
+ SET_CALLBACK_TO_NULL (*debug_callback);
return 0;
}
diff --git a/lib/opt.c b/lib/opt.c
index 003ecf8..6ea8326 100644
--- a/lib/opt.c
+++ b/lib/opt.c
@@ -156,6 +156,7 @@ nbd_unlocked_opt_list (struct nbd_handle *h, nbd_list_callback *list)...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...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;
- h->debug_data = NULL;
+ h->debug_callback.callback...
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 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...+ if (cmd->cb.completion.callback) {
+ 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 7753394..1dd6240 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -42,9 +42,9 @@ int
nbd_unlocked_clear_debug_callback (struct nbd_handle *h)
{
if (h->debug_callback.callback)
- /* ignore return value */
- h->debug_callback.callback (LIBNBD_CALLBACK_FREE,
- h->debug_callback.user_data, NULL, NULL);
+ if (h->debug_callback.free)
+ /* ignore return value */...
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a
single nbd connection for all cases when reading the heads of the
file is not required), but I'm happy with patches 1-11, and 12-13
show where I'm headed for getting NBD_OPT_INFO to work. Posting
now to see if some of the earlier patches are ready to commit while
I continue working on the latter half.
Eric Blake (13):