STRUCT IIO_DEV_OPAQUE(9)
π 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 calliio_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 inread_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
- 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