sg_copy_to_buffer(9)
π« sg_copy_to_buffer(9) π«
Ok bestie, welcome to the Kernel API Manual, section 9 β yes, the kernel kernel, main character energy only. Today's episode: sg_copy_to_buffer, aka "copy from an SG list to a linear buffer" (that's the NAME section, and yes it literally tells you the whole plot in one line π).
β¨ SYNOPSIS β¨
size_t sg_copy_to_buffer (struct scatterlist *sgl , unsigned int nents ,
void *buf , size_t buflen );
That's the whole signature, no cap β size_t in, size_t out, four args, periodt. π
πΈ ARGUMENTS πΈ
sglβ the SG list. like, the list. the source of truth, the moment, the vibe. π¦nentsβ number of SG entries. how many of them we're actually dealing with, fr fr.bufβ where to copy to. the destination. the glow-up location. βbuflenβ the number of bytes to copy. that's your budget, bestie, don't overspend. π
π DESCRIPTION π
Returns the number of copied bytes.
That's it. That's the description. Short, iconic, ate and left no crumbs π β it takes your SG list and copies stuff into a linear buffer, and then hands you back a size_t telling you how many bytes actually made it. lowkey the most honest function in the kernel ngl.
π₯ SEE ALSO π₯
Buckle up babes, this is the friend group and it is huge π«Ά. First, the location, in the kernel file ./lib/scatterlist.c:
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_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_pcopy_from_buffer(9)sg_pcopy_to_buffer(9)sg_zero_buffer(9)extract_iter_to_sg(9)
bestie the way this list has twenty-eight entries and not one of them is filler π go read them, iykyk.
ok that's the whole page, mwah π β this lil masterpiece lives in ./lib, dated October 2026, and it's filed under sg_copy_to_buffer(9). see u in the next manpage, love u, bye π§π
π¦ 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