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 (struct nbd_handle *h, uint64_t count,
12                       uint64_t offset, uint32_t flags);
13

DESCRIPTION

15       Issue the cache (prefetch) command to the NBD server, which if
16       supported by the server causes data to be prefetched into faster
17       storage by the server, speeding up a subsequent nbd_pread(3) call.  The
18       server can also silently ignore this command.  Note this will generally
19       return an error if nbd_can_cache(3) is false.
20
21       The "flags" parameter must be 0 for now (it exists for future NBD
22       protocol extensions).
23
24       By default, libnbd will reject attempts to use this function with
25       parameters that are likely to result in server failure, such as
26       requesting an unknown command flag.  The nbd_set_strict_mode(3)
27       function can be used to alter which scenarios should await a server
28       reply rather than failing fast.
29

RETURN VALUE

31       If the call is successful the function returns 0.
32

ERRORS

34       On error "-1" is returned.
35
36       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
37       of the error.
38

HANDLE STATE

40       The handle must be connected with the server, otherwise this call will
41       return an error.
42

VERSION

44       This function first appeared in libnbd 1.0.
45
46       If you need to test if this function is available at compile time check
47       if the following macro is defined:
48
49        #define LIBNBD_HAVE_NBD_CACHE 1
50

SEE ALSO

52       nbd_aio_cache(3), nbd_can_cache(3), nbd_create(3), nbd_pread(3),
53       nbd_set_strict_mode(3), libnbd(3).
54

AUTHORS

56       Eric Blake
57
58       Richard W.M. Jones
59
61       Copyright (C) 2019-2021 Red Hat Inc.
62

LICENSE

64       This library is free software; you can redistribute it and/or modify it
65       under the terms of the GNU Lesser General Public License as published
66       by the Free Software Foundation; either version 2 of the License, or
67       (at your option) any later version.
68
69       This library is distributed in the hope that it will be useful, but
70       WITHOUT ANY WARRANTY; without even the implied warranty of
71       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
72       Lesser General Public License for more details.
73
74       You should have received a copy of the GNU Lesser General Public
75       License along with this library; if not, write to the Free Software
76       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
77       02110-1301 USA
78
79
80
81libnbd-1.7.12                     2021-05-29                      nbd_cache(3)
Impressum