Lines Matching refs:the

1 Rules on how to access information in the Linux kernel sysfs
5 by the kernel developers that the Linux kernel does not provide a stable
6 internal API. Therefore, there are aspects of the sysfs interface that
9 To minimize the risk of breaking users of sysfs, which are in most cases
10 low-level userspace applications, with a new kernel release, the users
13 implement this and users are encouraged to plug, if possible, into the
17 the following rules and then your programs should work with future
18 versions of the sysfs interface.
22 offer any abstraction, it exposes all the kernel driver-core
24 reading directories and opening the files yourself.
25 Also, it is not actively maintained, in the sense of reflecting the
28 violates many of the rules in this document.
33 possibly support a SYSFS_PATH environment variable to overwrite the
46 - identical to the DEVPATH value in the event sent from the kernel
48 - the unique key to the device at that point in time
49 - the kernel's path to the device directory without the leading
53 target and the target path must be used to access the device.
54 That way the devpath to the device matches the devpath of the
57 is a bug in the application
60 - a directory name, identical to the last element of the devpath
62 the name
66 - retrieved by reading the "subsystem"-link and using only the
67 last element of the target path
72 - it is retrieved by reading the "driver"-link and using only the
73 last element of the target path
75 driver; copying the driver value in a child device context is a
76 bug in the application
79 - the files in the device directory or files below subdirectories
80 of the same device directory
82 like the "device"-link, is a bug in the application
88 Always look at the parent devices themselves for determining device
89 context properties. If the device 'eth0' or 'sda' does not have a
91 Never copy any property of the parent-device into a child-device. Parent
92 device properties may change dynamically without any notice to the
98 It is planned that all device directories will end up in the tree
105 symlinks pointing to the unified /sys/devices tree.
109 following the layout of the bus directories. All buses and
110 classes, including the converted block subsystem, will show up
112 The devices belonging to a subsystem will create a symlink in the
117 places, as the kernel is free to move a subsystem from one place to
118 the other, as long as the devices are still reachable by the same
123 the application.
127 /sys/subsystem/block will contain the links for disks and partitions
128 at the same level, never in a hierarchy. Assuming the block subsystem to
129 contain only disks and not partition devices in the same flat list is
130 a bug in the application.
133 Never depend on the "device"-link. The "device"-link is a workaround
134 for the old layout, where class devices are not created in
135 /sys/devices/ like the bus devices. If the link-resolving of a
136 device directory does not end in /sys/devices/, you can use the
137 "device"-link to find the parent devices in /sys/devices/. That is the
138 single valid use of the "device"-link; it must never appear in any
139 path as an element. Assuming the existence of the "device"-link for
140 a device in /sys/devices/ is a bug in the application.
141 Accessing /sys/class/net/eth0/device is a bug in the application.
143 Never depend on the class-specific links back to the /sys/class
144 directory. These links are also a workaround for the design mistake
147 may be used to find the child devices in /sys/class. That is the single
149 element. Assuming the existence of these links for devices which are
150 real child device directories in the /sys/devices tree is a bug in
151 the application.
157 Never depend on a specific parent device position in the devpath,
158 or the chain of parent devices. The kernel is free to insert devices into
159 the chain. You must always request the parent device you are looking for
160 by its subsystem value. You need to walk up the chain until you find
161 the device that matches the expected subsystem. Depending on a specific
163 access the chain of parents is a bug in the application.
167 the error handling implementation within the kernel.
174 the sysfs system itself if the read or store pointer is NULL.
179 to error codes result in user-space breakage, it will be fixed, or the
180 the offending change will be reverted.
182 Userspace applications can, however, expect the format and contents of
183 the attribute files to remain consistent in the absence of a version
184 attribute change in the context of a given attribute.