nanddev_markbad(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, the struct 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 ✨

  • 0 in 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:


and that's the whole page, bestie πŸ’…βœ¨ this gem came to you from ./drivers/mtd/nand, dated October 2026, under the name nanddev_markbad(9) β€” screenshot it, put it on your fridge, whatever πŸ§šπŸ’œ
πŸ“¦ where this page comes from