On Thu, Mar 3, 2011 at 10:17, Thomas Egerer <thomas.egerer@xxxxxxxxxxx> wrote: First, the patch seems line-wrapped. > I recently took part in writing an application using libudev to retrieve > information on devices present on a linux system. It became evident that > apparently there is no way to retrieve all possible sysfs attributes for a > particular device (the same way it is possible to get all of its properties). Keep in mind, that if you are root, you can do really nasty things if you open/read binary files. Sysfs is not meant to be used to blindly open "random" files. Think of it as device ioctl()s -- nobody would expect to just issue all numbers to a device, to check what comes back :) Things can go very wrong here. It is actually the reason libudev does not support anything like this. People must exactly know what they want to read, and need to be very careful here, unlike it it with udev properties managed by udev. If this is about a generic device browser, you would need to make sure nobody does weird things with it. > The matter kept nagging me -- even though we worked our way around this using > sysfs directly -- and I decided to add a udev_device_get_sysattr_list_entry. I don't mind in general to have such a list. But we need to think about the above first, if that is really stuff we should offer. > For > this matter the behavior of udev_device_get_sysattr_value had to be modified (a > little): on first access of any sysattr, it create an list including _all_ > sysfs-attributes as name (with an empty value, except for the symlinks). The > values are cached as soon as thery're requested. Negative entries do not exist > anymore. The same code is used by udevd. For performance reasons, we can not afford to call readdir() for every device we look at. We don't want to cache anything which we don't need. Thanks, 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