nbd_set_uri_allow_transports(3)

πŸ’… nbd_set_uri_allow_transports β€” libnbd's lil' transport bouncer πŸŽ€

okay so bestie, picture this: it's a manual page from libnbd, and it's here to tell you about nbd_set_uri_allow_transports β€” the function that decides which transports are even allowed to show up in your NBD URIs. yes, it's giving gatekeeper energy, and honestly? she's slaying at it. ✨


🌸 SYNOPSIS 🌸

#include <libnbd.h>

int nbd_set_uri_allow_transports (
      struct nbd_handle *h, uint32_t mask
    );

like, that's it. you hand her a handle and a mask and she does her thing. periodt. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: this function sets which transports are allowed to appear in NBD URIs. And the default? literally any transport. she's not picky by default, bestie, she's like "come one, come all" β€” but you can make her picky if you want. no cap.

The mask parameter may contain any of the following flags ORed together (yes, OR them, like a little flag salad πŸ₯—):

  • LIBNBD_ALLOW_TRANSPORT_TCP = 0x1
  • LIBNBD_ALLOW_TRANSPORT_UNIX = 0x2
  • LIBNBD_ALLOW_TRANSPORT_VSOCK = 0x4
  • LIBNBD_ALLOW_TRANSPORT_SSH = 0x8

For convenience (and honestly, thank god), the constant LIBNBD_ALLOW_TRANSPORT_MASK is available to describe all transports recognized by this build of libnbd. iconic. 🫢

heads up though: a future version of the library may add new flags. so like, don't @ her when that happens, she warned you πŸ’€

✨ RETURN VALUE ✨

If the call is successful, the function returns 0. that's the good ending, bestie. πŸŽ‰


πŸ’€ ERRORS πŸ’€

On error, -1 is returned. rip.

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β€” she's not gonna spell it all out here, go read the lore. πŸ“–

The following parameters must not be NULL: h. For more information see "Non-NULL parameters" in libnbd(3). like, do not come at her with a NULL handle, she will not be amused πŸ™ˆ


πŸ‘‘ HANDLE STATE πŸ‘‘

nbd_set_uri_allow_transports can be called when the handle is in the following state:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Handle created, before connecting   β”‚ βœ… allowed              β”‚
β”‚ Connecting                          β”‚ ❌ error                β”‚
β”‚ Connecting & handshaking (opt_mode) β”‚ ❌ error                β”‚
β”‚ Connected to the server             β”‚ ❌ error                β”‚
β”‚ Connection shut down                β”‚ ❌ error                β”‚
β”‚ Handle dead                         β”‚ ❌ error                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

so basically: only before connecting. after that? it's a no from her. the vibe check has been failed. βŒπŸ’…


⭐ VERSION ⭐

This function first appeared in libnbd 1.2. she's been around, she's got history, she's a main character. 🌈

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_URI_ALLOW_TRANSPORTS 1

iykyk πŸ”₯


🧚 SEE ALSO 🧚

nbd_connect_uri(3), nbd_create(3), nbd_set_uri_allow_tls(3), libnbd(3).

go read those too, bestie, they're all part of the same friend group 🫢


πŸ“ AUTHORS πŸ“

Eric Blake

Richard W.M. Jones

(legends, fr fr πŸ‘‘)


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


that's the whole page, babe β€” brought to you by libnbd-1.25.8, dated 2026-10-13, and yes, it really is nbd_set_uri_allow_transports(3). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from