nbd_aio_opt_list_meta_context(3)

πŸ’… nbd_aio_opt_list_meta_context β€” the libnbd glow-up page

okay so bestie, welcome to nbd_aio_opt_list_meta_context(3) from the LIBNBD manual, section 3 πŸ‘‘ this is the async girlie of meta-context listing and she ate, no cap ✨

🌸 NAME 🌸

nbd_aio_opt_list_meta_context β€” ask for the list of available meta contexts, using an implicit query πŸ¦‹


✨ SYNOPSIS ✨

#include <libnbd.h>

typedef struct {
  int (*callback) (void *user_data, const char *name);
  void *user_data;
  void (*free) (void *user_data);
} nbd_context_callback;

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

int nbd_aio_opt_list_meta_context (
      struct nbd_handle *h,
      nbd_context_callback context_callback,
      nbd_completion_callback completion_callback
    );

πŸŽ€ DESCRIPTION πŸŽ€

okay so picture this πŸ’­ β€” you're asking the server to list the meta contexts that are available for the export you already picked out with the most recent nbd_set_export_name(3) or nbd_connect_uri(3), and it also matches up against a list of queries from earlier calls to nbd_add_meta_context(3) πŸ”₯ if you'd rather hand over your own explicit query list, go look at nbd_aio_opt_list_meta_context_queries(3) instead, iykyk.

lowkey important: this only works if nbd_set_opt_mode(3) turned option mode on. no opt mode, no vibes πŸ’€

so how do you know when the request is done? wait for nbd_aio_is_connecting(3) to return false ⏳ or you can hand over the optional completion_callback, which gets invoked exactly the way it's described in "Completion callbacks" in libnbd(3) β€” except it's automatically retired no matter what the return value is, periodt πŸ’…

also real talk: figuring out whether the server returned an error (which is what the return value of the synchronous counterpart does for you) is only possible with a completion callback. so like… use one if you care 😭

⭐ RETURN VALUE ⭐

this call returns an integer β‰₯ 0 πŸ’–


πŸ’€ ERRORS πŸ’€

on error -1 is returned 🫠

for the full deets on how to get more info about the error, go read "ERROR HANDLING" in libnbd(3).

also, these parameters must not be NULL: "h". for more info see "Non-NULL parameters" in libnbd(3) 🧚


πŸ¦‹ HANDLE STATE πŸ¦‹

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

  • Handle created, before connecting β€” ❌ error
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” βœ… allowed
  • Connected to the server β€” ❌ error
  • Connection shut down β€” ❌ error
  • Handle dead β€” ❌ error
so basically: option-mode handshake era only, bestie 🌈 everywhere else is a no πŸ’€

🌟 VERSION 🌟

this function first appeared in libnbd 1.6 πŸ‘‘

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

#define LIBNBD_HAVE_NBD_AIO_OPT_LIST_META_CONTEXT 1

πŸ” SEE ALSO πŸ”

nbd_add_meta_context(3), nbd_aio_is_connecting(3), nbd_aio_opt_list_meta_context_queries(3), nbd_connect_uri(3), nbd_create(3), nbd_opt_list_meta_context(3), nbd_set_export_name(3), nbd_set_opt_mode(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


and that's the whole page, bestie πŸŽ€βœ¨ this was libnbd-1.25.8, dated 2026-10-13 β€” mwah, go slay your meta contexts πŸ’…πŸ¦‹πŸ’–

πŸ“¦ where this page comes from