Team LiB
Previous Section Next Section

ksets

ksets aggregate collections of kobjects. ksets work as the base container class for a set of objects, collecting related kobjects, such as "all block devices," together in a single place. ksets may sound very similar to ktypes and beg the question, "Why have both?" Although ksets collect kobjects into a set, ktypes describe properties shared by kobjects of a related type. The distinction is kept to allow kobjects of identical ktypes to be grouped into different ksets.

The kset pointer points at a kobject's associated kset. ksets are represented by the kset structure, which is defined in <linux/kobject.h>:

struct kset {
        struct subsystem         *subsys;
        struct kobj_type         *ktype;
        struct list_head         list;
        struct kobject           kobj;
        struct kset_hotplug_ops  *hotplug_ops;
};

The ktype pointer points to the ktype for the kobjects in this kset, list is a linked list of all kobjects in this kset, kobj is a kobject representing the base class for this set, and hotplug_ops points to a structure that describes the hotplug behavior of kobjects in this kset.

Finally, the subsys pointer points to the struct subsystem associated with this kset.

    Team LiB
    Previous Section Next Section