nbd_aio_block_status_filter(3)

πŸ’… nbd_aio_block_status_filter(3) β€” bestie's guide to pinging the NBD server for a filtered block status

okay so this whole page lives in LIBNBD (that's the library these manpages belong to, iykyk) and it's honestly giving "send a message and don't wait for the reply" energy. the function is literally called nbd_aio_block_status_filter and it does exactly what it says on the tin: fires off a filtered block status command to the NBD server, asynchronously, like a queen who refuses to block. πŸ‘‘


✨ NAME ✨

nbd_aio_block_status_filter β€” send filtered block status command to the NBD server πŸ’Œ


🌸 SYNOPSIS 🌸

here's the whole cast of characters, no cap:

#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_filter (
          struct nbd_handle *h, uint64_t count,
          uint64_t offset, char **contexts,
          nbd_extent64_callback extent64_callback,
          nbd_completion_callback completion_callback,
          uint32_t flags
        );

yes bestie that's a lot of parameters. it's giving "group project where everyone has a job." 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so. you're sending a filtered block status command to the NBD server. that's the whole thing. the filtered part is doing heavy lifting here β€” the plain version is a different function, and this one is the glow-up.

to check if the command actually completed, you call nbd_aio_command_completed(3). that's your vibe check. βœ…

or β€” and this is the iconique option β€” you supply the optional completion_callback, which gets invoked exactly as described in "Completion callbacks" in libnbd(3). so no polling, no anxiety, the callback just shows up when it's ready. main character energy fr fr.

πŸ’« small but important: all the other parameters behave as documented in nbd_block_status_filter(3). not making this up, not adding anything, that's just where the lore lives. go read that page if you need the deets.

πŸŽ€ RETURN VALUE πŸŽ€

this call hands you back the 64 bit cookie of the command. πŸͺ

  • the cookie is β‰₯ 1
  • cookies are unique β€” but lowkey only per libnbd handle, not globally. so don't go thinking your cookie is special across the whole universe, it's special to your handle. πŸ™ˆ

πŸ’€ ERRORS πŸ’€

on error, -1 is returned. that's it. that's the whole number.

for how to get further details of the error (because -1 alone is not it, bestie), refer to "ERROR HANDLING" in libnbd(3).

⚠️ real talk: the following parameters must not be NULL: "h", "contexts". for more info see "Non-NULL parameters" in libnbd(3). do not test her with a NULL, she will not be cute about it.

πŸ”₯ NOTES πŸ”₯

Strict call

by default, libnbd will reject attempts to use this function with parameters that are likely to result in server failure β€” like, say, requesting an unknown command flag. it's giving protective best friend. πŸ›‘οΈ

the nbd_set_strict_mode(3) function can be used to alter which scenarios should await a server reply rather than failing fast. so like, you can change the rules, but that's a choice you're making. πŸ’…


πŸ‘‘ HANDLE STATE πŸ‘‘

nbd_aio_block_status_filter can be called when the handle is in the following state. this is the whole vibe chart, study it:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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 yeah β€” connected to the server is the only βœ…. everything else is a no. one door, and it's the "Connected to the server" door. πŸšͺ✨


🌈 VERSION 🌈

this function first appeared in libnbd 1.18. she's not a legacy icon, she's a relatively recent icon.

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

#define LIBNBD_HAVE_NBD_AIO_BLOCK_STATUS_FILTER 1

#ifdef her and you're golden. 🧚


πŸ“ SEE ALSO πŸ“

the whole friend group, in order:


πŸ’œ AUTHORS πŸ’œ

Eric Blake

Richard W.M. Jones

legends, both of them. 🫢


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, you ate that. πŸ’…βœ¨ this beauty is from libnbd-1.25.8, dated 2026-10-13, and it's nbd_aio_block_status_filter(3) forever and always. go forth and filter those block statuses, bestie πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from