diff options
| author | Randy Dunlap <randy.dunlap@oracle.com> | 2007-07-24 00:05:02 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-30 17:25:12 -0400 |
| commit | 30b1b28001fef09ea31b1c87e8e8acb962d109e2 (patch) | |
| tree | 790f0984bf042a557920b73b13c8a3c7e7a01af2 | |
| parent | 42e61f4adbf18c7b0218b91d32fd6ee1f978d82c (diff) | |
Fix Doc/sysfs-rules typos
Fix typos only (spelling, grammar, duplicate words, etc.).
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Kay Sievers <kay.sievers@vrfy.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | Documentation/sysfs-rules.txt | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt index 42861bb0bc9b..80ef562160bb 100644 --- a/Documentation/sysfs-rules.txt +++ b/Documentation/sysfs-rules.txt | |||
| @@ -1,19 +1,18 @@ | |||
| 1 | Rules on how to access information in the Linux kernel sysfs | 1 | Rules on how to access information in the Linux kernel sysfs |
| 2 | 2 | ||
| 3 | The kernel exported sysfs exports internal kernel implementation-details | 3 | The kernel-exported sysfs exports internal kernel implementation details |
| 4 | and depends on internal kernel structures and layout. It is agreed upon | 4 | and depends on internal kernel structures and layout. It is agreed upon |
| 5 | by the kernel developers that the Linux kernel does not provide a stable | 5 | by the kernel developers that the Linux kernel does not provide a stable |
| 6 | internal API. As sysfs is a direct export of kernel internal | 6 | internal API. As sysfs is a direct export of kernel internal |
| 7 | structures, the sysfs interface can not provide a stable interface eighter, | 7 | structures, the sysfs interface cannot provide a stable interface either; |
| 8 | it may always change along with internal kernel changes. | 8 | it may always change along with internal kernel changes. |
| 9 | 9 | ||
| 10 | To minimize the risk of breaking users of sysfs, which are in most cases | 10 | To minimize the risk of breaking users of sysfs, which are in most cases |
| 11 | low-level userspace applications, with a new kernel release, the users | 11 | low-level userspace applications, with a new kernel release, the users |
| 12 | of sysfs must follow some rules to use an as abstract-as-possible way to | 12 | of sysfs must follow some rules to use an as-abstract-as-possible way to |
| 13 | access this filesystem. The current udev and HAL programs already | 13 | access this filesystem. The current udev and HAL programs already |
| 14 | implement this and users are encouraged to plug, if possible, into the | 14 | implement this and users are encouraged to plug, if possible, into the |
| 15 | abstractions these programs provide instead of accessing sysfs | 15 | abstractions these programs provide instead of accessing sysfs directly. |
| 16 | directly. | ||
| 17 | 16 | ||
| 18 | But if you really do want or need to access sysfs directly, please follow | 17 | But if you really do want or need to access sysfs directly, please follow |
| 19 | the following rules and then your programs should work with future | 18 | the following rules and then your programs should work with future |
| @@ -25,22 +24,22 @@ versions of the sysfs interface. | |||
| 25 | implementation details in its own API. Therefore it is not better than | 24 | implementation details in its own API. Therefore it is not better than |
| 26 | reading directories and opening the files yourself. | 25 | reading directories and opening the files yourself. |
| 27 | Also, it is not actively maintained, in the sense of reflecting the | 26 | Also, it is not actively maintained, in the sense of reflecting the |
| 28 | current kernel-development. The goal of providing a stable interface | 27 | current kernel development. The goal of providing a stable interface |
| 29 | to sysfs has failed, it causes more problems, than it solves. It | 28 | to sysfs has failed; it causes more problems than it solves. It |
| 30 | violates many of the rules in this document. | 29 | violates many of the rules in this document. |
| 31 | 30 | ||
| 32 | - sysfs is always at /sys | 31 | - sysfs is always at /sys |
| 33 | Parsing /proc/mounts is a waste of time. Other mount points are a | 32 | Parsing /proc/mounts is a waste of time. Other mount points are a |
| 34 | system configuration bug you should not try to solve. For test cases, | 33 | system configuration bug you should not try to solve. For test cases, |
| 35 | possibly support a SYSFS_PATH environment variable to overwrite the | 34 | possibly support a SYSFS_PATH environment variable to overwrite the |
| 36 | applications behavior, but never try to search for sysfs. Never try | 35 | application's behavior, but never try to search for sysfs. Never try |
| 37 | to mount it, if you are not an early boot script. | 36 | to mount it, if you are not an early boot script. |
| 38 | 37 | ||
| 39 | - devices are only "devices" | 38 | - devices are only "devices" |
| 40 | There is no such thing like class-, bus-, physical devices, | 39 | There is no such thing like class-, bus-, physical devices, |
| 41 | interfaces, and such that you can rely on in userspace. Everything is | 40 | interfaces, and such that you can rely on in userspace. Everything is |
| 42 | just simply a "device". Class-, bus-, physical, ... types are just | 41 | just simply a "device". Class-, bus-, physical, ... types are just |
| 43 | kernel implementation details, which should not be expected by | 42 | kernel implementation details which should not be expected by |
| 44 | applications that look for devices in sysfs. | 43 | applications that look for devices in sysfs. |
| 45 | 44 | ||
| 46 | The properties of a device are: | 45 | The properties of a device are: |
| @@ -48,11 +47,11 @@ versions of the sysfs interface. | |||
| 48 | - identical to the DEVPATH value in the event sent from the kernel | 47 | - identical to the DEVPATH value in the event sent from the kernel |
| 49 | at device creation and removal | 48 | at device creation and removal |
| 50 | - the unique key to the device at that point in time | 49 | - the unique key to the device at that point in time |
| 51 | - the kernels path to the device-directory without the leading | 50 | - the kernel's path to the device directory without the leading |
| 52 | /sys, and always starting with with a slash | 51 | /sys, and always starting with with a slash |
| 53 | - all elements of a devpath must be real directories. Symlinks | 52 | - all elements of a devpath must be real directories. Symlinks |
| 54 | pointing to /sys/devices must always be resolved to their real | 53 | pointing to /sys/devices must always be resolved to their real |
| 55 | target, and the target path must be used to access the device. | 54 | target and the target path must be used to access the device. |
| 56 | That way the devpath to the device matches the devpath of the | 55 | That way the devpath to the device matches the devpath of the |
| 57 | kernel used at event time. | 56 | kernel used at event time. |
| 58 | - using or exposing symlink values as elements in a devpath string | 57 | - using or exposing symlink values as elements in a devpath string |
| @@ -73,17 +72,17 @@ versions of the sysfs interface. | |||
| 73 | link | 72 | link |
| 74 | - it is retrieved by reading the "driver"-link and using only the | 73 | - it is retrieved by reading the "driver"-link and using only the |
| 75 | last element of the target path | 74 | last element of the target path |
| 76 | - devices which do not have "driver"-link, just do not have a | 75 | - devices which do not have "driver"-link just do not have a |
| 77 | driver; copying the driver value in a child device context, is a | 76 | driver; copying the driver value in a child device context is a |
| 78 | bug in the application | 77 | bug in the application |
| 79 | 78 | ||
| 80 | o attributes | 79 | o attributes |
| 81 | - the files in the device directory or files below a subdirectories | 80 | - the files in the device directory or files below subdirectories |
| 82 | of the same device directory | 81 | of the same device directory |
| 83 | - accessing attributes reached by a symlink pointing to another device, | 82 | - accessing attributes reached by a symlink pointing to another device, |
| 84 | like the "device"-link, is a bug in the application | 83 | like the "device"-link, is a bug in the application |
| 85 | 84 | ||
| 86 | Everything else is just a kernel driver-core implementation detail, | 85 | Everything else is just a kernel driver-core implementation detail |
| 87 | that should not be assumed to be stable across kernel releases. | 86 | that should not be assumed to be stable across kernel releases. |
| 88 | 87 | ||
| 89 | - Properties of parent devices never belong into a child device. | 88 | - Properties of parent devices never belong into a child device. |
| @@ -91,25 +90,25 @@ versions of the sysfs interface. | |||
| 91 | context properties. If the device 'eth0' or 'sda' does not have a | 90 | context properties. If the device 'eth0' or 'sda' does not have a |
| 92 | "driver"-link, then this device does not have a driver. Its value is empty. | 91 | "driver"-link, then this device does not have a driver. Its value is empty. |
| 93 | Never copy any property of the parent-device into a child-device. Parent | 92 | Never copy any property of the parent-device into a child-device. Parent |
| 94 | device-properties may change dynamically without any notice to the | 93 | device properties may change dynamically without any notice to the |
| 95 | child device. | 94 | child device. |
| 96 | 95 | ||
| 97 | - Hierarchy in a single device-tree | 96 | - Hierarchy in a single device tree |
| 98 | There is only one valid place in sysfs where hierarchy can be examined | 97 | There is only one valid place in sysfs where hierarchy can be examined |
| 99 | and this is below: /sys/devices. | 98 | and this is below: /sys/devices. |
| 100 | It is planned, that all device directories will end up in the tree | 99 | It is planned that all device directories will end up in the tree |
| 101 | below this directory. | 100 | below this directory. |
| 102 | 101 | ||
| 103 | - Classification by subsystem | 102 | - Classification by subsystem |
| 104 | There are currently three places for classification of devices: | 103 | There are currently three places for classification of devices: |
| 105 | /sys/block, /sys/class and /sys/bus. It is planned that these will | 104 | /sys/block, /sys/class and /sys/bus. It is planned that these will |
| 106 | not contain any device-directories themselves, but only flat lists of | 105 | not contain any device directories themselves, but only flat lists of |
| 107 | symlinks pointing to the unified /sys/devices tree. | 106 | symlinks pointing to the unified /sys/devices tree. |
| 108 | All three places have completely different rules on how to access | 107 | All three places have completely different rules on how to access |
| 109 | device information. It is planned to merge all three | 108 | device information. It is planned to merge all three |
| 110 | classification-directories into one place at /sys/subsystem, | 109 | classification directories into one place at /sys/subsystem, |
| 111 | following the layout of the bus-directories. All buses and | 110 | following the layout of the bus directories. All buses and |
| 112 | classes, including the converted block-subsystem, will show up | 111 | classes, including the converted block subsystem, will show up |
| 113 | there. | 112 | there. |
| 114 | The devices belonging to a subsystem will create a symlink in the | 113 | The devices belonging to a subsystem will create a symlink in the |
| 115 | "devices" directory at /sys/subsystem/<name>/devices. | 114 | "devices" directory at /sys/subsystem/<name>/devices. |
| @@ -121,38 +120,38 @@ versions of the sysfs interface. | |||
| 121 | subsystem name. | 120 | subsystem name. |
| 122 | 121 | ||
| 123 | Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or | 122 | Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or |
| 124 | /sys/block and /sys/class/block are not interchangeable, is a bug in | 123 | /sys/block and /sys/class/block are not interchangeable is a bug in |
| 125 | the application. | 124 | the application. |
| 126 | 125 | ||
| 127 | - Block | 126 | - Block |
| 128 | The converted block-subsystem at /sys/class/block, or | 127 | The converted block subsystem at /sys/class/block or |
| 129 | /sys/subsystem/block will contain the links for disks and partitions | 128 | /sys/subsystem/block will contain the links for disks and partitions |
| 130 | at the same level, never in a hierarchy. Assuming the block-subsytem to | 129 | at the same level, never in a hierarchy. Assuming the block subsytem to |
| 131 | contain only disks and not partition-devices in the same flat list is | 130 | contain only disks and not partition devices in the same flat list is |
| 132 | a bug in the application. | 131 | a bug in the application. |
| 133 | 132 | ||
| 134 | - "device"-link and <subsystem>:<kernel name>-links | 133 | - "device"-link and <subsystem>:<kernel name>-links |
| 135 | Never depend on the "device"-link. The "device"-link is a workaround | 134 | Never depend on the "device"-link. The "device"-link is a workaround |
| 136 | for the old layout, where class-devices are not created in | 135 | for the old layout, where class devices are not created in |
| 137 | /sys/devices/ like the bus-devices. If the link-resolving of a | 136< | |
