nbd_opt_info(3)
π nbd_opt_info β request the server for information about an export
okay bestie so this page is from the libnbd manual (that's the manual name, we're in nbd_opt_info(3) territory) and let me tell you, this little function is giving β¨reconnaissance eraβ¨. It's literally you walking up to the server like "hey queen, tell me about this export before I commit" π
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_opt_info (
struct nbd_handle *h
);
one function, one handle, zero drama. she's simple. she's iconic. π
β¨ DESCRIPTION β¨
So what you're doing here is requesting that the server supply info about the export name β and which export name, you ask? The one you already specified with the most recent nbd_set_export_name(3) or nbd_connect_uri(3). Like, you already dropped the name earlier, this is just you asking for the tea about it π«
π¨ important vibe check: this can only be used if nbd_set_opt_mode(3) enabled option mode. Option mode ON or this function says "not today bestie."
If it works out, functions like nbd_is_read_only(3) and nbd_get_size(3) will report the deets about that export. Very "now I know everything about you" energy, ngl π
And listen β if nbd_set_request_meta_context(3) is set (which it is by default, just FYI) and structured replies or extended headers were negotiated, then it's also valid to use nbd_can_meta_context(3) after this call. cute!
That said π it may be more efficient to clear that setting and manually utilize nbd_opt_list_meta_context(3) with its callback approach, if what you're actually trying to learn is which contexts an export supports. different tool, different job, y'know?
In general, if nbd_opt_go(3) is called next, that call will likely succeed with the details remaining the same β although this is not guaranteed by all servers. so like... probably fine? but not promised. servers are individuals, we respect that π
Also not all servers even understand this request π and even when it is understood, the server might fail the request even when a corresponding nbd_opt_go(3) would succeed. awkward but real. fr fr.
π¦ RETURN VALUE π¦
If the call is successful the function returns 0. slay. β¨
π ERRORS π
On error -1 is returned. (rude, but okay.)
Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β that's where the actual explanation lives, go read it.
The following parameters must not be NULL: "h". For more information see "Non-NULL parameters" in libnbd(3).
π HANDLE STATE π
nbd_opt_info can be called when the handle is in the following state:
- Handle created, before connecting β β error
- Connecting β β error
- Connecting & handshaking (opt_mode) β β allowed
- Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so basically there's exactly one green light and it's the handshake window. that's the moment. main character moment only. β
π VERSION π
This function first appeared in libnbd 1.4.
If you need to test if this function is available at compile time, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_OPT_INFO 1
iykyk, preprocessor girlies know π
π SEE ALSO π
nbd_aio_opt_info(3), nbd_can_meta_context(3), nbd_connect_uri(3), nbd_create(3), nbd_get_size(3), nbd_is_read_only(3), nbd_opt_go(3), nbd_opt_list_meta_context(3), nbd_set_export_name(3), nbd_set_opt_mode(3), nbd_set_request_meta_context(3), libnbd(3).
the whole friend group honestly π«Ά
πΈ AUTHORS πΈ
Eric Blake
Richard W.M. Jones
π 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 bestie, we ate and left no crumbs π this was libnbd-1.25.8, dated 2026-10-13 β mwah, go forth and interrogate some servers ππ§
π¦ 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