sgl_alloc(9)
π sgl_alloc(9) π
okay so bestie, welcome to the Kernel API Manual β this is the page for sgl_alloc(9) and it's honestly a whole vibe. it does exactly one thing and it does it iconically: it hands you a scatterlist and the pages that go with it. let's get into it π
β¨ NAME β¨
sgl_alloc β allocate a scatterlist and its pages π«Ά
like, both of them. together. one function call. main character energy fr fr.
πΈ SYNOPSIS πΈ
struct scatterlist * sgl_alloc (unsigned long long length , gfp_t gfp ,
unsigned int *nent_p );
π¦ ARGUMENTS π¦
lengthβ the length in bytes of the scatterlist. yes,unsigned long long, she's got range πgfpβ the memory allocation flags. this is where you tell the kernel how you want your memory to behave (iykyk) β¨nent_pβ marked[out]in the original, so it's an output param, bestie β the number of entries in the scatterlist gets written back through this pointer. it's giving "you'll find out how many when we're done" π
π RETURN π
a pointer to an initialized scatterlist, or NULL upon failure π
no cap: check for that NULL, okay? it's literally right there in the spec.
π₯ SEE ALSO π₯
the kernel file lives at ./lib/scatterlist.c β that's the mothership π and here's the whole scatterlist family reunion, every single one of them, no skips:
sg_nents(9)sg_nents_for_len(9)sg_nents_for_dma(9)sg_last(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_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)
that's the whole page, bestie, nothing left out π this one ships from ./lib, dated October 2026 β go be iconic with your scatterlists, 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