1nbd_get_uri(3) LIBNBD nbd_get_uri(3)
2
3
4
6 nbd_get_uri - construct an NBD URI for a connection
7
9 #include <libnbd.h>
10
11 char * nbd_get_uri (struct nbd_handle *h);
12
14 This makes a best effort attempt to construct an NBD URI which could be
15 used to connect back to the same server (using nbd_connect_uri(3)).
16
17 In some cases there is not enough information in the handle to
18 successfully create a URI (eg. if you connected with
19 nbd_connect_socket(3)). In such cases the call returns "NULL" and
20 further diagnostic information is available via nbd_get_errno(3) and
21 nbd_get_error(3) as usual.
22
23 Even if a URI is returned it is not guaranteed to work, and it may not
24 be optimal.
25
27 This call returns a string. The caller must free the returned string
28 to avoid a memory leak.
29
31 On error "NULL" is returned.
32
33 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
34 of the error.
35
36 The following parameters must not be NULL: "h". For more information
37 see "Non-NULL parameters" in libnbd(3).
38
40 The handle must be connecting, or negotiating, or connected with the
41 server, or shut down, or dead, otherwise this call will return an
42 error.
43
45 This function first appeared in libnbd 1.8.
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_GET_URI 1
51
53 nbd_aio_connect_uri(3), nbd_connect_socket(3), nbd_connect_uri(3),
54 nbd_create(3), nbd_get_errno(3), nbd_get_error(3), nbd_supports_uri(3),
55 libnbd(3).
56
58 Eric Blake
59
60 Richard W.M. Jones
61
63 Copyright (C) 2019-2021 Red Hat Inc.
64
66 This library is free software; you can redistribute it and/or modify it
67 under the terms of the GNU Lesser General Public License as published
68 by the Free Software Foundation; either version 2 of the License, or
69 (at your option) any later version.
70
71 This library is distributed in the hope that it will be useful, but
72 WITHOUT ANY WARRANTY; without even the implied warranty of
73 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74 Lesser General Public License for more details.
75
76 You should have received a copy of the GNU Lesser General Public
77 License along with this library; if not, write to the Free Software
78 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
79 02110-1301 USA
80
81
82
83libnbd-1.14.2 2023-01-03 nbd_get_uri(3)