STRUCT MTD_READ_REQ(9)
β¨ 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 herselfstruct 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms