STRUCT UBI_ATTACH_INFO(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– 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 the corr list ๐Ÿงฎ
  • empty_peb_count โ€” count of PEBs which are presumably empty (contain only 0xFF bytes) ๐Ÿซง
  • alien_peb_count โ€” count of PEBs in the alien list ๐Ÿ‘ฝ
  • 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 drop
  • min_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 calculating mean_ec ๐Ÿงพ
  • ec_count โ€” a temporary variable used when calculating mean_ec ๐Ÿงพ
  • aeb_slab_cache โ€” slab cache for struct ubi_ainf_peb objects ๐Ÿงบ
  • 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