mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
keventd: resolve $attr{} and %s{} through the parent chain
Attribute substitution only looked at the device's own sysfs directory,
while the matching key ATTRS{} walks parents. Devices without an
attribute of their own, partitions in particular whose serial lives in
the parent disk, therefore substituted to an empty string.
This commit is contained in:
3 files changed
+52
-7
No files matched your search
@@ -40,6 +40,15 @@ int sysfs_read_file(const char *path, char *buf, size_t len);
|
||||
int sysfs_read_attr(const char *devpath, const char *attr,
|
||||
char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Read a sysfs attribute for the device at /sys{devpath}, falling back
|
||||
* to the parent chain, partitions have no "serial" of their own, it
|
||||
* lives in the parent disk's sysfs directory.
|
||||
* Returns 0 on success, -1 if no level of the chain has the attribute.
|
||||
*/
|
||||
int sysfs_read_attr_chain(const char *devpath, const char *attr,
|
||||
char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Walk the sysfs device tree upward from devpath toward /sys/devices,
|
||||
* calling cb at each level. cb receives the absolute syspath and the
|
||||
|
||||
Reference in new issue
Block a user