Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
eecd7569
Commit
eecd7569
authored
May 12, 2003
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kobject: Update Documentation
From Geert Uytterhoeven.
parent
185b8e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Documentation/kobject.txt
Documentation/kobject.txt
+12
-12
No files found.
Documentation/kobject.txt
View file @
eecd7569
...
@@ -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
k
type::release() (which the kobject's kset points to) is called. This
k
obj_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 Des
e
cription
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 object
s 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 the
ir
may be disparate sets of identical objects.
ksets, as the
re
may be disparate sets of identical objects.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment