FLASH(9)

📦 version 11.0, in nixpkgs unstable

🌸 NAME — FLASH(9) from the Kernel Developer’s Manual

okay so the name is flash, and it’s the subsystem for flash-like memory devices 💖. That’s the whole vibe, bestie — flash-like memory devices get their own little subsystem and we’re obsessed.


✨ SYNOPSIS

#include <dev/flash/flash.h>

device_t
flash_attach_mi(const struct flash_interface *fl, device_t dev);

💖 DESCRIPTION

Flash-like devices can register themselves to the flash layer with the flash_hw_if structure. This structure has function pointers and other fields — it’s giving “function-pointer central” and we respect it 💅.

The attachment can be done by calling flash_attach_mi() with this structure and the device’s device_t as an argument. The return value is the flash layer device. Slay. The flash_interface structure is shown below 👇:

struct flash_interface {
        int (*erase) (device_t, struct flash_erase_instruction *);
        int (*read) (device_t, off_t, size_t, size_t *, uint8_t *);
        int (*write) (device_t, off_t, size_t, size_t *, const uint8_t *);
        int (*block_markbad)(device_t, uint64_t);
        int (*block_isbad)(device_t, uint64_t);
        int (*sync) (device_t);

        int (*submit)(device_t, struct buf *);

        /* storage for partition info */
        struct flash_partition partition;

        /* total size of mtd */
        flash_addr_t size;
        uint32_t page_size;
        uint32_t erasesize;
        uint32_t writesize;
        uint32_t minor;
        uint8_t type;
};

That’s the whole struct, every field included, no cap 🫶.


🔥 SEE ALSO

Go read flash(4) and nand(9) next — those are the related pages, fr fr ⭐.


🎀 AUTHORS

Adam Hoka <ahoka@NetBSD.org> — iconic behavior, honestly 👑.


Source/version: Debian · date: March 31, 2011 · manual: FLASH(9) — bye bestie, mwah 💋✨

📦 where this page comes from
  • nixpkgs unstable: netbsd-source 11.0
  • 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms