1nbd_set_debug_callback(3)           LIBNBD           nbd_set_debug_callback(3)
2
3
4

NAME

6       nbd_set_debug_callback - set the debug callback
7

SYNOPSIS

9        #include <libnbd.h>
10
11        typedef struct {
12          int (*callback) (void *user_data, const char *context,
13                           const char *msg);
14          void *user_data;
15          void (*free) (void *user_data);
16        } nbd_debug_callback;
17
18        int nbd_set_debug_callback (
19              struct nbd_handle *h,
20              nbd_debug_callback debug_callback
21            );
22

DESCRIPTION

24       Set the debug callback.  This function is called when the library emits
25       debug messages, when debugging is enabled on a handle.  The callback
26       parameters are "user_data" passed to this function, the name of the
27       libnbd function emitting the debug message ("context"), and the message
28       itself ("msg").  If no debug callback is set on a handle then messages
29       are printed on "stderr".
30
31       The callback should not call "nbd_*" APIs on the same handle since it
32       can be called while holding the handle lock and will cause a deadlock.
33

RETURN VALUE

35       If the call is successful the function returns 0.
36

ERRORS

38       On error -1 is returned.
39
40       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
41       of the error.
42
43       The following parameters must not be NULL: "h".  For more information
44       see "Non-NULL parameters" in libnbd(3).
45

VERSION

47       This function first appeared in libnbd 1.0.
48
49       If you need to test if this function is available at compile time check
50       if the following macro is defined:
51
52        #define LIBNBD_HAVE_NBD_SET_DEBUG_CALLBACK 1
53

SEE ALSO

55       nbd_create(3), libnbd(3).
56

AUTHORS

58       Eric Blake
59
60       Richard W.M. Jones
61
63       Copyright Red Hat
64

LICENSE

66       This library is free software; you can redistribute it and/or modify it
67       under the terms of the GNU Lesser General Public License as published
68       by the Free Software Foundation; either version 2 of the License, or
69       (at your option) any later version.
70
71       This library is distributed in the hope that it will be useful, but
72       WITHOUT ANY WARRANTY; without even the implied warranty of
73       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
74       Lesser General Public License for more details.
75
76       You should have received a copy of the GNU Lesser General Public
77       License along with this library; if not, write to the Free Software
78       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
79       02110-1301 USA
80
81
82
83libnbd-1.16.5                     2023-09-26         nbd_set_debug_callback(3)
Impressum