sg_alloc_table_from_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 sg_alloc_table_from_pages(9) 🌸

okay so this is the Kernel API Manual page for sg_alloc_table_from_pages(9), and bestie, it's literally the glow-up for turning a pile of pages into a proper sg table. no cap. πŸ’…


✨ NAME ✨

sg_alloc_table_from_pages β€” allocate and initialize an sg table from an array of pages 🫢


🌸 SYNOPSIS 🌸

int sg_alloc_table_from_pages (struct sg_table *sgt , struct page **pages , unsigned int n_pages , unsigned int offset , unsigned long size , gfp_t gfp_mask );

πŸŽ€ ARGUMENTS πŸŽ€

  • sgt β€” the sg table header you're using 🫢
  • pages β€” pointer to an array of page pointers ✨
  • n_pages β€” how many pages are in the pages array πŸ”₯
  • offset β€” offset from start of the first page to the start of a buffer πŸŽ€
  • size β€” number of valid bytes in the buffer (after offset) πŸ¦‹
  • gfp_mask β€” GFP allocation mask 🌈

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole vibe: this one allocates and initializes an sg table from a list of pages. Contiguous ranges of the pages are squashed into a single scatterlist node β€” yes, squashed, iconic behavior fr fr. 🫢

A user may provide an offset at a start and a size of valid data in a buffer specified by the page array. The returned sg table is released by sg_free_table. don't forget that part, bestie, or it's giving leak energy 😭


πŸ’œ RETURN πŸ’œ

It's giving 0 on success, and a negative error on failure. periodt. πŸ’…


🌈 SEE ALSO 🌈

go read these too, bestie, they're iconic:


mwah πŸ’‹ this cutie came from ./include/linux, dated October 2026, and it's sg_alloc_table_from_pages(9) β€” slay and goodbye πŸŽ€βœ¨

πŸ“¦ where this page comes from