nbd_set_uri_allow_local_file(3)
π nbd_set_uri_allow_local_file(3) β libnbd bestie edition
okay so real talk β this is nbd_set_uri_allow_local_file(3), a page from the LIBNBD manual, section 3. it's a tiny function with one job and it does it slayfully. let's get into it π
β¨ NAME β¨
nbd_set_uri_allow_local_file β set the allowed transports in NBD URIs
like, the name says "local file" but the description says "allowed transports" β yes bestie, that's the original wording, i'm not making the rules i'm just delivering them π
β¨ SYNOPSIS β¨
#include <libnbd.h>
int nbd_set_uri_allow_local_file (
struct nbd_handle *h, bool allow
);
you pass it a handle h and a bool allow, and it hands you back an int. that's the whole vibe. π¦
β¨ DESCRIPTION β¨
so what does it do? it lets NBD URIs reference local files. iconic of them honestly.
but listen β this is disabled by default. so if you want it, you gotta ask for it, no cap. π
and rn, in the current state of things, this setting has exactly one job: it controls whether the tls-psk-file parameter in NBD URIs is allowed. that's it. that's the whole scope. not me being dramatic, that's literally what the page says. β
β¨ RETURN VALUE β¨
if the call succeeds? you get 0. clean. perfect. a little success kiss π
β¨ ERRORS β¨
if it goes wrong, you get -1 back. π
and if you wanna know why, the page is like "girl go read "ERROR HANDLING" in libnbd(3)" β that's where the deets on digging into the error live. highly recommend, it's giving detective energy π₯
β οΈ also important: the following parameter must not be NULL:"h". for more on that, see"Non-NULL parameters"inlibnbd(3). so like... don't hand it a null handle, bestie, that's not the move π«Ά
β¨ HANDLE STATE β¨
here's the vibe check on when you're allowed to call this β nbd_set_uri_allow_local_file works only if the handle is in these states:
- Handle created, before connecting β β allowed (this is your moment, main character energy π)
- Connecting β β error
- Connecting & handshaking (
opt_mode) β β error - Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so basically: set it up before you connect, or don't bother. it's a before-the-party function, not a mid-party function. πΈ
β¨ VERSION β¨
this function first showed up in libnbd 1.2. vintage β¨
and if you need to check at compile time whether it exists? see if this macro is defined:
#define LIBNBD_HAVE_NBD_SET_URI_ALLOW_LOCAL_FILE 1
if that's there, you're good. π§
β¨ SEE ALSO β¨
go give these a read, they're the supporting cast and they ate:
β¨ AUTHORS β¨
- Eric Blake
- Richard W.M. Jones
legends, honestly. π
β¨ COPYRIGHT β¨
Copyright Red Hat
β¨ LICENSE β¨
okay legal moment, stay with me β this one matters so i'm keeping it exact:
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
like, read it, it's the actual rules, no skipping π
and that's the whole page!! this lil rewrite is chilling at version libnbd-1.25.8, dated 2026-10-13, and it's page 3 of the manual for nbd_set_uri_allow_local_file. bye bestie, go set your URI flags 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