PMEM2_BADBLOCK_NEXT(3)
π PMEM2_BADBLOCK_NEXT(3) π
okay bestie, welcome to the PMDK Programmer's Manual β¨ this one's a lil function called pmem2_badblock_next() and honestly? it's giving "sequel energy" β it just reads the next bad block for a bad block context. that's it. that's the whole job. and it eats. π
πΈ NAME πΈ
pmem2_badblock_next() β read the next bad block for the given bad block context *bbctx.
like, the next one. the one after the one you already looked at. slay.
β¨ SYNOPSIS β¨
#include <libpmem2.h>
struct pmem2_badblock;
struct pmem2_badblock_context;
int pmem2_badblock_next(
struct pmem2_badblock_context *bbctx,
struct pmem2_badblock *bb);
no cap, that's the whole signature π«Ά two structs declared up front, one function that takes a pointer to a bad block context and a pointer to a bad block. iconic.
π¦ DESCRIPTION π¦
The pmem2_badblock_next() function reads the next bad block for the given bad block context *bbctx.
that's the vibe check, fr fr. you hand it your *bbctx, it goes and finds the next bad block, and it drops it right into *bb. it's basically a little iterator moment β call it again, get the next one, call it again, keep going, main character energy until there's nothing left. β¨
π RETURN VALUE π
so here's the deal:
- on success,
pmem2_badblock_next()returns0and stores the next bad block in*bbπ - if there are no more bad blocks for the given bad block context
*bbctx, it returns a negative error code π
yes queen, 0 means good, negative means we've run out. periodt.
π₯ ERRORS π₯
pmem2_badblock_next() can fail with the following error:
PMEM2_E_NO_BAD_BLOCK_FOUNDβ there are no more bad blocks for the given bad block context*bbctx, and*bbis undefined in this case. π«
bestie listen to me. *bb is undefined here. do not go reading it, do not go printing it, do not pass go. we do not touch undefined values in this house. π
PMEM2_E_NOSUPPβ when the OS does not support this functionality. π
π SEE ALSO π
go read those too, iykyk π
okay that's the whole page bestie, no notes π this was the PMDK Programmer's Manual entry for pmem2_badblock_next(), and the footer said PMDK and dated it 2025-07-24 β so shoutout to the PMDK girlies and that date, mwah πβ¨ bye pookie, go read some more manpages π
π¦ where this page comes from
- fedora 43: libpmem2-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2020-2023, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms