1nbd_aio_opt_set_meta_context(3)     LIBNBD     nbd_aio_opt_set_meta_context(3)
2
3
4

NAME

6       nbd_aio_opt_set_meta_context - select specific meta contexts, with
7       implicit query list
8

SYNOPSIS

10        #include <libnbd.h>
11
12        typedef struct {
13          int (*callback) (void *user_data, const char *name);
14          void *user_data;
15          void (*free) (void *user_data);
16        } nbd_context_callback;
17
18        typedef struct {
19          int (*callback) (void *user_data, int *error);
20          void *user_data;
21          void (*free) (void *user_data);
22        } nbd_completion_callback;
23
24        int nbd_aio_opt_set_meta_context (
25              struct nbd_handle *h,
26              nbd_context_callback context_callback,
27              nbd_completion_callback completion_callback
28            );
29

DESCRIPTION

31       Request that the server supply all recognized meta contexts registered
32       through prior calls to nbd_add_meta_context(3), in conjunction with the
33       export previously specified by the most recent nbd_set_export_name(3)
34       or nbd_connect_uri(3).  This can only be used if nbd_set_opt_mode(3)
35       enabled option mode.  Normally, this function is redundant, as
36       nbd_opt_go(3) automatically does the same task if structured replies or
37       extended headers have already been negotiated.  But manual control over
38       meta context requests can be useful for fine-grained testing of how a
39       server handles unusual negotiation sequences.  Often, use of this
40       function is coupled with nbd_set_request_meta_context(3) to bypass the
41       automatic context request normally performed by nbd_opt_go(3).
42
43       To determine when the request completes, wait for
44       nbd_aio_is_connecting(3) to return false.  Or supply the optional
45       "completion_callback" which will be invoked as described in "Completion
46       callbacks" in libnbd(3), except that it is automatically retired
47       regardless of return value.  Note that detecting whether the server
48       returns an error (as is done by the return value of the synchronous
49       counterpart) is only possible with a completion callback.
50

RETURN VALUE

52       This call returns an integer ≥ 0.
53

ERRORS

55       On error -1 is returned.
56
57       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
58       of the error.
59
60       The following parameters must not be NULL: "h".  For more information
61       see "Non-NULL parameters" in libnbd(3).
62

HANDLE STATE

64       The handle must be negotiating, otherwise this call will return an
65       error.
66

VERSION

68       This function first appeared in libnbd 1.16.
69
70       If you need to test if this function is available at compile time check
71       if the following macro is defined:
72
73        #define LIBNBD_HAVE_NBD_AIO_OPT_SET_META_CONTEXT 1
74

SEE ALSO

76       nbd_add_meta_context(3), nbd_aio_is_connecting(3),
77       nbd_aio_opt_set_meta_context_queries(3), nbd_connect_uri(3),
78       nbd_create(3), nbd_opt_go(3), nbd_opt_set_meta_context(3),
79       nbd_set_export_name(3), nbd_set_opt_mode(3),
80       nbd_set_request_meta_context(3), libnbd(3).
81

AUTHORS

83       Eric Blake
84
85       Richard W.M. Jones
86
88       Copyright Red Hat
89

LICENSE

91       This library is free software; you can redistribute it and/or modify it
92       under the terms of the GNU Lesser General Public License as published
93       by the Free Software Foundation; either version 2 of the License, or
94       (at your option) any later version.
95
96       This library is distributed in the hope that it will be useful, but
97       WITHOUT ANY WARRANTY; without even the implied warranty of
98       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
99       Lesser General Public License for more details.
100
101       You should have received a copy of the GNU Lesser General Public
102       License along with this library; if not, write to the Free Software
103       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
104       02110-1301 USA
105
106
107
108libnbd-1.18.1                     2023-10-31   nbd_aio_opt_set_meta_context(3)
Impressum