[systemd-devel] libudev: subdirectories in sysfs
dh.herrmann at gmail.com
Tue Nov 17 07:48:19 PST 2015
On Mon, Nov 16, 2015 at 5:35 PM, Anne Mulhern <amulhern at redhat.com> wrote:
> libudev has some cooperating procedures that return the keys for a bunch of sysfs attributes for a given device.
> These attributes all correspond to files that are stored in the sysfs device directory.
> In the same directory there are sometimes subdirectories, that themselves contain files
> with information about their corresponding attribute. The dm directory is one obvious
> Are their any plans for libudev to add an ability to get the values from these subdirectories
> as some kind of attributes?
> If no, why?
sd_device_get_sysattr_value(device, "foo/bar/baz", &value);
This should work fine (or its udev_device_* equivalent).
Btw., I recommend just using readdir(), open(), read(), and write().
sysfs is a filesystem, no reason to wrap all those commands.
More information about the systemd-devel