STRUCT VIRTIO_DRIVER(9)
π struct virtio_driver(9)
okay bestie, grab your iced coffee because we're diving into the Kernel API Manual β this is the struct virtio_driver page and it is literally the blueprint for how a virtio I/O driver behaves. no cap, this is the main character struct. π
β¨ NAME β¨
struct virtio_driver β the operations for a virtio I/O driver. that's it, that's the vibe. π¦
πΈ SYNOPSIS πΈ
here's the whole glow-up, verbatim, don't touch a single character:
struct virtio_driver {
struct device_driver driver;
const struct virtio_device_id *id_table;
const unsigned int *feature_table;
unsigned int feature_table_size;
const unsigned int *feature_table_legacy;
unsigned int feature_table_size_legacy;
int (*validate)(struct virtio_device *dev);
int (*probe)(struct virtio_device *dev);
void (*scan)(struct virtio_device *dev);
void (*remove)(struct virtio_device *dev);
void (*config_changed)(struct virtio_device *dev);
int (*freeze)(struct virtio_device *dev);
int (*restore)(struct virtio_device *dev);
int (*reset_prepare)(struct virtio_device *dev);
int (*reset_done)(struct virtio_device *dev);
void (*shutdown)(struct virtio_device *dev);
};
like, look at all those function pointers. she's got range. π
π«Ά Members (the whole friend group)
driverβ the underlying device driver. populatename, okay? that's her whole identity. β¨id_tableβ the ids serviced by this driver. this is the "who's allowed in the group chat" list. πfeature_tableβ an array of feature numbers supported by this driver.feature_table_sizeβ number of entries in the feature table array. yes, you gotta count them too, bestie. π’feature_table_legacyβ same asfeature_tablebut for when you're working in legacy mode. throwback era. π°οΈfeature_table_size_legacyβ number of entries in the feature table legacy array. count 'em again.validateβ the function to call to validate features and config space. Returns0or-errno. π§probeβ the function to call when a device is found. Returns0or-errno. this is the "omg new device just dropped" moment. π²scanβ optional function to call after successfulprobe; intended forvirtio-scsito invoke a scan. not required, but iconic when she shows up. βremoveβ the function to call when a device is removed. sad era, but it's gotta happen. πconfig_changedβ optional function to call when the device configuration changes; may be called in interrupt context. heads up: interrupt context, so act accordingly. β‘freezeβ optional function to call during suspend/hibernation. nap time. π€restoreβ optional function to call on resume. welcome back, queen. πreset_prepareβ optional function to call when a transport specific reset occurs.reset_doneβ optional function to call after the transport specific reset operation has finished. it's giving "after the reset party" energy. πshutdownβ synchronize with the device on shutdown. If provided, this replaces the virtio core implementation. so like, you're taking over β no pressure or anything. π
π SEE ALSO π
go look at the kernel file ./include/linux/virtio.h, plus these two besties: struct virtqueue(9), struct virtio_device(9). iykyk. π¦
fr fr, every single member listed above is part of the struct β don't skip the optional ones just because they're marked optional, the kernel does not care about your vibe check. π
and that's the whole page, bestie β from ./include/linux, dated October 2026, brought to you by the struct virtio_driver(9) girlies. slay, and remember: populate your name. periodt. ππβ¨
π¦ 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