nand_check_erased_buf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– nand_check_erased_buf(9) πŸ’–

okay so this little icon is straight outta the Kernel API Manual, and it's here to check if a buffer is giving erased-NAND energy ✨

🌸 NAME 🌸

nand_check_erased_buf β€” check if a buffer contains (almost) only 0xff data πŸ’…

✨ SYNOPSIS ✨

int nand_check_erased_buf (void *buf , int len , int bitflips_threshold
);

πŸŽ€ ARGUMENTS πŸŽ€

  • buf β€” buffer to test, bestie 🫢
  • len β€” buffer length
  • bitflips_threshold β€” maximum number of bitflips

πŸ’… DESCRIPTION πŸ’…

so the whole vibe is: check if a buffer contains only 0xff, which means the underlying region has been erased and is ready to be programmed ✨ no cap.

The bitflips_threshold specify the maximum number of bitflips before considering the region is not erased πŸ‘‘

πŸ’€ NOTE πŸ’€

The logic of this function has been extracted from the memweight implementation, except that the nand_check_erased_buf function exits before testing the whole buffer if the number of bitflips exceed the bitflips_threshold value 😭

It returns a positive number of bitflips less than or equal to bitflips_threshold, or -ERROR_CODE for bitflips in excess of the threshold πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/mtd/nand/core.c β€” and here's the whole friend group:


later bestie β€” this one's from ./drivers/mtd/nand, October 2026 πŸ’…βœ¨

πŸ“¦ where this page comes from