STRUCT SUBSYS_PRIVATE(9)
β¨ struct subsys_private π (from the Kernel API Manual, bestie)
okay so likeβ¦ this page is literally about struct subsys_private, and yes it's exactly what it sounds like: it's the structure that holds all the private-to-the-driver-core bits of the bus_type/class structure. no cap, that's the whole vibe β¨
πΈ NAME πΈ
struct subsys_private β the structure that holds the private, driver-core-only portions of the bus_type/class structure. it's giving "backstage pass, not for public consumption" π
π¦ SYNOPSIS π¦
struct subsys_private {
struct kset subsys;
struct kset *devices_kset;
struct list_head interfaces;
struct mutex mutex;
struct kset *drivers_kset;
struct klist klist_devices;
struct klist klist_drivers;
struct blocking_notifier_head bus_notifier;
unsigned int drivers_autoprobe:1;
const struct bus_type *bus;
struct device *dev_root;
struct kset glue_dirs;
const struct class *class;
struct lock_class_key lock_key;
};
like, look at her. iconic. absolutely ate that struct definition π
π§ Members (the whole cast, no skips) π§
subsysβ thestruct ksetthat defines this subsystem. it's the main character of the whole operation tbh.devices_ksetβ the subsystem's'devices'directory. like, where the devices live πinterfacesβ the list of subsystem interfaces associated. lowkey just a list of who's hanging out here.mutexβ protects the devices and interfaces lists. do not skip the lock, bestie, fr fr πdrivers_ksetβ the list of drivers associated. the driver squad πklist_devicesβ theklistyou use to iterate over thedevices_kset. that's the whole job. iykyk.klist_driversβ theklistto iterate over thedrivers_kset. same energy, different list π«bus_notifierβ the bus notifier list, for anything that cares about things on this bus. and yes, some things really do care πdrivers_autoprobeβ the gate that decides whether new devices automatically get attached to registered drivers, or new drivers automatically attach to existing devices. it's literally aunsigned int drivers_autoprobe:1bitfield. one single bit running the whole show πbusβ pointer back to thestruct bus_typethat this structure is associated with. a little "take me home" pointer π«Άdev_rootβ the default device to use as the parent. every icon needs a parent, periodt.glue_dirsβ the"glue"directory that goes in-between the parent device so you avoid namespace conflicts. it's the buffer friend at the party πclassβ pointer back to thestruct classthat this structure is associated with. matching set withbus, obviously β¨lock_keyβ the lock class key, for use by the lock validator. very responsible of her ngl π
π Description π
so here's the tea: this structure is the one β it's the actual kobject that lets struct bus_type/class be statically allocated safely. that's the flex. π
β οΈ real talk: nothing outside of the driver core should ever touch these fields. not you, not your friend, not your friend's friend. hands off, bestie π
π SEE ALSO π
- Kernel file
./drivers/base/base.h struct device_private(9)β go read that one next, it's connected, trust π¦
and that's the page! π«Ά shoutout to ./drivers/base for hosting this one, this is the Kernel API Manual, dated October 2026, and this has been your girl explaining struct subsys_private(9) β stay safe, lock your mutexes, and don't touch driver-core fields π
β¨π
π¦ 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