1nbd_set_request_block_size(3) LIBNBD nbd_set_request_block_size(3)
2
3
4
6 nbd_set_request_block_size - control whether NBD_OPT_GO requests block
7 size
8
10 #include <libnbd.h>
11
12 int nbd_set_request_block_size (
13 struct nbd_handle *h, bool request
14 );
15
17 By default, when connecting to an export, libnbd requests that the
18 server report any block size restrictions. The NBD protocol states
19 that a server may supply block sizes regardless of whether the client
20 requests them, and libnbd will report those block sizes (see
21 nbd_get_block_size(3)); conversely, if a client does not request block
22 sizes, the server may reject the connection instead of dealing with a
23 client sending unaligned requests. This function makes it possible to
24 test server behavior by emulating older clients.
25
26 Note that even when block size is requested, the server is not
27 obligated to provide any. Furthermore, if block sizes are provided
28 (whether or not the client requested them), libnbd enforces alignment
29 to those sizes unless nbd_set_strict_mode(3) is used to bypass client-
30 side safety checks.
31
33 If the call is successful the function returns 0.
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
41 The following parameters must not be NULL: "h". For more information
42 see "Non-NULL parameters" in libnbd(3).
43
45 The handle must be newly created, or negotiating, otherwise this call
46 will return an error.
47
49 This function first appeared in libnbd 1.12.
50
51 If you need to test if this function is available at compile time check
52 if the following macro is defined:
53
54 #define LIBNBD_HAVE_NBD_SET_REQUEST_BLOCK_SIZE 1
55
57 nbd_create(3), nbd_get_block_size(3), nbd_get_request_block_size(3),
58 nbd_set_full_info(3), nbd_set_strict_mode(3), libnbd(3).
59
61 Eric Blake
62
63 Richard W.M. Jones
64
66 Copyright Red Hat
67
69 This library is free software; you can redistribute it and/or modify it
70 under the terms of the GNU Lesser General Public License as published
71 by the Free Software Foundation; either version 2 of the License, or
72 (at your option) any later version.
73
74 This library is distributed in the hope that it will be useful, but
75 WITHOUT ANY WARRANTY; without even the implied warranty of
76 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
77 Lesser General Public License for more details.
78
79 You should have received a copy of the GNU Lesser General Public
80 License along with this library; if not, write to the Free Software
81 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
82 02110-1301 USA
83
84
85
86libnbd-1.18.1 2023-10-31 nbd_set_request_block_size(3)