nbd_set_export_name(3)
π nbd_set_export_name β like, the libnbd 3 manual page, but make it make sense
okay so bestie, this is nbd_set_export_name from the libnbd section 3 manual. sit down, grab a boba, we're gonna pick which disk image we want off the server. it's giving very main character energy and honestly? iconic.
β¨ NAME β¨
nbd_set_export_name β set the export name π
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_set_export_name (
struct nbd_handle *h, const char *export_name
);
π¦ DESCRIPTION π¦
so some NBD servers are overachievers and serve multiple disk images, which we call "exports". the client gets to pick which one, by asking for an export name during the negotiation phase. the default export? it's the empty string "". very demure, very mindful, no cap.
some NBD servers literally ignore this whole thing and serve the same content regardless π. and heads up: this is only relevant when you're connecting to servers using the newstyle protocol, because the oldstyle protocol didn't support export names at all. periodt.
the NBD protocol limits export names to 4096 bytes, but servers may not support the full length β so like, don't get too attached to your 4096-byte name, she might not make it. the encoding of export names is always UTF-8. always. π
when option mode is not in use, the export name must be set before beginning a connection. however β and this is the fun part β when nbd_set_opt_mode(3) has enabled option mode, it is possible to change the export name prior to nbd_opt_go(3). in particular, the use of nbd_opt_list(3) during negotiation can be used to determine a name the server is likely to accept, and nbd_opt_info(3) can be used to learn details about an export before connecting. it's giving β¨researchβ¨ before you commit. queen behavior.
this call may be skipped if you're using nbd_connect_uri(3) to connect to a URI that includes an export name. so like, it's already handled, don't do the work twice. π
π₯ RETURN VALUE π₯
if the call is successful the function returns 0. slay. π
π ERRORS π
on error -1 is returned. not slay.
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.
the following parameters must not be NULL: "h", "export_name". for more information see "Non-NULL parameters" in libnbd(3). like, fr fr, don't pass NULL, she will not survive it.
π HANDLE STATE π
nbd_set_export_name 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
bestie the vibe check here is simple: before you connect (or while handshaking in opt mode) you're golden β¨, anywhere else? nope, the handle said no. π«
β VERSION β
this function first appeared in libnbd 1.0. vintage, honestly.
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_EXPORT_NAME 1
π SEE ALSO π
nbd_connect_uri(3), nbd_create(3), nbd_get_canonical_export_name(3), nbd_get_export_name(3), nbd_opt_go(3), nbd_opt_info(3), nbd_opt_list(3), nbd_set_opt_mode(3), libnbd(3), libnbd(3). go read them, iykyk π
π«Ά 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 page!! mwah π this little beauty is from libnbd-1.25.8, dated 2026-10-13, and she's filed under nbd_set_export_name(3). go forth and pick your export, 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