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 (struct nbd_handle *h,
12 uint32_t flags);
13
15 Issue the disconnect command to the NBD server. This is not a normal
16 command because NBD servers are not obliged to send a reply. Instead
17 you should wait for nbd_aio_is_closed(3) to become true on the
18 connection. Once this command is issued, you cannot issue any further
19 commands.
20
21 Although libnbd does not prevent you from issuing this command while
22 still waiting on the replies to previous commands, the NBD protocol
23 recommends that you wait until there are no other commands in flight
24 (see nbd_aio_in_flight(3)), to give the server a better chance at a
25 clean shutdown.
26
27 The "flags" parameter must be 0 for now (it exists for future NBD
28 protocol extensions). There is no direct synchronous counterpart;
29 however, nbd_shutdown(3) will call this function if appropriate.
30
32 If the call is successful the function returns 0.
33
35 On error "-1" is returned.
36
37 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
38 of the error.
39
41 The handle must be connected and finished handshaking with the server,
42 otherwise this call will return an error.
43
45 This function first appeared in libnbd 1.0.
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_AIO_DISCONNECT 1
51
53 nbd_aio_in_flight(3), nbd_create(3), libnbd(3).
54
56 Eric Blake
57
58 Richard W.M. Jones
59
61 Copyright (C) 2019 Red Hat Inc.
62
64 This library is free software; you can redistribute it and/or modify it
65 under the terms of the GNU Lesser General Public License as published
66 by the Free Software Foundation; either version 2 of the License, or
67 (at your option) any later version.
68
69 This library is distributed in the hope that it will be useful, but
70 WITHOUT ANY WARRANTY; without even the implied warranty of
71 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72 Lesser General Public License for more details.
73
74 You should have received a copy of the GNU Lesser General Public
75 License along with this library; if not, write to the Free Software
76 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
77 02110-1301 USA
78
79
80
81libnbd-1.2.1 2019-11-14 nbd_aio_disconnect(3)