nbd_aio_opt_info(3)
π nbd_aio_opt_info β like, the libnbd girlie's guide
okay bestie, so this is a page from the libnbd manual (that's nbd_aio_opt_info(3), mwah), and we're about to make it make sense. buckle up π
β¨ NAME β¨
nbd_aio_opt_info β ask the server for the tea about an export βπ
β¨ SYNOPSIS β¨
#include <libnbd.h>
typedef struct {
int (*callback) (void *user_data, int *error);
void *user_data;
void (*free) (void *user_data);
} nbd_completion_callback;
int nbd_aio_opt_info (
struct nbd_handle *h,
nbd_completion_callback completion_callback
);
like, that's the whole vibe. no cap. π«Ά
πΈ DESCRIPTION πΈ
So basically you're requesting that the server, like, supply information about the export name β and which export name? the one you specified most recently with nbd_set_export_name(3) or nbd_connect_uri(3). the most recent one. don't @ me. π
π¨ important vibe check: this can only be used if nbd_set_opt_mode(3) enabled option mode. no option mode, no service. periodt.
So how do you know when the request is done? two ways, bestie:
- just wait for
nbd_aio_is_connecting(3)to return false. iconic, simple. - OR supply the optional
"completion_callback"β which gets invoked exactly as described in"Completion callbacks"inlibnbd(3), except that it's automatically retired regardless of return value. (yes, automatically, regardless, we love a self-cleaning girlie β¨)
π ngl, this one's important: detecting whether the server returns an error β you know, the thing the return value of the synchronous counterpart does for you β is only possible with a completion callback. so if you skip the callback, you're lowkey flying blind on errors. iykyk.
π¦ RETURN VALUE π¦
If the call is successful, the function returns 0. slay. π
π ERRORS π
On error, -1 is returned. π
If you wanna know more deets about what went wrong, refer to "ERROR HANDLING" in libnbd(3).
Also, "h" must not be NULL β that's a hard requirement, fr fr. like, it's just not optional. For more info, see "Non-NULL parameters" in libnbd(3).
π HANDLE STATE π
nbd_aio_opt_info can be called when the handle is in the following state β here's the whole vibe check, one row at a time:
- 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 yeah. only the opt_mode handshaking window. everything else? error. not me being picky, that's just the state machine π§
β VERSION β
This function first appeared in libnbd 1.4. a classic. a legend. π₯
If you need to test whether this function is available at compile time, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_AIO_OPT_INFO 1
π SEE ALSO π
go read these too, bestie, they're all linked up:
nbd_aio_is_connecting(3), nbd_connect_uri(3), nbd_create(3), nbd_is_read_only(3), nbd_opt_info(3), nbd_set_export_name(3), nbd_set_opt_mode(3), libnbd(3).
π AUTHORS π
- Eric Blake
- Richard W.M. Jones
the icons who made this happen π«Άπ
π 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. (yes, that's all caps for a reason, don't skip it π)
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!! this was libnbd-1.25.8, dated 2026-10-13 β go forth and opt-info responsibly π
β¨π
π¦ 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