nbd_get_extend...ders_negotiated(3)

πŸ’… NAME πŸ’…

nbd_get_extended_headers_negotiated β€” bestie, this is literally the little function that tells you whether extended headers are in use ✨

(oh and hey, this is a page from the libnbd manual, in case you were wondering where you wandered into 🫢)


✨ SYNOPSIS ✨

#include <libnbd.h>

int nbd_get_extended_headers_negotiated (
      struct nbd_handle *h
    );

🌸 DESCRIPTION 🌸

So after you've connected, you can call this little icon to find out if your connection is using extended headers πŸ’–

Important vibe check tho: this setting is sticky β€” it can return true even after a second nbd_opt_extended_headers(3) returns false, and that happens because the server detected a duplicate request. So don't come for her, she's just remembering what happened πŸ‘‘

When extended headers are not in use, commands are limited to a 32-bit length β€” and yes, that's true even when the libnbd API uses a 64-bit parameter to express the length 😭 But even when extended headers are supported, the server may enforce other limits, and those are visible through nbd_get_block_size(3).

Also, when extended headers are negotiated, you should prefer using nbd_block_status_64(3) instead of nbd_block_status(3) if any of the meta contexts you requested via nbd_add_meta_context(3) might return 64-bit status values πŸ¦‹ However (and this is the chill part), all of the well-known meta contexts covered by current "LIBNBD_CONTEXT_*" constants only return 32-bit status. Slay.


πŸŽ€ RETURN VALUE πŸŽ€

This call returns a boolean value. Simple as that, no cap πŸ’…


πŸ’€ ERRORS πŸ’€

On error -1 is returned.

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.

The following parameters must not be NULL: "h". For more information see "Non-NULL parameters" in libnbd(3).


πŸ¦‹ HANDLE STATE πŸ¦‹

nbd_get_extended_headers_negotiated can be called when the handle is in the following states:

  • Handle created, before connecting β€” ❌ error
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” βœ… allowed
  • Connected to the server β€” βœ… allowed
  • Connection shut down β€” βœ… allowed
  • Handle dead β€” ❌ error
Like, read the room bestie β€” if the handle is dead or hasn't even started connecting, she is not gonna answer you πŸ™ˆ

⭐ VERSION ⭐

This function first appeared in libnbd 1.18.

If you need to test if this function is available at compile time, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_GET_EXTENDED_HEADERS_NEGOTIATED 1

🌈 SEE ALSO 🌈

nbd_add_meta_context(3), nbd_block_status(3), nbd_block_status_64(3), nbd_cache(3), nbd_create(3), nbd_get_block_size(3), nbd_get_protocol(3), nbd_get_request_extended_headers(3), nbd_get_structured_replies_negotiated(3), nbd_opt_extended_headers(3), nbd_set_request_extended_headers(3), nbd_trim(3), nbd_zero(3), libnbd(3).


πŸ‘‘ AUTHORS πŸ‘‘

Eric Blake

Richard W.M. Jones


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 bestie, ily, go read your extended headers in peace πŸ§šπŸ’– this was libnbd-1.25.8, dated 2026-10-1 β€” periodt ✨

πŸ“¦ where this page comes from