nbd_set_request_block_size(3)
π nbd_set_request_block_size β like, the libnbd(3) girlies' guide
okay so bestie, welcome to nbd_set_request_block_size(3), straight out of the LIBNBD manual π this one's a tiny function with big "let me test the server's vibe" energy, and yes, you're gonna get it.
β¨ NAME β¨
nbd_set_request_block_size β it controls whether NBD_OPT_GO requests block size π (that's literally the whole plot, no cap)
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_set_request_block_size (
struct nbd_handle *h, bool request
);
like, two args, that's it, we love a low-effort icon β¨
π¦ DESCRIPTION π¦
okay so first things first: by default, when you connect to an export, libnbd requests that the server report any block size restrictions. that's the default behavior, nobody's asking you to do anything.
the NBD protocol is lowkey messy about this tho β it states that a server may supply block sizes regardless of whether the client requests them, and libnbd will report those block sizes anyway (peep nbd_get_block_size(3) if you wanna see them π). conversely β and this is the spicy part β if a client does not request block sizes, the server may reject the connection instead of dealing with a client sending unaligned requests. so, like, it can get dramatic π
this function makes it possible to test server behavior by emulating older clients. yes bestie, we're cosplaying as an old client. it's giving method acting π
β οΈ note that even when block size is requested, the server is not obligated to provide any. it can justβ¦ not. rude, but legal.
β οΈ and furthermore β if block sizes are provided (whether or not the client requested them), libnbd enforces alignment to those sizes, unless nbd_set_strict_mode(3) is used to bypass client-side safety checks. so like, that's the escape hatch, use it responsibly, iykyk π
π RETURN VALUE π
if the call is successful the function returns 0. slay. that's the good ending π«Ά
π ERRORS π
on error -1 is returned. not slay.
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β it's like the receipts, go read them π₯
the following parameters must not be NULL: h. for more information see "Non-NULL parameters" in libnbd(3). do not pass a NULL handle, bestie, that's not the vibe check you want to fail π§
π HANDLE STATE π
nbd_set_request_block_size can be called when the handle is in the following states:
- Handle created, before connecting β β allowed
- Connecting β β error
- Connecting & handshaking (
opt_mode) β β allowed - Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so basically: before you connect, or mid-handshake while cycling through opt_mode. anywhere else and it's a no π
β VERSION β
this function first appeared in libnbd 1.12 π a little vintage, a little iconic.
if you need to test if this function is available at compile time, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_SET_REQUEST_BLOCK_SIZE 1
π SEE ALSO π
nbd_create(3), nbd_get_block_size(3), nbd_get_request_block_size(3), nbd_set_full_info(3), nbd_set_strict_mode(3), libnbd(3).
go read them, they're all besties fr fr π
π AUTHORS π
Eric Blake
Richard W.M. Jones
legends, honestly, we stan π«Ά
π COPYRIGHT π
Copyright Red Hat
π§ LICENSE π§
this library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
this library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU Lesser General Public License for more details.
you should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
okay that's the whole page, you ate that π this was nbd_set_request_block_size(3) from libnbd-1.25.8, dated 2026-10-13, and that's the entire manual page, periodt. go forth and request block sizes (or don't, that's literally the point of the function) β¨ππ
π¦ where this page comes from
- centos-stream 10: libnbd-devel 1.25.8-1.el10 Β· LGPL-2.0-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms