Re: libudev, a question about the enumerate API.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 7, 2011 at 17:01, Alan Ott <alan@xxxxxxxxxxx> wrote:
> On 03/07/2011 10:27 AM, Kay Sievers wrote:
>>
>> The usual enumeration in udev never uses the device tree in
>> /sys/devices/, only the subsystem lists /sys/{class,bus}/. We could
>> have something to enumerate all child devices of a given device. It's
>> not simple, but could be made working.

> The documentation in Documentation/sysfs-rules.txt seems to warn against
> using /sys/class and sys/bus:
>
> - devices are only "devices"
> ÂThere is no such thing like class-, bus-, physical devices,
> Âinterfaces, and such that you can rely on in userspace. Everything is
> Âjust simply a "device". Class-, bus-, physical, ... types are just
> Âkernel implementation details which should not be expected by
> Âapplications that look for devices in sysfs.
>
> ...
> Â Â Â- all elements of a devpath must be real directories. Symlinks
> Â Â Â Âpointing to /sys/devices must always be resolved to their real
> Â Â Â Âtarget and the target path must be used to access the device.
> Â Â Â ÂThat way the devpath to the device matches the devpath of the
> Â Â Â Âkernel used at event time.
> Â Â Â- using or exposing symlink values as elements in a devpath string
> Â Â Â Âis a bug in the application
>
> ...
>
> Â Â Â- accessing attributes reached by a symlink pointing to another device,
> Â Â Â Âlike the "device"-link, is a bug in the application
>
> ...
>
> - 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.
>
> and more...
>
> I figured that this document was probably out of date, since even libudev
> uses /sys/class. What's your take on this document?

I wrote that document. :) It's partly out-of-date, but this is still true.

Udev, since quite some years, even the old and dead HAL supports
/sys/subsystem/ already, which is not in the kernel today, but might
be soon.

If that directory is available, /sys/{class,bus}/ will not be looked at:
  http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=libudev/libudev-enumerate.c;h=128813c7d618717690f79d0eca82776a6c4fa011;hb=HEAD#l776

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux