STRUCT VIRTIO_DMA_BUF_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct virtio_dma_buf_ops ✨

okay bestie, so this is a page from the Kernel API Manual about struct virtio_dma_buf_ops β€” literally the operations you can do on an exported object dma-buf πŸ’…. Yes it's kernel-land, yes it's iconic, let's get into it 🫢


🌸 NAME 🌸

struct virtio_dma_buf_ops β€” the operations possible on an exported object dma-buf. that's it, that's the whole vibe ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the struct, exactly as it lives, don't come for me about the indentation it's the kernel's fault 😭

struct virtio_dma_buf_ops {
    struct dma_buf_ops ops;
    int (*device_attach)(struct dma_buf *dma_buf, struct dma_buf_attachment *attach);
    int (*get_uuid)(struct dma_buf *dma_buf, uuid_t *uuid);
 };

πŸ‘‘ Members πŸ‘‘

okay so there are three of them, and each one has very different energy:

  • ops β€” this is the base dma_buf_ops, the foundation of the whole fit πŸ’–. and listen, there's a rule here that is not optional: ops.attach MUST be virtio_dma_buf_attach. like, that's not a suggestion, that's the law, no cap πŸ”₯
  • device_attach β€” [optional] callback, invoked by virtio_dma_buf_attach during all attach operations. so it's a little bonus hook that fires every single time something attaches β€” optional but lowkey a whole moment πŸŽ€
  • get_uuid β€” [required] callback to get the uuid of the exported object. required required, like you literally cannot skip this one bestie 🫢
ngl, double-check that ops.attach line before you ship anything β€” messing that up is a not me moment waiting to happen πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./include/linux/virtio_dma_buf.h β€” go read it, it ate πŸ‘‘


and that's the whole page, mwah πŸ’‹ β€” signed, sealed, delivered from ./include/linux, October 2026, straight out of the Kernel API Manual, struct virtio_dma_buf_ops(9) era πŸ§šπŸ’œ

πŸ“¦ where this page comes from