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 (struct nbd_handle *h,
13 bool request);
14
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
32 If the call is successful the function returns 0.
33
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
40 The following parameters must not be NULL: "h". For more information
41 see "Non-NULL parameters" in libnbd(3).
42
44 The handle must be newly created, or negotiating, otherwise this call
45 will return an error.
46
48 This function first appeared in libnbd 1.12.
49
50 If you need to test if this function is available at compile time check
51 if the following macro is defined:
52
53 #define LIBNBD_HAVE_NBD_SET_REQUEST_BLOCK_SIZE 1
54
56 nbd_create(3), nbd_get_block_size(3), nbd_get_request_block_size(3),
57 nbd_set_full_info(3), nbd_set_strict_mode(3), libnbd(3).
58
60 Eric Blake
61
62 Richard W.M. Jones
63
65 Copyright (C) 2019-2021 Red Hat Inc.
66
68 This library is free software; you can redistribute it and/or modify it
69 under the terms of the GNU Lesser General Public License as published
70 by the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72
73 This library is distributed in the hope that it will be useful, but
74 WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 Lesser General Public License for more details.
77
78 You should have received a copy of the GNU Lesser General Public
79 License along with this library; if not, write to the Free Software
80 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
81 02110-1301 USA
82
83
84
85libnbd-1.14.2 2023-01-03 nbd_set_request_block_size(3)