Re: Rules on how to use sysfs in userspace programs

Jan Engelhardt
2007-06-09T07:43:14Z

On Jun 8 2007 13:36, Greg KH wrote:
>
>Any comments or critique of this is greatly appreciated.
>
>------------------------------------
>
>Rules to access device-information in the Linux kernel sysfs
>
>The kernel exported sysfs exports internal kernel implementation-details
>and depends on internal kernel-structures and layout. It is agreed upon
>kernel developers, that the Linux kernel does not provide a stable
>internal API. As sysfs is a direct export of kernel internal
>structures, the sysfs interface can't provide a stable interface too, it
>may always change along with internal kernel changes.

Perhaps use the full writing form of "can't", "don't", etc. for,
well, written text?

>- Hierarchy in a single device-tree
> There is only one valid place in sysfs where hierarchy can be examined
> and this is below: /sys/devices.
> It is planned, the all device directories will end up in the tree
It is planned that all ...
> below this directory.
>
>- Classification by subsystem
> There are currently three places for classification of devices:
> /sys/block, /sys/class and /sys/bus. It is planned, that these will

No commas before "that".

> not contain any device-directories themselves, but only flat lists of
> symlinks pointing to the unified /sys/devices tree.
>
> All three places have completely different rules to access the
> information. It is planned to merge all three
> classification-directories into one place at /sys/subsystem/,

What about this future plan? If it is not going in soon or so, the paragraph
should probably be left out.

> following the current layout of the bus-directories. All buses and
> classes, including the converted block-subsystemm, will show up
> there.
> The devices of a subsystem will create a symlink in the "devices"
> directory at /sys/subsystem/<name>/devices/.
>
> It is planned to remove all these links when when all class-device
> directories live in /sys/devices.
>

Jan
--