summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-09-11 16:10:16 +0200
committerJohn Crispin <blogic@openwrt.org>2013-09-13 17:36:59 +0200
commitd2d0268b167c6f2cca85aa45f757b436c58a747d (patch)
tree9a4857b3a5b546554dbd204a3da57c9029c54015
parent0a5f43565309fc6cad3d47fd6ad12dc368677d10 (diff)
downloadunitd-d2d0268b167c6f2cca85aa45f757b436c58a747d.tar
unitd-d2d0268b167c6f2cca85aa45f757b436c58a747d.zip
udevtrigger: simplify scan_block function
Remove the local directory scanning code and use the scan_subdir function instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-rw-r--r--udevtrigger.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/udevtrigger.c b/udevtrigger.c
index 08ddb06..423df6a 100644
--- a/udevtrigger.c
+++ b/udevtrigger.c
@@ -230,32 +230,10 @@ static void scan_subsystem(const char *subsys)
static void scan_block(void)
{
char base[PATH_SIZE];
- DIR *dir;
- struct dirent *dent;
strlcpy(base, "/sys/block", sizeof(base));
- dir = opendir(base);
- if (dir == NULL)
- return;
-
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- char dirname[PATH_SIZE];
-
- if (dent->d_name[0] == '.')
- continue;
-
- strlcpy(dirname, base, sizeof(dirname));
- strlcat(dirname, "/", sizeof(dirname));
- strlcat(dirname, dent->d_name, sizeof(dirname));
- if (device_list_insert(dirname) != 0)
- continue;
-
- /* look for partitions */
- scan_subdir(dirname, NULL, true, 0);
- }
-
- closedir(dir);
+ scan_subdir("/sys/block", NULL, true, 1);
}
static void scan_class(void)