diff options
Diffstat (limited to 'Documentation/filesystems/sysfs.txt')
-rw-r--r-- | Documentation/filesystems/sysfs.txt | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index 5d1335faec2d..f806e50aaa63 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt | |||
@@ -39,10 +39,12 @@ userspace. Top-level directories in sysfs represent the common | |||
39 | ancestors of object hierarchies; i.e. the subsystems the objects | 39 | ancestors of object hierarchies; i.e. the subsystems the objects |
40 | belong to. | 40 | belong to. |
41 | 41 | ||
42 | Sysfs internally stores the kobject that owns the directory in the | 42 | Sysfs internally stores a pointer to the kobject that implements a |
43 | ->d_fsdata pointer of the directory's dentry. This allows sysfs to do | 43 | directory in the sysfs_dirent object associated with the directory. In |
44 | reference counting directly on the kobject when the file is opened and | 44 | the past this kobject pointer has been used by sysfs to do reference |
45 | closed. | 45 | counting directly on the kobject whenever the file is opened or closed. |
46 | With the current sysfs implementation the kobject reference count is | ||
47 | only modified directly by the function sysfs_schedule_callback(). | ||
46 | 48 | ||
47 | 49 | ||
48 | Attributes | 50 | Attributes |
@@ -208,9 +210,9 @@ Other notes: | |||
208 | is 4096. | 210 | is 4096. |
209 | 211 | ||
210 | - show() methods should return the number of bytes printed into the | 212 | - show() methods should return the number of bytes printed into the |
211 | buffer. This is the return value of snprintf(). | 213 | buffer. This is the return value of scnprintf(). |
212 | 214 | ||
213 | - show() should always use snprintf(). | 215 | - show() should always use scnprintf(). |
214 | 216 | ||
215 | - store() should return the number of bytes used from the buffer. If the | 217 | - store() should return the number of bytes used from the buffer. If the |
216 | entire buffer has been used, just return the count argument. | 218 | entire buffer has been used, just return the count argument. |
@@ -229,7 +231,7 @@ A very simple (and naive) implementation of a device attribute is: | |||
229 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, | 231 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, |
230 | char *buf) | 232 | char *buf) |
231 | { | 233 | { |
232 | return snprintf(buf, PAGE_SIZE, "%s\n", dev->name); | 234 | return scnprintf(buf, PAGE_SIZE, "%s\n", dev->name); |
233 | } | 235 | } |
234 | 236 | ||
235 | static ssize_t store_name(struct device *dev, struct device_attribute *attr, | 237 | static ssize_t store_name(struct device *dev, struct device_attribute *attr, |