get_vaddr_frames(9)
π get_vaddr_frames(9) β like, the whole kernel API manual energy, bestie
okay so welcome to the glow-up of get_vaddr_frames, straight from your fave Kernel API Manual β¨ this one's a function page, so grab a strawberry drink π and let's get into it.
π NAME π
get_vaddr_frames β maps virtual addresses to pfns. that's it, that's the vibe π¦
β¨ SYNOPSIS β¨
int get_vaddr_frames (unsigned long start , unsigned int nr_frames ,
bool write , struct frame_vector *vec );
literally the whole signature, no cap π
πΈ ARGUMENTS πΈ
startβ the starting user address. like, where the whole thing begins πnr_framesβ number of pages / pfns fromstartto map. the count, the amount, the quantity π§writeβ the mapped address has write permission. yes, it's abool, yes it's important π₯vecβ thestruct frame_vectorthat receives the pages / pfns of the addresses mapped. it should have space for at leastnr_framesentries, so pls size it right bestie π
π¦ DESCRIPTION π¦
so what does this icon actually do? it maps virtual addresses starting from start and fills the vec structure with page frame numbers or page pointers to the corresponding pages β the choice depends on the type of the vma underlying the virtual address π
here's the tea, split by case:
- if
startbelongs to a normal vma, the function grabs a reference to each of the pages to pin them in memory π - if
startbelongs to aVM_IO | VM_PFNMAPvma, we don't touch page structures and the caller must make sure pfns aren't reused for anything else while he is using them β that's on you, fr fr, this is the important warning part π
the function returns the number of pages mapped, which may be less than nr_frames. in particular it stops mapping if there are more vmas of different type underlying the specified range of virtual addresses. and when the function isn't able to map a single page, it returns an error π
note thatget_vaddr_framescannot followVM_IOmappings. it used to be able to do that, but that could (racily) return non-refcounted pfns. so like... we don't do that anymore, and honestly good for us π
also this function takes care of grabbing mmap_lock as necessary β no need to do it yourself, she handles it π«Ά
π SEE ALSO π
- kernel file
./drivers/media/common/videobuf2/frame_vector.c put_vaddr_frames(9)frame_vector_to_pages(9)frame_vector_to_pfns(9)frame_vector_create(9)frame_vector_destroy(9)
go read those too, iykyk π
and that's the page, bestie π sign-off time: this lil masterpiece lives in ./drivers/media/common/videobuf2, dated October 2026 β and honestly? iconic. 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