sg_copy_buffer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sg_copy_buffer β€” bestie's guide to shuttling bytes between a linear buffer and an SG list ✨

okay so this one is from the Kernel API Manual (that's the manual name, keep up 🫢), and honestly? it's a lil workhorse. It copies data between a boring flat linear buffer and a fancy scatterlist (SG) list. That's it. That's the whole vibe. No cap.


🌸 SYNOPSIS 🌸

size_t sg_copy_buffer (struct scatterlist *sgl , unsigned int nents ,
       void *buf , size_t buflen , off_t skip , bool to_buffer );

πŸŽ€ ARGUMENTS πŸŽ€

  • sgl β€” the SG list, aka the main character of this whole operation 🫢
  • nents β€” how many SG entries there are (count 'em)
  • buf β€” where to copy from
  • buflen β€” the number of bytes to copy (yes, exactly this many, no more no less πŸ’…)
  • skip β€” how many bytes to skip before we start copying. like scrolling past the intro, iykyk
  • to_buffer β€” the transfer direction, and it's literally just a bool:
    • true == from an sg list to a buffer
    • false == from a buffer to an sg list

πŸ’– DESCRIPTION πŸ’–

Returns the number of copied bytes. that's the whole bit β€” the return value is your count, periodt. ⭐

lowkey obsessed with how this function just does the thing and tells you how many bytes it did it to. no drama, no notes. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./lib/scatterlist.c, plus this whole friend group of scatterlist functions (all (9) section, obviously β€” kernel internals only πŸ’…):

like… the whole extended universe fr fr 🌈


✨ anyway bestie that's the page!! live from ./lib, dated October 2026 β€” catch you in the next scatterlist πŸ’œπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from