nbd_get_meta_context(3)

✨ nbd_get_meta_context(3) ✨

okay bestie, this is a page from libnbd and honestly it's a little cutie πŸŽ€ β€” it hands you back the i'th meta context request you asked for. Let's get into it πŸ’…


πŸ’– NAME πŸ’–

nbd_get_meta_context β€” return the i'th meta context request ✨


🌸 SYNOPSIS 🌸

#include <libnbd.h>

char * nbd_get_meta_context (
         struct nbd_handle *h, size_t i
       );

like, that's the whole vibe 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so during connection, libnbd can negotiate zero or more metadata contexts with the server. no cap β€” zero is allowed, it's not a typo πŸ’€

metadata contexts are features (like base:allocation) that describe the info returned by the nbd_block_status_64(3) command. and for base:allocation specifically? that one's telling you whether blocks of data are allocated, zero, or sparse. icon material honestly πŸ‘‘

this command returns the i'th meta context request β€” as added by nbd_add_meta_context(3), and bounded by nbd_get_nr_meta_contexts(3). so like, i has a ceiling, bestie, respect the ceiling πŸ™ˆ


πŸŽ€ RETURN VALUE πŸŽ€

this call returns a string. ⭐

not me about to let you leak memory β€” the caller must free the returned string to avoid a memory leak. that's a free() on your tab, not mine πŸ’…

πŸ”₯ ERRORS πŸ”₯

on error, NULL is returned. 😭

refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β€” that's where the lore lives πŸ“–

the following parameters must not be NULL: h. for more info see "Non-NULL parameters" in libnbd(3). like, h is the main character here, do not pass her in as NULL 🫢


🌈 VERSION 🌈

this function first appeared in libnbd 1.6. a whole era ✨

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

#define LIBNBD_HAVE_NBD_GET_META_CONTEXT 1

slay, conditional compilation 🧚


πŸ’œ SEE ALSO πŸ’œ

the whole friend group, fr fr 🫢


πŸ‘‘ AUTHORS πŸ‘‘

Eric Blake

Richard W.M. Jones

both iconic, both ate πŸ’…


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 one's from libnbd-1.25.8, dated 2026-10-13, and it's the nbd_get_meta_context(3) page β€” go free your strings and stay hydrated πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from