nbd_aio_opt_list(3)
β¨ nbd_aio_opt_list(3) β¨
okay bestie so this is a page from the libnbd manual, section 3, and it's literally all about nbd_aio_opt_list β one of the async girlies. no cap, it's giving "let me see the menu" energy. π
πΈ NAME πΈ
nbd_aio_opt_list β ask the server to list all its exports while you're still in negotiation. that's it, that's the vibe. π
π SYNOPSIS π
#include <libnbd.h>
typedef struct {
int (*callback) (void *user_data, const char *name,
const char *description);
void *user_data;
void (*free) (void *user_data);
} nbd_list_callback;
typedef struct {
int (*callback) (void *user_data, int *error);
void *user_data;
void (*free) (void *user_data);
} nbd_completion_callback;
int nbd_aio_opt_list (
struct nbd_handle *h,
nbd_list_callback list_callback,
nbd_completion_callback completion_callback
);
two whole structs, bestie. one for the listing, one for the completion notification. iconic. π«Ά
π DESCRIPTION π
so you're asking the server to list all the exports it supports. cute, right? but listen β this only works if you already turned on option mode with nbd_set_opt_mode(3). no option mode, no listing. periodt. π₯
now, how do you know when the request is done? two options:
- wait for
nbd_aio_is_connecting(3)to returnfalseβ that's your signal β¨ - or hand over the optional
completion_callback, which gets invoked exactly how it's described in "Completion callbacks" inlibnbd(3)β¦ except with one twist: it's automatically retired regardless of return value. so don't come for it later, it's gone, she's retired, respect her choice π
β οΈ heads up: knowing whether the server actually returned an error β the thing the synchronous counterpart tells you via its return value β is only possible with a completion callback. the async version can't tell you on its own. plan accordingly, bestie. π
π RETURN VALUE π
if the call slays, the function returns 0. simple. clean. β¨
π ERRORS π
on error, -1 is returned. rip. π
want the deets on what went wrong? go read "ERROR HANDLING" in libnbd(3) β it's got the whole scoop.
also, a couple of non-negotiables: these parameters must not be NULL β h. that's the one. for more, check "Non-NULL parameters" in libnbd(3).
π HANDLE STATE π
nbd_aio_opt_list can only be called when your handle is in the right state. vibe check your handle first, bestie:
- 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: only during connecting & handshaking with opt_mode on. every other state? nah. π
β VERSION β
this function first appeared in libnbd 1.4. she's been around a minute. π
if you need to test at compile time whether it's available, check whether this macro is defined:
#define LIBNBD_HAVE_NBD_AIO_OPT_LIST 1
π¦ SEE ALSO π¦
the whole friend group, fr fr:
π AUTHORS π
- Eric Blake
- Richard W.M. Jones
the literal main characters who wrote this. π
π§ 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're a nbd_aio_opt_list expert now, i don't make the rules π mwah! this edition was libnbd-1.25.8, dated 2026-10-13 β go forth and list those exports, bestie πβ¨
π¦ 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