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