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 (struct nbd_handle *h,
18 uint64_t count, uint64_t offset,
19 nbd_completion_callback completion_callback,
20 uint32_t flags);
21
23 Issue the cache (prefetch) command to the NBD server.
24
25 To check if the command completed, call nbd_aio_command_completed(3).
26 Or supply the optional "completion_callback" which will be invoked as
27 described in "Completion callbacks" in libnbd(3).
28
29 Other parameters behave as documented in nbd_cache(3).
30
32 This call returns the 64 bit cookie of the command. The cookie is ≥ 1.
33 Cookies are unique (per libnbd handle, not globally).
34
36 On error "-1" is returned.
37
38 Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
39 of the error.
40
42 The handle must be connected and finished handshaking with the server,
43 otherwise this call will return an error.
44
46 This function first appeared in libnbd 1.0.
47
48 If you need to test if this function is available at compile time check
49 if the following macro is defined:
50
51 #define LIBNBD_HAVE_NBD_AIO_CACHE 1
52
54 nbd_aio_command_completed(3), nbd_cache(3), nbd_can_cache(3),
55 nbd_create(3), "Issuing asynchronous commands" in libnbd(3), libnbd(3).
56
58 Eric Blake
59
60 Richard W.M. Jones
61
63 Copyright (C) 2019 Red Hat Inc.
64
66 This library is free software; you can redistribute it and/or modify it
67 under the terms of the GNU Lesser General Public License as published
68 by the Free Software Foundation; either version 2 of the License, or
69 (at your option) any later version.
70
71 This library is distributed in the hope that it will be useful, but
72 WITHOUT ANY WARRANTY; without even the implied warranty of
73 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74 Lesser General Public License for more details.
75
76 You should have received a copy of the GNU Lesser General Public
77 License along with this library; if not, write to the Free Software
78 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
79 02110-1301 USA
80
81
82
83libnbd-1.3.7 2020-04-23 nbd_aio_cache(3)