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