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 (struct nbd_handle *h,
19                                    nbd_debug_callback debug_callback);
20

DESCRIPTION

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

RETURN VALUE

33       If the call is successful the function returns 0.
34

ERRORS

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

VERSION

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

SEE ALSO

53       nbd_create(3), libnbd(3).
54

AUTHORS

56       Eric Blake
57
58       Richard W.M. Jones
59
61       Copyright (C) 2019-2021 Red Hat Inc.
62

LICENSE

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