summaryrefslogtreecommitdiff
path: root/udev_multiplex.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-03-17 09:59:32 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:53:53 -0700
commit67747e1de37158cd58782f432ccba8db55251592 (patch)
tree887efaf2b081dfe77d876c573e9cadfbbead41dc /udev_multiplex.c
parent7e3e23925b139075746c015eaffaba509d5eb304 (diff)
[PATCH] change call_foreach_file to return a list
Diffstat (limited to 'udev_multiplex.c')
-rw-r--r--udev_multiplex.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/udev_multiplex.c b/udev_multiplex.c
index 3ef6e1707a..9ab11e6bea 100644
--- a/udev_multiplex.c
+++ b/udev_multiplex.c
@@ -74,6 +74,8 @@ static int run_program(struct udevice *udev, const char *filename)
void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix)
{
char dirname[PATH_SIZE];
+ struct name_entry *name_loop, *name_tmp;
+ LIST_HEAD(name_list);
/* chop the device name up into pieces based on '/' */
if (udev->name[0] != '\0') {
@@ -89,7 +91,7 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c
if (strcmp(devname, udev->subsystem) != 0) {
snprintf(dirname, sizeof(dirname), "%s/%s", basedir, devname);
dirname[sizeof(dirname)-1] = '\0';
- call_foreach_file(run_program, udev, dirname, suffix);
+ add_matching_files(&name_list, dirname, suffix);
}
temp[0] = '/';
@@ -101,16 +103,22 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c
if (udev->name[0] != '\0') {
snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->name);
dirname[sizeof(dirname)-1] = '\0';
- call_foreach_file(run_program, udev, dirname, suffix);
+ add_matching_files(&name_list, dirname, suffix);
}
if (udev->subsystem[0] != '\0') {
snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->subsystem);
dirname[sizeof(dirname)-1] = '\0';
- call_foreach_file(run_program, udev, dirname, suffix);
+ add_matching_files(&name_list, dirname, suffix);
}
snprintf(dirname, sizeof(dirname), "%s/default", basedir);
dirname[sizeof(dirname)-1] = '\0';
- call_foreach_file(run_program, udev, dirname, suffix);
+ add_matching_files(&name_list, dirname, suffix);
+
+ list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) {
+ run_program(udev, name_loop->name);
+ list_del(&name_loop->node);
+ }
+
}