doc_erase(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« doc_erase β€” Kernel API Manual (9) πŸ’«

okay bestie, buckle up, we're diving into the Kernel API Manual section 9, and honestly? this one's a little snack. it's doc_erase, and yes, it does exactly what the name says πŸ’…


✨ NAME ✨

doc_erase β€” Erase a portion of the chip 🧚

like. it erases. a portion. of the chip. that's the whole vibe. no cap.


🌸 SYNOPSIS 🌸

int doc_erase (struct mtd_info *mtd , struct erase_info *info );

she takes two things and returns an int, periodt. ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • mtd β€” the device πŸ’– (this is the MTD device you're working on, the actual chip situation)
  • info β€” the erase info 🌈 (the struct carrying all the erase details, iykyk)

πŸ”₯ DESCRIPTION πŸ”₯

so here's what's actually going down: this erases a bunch of contiguous blocks, and it does them by pairs β€” because a "mtd" page of 1024 is split into 2 pages of 512 bytes across 2 contiguous blocks. it's giving teamwork, honestly. two blocks, one page, iconic 🫢

as for what you get back:

  • returns 0 if the erase was successful πŸ‘‘ β€” slay
  • returns -EINVAL if there's an addressing error πŸ™ˆ
  • returns -EIO if there's an erase issue πŸ’€
ngl, watch those error codes β€” -EINVAL and -EIO mean the erase did not go well, and you're gonna want to handle that fr fr.

πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file lives at ./drivers/mtd/devices/docg3.c and it is stacked with friends β€” here's the whole group chat, bestie:

doc_delay(9), doc_read_data_area(9), doc_write_data_area(9), doc_set_reliable_mode(9), doc_set_asic_mode(9), doc_set_device_id(9), doc_set_extra_page_mode(9), doc_setup_addr_sector(9), doc_setup_writeaddr_sector(9), doc_read_seek(9), doc_write_seek(9), doc_read_page_ecc_init(9), doc_write_page_ecc_init(9), doc_ecc_disable(9), doc_hamming_ecc_init(9), doc_ecc_bch_fix_data(9), doc_read_page_prepare(9), doc_read_page_getbytes(9), doc_write_page_putbytes(9), doc_get_bch_hw_ecc(9), doc_page_finish(9), doc_read_page_finish(9), calc_block_sector(9), doc_read_oob(9), doc_block_isbad(9), doc_get_erase_count(9), doc_get_op_status(9), doc_write_erase_wait_status(9), doc_erase_block(9), doc_write_page(9), doc_guess_autoecc(9), doc_fill_autooob(9), doc_backup_oob(9), doc_write_oob(9), doc_set_driver_info(9), doc_probe_device(9), doc_release_device(9), docg3_resume(9), docg3_suspend(9), docg3_probe(9), docg3_release(9)

like, that's a whole squad. go read them. i'm obsessed 🌟


and that's the page, bestie!! πŸŽ€ this little beauty comes to you from ./drivers/mtd/devices, dated October 2026, filed under doc_erase(9). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from