nbd_set_request_meta_context(3)
β¨ nbd_set_request_meta_context β your girl's guide to libnbd β¨
okay so bestie, grab your iced coffee π because today we're talking about nbd_set_request_meta_context(3) from the <libnbd.h> girlies. this one's a setter, it's lowkey powerful, and yes it's giving "small function, big consequences" energy. π
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_set_request_meta_context (
struct nbd_handle *h, bool request
);
that's it. that's the whole vibe. one handle, one bool, no cap. β¨
π DESCRIPTION π
so here's the tea, bestie π« β this function controls whether the actual act of connecting to an export will ALSO try to issue NBD_OPT_SET_META_CONTEXT for you. and when I say "the act of connecting", I mean:
- all the
nbd_connect_*calls, whennbd_set_opt_mode(3)isfalse, or nbd_opt_go(3)andnbd_opt_info(3)when option mode is enabled π
and it only does that little extra step when both of these are true:
- the server supports structured replies or extended headers, and
- any contexts were registered by
nbd_add_meta_context(3)
default setting? true. iconic. but likeβ¦ the extra step of negotiating meta contexts is not always desirable, and here's why (per the manpage, not me making stuff up, i promise π):
- performing both info and go on the same export works fine without needing to re-negotiate contexts on that second call β so why do the work twice? π
- integration testing of other servers may benefit from manually invoking
nbd_opt_set_meta_context(3)at other points in the negotiation sequence β main character energy, choosing your own timing π - and even when you're just using
nbd_opt_info(3), it can be faster to collect the server's results by relying on the callback function you passed tonbd_opt_list_meta_context(3)than by doing a whole series of post-process calls tonbd_can_meta_context(3). efficiency queen π
β οΈ important note, fr fr: this control has no effect if the server doesn't negotiate structured replies or extended headers, or if the client didn't request any contexts vianbd_add_meta_context(3). and heads up β setting this control tofalsemay causenbd_block_status(3)to fail. so like, know what you're doing before you turn it off bestie π
π₯ RETURN VALUE π₯
if the call is successful, the function returns 0. slay. β
π ERRORS π
on error, -1 is returned. not slay. β
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β that's where the actual gossip lives.
also: the following parameters must not be NULL: h. for more info, see "Non-NULL parameters" in libnbd(3). don't pass a null handle, please, i'm begging π«Ά
π HANDLE STATE π
nbd_set_request_meta_context can be called when the handle is in the following states β vibe check incoming:
- Handle created, before connecting β β allowed
- Connecting β β error
- Connecting & handshaking (
opt_mode) β β allowed - Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so basically: before you connect (yes π), or while you're in opt_mode handshaking (yes π). everywhere else? absolutely not, don't even try it π
β VERSION β
this function first appeared in libnbd 1.16. a genuine icon of its era π
if you need to test whether this function is available at compile time, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_SET_REQUEST_META_CONTEXT 1
π SEE ALSO π
go read these next, i'm obsessed with all of them:
nbd_add_meta_context(3), nbd_block_status(3), nbd_can_meta_context(3), nbd_create(3), nbd_get_request_meta_context(3), nbd_get_structured_replies_negotiated(3), nbd_opt_go(3), nbd_opt_info(3), nbd_opt_list_meta_context(3), nbd_opt_set_meta_context(3), nbd_set_opt_mode(3), libnbd(3).
π§ AUTHORS π§
- Eric Blake
- Richard W.M. Jones
legends, honestly. we stan π
π 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!! π¦ written from libnbd-1.25.8, dated 2026-10-13, and we're closing out nbd_set_request_meta_context(3) with a lil kiss π mwah. go negotiate some meta contexts responsibly. πβ¨
π¦ 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