STRUCT UBI_ECINFO_REQ(9)
β¨ 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
- 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