Displaying 20 results from an estimated 20 matches for "nbd_internal_debug".
2019 Aug 05
1
[libnbd PATCH] lib: Always return cookie once command is queued
...gt;cmds_to_issue != NULL) {
@@ -240,7 +246,7 @@ nbd_internal_command_common (struct nbd_handle *h,
h->cmds_to_issue = h->cmds_to_issue_tail = cmd;
if (nbd_internal_is_state_ready (get_next_state (h)) &&
nbd_internal_run (h, cmd_issue) == -1)
- return -1;
+ nbd_internal_debug (h, "command queued, ignoring state machine failure");
}
return cmd->cookie;
--
2.20.1
2019 Nov 02
1
[PATCH libnbd] lib: Use GCC hints to move debug and error handling code out of hot paths.
...t;debug))
+#else
+#define unlikely(x) (x)
+#define if_debug(h) if ((h)->debug)
+#endif
+
/* MSG_MORE is an optimization. If not present, ignore it. */
#ifndef MSG_MORE
#define MSG_MORE 0
@@ -329,7 +341,7 @@ extern void nbd_internal_crypto_debug_tls_enabled (struct nbd_handle *);
extern void nbd_internal_debug (struct nbd_handle *h, const char *fs, ...);
#define debug(h, fs, ...) \
do { \
- if ((h)->debug) \
+ if_debug ((h)) \
nbd_inte...
2019 Aug 13
0
[PATCH libnbd 4/4] lib: Add CALL_CALLBACK macro.
...mpletion.user_data, &error);
+ r = CALL_CALLBACK (cmd->cb.completion, &error);
FREE_CALLBACK (cmd->cb.completion);
switch (r) {
case -1:
diff --git a/lib/debug.c b/lib/debug.c
index e1ec675..eec2051 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -84,7 +84,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_callback.callback)
/* ignore return value */
- h->debug_callback.callback (h->debug_callback.user_data, context, msg);
+ CALL_CALLBACK (h->debug_callback, context, msg);
else
fprintf (stderr, "libnbd:...
[PATCH libnbd v2 02/10] lib: Add macros to check if a callback is "null" or not, and set it to null.
2019 Aug 15
0
[PATCH libnbd v2 02/10] lib: Add macros to check if a callback is "null" or not, and set it to null.
...- if (cmd->cb.completion.callback) {
+ if (CALLBACK_IS_NOT_NULL (cmd->cb.completion)) {
int error = cmd->error ? cmd->error : ENOTCONN;
int r;
diff --git a/lib/debug.c b/lib/debug.c
index eec2051..90d2f71 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -82,7 +82,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (r == -1)
goto out;
- if (h->debug_callback.callback)
+ if (CALLBACK_IS_NOT_NULL (h->debug_callback))
/* ignore return value */
CALL_CALLBACK (h->debug_callback, context, msg);
else
diff --git a/lib/internal.h b/lib/in...
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...void *data,
- void (*debug_fn) (void *, const char *, const char *))
+ int (*debug_fn) (void *, const char *, const char *))
{
h->debug_fn = debug_fn;
h->debug_data = data;
@@ -75,6 +75,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
goto out;
if (h->debug_fn)
+ /* ignore return value */
h->debug_fn (h->debug_data, context, msg);
else
fprintf (stderr, "libnbd: debug: %s: %s\n", context ? : "unknown", msg);
diff --git a/lib/interna...
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...rn value */
- h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
- h->debug_fn = debug_fn;
+ h->debug_callback (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
+ h->debug_callback = debug_callback;
h->debug_data = data;
return 0;
}
@@ -76,9 +76,9 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (r == -1)
goto out;
- if (h->debug_fn)
+ if (h->debug_callback)
/* ignore return value */
- h->debug_fn (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
+ h->debug_callback (LIBNBD_CALLBACK_VALID, h->debug_...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
.../* ignore return value */
- h->debug_callback (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
+ if (h->debug_callback)
nbd_internal_free_callback (h, h->debug_data);
- }
h->debug_callback = debug_callback;
h->debug_data = data;
return 0;
@@ -80,7 +77,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_callback)
/* ignore return value */
- h->debug_callback (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
+ h->debug_callback (h->debug_data, context, msg);
else
fprintf (stderr, "libnbd: debug:...
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 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...d *, const char *, const char *),
void *data)
{
+ if (h->debug_fn)
+ /* ignore return value */
+ h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
h->debug_fn = debug_fn;
h->debug_data = data;
return 0;
@@ -76,7 +79,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_fn)
/* ignore return value */
- h->debug_fn (h->debug_data, context, msg);
+ h->debug_fn (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
else
fprintf (stderr, "libnbd: debug: %s: %s\n", c...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...BACK_FREE,
- h->debug_callback.user_data, NULL, NULL);
+ if (h->debug_callback.free)
+ /* ignore return value */
+ h->debug_callback.free (h->debug_callback.user_data);
h->debug_callback.callback = NULL;
return 0;
}
@@ -88,8 +88,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_callback.callback)
/* ignore return value */
- h->debug_callback.callback (LIBNBD_CALLBACK_VALID,
- h->debug_callback.user_data, context, msg);
+ h->debug_callback.callback (h->deb...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...void *data)
+ debug_fn debug_fn, void *data)
{
+ if (h->debug_fn)
+ /* ignore return value */
+ h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
h->debug_fn = debug_fn;
h->debug_data = data;
return 0;
@@ -76,7 +78,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_fn)
/* ignore return value */
- h->debug_fn (h->debug_data, context, msg);
+ h->debug_fn (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
else
fprintf (stderr, "libnbd: debug: %s: %s\n", c...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...data)
+ nbd_debug_callback debug_callback)
{
/* This can't fail at the moment - see implementation above. */
nbd_unlocked_clear_debug_callback (h);
h->debug_callback = debug_callback;
- h->debug_data = data;
return 0;
}
@@ -87,9 +86,10 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (r == -1)
goto out;
- if (h->debug_callback)
+ if (h->debug_callback.callback)
/* ignore return value */
- h->debug_callback (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
+ h->debug_callback.callback (LIBNB...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...void *data)
+ debug_fn debug_fn, void *data)
{
+ if (h->debug_fn)
+ /* ignore return value */
+ h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
h->debug_fn = debug_fn;
h->debug_data = data;
return 0;
@@ -76,7 +78,7 @@ nbd_internal_debug (struct nbd_handle *h, const char *fs, ...)
if (h->debug_fn)
/* ignore return value */
- h->debug_fn (h->debug_data, context, msg);
+ h->debug_fn (LIBNBD_CALLBACK_VALID, h->debug_data, context, msg);
else
fprintf (stderr, "libnbd: debug: %s: %s\n", c...
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
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 Jun 04
9
[PATCH libnbd v2 0/4] api: Implement concurrent writer.
v1:
https://www.redhat.com/archives/libguestfs/2019-June/msg00014.html
I pushed a few bits which are uncontroversial. The main
changes since v1 are:
An extra patch removes the want_to_send / check for nbd_aio_is_ready
in examples/threaded-reads-and-writes.c. This logic was wrong since
commit 6af72b87 as was pointed out by Eric in his review. Comments
and structure of
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 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples
have been updated, but it demonstrates an idea: Should we forget about
the concept of having multiple connections managed under a single
handle?
In this patch there is a single ‘struct nbd_handle *’ which manages a
single state machine and connection (and therefore no nbd_connection).
To connect to a multi-conn server you must