udevtrigger: nuke scan_{subdir,class,block} functions
authorGabor Juhos <juhosg@openwrt.org>
Wed, 11 Sep 2013 14:10:18 +0000 (16:10 +0200)
committerJohn Crispin <blogic@openwrt.org>
Fri, 13 Sep 2013 15:36:59 +0000 (17:36 +0200)
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>
udevtrigger.c

index 2fb0e68dab62d1239210b6428c466b666110de5c..5013189530a1741b8bfd8f3c9db85085124477f8 100644 (file)
@@ -217,34 +217,6 @@ static void scan_subdir(const char *base, const char *subdir,
        closedir(dir);
 }
 
-static void scan_subsystem(const char *subsys)
-{
-       char base[PATH_SIZE];
-
-       strlcpy(base, "/sys/", sizeof(base));
-       strlcat(base, subsys, sizeof(base));
-
-       scan_subdir(base, "/devices", false, 1);
-}
-
-static void scan_block(void)
-{
-       char base[PATH_SIZE];
-
-       strlcpy(base, "/sys/block", sizeof(base));
-
-       scan_subdir("/sys/block", NULL, true, 1);
-}
-
-static void scan_class(void)
-{
-       char base[PATH_SIZE];
-
-       strlcpy(base, "/sys/class", sizeof(base));
-
-       scan_subdir("/sys/class", NULL, false, 1);
-}
-
 int main(int argc, char *argv[], char *envp[])
 {
        struct stat statbuf;
@@ -278,12 +250,12 @@ int main(int argc, char *argv[], char *envp[])
 
 
        /* if we have /sys/subsystem, forget all the old stuff */
-       scan_subsystem("bus");
-       scan_class();
+       scan_subdir("/sys/bus", "/devices", false, 1);
+       scan_subdir("/sys/class", NULL, false, 1);
 
        /* scan "block" if it isn't a "class" */
        if (stat("/sys/class/block", &statbuf) != 0)
-               scan_block();
+               scan_subdir("/sys/block", NULL, true, 1);
 
 exit: