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
42 This call returns the 64 bit cookie of the command. The cookie is ≥ 1.
43 Cookies are unique (per libnbd handle, not globally).
44
46 On error "-1" is returned.
47
48 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
49 of the error.
50
52 The handle must be connected and finished handshaking with the server,
53 otherwise this call will return an error.
54
56 This function first appeared in libnbd 1.0.
57
58 If you need to test if this function is available at compile time check
59 if the following macro is defined:
60
61 #define LIBNBD_HAVE_NBD_AIO_PREAD_STRUCTURED 1
62
64 nbd_aio_command_completed(3), nbd_aio_pread(3), nbd_create(3),
65 nbd_pread_structured(3), "Issuing asynchronous commands" in libnbd(3),
66 libnbd(3).
67
69 Eric Blake
70
71 Richard W.M. Jones
72
74 Copyright (C) 2019 Red Hat Inc.
75
77 This library is free software; you can redistribute it and/or modify it
78 under the terms of the GNU Lesser General Public License as published
79 by the Free Software Foundation; either version 2 of the License, or
80 (at your option) any later version.
81
82 This library is distributed in the hope that it will be useful, but
83 WITHOUT ANY WARRANTY; without even the implied warranty of
84 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85 Lesser General Public License for more details.
86
87 You should have received a copy of the GNU Lesser General Public
88 License along with this library; if not, write to the Free Software
89 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
90 02110-1301 USA
91
92
93
94libnbd-1.3.7 2020-04-23 nbd_aio_pread_structured(3)