STRUCT MTD_WRITE_REQ(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct mtd_write_req(9) πŸ’…

okay bestie, welcome to the Kernel API Manual ✨ β€” this is the whole entire page about struct mtd_write_req, which is literally the data structure you use when you wanna request a write operation. it's giving "small struct, big responsibilities" fr fr πŸŽ€


🌸 NAME 🌸

struct mtd_write_req β€” the data structure for requesting a write operation 🫢 (yes that's it, that's the whole vibe)


✨ SYNOPSIS ✨

here's the literal shape of it, copy it exactly, no improvising:

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

πŸ’– Members πŸ’–

each field, one by one, no skipping 😀

  • start β€” the start address. that's where the whole thing begins πŸ“
  • len β€” length of the data buffer. careful tho: only the lower 32 bits are used β€” the rest is just vibes πŸ’€
  • ooblen β€” length of the OOB buffer. same story: only the lower 32 bits are used πŸ™ˆ
  • usr_data β€” the user-provided data buffer, aka where your actual bytes live πŸ“
  • usr_oob β€” the user-provided OOB buffer πŸ¦‹
  • mode β€” the MTD mode (peep "MTD operation modes" for the tea) πŸ‘‘
  • padding β€” reserved!! must be set to 0 β€” do not touch, do not decorate, just zero it and move on πŸ’…

🌈 Description 🌈

so this structure is the main character for ioctl(MEMWRITE) operations πŸ”₯ it lets you do data writes and/or OOB writes in various modes, which is honestly so versatile of it.

here's the little cheat sheet:

  • wanna write OOB-only? set usr_data == NULL ✨
  • wanna write data-only? set usr_oob == NULL ✨
bestie pls 😭 setting both usr_data and usr_oob to NULL is NOT allowed. like, at all. don't do it. i'm begging.

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, iykwim πŸ’œ

  • Kernel file ./include/uapi/mtd/mtd-abi.h struct
  • mtd_read_req_ecc_stats(9)
  • struct mtd_read_req(9)
  • struct mtd_ecc_stats(9)

and that's the whole page!! πŸ’– mwah 🫢 this little cutie lives over in ./include/uapi/mtd, dated October 2026, and it's filed under struct mtd_write_req(9) in the Kernel API Manual β€” periodt πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from