STRUCT VIRTIO_DRIVER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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. populate name, 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 as feature_table but 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. Returns 0 or -errno. 🧚
  • probe β€” the function to call when a device is found. Returns 0 or -errno. this is the "omg new device just dropped" moment. πŸ“²
  • scan β€” optional function to call after successful probe; intended for virtio-scsi to 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