1nbd_aio_block_status(3)             LIBNBD             nbd_aio_block_status(3)
2
3
4

NAME

6       nbd_aio_block_status - send block status command, with 32-bit callback
7

SYNOPSIS

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 (
27                  struct nbd_handle *h, uint64_t count,
28                  uint64_t offset,
29                  nbd_extent_callback extent_callback,
30                  nbd_completion_callback completion_callback,
31                  uint32_t flags
32                );
33

DESCRIPTION

35       Send the block status command to the NBD server.
36
37       To check if the command completed, call nbd_aio_command_completed(3).
38       Or supply the optional "completion_callback" which will be invoked as
39       described in "Completion callbacks" in libnbd(3).
40
41       Other parameters behave as documented in nbd_block_status(3).
42
43       This function is inherently limited to 32-bit values.  If the server
44       replies with a larger extent, the length of that extent will be
45       truncated to just below 32 bits and any further extents from the server
46       will be ignored.  If the server replies with a status value larger than
47       32 bits (only possible when extended headers are in use), the callback
48       function will be passed an "EOVERFLOW" error.  To get the full extent
49       information from a server that supports 64-bit extents, you must use
50       nbd_aio_block_status_64(3).
51
52       By default, libnbd will reject attempts to use this function with
53       parameters that are likely to result in server failure, such as
54       requesting an unknown command flag.  The nbd_set_strict_mode(3)
55       function can be used to alter which scenarios should await a server
56       reply rather than failing fast.
57

RETURN VALUE

59       This call returns the 64 bit cookie of the command.  The cookie is ≥ 1.
60       Cookies are unique (per libnbd handle, not globally).
61

ERRORS

63       On error -1 is returned.
64
65       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
66       of the error.
67
68       The following parameters must not be NULL: "h".  For more information
69       see "Non-NULL parameters" in libnbd(3).
70

HANDLE STATE

72       The handle must be connected with the server, otherwise this call will
73       return an error.
74

VERSION

76       This function first appeared in libnbd 1.0.
77
78       If you need to test if this function is available at compile time check
79       if the following macro is defined:
80
81        #define LIBNBD_HAVE_NBD_AIO_BLOCK_STATUS 1
82

SEE ALSO

84       nbd_aio_block_status_64(3), nbd_aio_command_completed(3),
85       nbd_block_status(3), nbd_can_meta_context(3), nbd_create(3),
86       nbd_set_strict_mode(3), "Issuing asynchronous commands" in libnbd(3),
87       libnbd(3).
88

AUTHORS

90       Eric Blake
91
92       Richard W.M. Jones
93
95       Copyright Red Hat
96

LICENSE

98       This library is free software; you can redistribute it and/or modify it
99       under the terms of the GNU Lesser General Public License as published
100       by the Free Software Foundation; either version 2 of the License, or
101       (at your option) any later version.
102
103       This library is distributed in the hope that it will be useful, but
104       WITHOUT ANY WARRANTY; without even the implied warranty of
105       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
106       Lesser General Public License for more details.
107
108       You should have received a copy of the GNU Lesser General Public
109       License along with this library; if not, write to the Free Software
110       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
111       02110-1301 USA
112
113
114
115libnbd-1.18.1                     2023-10-31           nbd_aio_block_status(3)
Impressum