summaryrefslogtreecommitdiffstats
path: root/udevtrigger.c
AgeCommit message (Collapse)Author
2013-09-13udevtrigger: nuke scan_{subdir,class,block} functionsGabor Juhos
These functions are simple wrappers around the 'scan_subdir' function. Remove the wrapper code and use the 'scan_subdir' function directly instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: simplify scan_class functionGabor Juhos
Remove the local directory scanning code and use the scan_subdir function instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: simplify scan_block functionGabor Juhos
Remove the local directory scanning code and use the scan_subdir function instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: simplify scan_subsystem functionGabor Juhos
Remove the local directory scanning code and use the scan_subdir function instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: extend scan_subdir functionGabor Juhos
Add more arguments to the function to make it usable recursively. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: remove superfluous strlcpyGabor Juhos
Use the "/sys/class/block" string directly for the stat call. This makes the code simpler and reduces stack usage. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-13udevtrigger: add back directory name check into scan_subdirGabor Juhos
It has been accidentally removed by: commit 824a4b3da2c0be19ccf54a48dcd4c10677b82c1a Author: Gabor Juhos <juhosg@openwrt.org> Date: Tue Sep 10 12:59:25 2013 +0200 udevtrigger: reduce indent level in scan_* functions Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-10udevtrigger: reduce indent level in scan_* functionsGabor Juhos
Return early from the scan_* functions if the opendir call fails. This allows to reduce the indentation level of the subsequent code by one tab. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-10udevtrigger: rename variables in scan_subdirGabor Juhos
There are only one variable present for a given type. Remove the '2' suffix from the variable names. Also rename the function argument to avoid name collision. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-10udevtrigger: use a helper function for subdir scanningGabor Juhos
The scan_{block,class,subsystem} functions are using identical code for scanning. Move that into a separate function to avoid code duplication. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-10udevtrigger: check presence of dev attributeGabor Juhos
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>
2013-09-10udevtrigger: add device_has_attribute helperGabor Juhos
Move the code from device_list_insert() into a separate function. This makes it possible to reuse the code for other attribute files. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-09-10udevtrigger: remove trailing whitespacesGabor Juhos
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2013-03-13add udevtrigger toolJohn Crispin