Commit eecd7569 authored by Patrick Mochel's avatar Patrick Mochel

kobject: Update Documentation

From Geert Uytterhoeven.
parent 185b8e24
...@@ -9,7 +9,7 @@ Patrick Mochel <mochel@osdl.org> ...@@ -9,7 +9,7 @@ Patrick Mochel <mochel@osdl.org>
The kobject infrastructure performs basic object management that larger The kobject infrastructure performs basic object management that larger
data structures and subsystems can leverage, rather than reimplement data structures and subsystems can leverage, rather than reimplement
similar functionality. This functionality consists primarily concerns: similar functionality. This functionality primarily concerns:
- Object reference counting. - Object reference counting.
- Maintaining lists (sets) of objects. - Maintaining lists (sets) of objects.
...@@ -45,7 +45,7 @@ and allows kobjects and ksets to be used without being registered ...@@ -45,7 +45,7 @@ and allows kobjects and ksets to be used without being registered
struct kobject is a simple data type that provides a foundation for struct kobject is a simple data type that provides a foundation for
more complex object types. It provides a set of basic fields that more complex object types. It provides a set of basic fields that
almost all complex data types share. kobjects are intended to be almost all complex data types share. kobjects are intended to be
embedded in larger data structures and replace fields it duplicates. embedded in larger data structures and replace fields they duplicate.
1.2 Defintion 1.2 Defintion
...@@ -77,7 +77,7 @@ using kobject_register() and kobject_unregister(). Registration ...@@ -77,7 +77,7 @@ using kobject_register() and kobject_unregister(). Registration
includes inserting the kobject in the list of its dominant kset and includes inserting the kobject in the list of its dominant kset and
creating a directory for it in sysfs. creating a directory for it in sysfs.
Alternatively, one may use a kobject without adding to its kset's list Alternatively, one may use a kobject without adding it to its kset's list
or exporting it via sysfs, by simply calling kobject_init(). An or exporting it via sysfs, by simply calling kobject_init(). An
initialized kobject may later be added to the object hierarchy by initialized kobject may later be added to the object hierarchy by
calling kobject_add(). An initialized kobject may be used for calling kobject_add(). An initialized kobject may be used for
...@@ -87,8 +87,8 @@ Note: calling kobject_init(), then kobject_add() is functionally ...@@ -87,8 +87,8 @@ Note: calling kobject_init(), then kobject_add() is functionally
equivalent to calling kobject_register(). equivalent to calling kobject_register().
When a kobject is unregistered, it is removed from its kset's list, When a kobject is unregistered, it is removed from its kset's list,
removed from the sysfs filesystem, and its reference decremented. List removed from the sysfs filesystem, and its reference count is decremented.
and sysfs removal happen in kobject_del(), and may be called List and sysfs removal happen in kobject_del(), and may be called
manually. kobject_put() decrements the reference count, and may also manually. kobject_put() decrements the reference count, and may also
be called manually. be called manually.
...@@ -98,8 +98,8 @@ kobject_put(). An object's reference count may only be incremented if ...@@ -98,8 +98,8 @@ kobject_put(). An object's reference count may only be incremented if
it is already positive. it is already positive.
When a kobject's reference count reaches 0, the method struct When a kobject's reference count reaches 0, the method struct
ktype::release() (which the kobject's kset points to) is called. This kobj_type::release() (which the kobject's kset points to) is called.
allows any memory allocated for the object to be freed. This allows any memory allocated for the object to be freed.
1.4 sysfs 1.4 sysfs
...@@ -118,7 +118,7 @@ happen for kobjects that are embedded in a struct subsystem. ...@@ -118,7 +118,7 @@ happen for kobjects that are embedded in a struct subsystem.
2. ksets 2. ksets
2.1 Desecription 2.1 Description
A kset is a set of kobjects that are embedded in the same type. A kset is a set of kobjects that are embedded in the same type.
...@@ -163,9 +163,9 @@ following code snippet illustrates how to properly express this. ...@@ -163,9 +163,9 @@ following code snippet illustrates how to properly express this.
kset_register(&disk->kset); kset_register(&disk->kset);
- The kset that the disk's embedded object belongs to is the - The kset that the disk's embedded object belongs to is the
block_kset, and is pointed to disk->kset.kobj.kset. block_kset, and is pointed to by disk->kset.kobj.kset.
- The type of object of the disk's _subordinate_ list are partitions, - The type of objects on the disk's _subordinate_ list are partitions,
and is set in disk->kset.ktype. and is set in disk->kset.ktype.
- The kset is then registered, which handles initializing and adding - The kset is then registered, which handles initializing and adding
...@@ -218,13 +218,13 @@ the object-specific fields, which include: ...@@ -218,13 +218,13 @@ the object-specific fields, which include:
- sysfs_ops: Provides conversion functions for sysfs access. Please - sysfs_ops: Provides conversion functions for sysfs access. Please
see the sysfs documentation for more information. see the sysfs documentation for more information.
- default_attrs: Default attributes to exported via sysfs when the - default_attrs: Default attributes to be exported via sysfs when the
object is registered. object is registered.
Instances of struct kobj_type are not registered; only referenced by Instances of struct kobj_type are not registered; only referenced by
the kset. A kobj_type may be referenced by an arbitrary number of the kset. A kobj_type may be referenced by an arbitrary number of
ksets, as their may be disparate sets of identical objects. ksets, as there may be disparate sets of identical objects.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment