1nbd_aio_block_status(3) LIBNBD nbd_aio_block_status(3)
2
3
4
6 nbd_aio_block_status - send block status command to the NBD server
7
9 #include <libnbd.h>
10
11 typedef struct {
12 int (*callback) (void *user_data,
13 const char *metacontext,
14 uint64_t offset, uint32_t *entries,
15 size_t nr_entries, int *error);
16 void *user_data;
17 void (*free) (void *user_data);
18 } nbd_extent_callback;
19
20 typedef struct {
21 int (*callback) (void *user_data, int *error);
22 void *user_data;
23 void (*free) (void *user_data);
24 } nbd_completion_callback;
25
26 int64_t nbd_aio_block_status (struct nbd_handle *h,
27 uint64_t count,
28 uint64_t offset,
29 nbd_extent_callback extent_callback,
30 nbd_completion_callback completion_callback,
31 uint32_t flags);
32
34 Send the block status command to the NBD server.
35
36 To check if the command completed, call nbd_aio_command_completed(3).
37 Or supply the optional "completion_callback" which will be invoked as
38 described in "Completion callbacks" in libnbd(3).
39
40 Other parameters behave as documented in nbd_block_status(3).
41
42 By default, libnbd will reject attempts to use this function with
43 parameters that are likely to result in server failure, such as
44 requesting an unknown command flag. The nbd_set_strict_mode(3)
45 function can be used to alter which scenarios should await a server
46 reply rather than failing fast.
47
49 This call returns the 64 bit cookie of the command. The cookie is ≥ 1.
50 Cookies are unique (per libnbd handle, not globally).
51
53 On error "-1" is returned.
54
55 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
56 of the error.
57
58 The following parameters must not be NULL: "h". For more information
59 see "Non-NULL parameters" in libnbd(3).
60
62 The handle must be connected with the server, otherwise this call will
63 return an error.
64
66 This function first appeared in libnbd 1.0.
67
68 If you need to test if this function is available at compile time check
69 if the following macro is defined:
70
71 #define LIBNBD_HAVE_NBD_AIO_BLOCK_STATUS 1
72
74 nbd_aio_command_completed(3), nbd_block_status(3),
75 nbd_can_meta_context(3), nbd_create(3), nbd_set_strict_mode(3),
76 "Issuing asynchronous commands" in libnbd(3), libnbd(3).
77
79 Eric Blake
80
81 Richard W.M. Jones
82
84 Copyright (C) 2019-2021 Red Hat Inc.
85
87 This library is free software; you can redistribute it and/or modify it
88 under the terms of the GNU Lesser General Public License as published
89 by the Free Software Foundation; either version 2 of the License, or
90 (at your option) any later version.
91
92 This library is distributed in the hope that it will be useful, but
93 WITHOUT ANY WARRANTY; without even the implied warranty of
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 Lesser General Public License for more details.
96
97 You should have received a copy of the GNU Lesser General Public
98 License along with this library; if not, write to the Free Software
99 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
100 02110-1301 USA
101
102
103
104libnbd-1.14.2 2023-01-03 nbd_aio_block_status(3)