sg_last(9)
π sg_last(9) β like, the Kernel API Manual, but make it make sense
okay so bestie, welcome to sg_last(9), a page straight out of the Kernel API Manual, and honestly? it's short, it's sweet, and it's gonna eat. let's go π«Ά
β¨ NAME β¨
sg_last β literally just returns the last scatterlist entry in a list. that's the whole gig. no cap. π
πΈ SYNOPSIS πΈ
struct scatterlist * sg_last (struct scatterlist *sgl , unsigned int
nents );
like yes, the line break is really there, i don't make the rules π
π ARGUMENTS π
sglβ the first entry in the scatterlist. it's giving main character energy, it's the starting point of the whole thing β¨nentsβ the number of entries in the scatterlist. the headcount, if you will π§
π¦ DESCRIPTION π¦
so the vibe check here is: you should only use this casually, because (currently) it scans the entire list just to get to the last entry. yeah. it walks the whole thing. no shortcuts, no cheating, fr fr π
important lore: thesglpointer you pass in does not have to be the first one. the thing that actually matters is thatnentsdenotes the number of entries that exist fromsglonward. that's the whole assignment, bestie π
π SEE ALSO π
kernel file ./lib/scatterlist.c, plus this entire friend group:
sg_nents(9)sg_nents_for_len(9)sg_nents_for_dma(9)sg_init_table(9)sg_init_one(9)__sg_free_table(9)sg_free_append_table(9)sg_free_table(9)__sg_alloc_table(9)sg_alloc_table(9)sg_alloc_append_table_from_pages(9)sg_alloc_table_from_pages_segment(9)sgl_alloc_order(9)sgl_alloc(9)sgl_free_n_order(9)sgl_free_order(9)sgl_free(9)sg_miter_start(9)sg_miter_skip(9)sg_miter_next(9)sg_miter_stop(9)sg_copy_buffer(9)sg_copy_from_buffer(9)sg_copy_to_buffer(9)sg_pcopy_from_buffer(9)sg_pcopy_to_buffer(9)sg_zero_buffer(9)extract_iter_to_sg(9)
and that's the whole page, babes π it lives in ./lib, it's dated October 2026, and it answers to the name sg_last(9). mwah π
π¦ 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