NBD_AIO_OPT_SET_META_CONTEXT_QUERIES(3)
π NAME
nbd_aio_opt_set_meta_context_queries β pick exactly which meta contexts you want, with your own explicit query list, bestie β¨
So basically this is the libnbd function (manual name LIBNBD, in case you were wondering π) that lets you hand the server a list of meta contexts and be like "hey, give me back all the ones you actually recognize, k?"
πΈ 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_set_meta_context_queries (
struct nbd_handle *h, char **queries,
nbd_context_callback context_callback,
nbd_completion_callback completion_callback
);
β¨ DESCRIPTION
okay so. You're asking the server to supply back, like, all the recognized meta contexts that you passed in through queries π₯ and it does that in conjunction with the export you already specified with the most recent nbd_set_export_name(3) or nbd_connect_uri(3). Iykyk.
β οΈ This can only be used if nbd_set_opt_mode(3) enabled option mode. No opt mode, no deal, bestie.
Normally this function is redundant β because nbd_opt_go(3) automatically does the same task for you if structured replies or extended headers have already been negotiated. Like, it's already handled, bestie, you're fine. π
But β manual control over meta context requests can be genuinely useful for fine-grained testing of how a server handles unusual negotiation sequences π. Testing vibes, essentially.
Often, use of this function is coupled with nbd_set_request_meta_context(3) to bypass the automatic context request that nbd_opt_go(3) normally performs. Slay.
So how do you know when the request completes? Two ways, pick your fighter:
- wait for
nbd_aio_is_connecting(3)to return false, or - supply the optional
completion_callback, which will be invoked as described in "Completion callbacks" inlibnbd(3)β except that it is automatically retired regardless of return value. Periodt.
π Big important note: detecting whether the server returns an error (the way the return value of the synchronous counterpart does it) is only possible with a completion callback. So if you want to know, you gotta pass the callback. No callback, no error knowledge. π
π¦ RETURN VALUE
This call returns an integer β₯ 0. Cute and non-negative. π«Ά
π ERRORS
On error -1 is returned. π
Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error. It's all in there, go look.
Also, heads up: the following parameters must not be NULL: h, queries. For more information see "Non-NULL parameters" in libnbd(3). Don't be that person. π
π HANDLE STATE
nbd_aio_opt_set_meta_context_queries 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 likeβ¦ exactly one situation works. Connecting & handshaking in opt mode. That's the whole vibe check. β
π VERSION
This function first appeared in libnbd 1.16. Baby icon.
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_OPT_SET_META_CONTEXT_QUERIES 1
π§ SEE ALSO
nbd_aio_is_connecting(3)nbd_aio_opt_set_meta_context(3)nbd_connect_uri(3)nbd_create(3)nbd_opt_go(3)nbd_opt_set_meta_context_queries(3)nbd_set_export_name(3)nbd_set_opt_mode(3)nbd_set_request_meta_context(3)libnbd(3)
π AUTHORS
Eric Blake
Richard W.M. Jones
πΈ COPYRIGHT
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 β go forth and negotiate those meta contexts, you absolute main character π«Άπ
π¦ where this page comes from
- centos-stream 10: libnbd-devel 1.25.8-1.el10 Β· LGPL-2.0-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms