diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-09-10 12:59:22 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-09-10 13:25:35 +0200 |
commit | e6021a8a34e39328ffc867141da03c19da9b2aec (patch) | |
tree | f3642aaf16819dae148ca9e7f45bade6f4d466fb | |
parent | 070bb98651b7e38d953eeffc5b0435e909e603b9 (diff) | |
download | unitd-e6021a8a34e39328ffc867141da03c19da9b2aec.tar unitd-e6021a8a34e39328ffc867141da03c19da9b2aec.zip |
udevtrigger: check presence of dev attribute
The presence of the 'uevent' attribute file
does not always mean that a corresponding
device node can be created under '/dev'.
For valid device nodes, a 'dev' attribute
file must be present which cntains the major
and minor numbers of the device.
Modify the code to check the presence of the
dev attribute as well. This allows to avoid
superfluous trigger_uevent calls. On a test
system, the patch reduced the number of the
triegger_uevent calls from 144 to 70.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-rw-r--r-- | udevtrigger.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/udevtrigger.c b/udevtrigger.c index c5628bd..af620c2 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -161,8 +161,9 @@ static int device_list_insert(const char *path) dbg("add '%s'" , path); - /* we only have a device, if we have an uevent file */ - if (!device_has_attribute(path, "/uevent", S_IWUSR)) + /* we only have a device, if we have a dev and an uevent file */ + if (!device_has_attribute(path, "/dev", S_IRUSR) || + !device_has_attribute(path, "/uevent", S_IWUSR)) return -1; strlcpy(devpath, &path[4], sizeof(devpath)); |