STRUCT IIO_DMA_BUFFER_BLOCK(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct iio_dma_buffer_block(9) β€” the Kernel API Manual, but make it make sense

okay bestie, so we're in the kernel API manual for struct iio_dma_buffer_block(9) β€” yes that's the whole title, no this isn't a drill πŸŽ€ this is literally the struct that describes one IIO buffer block, and we're about to know her intimately.


✨ NAME ✨

struct iio_dma_buffer_block β€” IIO buffer block. that's it, that's the name, short and iconic πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole struct, verbatim, don't touch a single character:

struct iio_dma_buffer_block {
    struct list_head head;
    size_t bytes_used;
    void *vaddr;
    dma_addr_t phys_addr;
    size_t size;
    struct iio_dma_buffer_queue *queue;
    struct kref kref;
    enum iio_block_state state;
    bool cyclic;
    bool fileio;
    struct sg_table *sg_table;
    struct dma_fence *fence;
 };

like, look at her. twelve members. main character energy fr fr πŸ’œ


🌸 Members 🌸

every single field, no skipping, we don't do that here 🫢

  • head β€” the list head. she's a struct list_head, she links πŸ’…
  • bytes_used β€” number of bytes that actually contain valid data. not the whole thing, just the real ones ✨
  • vaddr β€” the virutal address of the block's memory (yes "virutal", that's genuinely what the doc says, not me being sloppy πŸ˜­πŸ™ˆ). a void *.
  • phys_addr β€” the physical address of the block's memory. a dma_addr_t. the real-real address πŸ”₯
  • size β€” total size of the block, in bytes. the whole vibe, not just the used part πŸŽ€
  • queue β€” the parent DMA buffer queue, as a struct iio_dma_buffer_queue *. who's her mom? that's her mom.
  • kref β€” a struct kref used to manage the lifetime of the block. keeping her alive, responsibly 🧚
  • state β€” current state of the block, of type enum iio_block_state. vibe check as a field πŸ’€
  • cyclic β€” a bool, true if this is a cyclic buffer. she loops πŸ‘‘
  • fileio β€” a bool, true if this buffer is used for fileio mode. lowkey a whole different mode 🌈
  • sg_table β€” DMA table for the transfer when transferring a DMABUF. a struct sg_table * that does the heavy lifting ⭐
  • fence β€” DMA fence to be signaled when a DMABUF transfer is complete. a struct dma_fence *. she's literally the "we're done here" signal, no cap πŸ¦‹

πŸ’– SEE ALSO πŸ’–

go read these next, i'm obsessed:

  • Kernel file ./include/linux/iio/buffer-dma.h
  • enum iio_block_state(9)
  • struct iio_dma_buffer_queue_fileio(9)
  • struct iio_dma_buffer_queue(9)
  • struct iio_dma_buffer_ops(9)

ngl this whole page is documented under ./include/linux/iio, dated October 2026, and the footer is out here calling itself struct iio_dma_buffer_block(9) again like we forgot πŸ’€

and that's the tea, bestie β€” periodt. go forth and buffer responsibly πŸ“πŸ’œ

πŸ“¦ where this page comes from