virtqueue_add_inbuf_ctx(9)
π virtqueue_add_inbuf_ctx π
okay bestie so this is a page from the Kernel API Manual and it's literally about showing your input buffers to the other end of the virtqueue. it's giving "here, take my stuff, please don't fumble it" energy π
β¨ NAME β¨
virtqueue_add_inbuf_ctx β expose input buffers to other end π«Ά
πΈ SYNOPSIS πΈ
int virtqueue_add_inbuf_ctx (struct virtqueue *vq , struct scatterlist
*sg , unsigned int num , void *data , void *ctx , gfp_t gfp );
like, yes, it's a long signature, but she's worth it π
π¦ ARGUMENTS π¦
vqβ thestruct virtqueuewe're talking about. your main character struct, the one we're actually doing the thing to πsgβ thescatterlist. and hear me out: it must be well-formed and terminated. no half-built scatterlists, no loose ends, she needs to be complete fr fr πnumβ the number of entries insgthat are writable by the other side. count them, bestie, don't guess π’dataβ the token that identifies the buffer. it's like a little name tag so you know who's who later π·οΈctxβ extra context for that token. more lore, more detail, we love a token with backstory πgfpβ how to do memory allocations (if necessary). that's the "if necessary" doing a lot of heavy lifting ngl π
β DESCRIPTION β
so the caller β that's you, bestie β must ensure we don't call this at the same time as other virtqueue operations, except where noted. like, no multitasking with the virtqueue, okay? she needs your full attention π
it returns zero or a negative error (ie.ENOSPC,ENOMEM,EIO). so like, zero = slay, negative = something went sideways and you gotta read the error π
π SEE ALSO π
these are the sibling functions, the whole friend group, and honestly they all ate π₯ the kernel file is ./drivers/virtio/virtio_ring.c:
virtqueue_add_sgs(9)virtqueue_add_outbuf(9)virtqueue_add_outbuf_premapped(9)virtqueue_add_inbuf(9)virtqueue_add_inbuf_cache_clean(9)virtqueue_add_inbuf_premapped(9)virtqueue_dma_dev(9)virtqueue_kick_prepare(9)virtqueue_notify(9)virtqueue_kick(9)virtqueue_get_buf_ctx(9)virtqueue_disable_cb(9)virtqueue_enable_cb_prepare(9)virtqueue_poll(9)virtqueue_enable_cb(9)virtqueue_enable_cb_delayed(9)virtqueue_detach_unused_buf(9)vring_interrupt(9)virtqueue_resize(9)virtqueue_reset(9)virtqueue_get_vring_size(9)virtqueue_map_alloc_coherent(9)virtqueue_map_free_coherent(9)virtqueue_map_page_attrs(9)virtqueue_unmap_page_attrs(9)virtqueue_map_single_attrs(9)virtqueue_unmap_single_attrs(9)virtqueue_map_mapping_error(9)virtqueue_map_need_sync(9)virtqueue_map_sync_single_range_for_cpu(9)virtqueue_map_sync_single_range_for_device(9)
periodt. that's the whole list, no cap π β¨
and that's the page bestie!! this one's from ./drivers/virtio, dated October 2026, and it's all about virtqueue_add_inbuf_ctx(9) β go expose those input buffers, you've got this ππ¦πΈ
π¦ 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