STRUCT MTD_READ_REQ(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct mtd_read_req(9) ✨

okay so bestie, we're in the Kernel API Manual today and this page is literally all about struct mtd_read_req β€” the data structure for requesting a read operation πŸ’– it's giving "let me read some flash memory please" and honestly? iconic.


🌸 NAME 🌸

struct mtd_read_req β€” the data structure for requesting a read operation πŸŽ€ yes that's it, that's the whole name section, she's concise and we respect it.


πŸ¦‹ SYNOPSIS πŸ¦‹

struct mtd_read_req {
    __u64 start;
    __u64 len;
    __u64 ooblen;
    __u64 usr_data;
    __u64 usr_oob;
    __u8 mode;
    __u8 padding[7];
    struct mtd_read_req_ecc_stats ecc_stats;
 };

look at her πŸ₯Ή every field accounted for, padding[7] doing its little reserved thing, we love a well-organized struct periodt.


πŸ’… Members πŸ’…

  • start β€” the start address 🫢 where the reading begins, bestie.
  • len β€” length of the data buffer β€” and heads up, only the lower 32 bits are used πŸ‘€ don't go flexing those upper bits, they're not invited.
  • ooblen β€” length of the OOB buffer β€” same deal, only the lower 32 bits are used πŸ’€ the upper bits are just vibing there, unused.
  • usr_data β€” the user-provided data buffer, literally your data's home address 🏠
  • usr_oob β€” the user-provided OOB buffer, separate little home for the OOB data ✨
  • mode β€” the MTD mode (see "MTD operation modes") β€” this is where you tell it how you wanna read, iykyk 🌈
  • padding β€” reserved, must be set to 0 ⚠️ no cap, set it to zero, don't be weird about it.
  • ecc_stats β€” ECC statistics for the read operation πŸ“Š she's keeping receipts on the error correction, love that for her.

πŸ”₯ Description πŸ”₯

so this structure supports ioctl(MEMREAD) operations, and it's highkey versatile β€” it lets you do data reads and/or OOB reads in various modes πŸŽ€ choose your own adventure fr fr.

wanna read from OOB-only? easy, set usr_data == NULL πŸ¦‹

wanna read data-only? set usr_oob == NULL ⭐

but!! and this is the important part bestie β€” setting both usr_data and usr_oob to NULL is not allowed πŸš«πŸ™ˆ that combo is a no, the struct will not be having it. don't do it.


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/uapi/mtd/mtd-abi.h
  • struct mtd_write_req(9) β€” the write-side sibling, go say hi πŸ’œ
  • struct mtd_read_req_ecc_stats(9) β€” the ECC stats struct herself
  • struct mtd_ecc_stats(9) β€” and the OG ECC stats struct, we stan 🌸

and that's the whole page bestie, you ate that 🫢 mwah πŸ’‹ this little gem lives in ./include/uapi/mtd and the version tag says October 2026 β€” so like, future vibes, very main character energy β°πŸ‘‘ go forth and read your flash memory responsibly, mwah!! πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from