nbd_get_nr_meta_contexts(3)

πŸ’… nbd_get_nr_meta_contexts β€” like, how many meta contexts did we even ask for?? (this is a libnbd(3) manpage, bestie)

okay so bestie, real talk: this is a libnbd function and its whole entire job is telling you how many metadata contexts you've queued up in your request list. that's it. that's the vibe. ✨


🌸 SYNOPSIS 🌸

#include <libnbd.h>

ssize_t nbd_get_nr_meta_contexts (
          struct nbd_handle *h
        );

πŸ¦‹ DESCRIPTION πŸ¦‹

so during connection, libnbd can negotiate zero or more metadata contexts with the server. no cap. and what even are metadata contexts? they're features β€” like "base:allocation" β€” that describe the info returned by the nbd_block_status_64(3) command. for "base:allocation" specifically, that info is whether blocks of data are allocated, zero, or sparse. iconic behavior honestly.

this command returns how many meta contexts have been added to the list that you're requesting from the server via nbd_add_meta_context(3). πŸŽ€

⚠️ heads up bestie: the server is not obligated to honor all of your requests. like, it can just say no. to see what it actually supports, go check nbd_can_meta_context(3). iykyk πŸ’…

πŸ’– RETURN VALUE πŸ’–

this call returns an integer size β‰₯ 0. slay. 🫢


😭 ERRORS 😭

on error, -1 is returned. rough, i know.

refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.

also these parameters must not be NULL: "h". like, literally don't. for more info see "Non-NULL parameters" in libnbd(3).


⭐ VERSION ⭐

this function first appeared in libnbd 1.6. vintage era honestly. 🧚

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

#define LIBNBD_HAVE_NBD_GET_NR_META_CONTEXTS 1

🌈 SEE ALSO 🌈

the whole friend group, fr fr. πŸ‘‘


πŸ‘‘ 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


okay that's the whole page bestie!! this one's from libnbd-1.25.8, dated 2026-10-13, and it lives in section 3 of the manual β€” go forth and count those meta contexts πŸ’œβœ¨

πŸ“¦ where this page comes from