STRUCT UBI_ATTACH_INFO(9)
๐ struct ubi_attach_info(9) ๐
okay bestie, so this is a page from the Kernel API Manual, and it's literally all about struct ubi_attach_info โ the MTD device attaching information. yes, the whole vibe is "we just attached an MTD device, here's everything we learned." slay.
โจ SYNOPSIS โจ
struct ubi_attach_info {
struct rb_root volumes;
struct list_head corr;
struct list_head free;
struct list_head erase;
struct list_head alien;
struct list_head fastmap;
int corr_peb_count;
int empty_peb_count;
int alien_peb_count;
int bad_peb_count;
int maybe_bad_peb_count;
int vols_found;
int highest_vol_id;
int is_empty;
int force_full_scan;
int min_ec;
int max_ec;
unsigned long long max_sqnum;
int mean_ec;
uint64_t ec_sum;
int ec_count;
struct kmem_cache *aeb_slab_cache;
struct ubi_ec_hdr *ech;
struct ubi_vid_io_buf *vidb;
};
๐ Members ๐
okay so here's the cast of characters, one by one, no skips:
volumesโ the root of the volume RB-tree, the main character of the tree world ๐ณcorrโ list of corrupted physical eraseblocks ๐ญfreeโ list of free physical eraseblocks โจeraseโ list of physical eraseblocks which have to be erased ๐งนalienโ list of physical eraseblocks which should not be used by UBI (e.g., those belonging to"preserve"-compatible internal volumes) ๐ฝfastmapโ list of physical eraseblocks which relate to fastmap (e.g., eraseblocks of the current and not yet erased old fastmap blocks) ๐บ๏ธcorr_peb_countโ count of PEBs in thecorrlist ๐งฎempty_peb_countโ count of PEBs which are presumably empty (contain only0xFFbytes) ๐ซงalien_peb_countโ count of PEBs in thealienlist ๐ฝbad_peb_countโ count of bad physical eraseblocks ๐maybe_bad_peb_countโ count of bad physical eraseblocks which are not marked as bad yet, but which look like bad ๐vols_foundโ number of volumes found ๐highest_vol_idโ highest volume ID ๐is_emptyโ flag indicating whether the MTD device is empty or not ๐ชนforce_full_scanโ flag indicating whether we need to do a full scan and dropmin_ecโ lowest erase counter value ๐max_ecโ highest erase counter value ๐max_sqnumโ highest sequence number value ๐ขmean_ecโ mean erase counter value โ๏ธec_sumโ a temporary variable used when calculatingmean_ec๐งพec_countโ a temporary variable used when calculatingmean_ec๐งพaeb_slab_cacheโ slab cache forstruct ubi_ainf_pebobjects ๐งบechโ temporary EC header. Only available during scan โณvidbโ listed right there in the struct, bestie ๐ซถ
ngl, that struct has a lot of fields. it's giving "I contain multitudes" energy ๐
๐ Description ๐
so what does it actually do? This data structure contains the result of attaching an MTD device, and it may be used by other UBI sub-systems to build final UBI data structures, further error-recovery and so on. literally the receipts of an attach, kept around so the rest of UBI can do its thing โจ
๐ฆ SEE ALSO ๐ฆ
Kernel file ./drivers/mtd/ubi/ubi.h:struct ubi_vid_io_buf(9), struct ubi_wl_entry(9), struct ubi_ltree_entry(9), struct ubi_rename_entry(9), struct ubi_fastmap_layout(9), struct ubi_fm_pool(9), struct ubi_eba_leb_desc(9), struct ubi_volume(9), struct ubi_volume_desc(9), struct ubi_debug_info(9), struct ubi_device(9), struct ubi_ainf_peb(9), struct ubi_ainf_volume(9), struct ubi_work(9), ubi_init_vid_buf(9), ubi_free_vid_buf(9), ubi_get_vid_hdr(9), ubi_ro_mode(9), vol_id2idx(9), idx2vol_id(9), ubi_is_fm_vol(9), ubi_find_fm_block(9)
and that's the whole page, bestie ๐ซถ it lives over in ./drivers/mtd/ubi and this edition is dated October 2026 โ go off, kernel docs, periodt ๐
โจ
๐ฆ 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