nanddev_markbad(9)
π nanddev_markbad(9) β Kernel API Manual, bestie edition
okay so picture this: it's a nanddev_markbad(9) kinda day, the kernel API manual is open, and you're about to officially declare a block bad. iconic, honestly. this whole page is your group chat briefing π«Ά
β¨ NAME β¨
nanddev_markbad β mark a block as bad. that's it, that's the whole gig. no cap π
β¨ SYNOPSIS β¨
int nanddev_markbad (struct nand_device *nand , const struct nand_pos
*pos );
likeβ¦ look at that signature. two pointers, one int coming back. main character energy fr π₯
β¨ ARGUMENTS β¨
nandβ the NAND device itself. your star of the show, thestruct nand_device *you're working on πposβ position of the block to mark bad.const struct nand_pos *, so you can look but you can't touch, respectfully π
β¨ DESCRIPTION β¨
Mark a block bad. yes bestie, that's literally the function β it flips the block at pos into the bad-block bin and it's not coming back.
the way it works: this function is updating the BBT if one is available (yep, the bad block table gets its little update πΈ), and it calls the low-level markbad hook, which is nand->ops->markbad. so it's giving "hand off to the driver layer" and honestly? slay.
π reminder that nand->ops->markbad is the low-level hook referenced here β not me making stuff up, it's right there in the source, iykyk.
β¨ RETURN β¨
0in case of success β we love a clean win β¨- a negative error code otherwise β π not the negative errno
β¨ SEE ALSO β¨
kernel file ./drivers/mtd/nand/core.c β that's where the magic lives, go read it π
and the whole friend group, in order:
nand_check_erased_buf(9)nand_check_erased_ecc_chunk(9)nanddev_isbad(9)nanddev_isreserved(9)nanddev_erase(9)nanddev_mtd_erase(9)nanddev_mtd_max_bad_blocks(9)nanddev_get_ecc_engine(9)nanddev_put_ecc_engine(9)nanddev_find_ecc_configuration(9)nanddev_ecc_engine_init(9)nanddev_ecc_engine_cleanup(9)nanddev_init(9)nanddev_cleanup(9)
and that's the whole page, bestie π β¨ this gem came to you from./drivers/mtd/nand, dated October 2026, under the namenanddev_markbad(9)β screenshot it, put it on your fridge, whatever π§π
π¦ 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