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;
24       nbd_get_extended_headers_negotiated(3) indicates which servers will
25       parse a request larger than 32 bits.  The NBD protocol does not yet
26       have a way for a client to learn if the server will enforce an even
27       smaller maximum cache size, although a future extension may add a
28       constraint visible in nbd_get_block_size(3).
29
30       The "flags" parameter must be 0 for now (it exists for future NBD
31       protocol extensions).
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

RETURN VALUE

40       If the call is successful the function returns 0.
41

ERRORS

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

HANDLE STATE

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

VERSION

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_CACHE 1
62

SEE ALSO

64       nbd_aio_cache(3), nbd_can_cache(3), nbd_create(3),
65       nbd_get_block_size(3), nbd_get_extended_headers_negotiated(3),
66       nbd_pread(3), nbd_set_strict_mode(3), libnbd(3).
67

AUTHORS

69       Eric Blake
70
71       Richard W.M. Jones
72
74       Copyright Red Hat
75

LICENSE

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.18.1                     2023-10-31                      nbd_cache(3)
Impressum