scan_peb(9)
π scan_peb(9) β like, the whole kernel API manual page, but make it make sense
okay bestie, gather round, because today we're reading a page from the Kernel API Manual and honestly? it's kind of a bop. it's called scan_peb and it does exactly one thing but it does it iconically. no cap. π
β¨ NAME β¨
scan_peb β scan and process UBI headers of a PEB.
like, that's it. that's the whole vibe. it scans, it processes, it handles its business. π¦
β¨ SYNOPSIS β¨
int scan_peb (struct ubi_device *ubi , struct ubi_attach_info *ai , int
pnum , bool fast );
look at that signature. four arguments, one int return, zero notes. she's busy, she's booked, she's got a job to do. π₯
β¨ ARGUMENTS β¨
ubiβ the UBI device description object. this is the main character of the whole situation, the device we're talking about. πaiβ the attaching information. yes, that's the "attaching info" structure you'll be hearing about again in like two seconds. keep her in mind. πpnumβ the physical eraseblock number. which PEB are we scanning? this one. literally this one. πfastβ abool, and it'strueif we're scanning for a Fastmap. so if you're in fastmap mode, this is your girl. β
β¨ DESCRIPTION β¨
okay so here's what actually happens, and pay attention because this is the whole plot:
this function reads the UBI headers of PEB pnum, checks them, and then adds information about this PEB to the corresponding list or RB-tree in the "attaching info" structure. π«Ά
that's the tea. read headers β check headers β file the info away in the right list or RB-tree inside ai. very organized, very demure, very "everything in its place."
as for what it gives back:
- it returns zero if the physical eraseblock was successfully handled π
- and a negative error code in case of failure π
ngl bestie, always check that return value. zero = slay, negative = we have a problem. fr fr.
β¨ SEE ALSO β¨
the kernel file lives at ./drivers/mtd/ubi/attach.c, and here's the whole friend group β every single one of them, no gatekeeping:
find_or_add_av(9), ubi_find_or_add_av(9), ubi_alloc_aeb(9), ubi_free_aeb(9), add_to_list(9), add_corrupted(9), add_fastmap(9), validate_vid_hdr(9), add_volume(9), ubi_compare_lebs(9), ubi_add_to_av(9), ubi_add_av(9), ubi_find_av(9), ubi_remove_av(9), early_erase_peb(9), ubi_early_get_peb(9), check_corruption(9), late_analysis(9), destroy_av(9), destroy_ai(9), scan_all(9), scan_fast(9), ubi_attach(9), self_check_ai(9)
that's twenty-three functions. twenty-three! we ate. π
anyway, that's the page babes. it shipped from ./drivers/mtd/ubi and it's dated October 2026, so like, mark your calendar. 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