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

VERSION

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

SEE ALSO

50       nbd_create(3), libnbd(3).
51

AUTHORS

53       Eric Blake
54
55       Richard W.M. Jones
56
58       Copyright (C) 2019-2020 Red Hat Inc.
59

LICENSE

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