sg_virt(9)
π« sg_virt(9) β the kernel API manual, bestie edition π«
okay so real quick: this is sg_virt(9) from the Kernel API Manual, and it lives over in ./include/linux. come on a little tour with me π
β¨ NAME β¨
sg_virt β returns the virtual address of an sg entry. that's it. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
void * sg_virt (struct scatterlist *sg );
π ARGUMENTS π
sgβ the SG entry, bestie. the one you want the virtual address of. π
π₯ DESCRIPTION π₯
so what actually happens: this calls page_address on the page inside this sg entry, and then it adds the sg offset. that's the whole recipe π
β οΈ but here's the catch, and it's a big one: the caller must know that the sg page has a valid virtual mapping. no cap. this function is not out here checking for you β that's on you, and if you're wrong, that's a you problem. π
π SEE ALSO π
kernel file ./include/linux/scatterlist.h β and literally the whole sg friend group:
sg_next(9)sg_assign_page(9)sg_set_page(9)sg_set_folio(9)sg_set_buf(9)sg_chain(9)sg_mark_end(9)sg_unmark_end(9)sg_dma_is_bus_address(9)sg_dma_mark_bus_address(9)sg_dma_unmark_bus_address(9)sg_dma_is_swiotlb(9)sg_dma_mark_swiotlb(9)sg_phys(9)sg_init_marker(9)sg_alloc_table_from_pages(9)sg_page_iter_page(9)sg_page_iter_dma_address(9)for_each_sg_page(9)for_each_sg_dma_page(9)for_each_sgtable_page(9)for_each_sgtable_dma_page(9)
like, the entire friend group showed up to the function. obsessed. π«Ά
okay that's the page!! sign-off time: this one shipped out of ./include/linux, dated October 2026, and it's filed under sg_virt(9). 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