1nbd_set_export_name(3) LIBNBD nbd_set_export_name(3)
2
3
4
6 nbd_set_export_name - set the export name
7
9 #include <libnbd.h>
10
11 int nbd_set_export_name (struct nbd_handle *h,
12 const char *export_name);
13
15 For servers which require an export name or can serve different content
16 on different exports, set the "export_name" to connect to. The default
17 is the empty string "".
18
19 This is only relevant when connecting to servers using the newstyle
20 protocol as the oldstyle protocol did not support export names. The
21 NBD protocol limits export names to 4096 bytes, but servers may not
22 support the full length. The encoding of export names is always UTF-8.
23
24 When option mode is not in use, the export name must be set before
25 beginning a connection. However, when nbd_set_opt_mode(3) has enabled
26 option mode, it is possible to change the export name prior to
27 nbd_opt_go(3). In particular, the use of nbd_opt_list(3) during
28 negotiation can be used to determine a name the server is likely to
29 accept, and nbd_opt_info(3) can be used to learn details about an
30 export before connecting.
31
32 This call may be skipped if using nbd_connect_uri(3) to connect to a
33 URI that includes an export name.
34
36 If the call is successful the function returns 0.
37
39 On error "-1" is returned.
40
41 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
42 of the error.
43
44 The following parameters must not be NULL: "h", "export_name". For
45 more information see "Non-NULL parameters" in libnbd(3).
46
48 The handle must be newly created, or negotiating, otherwise this call
49 will return an error.
50
52 This function first appeared in libnbd 1.0.
53
54 If you need to test if this function is available at compile time check
55 if the following macro is defined:
56
57 #define LIBNBD_HAVE_NBD_SET_EXPORT_NAME 1
58
60 nbd_connect_uri(3), nbd_create(3), nbd_get_export_name(3),
61 nbd_opt_go(3), nbd_opt_info(3), nbd_opt_list(3), nbd_set_opt_mode(3),
62 libnbd(3).
63
65 Eric Blake
66
67 Richard W.M. Jones
68
70 Copyright (C) 2019-2021 Red Hat Inc.
71
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.14.2 2023-01-03 nbd_set_export_name(3)