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
nexedi
linux
Commits
30acfaa4
Commit
30acfaa4
authored
Sep 05, 2003
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sysfs/kobject] Update documentation.
From Randy Dunlap.
parent
b930a21e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
Documentation/filesystems/sysfs.txt
Documentation/filesystems/sysfs.txt
+3
-3
Documentation/kobject.txt
Documentation/kobject.txt
+10
-10
No files found.
Documentation/filesystems/sysfs.txt
View file @
30acfaa4
...
@@ -116,7 +116,7 @@ static struct device_attribute dev_attr_foo = {
...
@@ -116,7 +116,7 @@ static struct device_attribute dev_attr_foo = {
Subsystem-Specific Callbacks
Subsystem-Specific Callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When a subsystem defines a new attribute type,
they
must implement a
When a subsystem defines a new attribute type,
it
must implement a
set of sysfs operations for forwarding read and write calls to the
set of sysfs operations for forwarding read and write calls to the
show and store methods of the attribute owners.
show and store methods of the attribute owners.
...
@@ -204,7 +204,7 @@ Other notes:
...
@@ -204,7 +204,7 @@ Other notes:
can be done using strlen().
can be done using strlen().
- show() or store() can always return errors. If a bad value comes
- show() or store() can always return errors. If a bad value comes
through, be sure
and
return an error.
through, be sure
to
return an error.
- The object passed to the methods will be pinned in memory via sysfs
- The object passed to the methods will be pinned in memory via sysfs
referencing counting its embedded object. However, the physical
referencing counting its embedded object. However, the physical
...
@@ -229,7 +229,7 @@ static DEVICE_ATTR(name,S_IRUGO,show_name,store_name);
...
@@ -229,7 +229,7 @@ static DEVICE_ATTR(name,S_IRUGO,show_name,store_name);
(Note that the real implementation doesn't allow userspace to set the
(Note that the real implementation doesn't allow userspace to set the
name for a device
).
name for a device
.)
Top Level Directory Layout
Top Level Directory Layout
...
...
Documentation/kobject.txt
View file @
30acfaa4
...
@@ -87,7 +87,7 @@ initialized kobject may later be added to the object hierarchy by
...
@@ -87,7 +87,7 @@ 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
reference counting.
reference counting.
Note: calling kobject_init()
,
then kobject_add() is functionally
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,
...
@@ -108,10 +108,10 @@ This allows any memory allocated for the object to be freed.
...
@@ -108,10 +108,10 @@ This allows any memory allocated for the object to be freed.
NOTE!!!
NOTE!!!
It is _imperative_ that you supply a des
c
tructor for dynamically
It is _imperative_ that you supply a destructor for dynamically
allocated kobjects to free them if you are using kobject reference
allocated kobjects to free them if you are using kobject reference
counts. The reference count controls the
duration of the lifetime of
counts. The reference count controls the
lifetime of the object.
the object. If it goes to 0, then it is assumed that the object
will
If it goes to 0, then it is assumed that the object
will
be freed and cannot be used.
be freed and cannot be used.
More importantly, you must free the object there, and not immediately
More importantly, you must free the object there, and not immediately
...
@@ -169,7 +169,7 @@ struct kobject * kset_find_obj(struct kset *, char *);
...
@@ -169,7 +169,7 @@ struct kobject * kset_find_obj(struct kset *, char *);
The type that the kobjects are embedded in is described by the ktype
The type that the kobjects are embedded in is described by the ktype
pointer. The subsystem that the kobject belongs to is pointed to by
pointer. The subsystem that the kobject belongs to is pointed to by
the
subsys pointer.
subsys pointer.
A kset contains a kobject itself, meaning that it may be registered in
A kset contains a kobject itself, meaning that it may be registered in
...
@@ -180,7 +180,7 @@ kset (of that object type).
...
@@ -180,7 +180,7 @@ kset (of that object type).
For example, a block device is an object (struct gendisk) that is
For example, a block device is an object (struct gendisk) that is
contained in a set of block devices. It may also contain a set of
contained in a set of block devices. It may also contain a set of
partitions (struct hd_struct) that have been found on the device. The
partitions (struct hd_struct) that have been found on the device. The
following code snippet illustrates how to
properly express this
.
following code snippet illustrates how to
express this properly
.
struct gendisk * disk;
struct gendisk * disk;
...
...
...
@@ -215,7 +215,7 @@ name. The kobject, if found, is returned.
...
@@ -215,7 +215,7 @@ name. The kobject, if found, is returned.
ksets are represented in sysfs when their embedded kobjects are
ksets are represented in sysfs when their embedded kobjects are
registered. They follow the same rules of parenting, with one
registered. They follow the same rules of parenting, with one
exception. If a kset does not have a parent, nor is its embedded
exception. If a kset does not have a parent, nor is its embedded
kobject part of another kset, the kset's parent becomes it
'
s dominant
kobject part of another kset, the kset's parent becomes its dominant
subsystem.
subsystem.
If the kset does not have a parent, its directory is created at the
If the kset does not have a parent, its directory is created at the
...
@@ -262,7 +262,7 @@ ksets, as there may be disparate sets of identical objects.
...
@@ -262,7 +262,7 @@ ksets, as there may be disparate sets of identical objects.
A subsystem represents a significant entity of code that maintains an
A subsystem represents a significant entity of code that maintains an
arbitrary number of sets of objects of various types. Since the number
arbitrary number of sets of objects of various types. Since the number
of ksets
, and the type of objects they contain,
are variable, a
of ksets
and the type of objects they contain
are variable, a
generic representation of a subsystem is minimal.
generic representation of a subsystem is minimal.
...
@@ -294,7 +294,7 @@ All ksets that are attached to a subsystem share the subsystem's R/W
...
@@ -294,7 +294,7 @@ All ksets that are attached to a subsystem share the subsystem's R/W
semaphore.
semaphore.
4.2 Programming Interface.
4.2
subsystem
Programming Interface.
The subsystem programming interface is simple and does not offer the
The subsystem programming interface is simple and does not offer the
flexibility that the kset and kobject programming interfaces do. They
flexibility that the kset and kobject programming interfaces do. They
...
@@ -305,7 +305,7 @@ calls to their embedded kobjects).
...
@@ -305,7 +305,7 @@ calls to their embedded kobjects).
4.3 Helpers
4.3 Helpers
A number of macros are available to make dealing with subsystems
,
and
A number of macros are available to make dealing with subsystems and
their embedded objects easier.
their embedded objects easier.
...
...
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