1nbd_add_meta_context(3)             LIBNBD             nbd_add_meta_context(3)
2
3
4

NAME

6       nbd_add_meta_context - ask server to negotiate metadata context
7

SYNOPSIS

9        #include <libnbd.h>
10
11        int nbd_add_meta_context (struct nbd_handle *h,
12                                  const char *name);
13

DESCRIPTION

15       During connection libnbd can negotiate zero or more metadata contexts
16       with the server.  Metadata contexts are features (such as
17       "base:allocation") which describe information returned by the
18       nbd_block_status(3) command (for "base:allocation" this is whether
19       blocks of data are allocated, zero or sparse).
20
21       This call adds one metadata context to the list to be negotiated.  You
22       can call it as many times as needed.  The list is initially empty when
23       the handle is created.
24
25       The NBD protocol limits meta context names to 4096 bytes, but servers
26       may not support the full length.  The encoding of meta context names is
27       always UTF-8.
28
29       Not all servers support all metadata contexts.  To learn if a context
30       was actually negotiated, call nbd_can_meta_context(3) after connecting.
31
32       The single parameter is the name of the metadata context, for example
33       "LIBNBD_CONTEXT_BASE_ALLOCATION".  <libnbd.h> includes defined
34       constants beginning with "LIBNBD_CONTEXT_" for some well-known
35       contexts, but you are free to pass in other contexts.
36
37       Other metadata contexts are server-specific, but include
38       "qemu:dirty-bitmap:..." for qemu-nbd (see qemu-nbd -B option).
39

RETURN VALUE

41       If the call is successful the function returns 0.
42

ERRORS

44       On error "-1" is returned.
45
46       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
47       of the error.
48

HANDLE STATE

50       The handle must be newly created, otherwise this call will return an
51       error.
52

VERSION

54       This function first appeared in libnbd 1.0.
55
56       If you need to test if this function is available at compile time check
57       if the following macro is defined:
58
59        #define LIBNBD_HAVE_NBD_ADD_META_CONTEXT 1
60

SEE ALSO

62       nbd_block_status(3), nbd_can_meta_context(3), nbd_create(3), libnbd(3).
63

AUTHORS

65       Eric Blake
66
67       Richard W.M. Jones
68
70       Copyright (C) 2019 Red Hat Inc.
71

LICENSE

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