summaryrefslogtreecommitdiff
path: root/udev.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-07-05 15:24:41 +0200
committerKay Sievers <kay.sievers@suse.de>2005-07-05 15:24:41 +0200
commit8bd41f36f793f7fc208ef6beb4b2b84e35a5e728 (patch)
treed2a8d9f3ad291cf9f341cc87d87be80f435cfc30 /udev.c
parent6369839195d7572151d986ddc2050162e6879585 (diff)
pack parsed rules list
This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory or file-size with precompiled rules. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev.c')
-rw-r--r--udev.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/udev.c b/udev.c
index 1c55ec14b8..7a0484472a 100644
--- a/udev.c
+++ b/udev.c
@@ -68,6 +68,7 @@ static void asmlinkage sig_handler(int signum)
int main(int argc, char *argv[], char *envp[])
{
struct udevice udev;
+ struct udev_rules rules;
char path[PATH_SIZE];
const char *error;
const char *action;
@@ -118,7 +119,7 @@ int main(int argc, char *argv[], char *envp[])
}
udev_init_device(&udev, devpath, subsystem, action);
- udev_rules_init();
+ udev_rules_init(&rules, 0);
if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) {
/* handle device node */
@@ -143,7 +144,7 @@ int main(int argc, char *argv[], char *envp[])
if (udev.type == DEV_NET || udev.devt) {
/* name device */
- udev_rules_get_name(&udev, class_dev);
+ udev_rules_get_name(&rules, &udev, class_dev);
if (udev.ignore_device) {
info("device event will be ignored");
goto cleanup;
@@ -157,7 +158,7 @@ int main(int argc, char *argv[], char *envp[])
retval = udev_add_device(&udev, class_dev);
} else {
dbg("no dev-file found");
- udev_rules_get_run(&udev, NULL);
+ udev_rules_get_run(&rules, &udev, NULL);
if (udev.ignore_device) {
info("device event will be ignored");
goto cleanup;
@@ -166,7 +167,7 @@ int main(int argc, char *argv[], char *envp[])
sysfs_close_class_device(class_dev);
} else if (strcmp(action, "remove") == 0) {
dbg("node remove");
- udev_rules_get_run(&udev, NULL);
+ udev_rules_get_run(&rules, &udev, NULL);
if (udev.ignore_device) {
dbg("device event will be ignored");
goto cleanup;
@@ -193,7 +194,7 @@ int main(int argc, char *argv[], char *envp[])
}
dbg("devices device opened '%s'", path);
wait_for_devices_device(devices_dev, &error);
- udev_rules_get_run(&udev, devices_dev);
+ udev_rules_get_run(&rules, &udev, devices_dev);
sysfs_close_device(devices_dev);
if (udev.ignore_device) {
info("device event will be ignored");
@@ -201,7 +202,7 @@ int main(int argc, char *argv[], char *envp[])
}
} else {
dbg("default handling");
- udev_rules_get_run(&udev, NULL);
+ udev_rules_get_run(&rules, &udev, NULL);
if (udev.ignore_device) {
info("device event will be ignored");
goto cleanup;