find_or_add_av(9)
β¨ find_or_add_av(9) β¨
okay so bestie, we're deep in the Kernel API Manual today and this one is literally called find_or_add_av β the internal function that finds a volume, adds a volume, or does both (find and add if missing). multi-talented icon behaviour fr fr π
πΈ SYNOPSIS πΈ
struct ubi_ainf_volume * find_or_add_av (struct ubi_attach_info *ai ,
int vol_id , unsigned int flags , bool *created );
that's the whole vibe check right there π¦
π ARGUMENTS π
aiβ the attaching information. like, the whole context of what we're attaching. πvol_idβ the volume ID you're asking for. the one you want. the main character. πflagsβ a combination of theAV_FINDandAV_ADDflags, and they describe the expected operation. this is the important part so pay attention bestie π- If only
AV_ADDis set,-EEXISTis returned if the volume already exists. - If only
AV_FINDis set,NULLis returned if the volume does not exist. - And if both flags are set, the helper first tries to find an existing volume, and if it does not exist it creates a new one. two-for-one combo, we love to see it β¨
- If only
createdβ an in value used to inform the caller whether it's a newly created volume or not. so like, "hey, was this fresh out the oven or already here?" π
π¦ DESCRIPTION π¦
This function returns a pointer to a volume description β or an ERR_PTR if the operation failed. π
It can also return NULL if only AV_FIND is set and the volume does not exist. no cap, that's a whole three-way exit situation, so check your returns properly π
π₯ SEE ALSO π₯
Kernel file ./drivers/mtd/ubi/attach.c plus the whole friend group:
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)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)
π reminder bestie: this lives in ./drivers/mtd/ubi and it's the October 2026 edition of the page. go off, read the source, slay π
mwah π thanks for reading my ted talk, now go call find_or_add_av responsibly π§
π¦ 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