sg_nents_for_dma(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sg_nents_for_dma β€” the Kernel API Manual tea 🫢

okay so bestie, you're in the Kernel API Manual and today's main character is sg_nents_for_dma(9). she's a little function with a big job and honestly? she ate. let's get into it ✨


🌸 NAME 🌸

sg_nents_for_dma β€” returns the count of DMA-capable entries in a scatterlist. that's it, that's the vibe check πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

int sg_nents_for_dma (struct scatterlist *sgl , unsigned int sglen ,
       size_t len );

look at her. three little params, one int coming back. iconic honestly.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • sgl β€” the scatterlist itself, the whole point of the function, the moment πŸ’…
  • sglen β€” the current number of entries (as in, how many you've got right now)
  • len β€” the max length of a DMA-capable block

✨ DESCRIPTION ✨

so what does she actually do? she figures out how many entries in sgl would be permitted in a DMA-capable transfer β€” like, if the list had been split accordingly. and yes, she's taking chaining into account too, because she's thorough like that πŸ’– no cap, she's considering the whole situation.


πŸ”₯ RETURN πŸ”₯

she gives you back the number of sgl entries needed. that's the whole answer, bestie. the count. the receipts. periodt πŸ‘‘


🌈 SEE ALSO 🌈

kernel file ./lib/scatterlist.c β€” and ok, the whole scatterlist friend group showed up, so let's give them their moment, one by one 🫢


ngl bestie, that's the entire roster β€” go read the whole squad if you want the full lore 🧚

and that's the page! sign-off time: this one's from the ./lib crew, dated October 2026, and it's sg_nents_for_dma(9) saying bye from the Kernel API Manual πŸ’œπŸŒΈ catch you in the source, bestie πŸŽ€

πŸ“¦ where this page comes from