1nbd_cache(3)                        LIBNBD                        nbd_cache(3)
2
3
4

NAME

6       nbd_cache - send cache (prefetch) command to the NBD server
7

SYNOPSIS

9        #include <libnbd.h>
10
11        int nbd_cache (
12              struct nbd_handle *h, uint64_t count,
13              uint64_t offset, uint32_t flags
14            );
15

DESCRIPTION

17       Issue the cache (prefetch) command to the NBD server, which if
18       supported by the server causes data to be prefetched into faster
19       storage by the server, speeding up a subsequent nbd_pread(3) call.  The
20       server can also silently ignore this command.  Note this will generally
21       return an error if nbd_can_cache(3) is false.
22
23       Note that not all servers can support a "count" of 4GiB or larger.  The
24       NBD protocol does not yet have a way for a client to learn if the
25       server will enforce an even smaller maximum cache size, although a
26       future extension may add a constraint visible in nbd_get_block_size(3).
27
28       The "flags" parameter must be 0 for now (it exists for future NBD
29       protocol extensions).
30
31       By default, libnbd will reject attempts to use this function with
32       parameters that are likely to result in server failure, such as
33       requesting an unknown command flag.  The nbd_set_strict_mode(3)
34       function can be used to alter which scenarios should await a server
35       reply rather than failing fast.
36

RETURN VALUE

38       If the call is successful the function returns 0.
39

ERRORS

41       On error -1 is returned.
42
43       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
44       of the error.
45
46       The following parameters must not be NULL: "h".  For more information
47       see "Non-NULL parameters" in libnbd(3).
48

HANDLE STATE

50       The handle must be connected with the server, otherwise this call will
51       return an error.
52

VERSION

54       This function first appeared in libnbd 1.0.
55
56       If you need to test if this function is available at compile time check
57       if the following macro is defined:
58
59        #define LIBNBD_HAVE_NBD_CACHE 1
60

SEE ALSO

62       nbd_aio_cache(3), nbd_can_cache(3), nbd_create(3),
63       nbd_get_block_size(3), nbd_pread(3), nbd_set_strict_mode(3), libnbd(3).
64

AUTHORS

66       Eric Blake
67
68       Richard W.M. Jones
69
71       Copyright Red Hat
72

LICENSE

74       This library is free software; you can redistribute it and/or modify it
75       under the terms of the GNU Lesser General Public License as published
76       by the Free Software Foundation; either version 2 of the License, or
77       (at your option) any later version.
78
79       This library is distributed in the hope that it will be useful, but
80       WITHOUT ANY WARRANTY; without even the implied warranty of
81       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
82       Lesser General Public License for more details.
83
84       You should have received a copy of the GNU Lesser General Public
85       License along with this library; if not, write to the Free Software
86       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
87       02110-1301 USA
88
89
90
91libnbd-1.16.5                     2023-09-26                      nbd_cache(3)
Impressum