vringh_getdesc_kern(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 vringh_getdesc_kern(9) β€” Kernel API Manual realness 🌸

Okay bestie, so this is vringh_getdesc_kern(9) from the Kernel API Manual, and it's literally the function that grabs the next available descriptor from a kernelspace ring. No cap, it's giving "main character energy" in the vringh kernel squad. πŸ’…βœ¨


✨ NAME ✨

vringh_getdesc_kern β€” get next available descriptor from kernelspace ring.


πŸ¦‹ SYNOPSIS πŸ¦‹

int vringh_getdesc_kern (struct vringh *vrh , struct vringh_kiov *riov ,
struct vringh_kiov *wiov , u16 *head , gfp_t gfp );

πŸŽ€ ARGUMENTS πŸŽ€

  • vrh β€” the kernelspace vring. That's your main character right there. πŸ‘‘
  • riov β€” where to put the readable descriptors (or NULL if you're not about that life).
  • wiov β€” where to put the writable descriptors (or NULL, same vibe).
  • head β€” the head index we received, for passing to vringh_complete_kern. Don't lose it, bestie.
  • gfp β€” flags for allocating larger riov/wiov. Like, if the ring needs more room, this tells the allocator how to act.

πŸ’– DESCRIPTION πŸ’–

Returns 0 if there was no descriptor, 1 if there was, or -errno. So like, 0 = nothing, 1 = slay, -errno = something went sideways. 😭

Note that on error return, you can tell the difference between an invalid ring and a single invalid descriptor: in the former case, *head will be vrh->vring.num. You may be able to ignore an invalid descriptor, but there's not much you can do with an invalid ring. πŸ’€

Also, you can reuse riov and wiov with subsequent calls. Content is overwritten and memory reallocated if more space is needed. It's giving "sustainable queen" energy. 🌱

When you don't have to use riov and wiov anymore, you should clean up them calling vringh_kiov_cleanup to release the memory, even on error! Like, do not skip this, fr fr. 🫢

🌈 SEE ALSO 🌈

Kernel file ./drivers/vhost/vringh.c and these iconic functions, iykyk:


This page lives in ./drivers/vhost, dated October 2026, and it's all about vringh_getdesc_kern(9). Bye bestie, go get those descriptors! πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from