sg_alloc_table(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ sg_alloc_table(9) ✨

okay so bestie, welcome to the kernel API manual, section 9, and today's main character is sg_alloc_table πŸ’… this one's from ./lib and it's literally all about setting up your scatterlist table, so let's get into it πŸŽ€


🌸 NAME 🌸

sg_alloc_table β€” allocate and initialize an sg table, periodt ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

int sg_alloc_table (struct sg_table *table , unsigned int nents , gfp_t
gfp_mask );

like, that's the whole vibe. it hands you back an int, no cap 🫢


πŸ’– ARGUMENTS πŸ’–

  • table β€” the sg table header you're gonna use, bestie πŸ‘‘
  • nents β€” how many entries are in the sg list, fr fr πŸ”’
  • gfp_mask β€” the GFP allocation mask, that's the memory vibes 🌈

🌟 DESCRIPTION 🌟

So what does it actually do? It allocates and initializes an sg table πŸ’« easy.

But here's the tea πŸ“: if nents is larger than SG_MAX_SINGLE_ALLOC, then a chained sg table will be set up. that's the plot twist, iykyk 😭πŸ”₯


πŸ’œ SEE ALSO πŸ’œ

okay this list is long and honestly iconic, so buckle up bestie 🧚

Kernel file ./lib/scatterlist.c, plus: 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_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) 🌸


ngl, if you're messing with scatterlists, read these too. the kernel does not play about memory, so stay safe out there πŸ’€

and that's a wrap, bestie!! 🫢 this lil page lives in ./lib, dated October 2026, and the source/version line is sg_alloc_table(9) β€” slay, go allocate something gorgeous βœ¨πŸ‘‘πŸ’–

πŸ“¦ where this page comes from