STRUCT MDEV_DRIVER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct mdev_driver(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– we're talking about struct mdev_driver β€” that's the Mediated device driver bestie, yes ma'am, the whole vibe πŸŽ€


🌸 NAME 🌸

struct mdev_driver β€” Mediated device driver πŸ’…


✨ SYNOPSIS ✨

struct mdev_driver {
    const char *device_api;
    unsigned int max_instances;
    int (*probe)(struct mdev_device *dev);
    void (*remove)(struct mdev_device *dev);
    unsigned int (*get_available)(struct mdev_type *mtype);
    ssize_t (*show_description)(struct mdev_type *mtype, char *buf);
    struct device_driver driver;
 };

look at that struct. it's giving organized. iconic honestly πŸ¦‹


πŸŽ€ Members πŸŽ€

  • device_api β€” the string that gets returned for the device_api sysfs 🫢 literally just the string, that's her whole job, and she ate.
  • max_instances β€” the maximum number of instances supported. this one's optional btw, no pressure ✨
  • probe β€” called when a new device is created 🌱 like the moment the new device shows up, this gets the call.
  • remove β€” called when the device is removed 😭 bye bestie, this is your goodbye moment.
  • get_available β€” returns the max number of instances that can be created πŸ”’ yes it's asking "how many can we make", and this gives the answer, periodt.
  • show_description β€” prints a description of the mtype πŸŽ€ like it's doing a little intro for the mtype, slay.
  • driver β€” the device driver structure πŸ’€ the main character of the struct tbh, lowkey the whole foundation.

🌈 SEE ALSO 🌈

Kernel file ./include/linux/mdev.h πŸ‘‘ go read it, iykyk.


and that's a wrap bestie πŸ§šπŸ’œ this little gem lives over in ./include/linux, dated October 2026 β€” so yeah, mark your calendars and go forth and mediate those devices fr fr πŸ“πŸŒΈ

πŸ“¦ where this page comes from