A kobject controls access to a domain-specific object.
In object-oriented speach, a kobject is an abstract base class that specifies some capabilities which are then used by concrete users of these capabilities.
A kset is a list of kobject (whose type does not necessarily need to be equal for all members).
ksets are used to define the attribute callbacks and other common events that happen to a kobject.
Each directory in In sysfs directory that contains other directories usually corresponds to a kobject of the same kset.
struct kset {
struct list_head list; /* The list */
spinlock_t list_lock; /* Lock for iterating over the kobjects */
struct kobject kobj; /* The embedded kobect for this kset */
const struct kset_uevent_ops *uevent_ops;/* The set of uevent operations for this kset */
} __randomize_layout;
The operations in kset_uevent_ops are called whenever a kobject has something happen to it so that the kset can add new environment variables or filter out the uevents if so desired.
struct kset_uevent_ops
struct kset_uevent_ops {
int (* const filter)(const struct kobject *kobj);
const char *(* const name )(const struct kobject *kobj);
int (* const uevent)(const struct kobject *kobj, struct kobj_uevent_env *env);
};