sg_next(9)
πΈ sg_next(9) πΈ
okay so real quick before we dive in: this page lives in the Kernel API Manual, and it's about one (1) little function that does one (1) little thing β but bestie, that little thing is load-bearing. let's get into it π
π NAME π
sg_next β return the next scatterlist entry in a list β¨
π¦ SYNOPSIS π¦
struct scatterlist * sg_next (struct scatterlist *sg );
π ARGUMENTS π
sgβ the current sg entry π«Ά (like, the one you're standing on right now, so the function knows where to go next)
π₯ DESCRIPTION π₯
okay so usually? the next entry is just sg + 1. simple. iconic. no notes. π
but plot twist π β if this sg element is part of a chained scatterlist, it could jump to the start of a whole new scatterlist array instead. so like, not a vibe-forward march through memory, but a hop. a little teleport. π§β¨
so fr fr: don't assume sg + 1. let the function cook. π
π SEE ALSO π
kernel file:
./include/linux/scatterlist.h
and the whole friend group π:
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_virt(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)
and that's the whole page, bestie π«Ά sign-off time: this one ships from ./include/linux, dated October 2026, and the manual name at the top is sg_next(9) β ikyk πβ¨ byeee π
π¦ 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