STRUCT UBI_LEB_CHANGE_REQ(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct ubi_leb_change_req(9) β€” the kernel API manual, bestie edition

okay so picture this: it's struct ubi_leb_change_req(9), from the Kernel API Manual, and it's literally the data structure you pass in when you want an atomic LEB change. That's it. That's the whole vibe. ✨


πŸŽ€ NAME πŸŽ€

struct ubi_leb_change_req β€” a data structure used in atomic LEB change requests. no cap, that's what it is.


🌸 SYNOPSIS 🌸

struct ubi_leb_change_req {
    __s32 lnum;
    __s32 bytes;
    __s8 dtype;
    __s8 padding[7];
 };

look at her. iconic. four fields, zero notes. 🫢


πŸ’– Members πŸ’–

  • lnum β€” the logical eraseblock number you're changing. like, which LEB, bestie. 🎯
  • bytes β€” how many bytes will be written to the logical eraseblock. count 'em. πŸ”’
  • dtype β€” pass "3" for better compatibility with old kernels. yes, literally the string three, the value 3, you get it. πŸ™ˆ
  • padding β€” reserved for future, not used, has to be zeroed. it's giving "seat saved for someone who's never showing up" πŸ’€ β€” but fr fr, zero it out.

πŸ¦‹ Description πŸ¦‹

okay so story time, because dtype has lore. πŸ“–βœ¨

The dtype field used to inform UBI about what kind of data will be written to the LEB, and the options were:

  1. long term (value 1)
  2. short term (value 2)
  3. unknown (value 3)

UBI tried to pick a PEB with lower erase counter for short term data and a PEB with higher erase counter for long term data. the way it was out here trying to be smart 😭

But this was not really used β€” because users usually do not know this and could easily mislead UBI. imagine that. misleading the kernel. embarrassing but relatable. πŸ™ˆ

So we removed this feature in May 2012. periodt. πŸ—“οΈ

UBI currently just ignores the dtype field. but for better compatibility with older kernels it is recommended to set dtype to 3 (unknown). so yeah β€” set it to 3. it's the safe, cute, universally-agreed-upon choice. πŸ‘‘

ngl if you're out here setting dtype to 1 or 2 expecting special treatment: UBI is not reading that. she's ignoring you. respectfully. πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./include/uapi/mtd/ubi-user.h
  • struct ubi_attach_req(9)
  • struct ubi_mkvol_req(9)
  • struct ubi_rsvol_req(9)
  • struct ubi_rnvol_req(9)
  • struct ubi_ecinfo_req(9)
  • struct ubi_map_req(9)
  • struct ubi_set_vol_prop_req(9)
  • struct ubi_blkcreate_req(9)

the whole friend group, all linked, all slaying in their own little headers. iykyk πŸ’œ


🌈 sign-off 🌈

and that's the page, bestie! this little beauty lives in ./include/uapi/mtd, the date on it is October 2026, and it's filed under struct ubi_leb_change_req(9) β€” go forth, zero your padding, set dtype to 3, and slay. πŸ’–πŸŽ€πŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from