1nbd_set_request_block_size(3)       LIBNBD       nbd_set_request_block_size(3)
2
3
4

NAME

6       nbd_set_request_block_size - control whether NBD_OPT_GO requests block
7       size
8

SYNOPSIS

10        #include <libnbd.h>
11
12        int nbd_set_request_block_size (struct nbd_handle *h,
13                                        bool request);
14

DESCRIPTION

16       By default, when connecting to an export, libnbd requests that the
17       server report any block size restrictions.  The NBD protocol states
18       that a server may supply block sizes regardless of whether the client
19       requests them, and libnbd will report those block sizes (see
20       nbd_get_block_size(3)); conversely, if a client does not request block
21       sizes, the server may reject the connection instead of dealing with a
22       client sending unaligned requests.  This function makes it possible to
23       test server behavior by emulating older clients.
24
25       Note that even when block size is requested, the server is not
26       obligated to provide any.  Furthermore, if block sizes are provided
27       (whether or not the client requested them), libnbd enforces alignment
28       to those sizes unless nbd_set_strict_mode(3) is used to bypass client-
29       side safety checks.
30

RETURN VALUE

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

ERRORS

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

HANDLE STATE

41       The handle must be newly created, or negotiating, otherwise this call
42       will return an error.
43

VERSION

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

SEE ALSO

53       nbd_create(3), nbd_get_block_size(3), nbd_get_request_block_size(3),
54       nbd_set_full_info(3), nbd_set_strict_mode(3), libnbd(3).
55

AUTHORS

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

LICENSE

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