From cdae488a3fbca5a61b3f8ea0651730cfa2da9cb0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Nov 2009 15:22:17 +0100 Subject: [PATCH] remove "ignore_device" There is no way to ignore an event these days. Libudev events can not be suppressed. It only prevents RUN keys from being executed, which results in an inconsistent behavior in current setups. --- NEWS | 9 +++++++++ configure.ac | 2 +- udev/udev-event.c | 16 ---------------- udev/udev-rules.c | 13 ------------- udev/udev.h | 1 - udev/udev.xml | 6 ------ udev/udevadm-test.c | 2 +- udev/udevd.c | 2 +- 8 files changed, 12 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index c0196a18..66a71e05 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +udev 148 +======== +Bugfixes. + +The option "ignore_device" does no longer exist. There is no way to +ignore an event, as libudev events can not be suppressed by rules. +It only prevented RUN keys from being executed, which results in an +inconsistent behavior in current setups. + udev 147 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 3cb2299c..12271f14 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [147], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [148], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/udev/udev-event.c b/udev/udev-event.c index d5b4d094..4e1773ff 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -568,12 +568,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) event->tmp_node = NULL; } - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - delete_kdevnode = 1; - goto exit_add; - } - if (event->name != NULL && event->name[0] == '\0') { info(event->udev, "device node creation suppressed\n"); delete_kdevnode = 1; @@ -638,10 +632,6 @@ exit_add: udev_device_delete_db(dev); udev_rules_apply_to_event(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } if (event->name == NULL) goto exit; @@ -694,10 +684,6 @@ exit_add: } udev_rules_apply_to_event(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } if (udev_device_get_ignore_remove(dev)) { info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); @@ -710,8 +696,6 @@ exit_add: /* default devices */ udev_rules_apply_to_event(rules, event); - if (event->ignore_device) - info(event->udev, "device event will be ignored\n"); if (strcmp(udev_device_get_action(dev), "remove") != 0) udev_device_update_db(dev); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 092ddcdc..07cb4a7f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -144,7 +144,6 @@ enum token_type { TK_M_RESULT, /* val */ TK_M_MAX, - TK_A_IGNORE_DEVICE, TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, TK_A_INOTIFY_WATCH, /* int */ @@ -275,7 +274,6 @@ static const char *token_str(enum token_type type) [TK_M_RESULT] = "M RESULT", [TK_M_MAX] = "M MAX", - [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", @@ -357,7 +355,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", token_str(type), operation_str(op), attr, value, string_glob_str(glob)); break; - case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_IGNORE_REMOVE: @@ -1030,7 +1027,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, if (data != NULL) token->key.mode = *(mode_t *)data; break; - case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_IGNORE_REMOVE: @@ -1496,10 +1492,6 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(key, "OPTIONS") == 0) { const char *pos; - if (strstr(value, "ignore_device") != NULL) { - dbg(rules->udev, "device should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); - } if (strstr(value, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); @@ -2259,11 +2251,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, event->program_result) != 0) goto nomatch; break; - - case TK_A_IGNORE_DEVICE: - event->ignore_device = 1; - return 0; - break; case TK_A_STRING_ESCAPE_NONE: esc = ESCAPE_NONE; break; diff --git a/udev/udev.h b/udev/udev.h index 8f0a3014..555eae63 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -48,7 +48,6 @@ struct udev_event { unsigned int name_final:1; unsigned int devlink_final:1; unsigned int run_final:1; - unsigned int ignore_device:1; unsigned int inotify_watch:1; }; diff --git a/udev/udev.xml b/udev/udev.xml index 41941c82..ff01fefe 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -419,12 +419,6 @@ Rule and device options: - - - - Ignore this event completely. - - diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 6c571038..5dd515bc 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -119,7 +119,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0 && !event->ignore_device && udev_get_run(udev)) { + if (err == 0 && udev_get_run(udev)) { udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; diff --git a/udev/udevd.c b/udev/udevd.c index 72f9b180..300d6035 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -293,7 +293,7 @@ static void worker_new(struct event *event) alarm(udev_device_get_event_timeout(dev)); /* execute RUN= */ - if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev)) + if (err == 0 && udev_get_run(udev_event->udev)) failed = udev_event_execute_run(udev_event, &orig_sigmask); -- 2.39.5