STRUCT UBI_ECINFO_REQ(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct ubi_ecinfo_req(9) ✨

okay bestie, so this is a page straight out of the Kernel API Manual β€” like, the struct ubi_ecinfo_req(9) entry itself β€” and we're about to make it make sense, fr fr 🫢


🌸 NAME 🌸

struct ubi_ecinfo_req β€” it's literally the data structure you use to ask a UBI device for erase block counter info and to receive it back. One struct, both jobs, main character energy πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

struct ubi_ecinfo_req {
    __s32 start;
    __s32 length;
    __s32 read_length;
    __s8 padding[16];
    __s32 erase_counters[];
};

copy it exactly, no cap, every field matters πŸ’…


πŸ’– Members πŸ’–

  • start β€” the index of the first physical erase block you wanna read (this one's in) πŸ¦‹
  • length β€” how many erase counters you're asking to read (also in) ✨
  • read_length β€” how many erase counters actually got read (this one's out, surprise!) πŸ™ˆ
  • padding β€” reserved for future stuff, not used rn, and it has to be zeroed β€” no exceptions, bestie πŸ’€
  • erase_counters β€” the array where the erase counter values land (out) πŸ“

🌈 Description 🌈

So here's the vibe: this struct is how you retrieve erase counter info for a specific range of PEBs on a UBI device ✨

The counters get read starting from start, and it attempts to read length number of erase counters. The retrieved values go into the erase_counters array β€” cute, right?

Important though: it's your responsibility (yes, the caller's) to allocate enough memory to store length elements in that erase_counters array. Don't skimp, or it's giving chaos 😭

If a block is bad, or if the erase counter is unknown, the corresponding value in the array gets set to -1. Noted. 🧚

And the read_length field will tell you the number of erase counters actually read β€” typically read_length will be limited, whether because of memory or because of the number of PEBs on the UBI device. So don't assume you got everything you asked for, iykyk πŸ’œ


⭐ SEE ALSO ⭐

Kernel file ./include/uapi/mtd/ubi-user.h plus the whole struct squad πŸ‘‘:

  • struct ubi_attach_req(9)
  • struct ubi_mkvol_req(9)
  • struct ubi_rsvol_req(9)
  • struct ubi_rnvol_req(9)
  • struct ubi_leb_change_req(9)
  • struct ubi_map_req(9)
  • struct ubi_set_vol_prop_req(9)
  • struct ubi_blkcreate_req(9)

okay that's the whole page β€” every field, every caveat, nothing skipped, periodt πŸ’…

and that's a wrap, bestie! πŸŽ€ this iconic little entry lives in ./include/uapi/mtd and it's dated October 2026 β€” signed off as struct ubi_ecinfo_req(9), slay πŸ’–

πŸ“¦ where this page comes from