virtqueue_a...uf_premapped(9)
π virtqueue_add_inbuf_premapped β Kernel API Manual, section 9 β¨
okay so bestie, we're in the <pink>Kernel API Manual</pink>, section 9, and today's main character is virtqueue_add_inbuf_premapped β she exposes input buffers to the other end. that's it, that's the vibe. π
β¨ NAME β¨
virtqueue_add_inbuf_premapped β expose input buffers to other end π
πΈ SYNOPSIS πΈ
int virtqueue_add_inbuf_premapped (struct virtqueue *vq , struct
scatterlist *sg , unsigned int num , void *data , void *ctx , gfp_t gfp
);
like, just look at her. six args, all iconic. π₯
π¦ ARGUMENTS π¦
vqβ thestruct virtqueuewe're talking about. yes, that one, the virtqueue in question. πsgβ thescatterlist. and ngl, it must be well-formed and terminated! this is not a drill, she is NOT flexible about this. πnumβ the number of entries insgthat are writable by the other side. count them. fr. πdataβ the token identifying the buffer. her little name tag πctxβ extra context for the token. because the token deserves lore. β¨gfpβ how to do memory allocations (if necessary). that "if necessary" is doing a lot of heavy lifting, iykyk. π
π DESCRIPTION π
okay so here's the thing, bestie β the caller must ensure we don't call this with other virtqueue operations at the same time (except where noted). it's giving "one thing at a time" energy. no parallel chaos. no cap. π«Ά
π RETURN π
returns zero, or a negative error β ie. ENOSPC, ENOMEM, EIO. so like, zero = slay, negative = the vibe check failed. π
bestie this is the part where you actually check the return value. i'm serious. π
β SEE ALSO β
start in the kernel file ./drivers/virtio/virtio_ring.c, then go meet the whole friend group:
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_ctx(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)
like, the whole squad. go say hi. πΈπ§
and that's the page, bestie!! this cute lil manual lives in./drivers/virtio, and it's dated October 2026 βvirtqueue_a...uf_premapped(9)out. mwah. πβ¨ππ¦
π¦ 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