self_check_not_bad(9)
β¨ self_check_not_bad(9) β¨
okay bestie, welcome to self_check_not_bad(9) β a tiny little function from the Kernel API Manual and honestly it's giving "small but mighty" π«Ά. Its whole personality? Making sure a physical eraseblock is not bad. That's it. That's the vibe check. π
πΈ SYNOPSIS πΈ
int self_check_not_bad (const struct ubi_device *ubi , int pnum );
literally the whole signature, no cap. two args, one int coming back at you. π
π¦ ARGUMENTS π¦
ubiβ the UBI device description object, aka the whole device's little info packet. you're basically handing it the receipts for the device you're poking at πpnumβ the physical eraseblock number you wanna check. like, "hey is block number this one okay?" π
π DESCRIPTION π
okay so here's the tea β: this function returns zero if the physical eraseblock is good β slay, everything's fine, block is iconic π.
But if the block is bad? You get -EINVAL. Not a vibe. π
And if something else went wrong β like a genuine error situation β you get a negative error code back. so basically: 0 = good, -EINVAL = bad block, other negatives = oops something happened, check the error code bestie π
fr fr, keep those three outcomes straight in your head:0good,-EINVALbad block, any other negative error code = an actual error occurred. don't conflate them, iykyk π€
π SEE ALSO π
go read these next, bestie, they're all in the same friend group π§β¨:
- Kernel file
./drivers/mtd/ubi/io.c ubi_io_read(9)ubi_io_write(9)do_sync_erase(9)torture_peb(9)nor_erase_prepare(9)ubi_io_sync_erase(9)ubi_io_is_bad(9)ubi_io_mark_bad(9)validate_ec_hdr(9)ubi_io_read_ec_hdr(9)ubi_io_write_ec_hdr(9)validate_vid_hdr(9)ubi_io_read_vid_hdr(9)ubi_io_write_vid_hdr(9)self_check_ec_hdr(9)self_check_peb_ec_hdr(9)self_check_vid_hdr(9)self_check_peb_vid_hdr(9)self_check_write(9)ubi_self_check_all_ff(9)
okay that's the whole page, you ate that π this lil gem lives over in ./drivers/mtd/ubi and the version vibes are dated October 2026 β go forth and check those eraseblocks, main character energy only π¦πΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms