add_volume(9)
π add_volume β Kernel API Manual β¨
okay so bestie, you found yourself deep in the kernel docs, specifically the add_volume(9) page from the Kernel API Manual, and honestly? it's giving "small function, big responsibilities." let's get into it π«Ά
β¨ NAME β¨
add_volume β adds a volume to the attaching information. that's the whole vibe, no cap π
π SYNOPSIS π
struct ubi_ainf_volume * add_volume (struct ubi_attach_info *ai , int
vol_id , int pnum , const struct ubi_vid_hdr *vid_hdr );
look at that signature, she's iconic π
πΈ ARGUMENTS πΈ
aiβ the attaching information. this is the main character of the whole operation, fr fr π¦vol_idβ the ID of the volume you want to add. yes, this one specifically πpnumβ the physical eraseblock number. lowkey important πvid_hdrβ the volume identifier header. the whole reason we're here π
π DESCRIPTION π
so here's the tea β: if the volume that corresponds to the vid_hdr logical eraseblock is already present in the attaching information, this function literally does nothing. like, nothing nothing. she's on break π
otherwise? she adds the corresponding volume to the attaching information, and that's the slay β¨
on success you get a pointer back to the allocated "av" object β that's your win, bestie π β and in the case of failure you get a negative error code instead. so, y'know, vibe check the return value π
π§ SEE ALSO π§
so many friends in the kernel filesystem neighborhood, i'm obsessed π these all live near Kernel file ./drivers/mtd/ubi/attach.c:
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)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)scan_peb(9)late_analysis(9)destroy_av(9)destroy_ai(9)scan_all(9)scan_fast(9)ubi_attach(9)self_check_ai(9)
go read them, iykyk ππ
and that's the whole page, bestie! brought to you by ./drivers/mtd/ubi, dated October 2026 β mwah, catch you in the next manpage πΈππ
π¦ 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