STRUCT SPI_NOR_ERASE_COMMAND(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct spi_nor_erase_command(9) β€” Kernel API Manual, but make it cute 🌸

okay so real talk, this one is from the Kernel API Manual and it's lowkey one of those little structs that does a LOT of heavy lifting, so let's get into it πŸ’…


✨ NAME ✨

struct spi_nor_erase_command β€” used for non-uniform erases, bestie 🫢

so the whole vibe of this structure is that it describes a list of erase commands, and those commands get executed once we validate that the erase can actually be performed. that's the whole point. and here's the iconic part: the elements in the list are run-length encoded πŸ‘‘ which is fr fr the efficient way to do it, we love a compressed queen.


✨ SYNOPSIS ✨

okay here's the struct in all its glory, copy it exactly please, no typos, we're not doing that today:

struct spi_nor_erase_command {
    struct list_head        list;
    u32 count;
    u32 size;
    u8 opcode;
 };

look at her. four fields. main character energy. 😌


✨ Members ✨

time for the member-by-member breakdown, iykyk:

  • list β€” for inclusion into the list of erase commands. she's literally built different, she goes inside the list. that's her job. that's her purpose. πŸ’–
  • count β€” how many times the same erase command should be consecutively used. like, back to back to back. no breaks. consecutive besties only. πŸ”₯
  • size β€” the size of the sector/block erased by the command. she big. she small. she whatever the sector/block is. πŸŽ€
  • opcode β€” the SPI command op code to erase the sector/block. this is the actual command, the thing that makes it happen. the moment. the slay. ✨

✨ SEE ALSO ✨

go read these next, they're all in the kernel file ./drivers/mtd/spi-nor/core.h and honestly the whole friend group is iconic:

  • struct spi_nor_erase_type(9)
  • struct spi_nor_erase_region(9)
  • struct spi_nor_erase_map(9)
  • struct spi_nor_locking_ops(9)
  • struct spi_nor_otp_organization(9)
  • struct spi_nor_otp_ops(9)
  • struct spi_nor_otp(9)
  • struct spi_nor_flash_parameter(9)
  • struct spi_nor_fixups(9)
  • struct spi_nor_id(9)
  • struct flash_info(9)
  • struct spi_nor_manufacturer(9)
  • struct sfdp(9)
  • spi_nor_needs_sfdp(9)

like, that's the whole squad. go say hi. πŸ¦‹


heads up bestie: this is documentation for the kernel API, so the details above are the facts β€” don't get creative with the field names or the encodings, we're just here for the vibes 🌈

and that's the page!! πŸ’œ this came out of ./drivers/mtd/spi-nor, dated October 2026, and that's your sign-off bestie β€” mwah, go erase some non-uniform stuff, you absolute icon πŸ§šπŸ’…πŸ“

πŸ“¦ where this page comes from