vringh_getdesc_user(9)
π vringh_getdesc_user β Kernel API Manual, bestie edition π
okay so this page is literally about vringh_getdesc_user(9) and it lives in the Kernel API Manual, and honestly? she's a whole vibe. grab a snack, we're getting descriptors from a userspace ring β¨
πΈ NAME πΈ
vringh_getdesc_user β get the next available descriptor from a userspace ring. that's it. that's the whole job. and she does it beautifully π
π¦ SYNOPSIS π¦
int vringh_getdesc_user (struct vringh *vrh , struct vringh_iov *riov ,
struct vringh_iov *wiov , bool (*getrange)(struct vringh *vrh, u64 addr,
struct vringh_range *r) , u16 *head );
like yes, that's a lot of arguments. she's high-maintenance. we love her anyway π«Ά
π ARGUMENTS π
vrhβ the userspace vring. this is the main character, the whole reason we're here πriovβ where you put the readable descriptors (orNULLif you're not about that life)wiovβ where you put the writable descriptors (orNULL, again, no pressure)getrangeβ the function you call to check ranges. yes it's a function pointer, yes it takes astruct vringh *vrh, au64 addr, and astruct vringh_range *r. keep up bestie πheadβ the head index we received, for passing along tovringh_complete_user. don't lose it, it's important π―
β¨ DESCRIPTION β¨
okay so the return values, listen up:
- returns
0if there was no descriptor - returns
1if there was one - or
-errnoif things went sideways π
ngl, on an error return you can actually tell the difference between an invalid ring and a single invalid descriptor: in the former case,*headwill bevrh->vring.num. and like... you may be able to ignore an invalid descriptor, but there's not much you can do with an invalid ring. it's giving doomed fr fr π
and here's the cute part: you can totally reuse riov and wiov with subsequent calls π content gets overwritten and memory gets reallocated if more space is needed. sustainable queen behavior π
β οΈ but when you don't have to useriovandwiovanymore, you should clean up them callingvringh_iov_cleanupto release the memory β even on error! like seriously, even on error. don't leave her hanging π
π§ SEE ALSO π§
so much lore to explore, iykyk:
Kernel file ./drivers/vhost/vringh.c, plus:
vringh_kiov_advance(9), vringh_init_user(9), vringh_iov_pull_user(9), vringh_iov_push_user(9), vringh_complete_user(9), vringh_complete_multi_user(9), vringh_notify_enable_user(9), vringh_notify_disable_user(9), vringh_need_notify_user(9), vringh_init_kern(9), vringh_getdesc_kern(9), vringh_complete_kern(9), vringh_notify_enable_kern(9), vringh_notify_disable_kern(9), vringh_need_notify_kern(9), vringh_init_iotlb(9), vringh_init_iotlb_va(9), vringh_set_iotlb(9), vringh_getdesc_iotlb(9), vringh_iov_pull_iotlb(9), vringh_iov_push_iotlb(9), vringh_complete_iotlb(9), vringh_need_notify_iotlb(9)
that's the whole page, bestie, we ate and left no crumbs π this icon dropped from ./drivers/vhost back in October 2026 β stan forever, periodt π
π¦ 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