nbd_aio_block_status_64(3)

✨ nbd_aio_block_status_64(3) ✨

okay so bestie, welcome to the nbd_aio_block_status_64 page from the LIBNBD manual πŸ’… this is the one where you yeet a block status command at the server asynchronously, and get a fancy 64-bit callback situation going. it's giving main character energy for extent-hungry gorls only πŸŽ€


🌸 NAME 🌸

nbd_aio_block_status_64 β€” send block status command, with 64-bit callback

like. that's literally it. you send the command, the callback gets 64-bit things. slay πŸ¦‹


⭐ SYNOPSIS ⭐

#include <libnbd.h>

typedef struct {
  int (*callback) (void *user_data,
                   const char *metacontext,
                   uint64_t offset, nbd_extent *entries,
                   size_t nr_entries, int *error);
  void *user_data;
  void (*free) (void *user_data);
} nbd_extent64_callback;

typedef struct {
  int (*callback) (void *user_data, int *error);
  void *user_data;
  void (*free) (void *user_data);
} nbd_completion_callback;

int64_t nbd_aio_block_status_64 (
          struct nbd_handle *h, uint64_t count,
          uint64_t offset,
          nbd_extent64_callback extent64_callback,
          nbd_completion_callback completion_callback,
          uint32_t flags
        );

two structs, one function, zero chill. copy it exactly, bestie, don't get creative with the types πŸ™ˆ


πŸ’œ DESCRIPTION πŸ’œ

Send the block status command to the NBD server. that's the whole vibe fr fr πŸ”₯

So how do you know it finished? Two ways, pick your fighter:

  • call nbd_aio_command_completed(3) β€” the classic, lowkey the responsible choice
  • or supply the optional completion_callback β€” which gets invoked exactly as described in "Completion callbacks" in libnbd(3)

and all the other parameters? they behave as documented in nbd_block_status_64(3). no cap, go read that one for the deets 🫢


πŸŽ€ RETURN VALUE πŸŽ€

This call returns the 64 bit cookie of the command πŸͺ and that cookie is β‰₯ 1.

like, cookies are unique β€” but per libnbd handle, not globally. so don't go comparing cookies across handles, that's not the vibe 😭


πŸ’€ ERRORS πŸ’€

On error, -1 is returned. that's your "nope, didn't work" signal 🚩

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β€” the manpage is literally telling you where the receipts live, iykyk.

⚠️ The following parameters must not be NULL: h. For more information see "Non-NULL parameters" in libnbd(3). like, do NOT pass NULL to h. that's a jump scare waiting to happen.

🧚 NOTES 🧚

🌈 Strict call 🌈

By default, libnbd will reject attempts to use this function with parameters that are likely to result in server failure β€” such as requesting an unknown command flag πŸ™…β€β™€οΈ it's giving "protective bestie".

The nbd_set_strict_mode(3) function can be used to alter which scenarios should await a server reply rather than failing fast. so if you really wanna live dangerously, that's the knob to turn. choose wisely tho πŸ’…


πŸ‘‘ HANDLE STATE πŸ‘‘

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

  • Handle created, before connecting β€” ❌ error
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” ❌ error
  • Connected to the server β€” βœ… allowed
  • Connection shut down β€” ❌ error
  • Handle dead β€” ❌ error

so basically: connect first, then call it. that's the whole plot πŸ¦‹


🌸 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_AIO_BLOCK_STATUS_64 1

it's giving "are you on the right version or are you about to have a bad time" 🫢


πŸ“ SEE ALSO πŸ“

go read them. all of them. that's the assignment πŸ“šβœ¨


πŸ’– AUTHORS πŸ’–

Eric Blake

Richard W.M. Jones

icons, legends, the whole thing πŸ‘‘


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, bestie 🫢 this was libnbd-1.25.8, dated 2026-10-13 β€” catch you on the next one, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from