sg_set_page(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ sg_set_page(9) ✨

okay so this is from the Kernel API Manual, and bestie, it's a whole little scatterlist moment. it's giving "small function, big rules." let's get into it πŸŽ€


πŸ’– NAME πŸ’–

sg_set_page β€” set an sg entry so it points at a given page. that's it, that's the vibe πŸ¦‹


🌸 SYNOPSIS 🌸

void sg_set_page (struct scatterlist *sg , struct page *page , unsigned
int len , unsigned int offset );

literally just one call, four things in, nothing out. void, so don't go looking for a return value, she doesn't have one πŸ’…


🫢 ARGUMENTS 🫢

  • sg β€” the SG entry. like, the actual scatterlist slot you're messing with ✨
  • page β€” the page. the one and only 🌈
  • len β€” how much data. the length, the amount, the whole point πŸ“
  • offset β€” offset into the page. where inside that page you're starting, iykyk πŸ’œ

πŸ”₯ DESCRIPTION πŸ”₯

use this function to set an sg entry pointing at a page. that's the whole assignment job, and it's hers πŸ’…

⚠️ never assign the page directly. like, do not just go poking the page field yourself. no cap, don't do it. we encode sg table information in the lower bits of the page pointer 😭 so a raw assignment would stomp all over that and ruin everything.

if you're trying to go the other direction β€” you got an sg entry and you wanna know which page belongs to it β€” see sg_page. she's the lookup queen πŸ‘‘


🌟 SEE ALSO 🌟

kernel file ./tools/virtio/linux/scatterlist.h, plus the whole scatterlist friend group:


and that's the page, bestie 🧚 source/version lives at ./tools/virtio/linux, dated October 2026, and yes she's still sg_set_page(9) at the bottom, iconic to the very last line πŸ‘‘πŸ’–

πŸ“¦ where this page comes from