STRUCT IIO_DEV_OPAQUE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct iio_dev_opaque(9) β€” the kernel API manual, but make it make sense πŸŽ€

okay so bestie, gather round, because we're diving into the industrial I/O device opaque information struct, aka struct iio_dev_opaque β€” and honestly? it's giving "secret sauce that runs the whole vibe" energy. let's get into it ✨


✨ SYNOPSIS ✨

struct iio_dev_opaque {
    struct iio_dev                  indio_dev;
    int currentmode;
    int id;
    struct module                   *driver_module;
    struct mutex                    mlock;
    struct lock_class_key           mlock_key;
    struct mutex                    info_exist_lock;
    struct lock_class_key           info_exist_key;
    bool trig_readonly;
    struct iio_event_interface      *event_interface;
    struct iio_buffer               **attached_buffers;
    unsigned int                    attached_buffers_cnt;
    struct iio_ioctl_handler        *buffer_ioctl_handler;
    struct list_head                buffer_list;
    struct list_head                channel_attr_list;
    struct attribute_group          chan_attr_group;
    struct list_head                ioctl_handlers;
    const struct attribute_group    **groups;
    int groupcounter;
    struct attribute_group          legacy_scan_el_group;
    struct attribute_group          legacy_buffer_group;
    void *bounce_buffer;
    size_t bounce_buffer_size;
    unsigned int                    scan_index_timestamp;
    clockid_t clock_id;
    struct cdev                     chrdev;
    unsigned long                   flags;
  #if defined(CONFIG_DEBUG_FS);
    struct dentry                   *debugfs_dentry;
    unsigned int                    cached_reg_addr;
    char read_buf[20];
    unsigned int                    read_buf_len;
  #endif;
};

like, look at all those fields. it's a whole aesthetic. πŸ¦‹


🌸 Members 🌸

okay so this is the part where we go field by field, no skips, no cap. every single one matters. let's go πŸ”₯

  • indio_dev β€” the public industrial I/O device info. this is the part everyone gets to see, the main character if you will πŸ‘‘
  • currentmode β€” the operating mode it's in right now! drivers may eventually peek at this, but bestie, treat it as read-only β€” it's a core internal bit, iykyk πŸ’…
  • id β€” used to identify the device internally. the internal little name tag 🏷️
  • driver_module β€” used to make it harder to undercut users. yes, it's a whole protective vibe 🫢
  • mlock β€” a lock that stops simultaneous device state changes. no two things touching the state at once, periodt 🚫
  • mlock_key β€” the lockdep class for the iio_dev lock. very "sorted, organized, iconic" of it πŸŽ€
  • info_exist_lock β€” a lock to prevent use during removal. don't touch it while it's leaving, that's rude 😭
  • info_exist_key β€” the lockdep class for the info_exist lock. matching set, slay ✨
  • trig_readonly β€” marks the current trigger immutable. it's frozen, don't come for it 🧊
  • event_interface β€” the event chrdevs associated with interrupt lines. the interrupt-line besties 🌈
  • attached_buffers β€” an array of buffers statically attached by the driver. the pre-attached crew πŸ“
  • attached_buffers_cnt β€” how many buffers are in that statically attached array. the headcount, literally πŸ”’
  • buffer_ioctl_handler β€” the ioctl handler for this IIO device's buffer interface. its personal handler, obsessed πŸ’–
  • buffer_list β€” a list of all buffers currently attached. the group chat of buffers πŸ“‹
  • channel_attr_list β€” keeps track of automatically created channel attributes. the auto-tracker, so organized πŸ—‚οΈ
  • chan_attr_group β€” the group for all attrs in the base directory. base directory gang πŸ’œ
  • ioctl_handlers β€” ioctl handlers registered with the core handler. the registered ones, very official πŸŽ€
  • groups β€” attribute groups. just groups, simple and iconic 🌸
  • groupcounter β€” the index of the next attribute group. the "what's next" counter πŸ”’
  • legacy_scan_el_group β€” the attribute group for the legacy scan elements attribute group. legacy but still serving 🫢
  • legacy_buffer_group β€” the attribute group for the legacy buffer attributes group. also legacy, also iconic πŸ¦‹
  • bounce_buffer β€” for devices that call iio_push_to_buffers_with_ts_unaligned. that's the whole vibe, no notes ✨
  • bounce_buffer_size β€” the size of the currently allocated bounce buffer. how big the bounce is, bestie πŸ“
  • scan_index_timestamp β€” a cache of the index to the timestamp. cached so it's fast, we love efficiency ⚑
  • clock_id β€” the timestamping clock posix identifier. its posix ID, very official πŸ’…
  • chrdev β€” the associated character device. the char device bestie πŸ”Œ
  • flags β€” file ops related flags, including the busy flag. flags with a busy one in there, note it 🚩
  • debugfs_dentry β€” the device-specific debugfs dentry. debugfs but make it specific 🐞
  • cached_reg_addr β€” the cached register address for debugfs reads. cached for the reads πŸ“Œ
  • read_buf β€” the read buffer used for the initial reg read. the initial-read buffer, literally πŸ“–
  • read_buf_len β€” the data length in read_buf. how much is in the buffer πŸ”’

πŸ‘‘ SEE ALSO πŸ‘‘

okay so if you wanna go deeper (and you should, bestie), check out the kernel file ./include/linux/iio/iio-opaque.h β€” that's the source of truth, fr fr 🌟


and that's the whole thing! hope this made the opaque struct feel a little less opaque πŸ’– you're doing amazing, sweetie. go forth and read those headers πŸ¦‹

source: ./include/linux/iio · date: October 2026 · this has been your kernel struct explainer, signing off ✨

πŸ“¦ where this page comes from