nbd_aio_opt_go(3)
π nbd_aio_opt_go β libnbd, bestie edition
okay so this is the nbd_aio_opt_go(3) page, like from the LIBNBD manual, and it's literally the "we're done negotiating, let's GO" button. no cap. β¨
πΈ NAME πΈ
nbd_aio_opt_go β end negotiation and move on to using 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_go (
struct nbd_handle *h,
nbd_completion_callback completion_callback
);
π¦ DESCRIPTION π¦
So basically you're sliding this function a request: "hey server, u done negotiating? cool, now serve me the export I already picked." π«Ά And which export is that? The one you set with the most recent nbd_set_export_name(3) or nbd_connect_uri(3). iykyk.
Important vibe check: this only works if nbd_set_opt_mode(3) turned option mode ON. no option mode, no deal, periodt.
Now, how do you know when the request finished? Two ways, both iconic:
- wait for
nbd_aio_is_connecting(3)to return false β that's your signal π - or pass the optional
"completion_callback", which gets invoked exactly as described in"Completion callbacks"inlibnbd(3)β except it's automatically retired regardless of return value. yes, even if it returns something weird. she's retired, she's resting, don't @ her.
And here's the tea β: directly detecting whether the server returned an error β which is what the return value of the synchronous counterpart does β is only possible with a completion callback. but!! you can also indirectly detect an error when nbd_aio_is_negotiating(3) returns true. sneaky but valid. π
π₯ RETURN VALUE π₯
If the call is successful, the function returns 0. slay. β¨
π ERRORS π
On error, -1 is returned. π
Need the deets on what went wrong? Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.
Also, these parameters must not be NULL: "h". For more info, see "Non-NULL parameters" in libnbd(3). don't try it. she will not be nice about it. π
π HANDLE STATE π
nbd_aio_opt_go can be called when the handle is in the following state β so like, check the vibe 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 yeah, exactly ONE state green-lights you: Connecting & handshaking (opt_mode). all the others? nope, blocked, denied, go home. π«
β VERSION β
This function first appeared in libnbd 1.4. she's been around, she's got history, she's a legend. π
If you need to test at compile time whether this function is available, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_AIO_OPT_GO 1
π SEE ALSO π
nbd_aio_is_connecting(3), nbd_aio_is_negotiating(3), nbd_connect_uri(3), nbd_create(3), nbd_opt_go(3), nbd_set_export_name(3), nbd_set_opt_mode(3), libnbd(3).
(the whole friend group, fr fr π«Ά)
π 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
and that's the whole page, bestie π this little beauty is from libnbd-1.25.8, dated 2026-10-13, and it lives at nbd_aio_opt_go(3). go forth and negotiate 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