diff options
| author | Patrick Mochel <mochel@osdl.org> | 2003-01-04 00:06:27 -0600 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2003-01-04 00:06:27 -0600 |
| commit | 23066070bb05cdf6fc94af43ca8f444bc293f93e (patch) | |
| tree | a322b17406a1c0191edb143c86593ba71dee9661 /include/linux/kobject.h | |
| parent | 509b39b15356d2cebf7ed9e709561eb7c5a59759 (diff) | |
kobject: Introduce struct kobj_type.
This is the first step in morphing struct subsystem into something meaningful.
A subsystem is defined simply as a list of kobjects of a certain type, which
is far too generic. A subsystem should be representative of a large entity
of code (i.e. a subsystem of the kernel), not just a simple list.
This changeset:
- Creates struct kobj_type, a descriptor of the type a kobject is embedded
in.
- Extracts the fields that are specific to a particular object type from
struct subsystem and puts them in struct kobj_type, which are
- the object's release method.
- the sysfs operations for the object type.
- the default attributes of the object type.
- Adds ptr to struct kobject to point to its type descriptor.
- Converts the existing subsystem definitions to define struct kobj_type.
struct kobj_type's are not registered, as they do not have any explicit
representation in the object hierarchy, nor do they have any fields that
need runtime initialization.
A kobject's ktype should be set when it is registered, like its subsystem.
Note this obviates the need for defining a struct subsystem when an object
type does not need to be kept in a global list.
Diffstat (limited to 'include/linux/kobject.h')
| -rw-r--r-- | include/linux/kobject.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 8a44ef867b35..e7a3f29135ff 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -20,6 +20,7 @@ struct kobject { struct list_head entry; struct kobject * parent; struct subsystem * subsys; + struct kobj_type * ktype; struct dentry * dentry; }; @@ -36,14 +37,17 @@ extern struct kobject * kobject_get(struct kobject *); extern void kobject_put(struct kobject *); +struct kobj_type { + void (*release)(struct kobject *); + struct sysfs_ops * sysfs_ops; + struct attribute ** default_attrs; +}; + struct subsystem { struct kobject kobj; struct list_head list; struct rw_semaphore rwsem; struct subsystem * parent; - void (*release)(struct kobject *); - struct sysfs_ops * sysfs_ops; - struct attribute ** default_attrs; }; extern void subsystem_init(struct subsystem *); |
