1nbd_aio_disconnect(3) LIBNBD nbd_aio_disconnect(3)
2
3
4
6 nbd_aio_disconnect - disconnect from the NBD server
7
9 #include <libnbd.h>
10
11 int nbd_aio_disconnect (
12 struct nbd_handle *h, uint32_t flags
13 );
14
16 Issue the disconnect command to the NBD server. This is not a normal
17 command because NBD servers are not obliged to send a reply. Instead
18 you should wait for nbd_aio_is_closed(3) to become true on the
19 connection. Once this command is issued, you cannot issue any further
20 commands.
21
22 Although libnbd does not prevent you from issuing this command while
23 still waiting on the replies to previous commands, the NBD protocol
24 recommends that you wait until there are no other commands in flight
25 (see nbd_aio_in_flight(3)), to give the server a better chance at a
26 clean shutdown.
27
28 The "flags" parameter must be 0 for now (it exists for future NBD
29 protocol extensions). There is no direct synchronous counterpart;
30 however, nbd_shutdown(3) will call this function if appropriate.
31
33 If the call is successful the function returns 0.
34
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
41 The following parameters must not be NULL: "h". For more information
42 see "Non-NULL parameters" in libnbd(3).
43
45 The handle must be connected with the server, otherwise this call will
46 return an error.
47
49 This function first appeared in libnbd 1.0.
50
51 If you need to test if this function is available at compile time check
52 if the following macro is defined:
53
54 #define LIBNBD_HAVE_NBD_AIO_DISCONNECT 1
55
57 nbd_aio_in_flight(3), nbd_aio_is_closed(3), nbd_create(3),
58 nbd_shutdown(3), libnbd(3).
59
61 Eric Blake
62
63 Richard W.M. Jones
64
66 Copyright Red Hat
67
69 This library is free software; you can redistribute it and/or modify it
70 under the terms of the GNU Lesser General Public License as published
71 by the Free Software Foundation; either version 2 of the License, or
72 (at your option) any later version.
73
74 This library is distributed in the hope that it will be useful, but
75 WITHOUT ANY WARRANTY; without even the implied warranty of
76 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
77 Lesser General Public License for more details.
78
79 You should have received a copy of the GNU Lesser General Public
80 License along with this library; if not, write to the Free Software
81 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
82 02110-1301 USA
83
84
85
86libnbd-1.16.5 2023-09-26 nbd_aio_disconnect(3)