]> err.no Git - systemd/commitdiff
remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 5 Oct 2011 22:45:06 +0000 (00:45 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 5 Oct 2011 22:45:06 +0000 (00:45 +0200)
12 files changed:
NEWS
TODO
libudev/docs/libudev-sections.txt
libudev/libudev-private.h
libudev/libudev-queue-private.c
libudev/libudev-queue.c
libudev/libudev.h
libudev/test-libudev.c
test/udev-test.pl
udev/udev-rules.c
udev/udevadm-trigger.c
udev/udevd.c

diff --git a/NEWS b/NEWS
index e32bbf7a6ac0dc3979ef8c122c89e3f534c6c04e..abb0ee922f6d4cd9602aa3d491f575c61ff092fc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ Systemd systems will take care of mounting fusectl and configfs
 now. Non-systemd systems need to ship their own rule if they
 need these filesystems auto-mounted.
 
+The long deprecated keys: SYSFS, ID, BUS have been removed.
+
+The support for 'udevadm trigger --type=failed, and the
+RUN{fail_event_on_error} attribute was removed.
+
 udev 173
 ========
 Bugfixes.
diff --git a/TODO b/TODO
index 3e013c99be4e0a66f69b4d9abd5b0d91a11e2807..65894ba8201eb186f721622325796397403f3490 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+ - validate the two hex chars in replace_chars \x
+
  - test (now fixed) /dev/tape/ links
 
  - /run/udev/control socket
 
  - move udevadm -> --bindir
 
- - remove deprecated trigger --type=failed logic
-
- - remove deprecated BUS=, SYSFS{}=, ID= keys
-
  - kill tabs?
 
  - warn about RUN+="socket:"
index 4cd383b4f892da033f82f35bcc4d0d14bccc7e0f..a686c4558ef1e462081393f368a71cc095bda606 100644 (file)
@@ -116,7 +116,6 @@ udev_queue_get_queue_is_empty
 udev_queue_get_seqnum_is_finished
 udev_queue_get_seqnum_sequence_is_finished
 udev_queue_get_queued_list_entry
-udev_queue_get_failed_list_entry
 udev_queue_get_kernel_seqnum
 udev_queue_get_udev_seqnum
 </SECTION>
index 2873b4d2c7ec09c0da9a7a3e1772c3302dfd4012..1bcd2e323694d64b990ed048cf1a57e8845599d2 100644 (file)
@@ -165,7 +165,6 @@ struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev
 void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export);
 int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
 int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
-int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
 
 /* libudev-util.c */
 #define UTIL_PATH_SIZE                         1024
index 6e13d8a3d95dbfe1f29a804326da5eca1ba58222..e0a7b53b8136b592a1c647fc6bdfc0265017de61 100644 (file)
@@ -56,7 +56,6 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export);
 
 struct udev_queue_export {
        struct udev *udev;
-       int failed_count;       /* number of failed events exported */
        int queued_count;       /* number of unfinished events exported in queue file */
        FILE *queue_file;
        unsigned long long int seqnum_max;      /* earliest sequence number in queue file */
@@ -328,7 +327,6 @@ write_error:
 enum device_state {
        DEVICE_QUEUED,
        DEVICE_FINISHED,
-       DEVICE_FAILED,
 };
 
 static inline size_t queue_record_size(size_t devpath_len)
@@ -394,47 +392,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export,
        return err;
 }
 
-static void update_failed(struct udev_queue_export *udev_queue_export,
-                         struct udev_device *udev_device, enum device_state state)
-{
-       struct udev *udev = udev_device_get_udev(udev_device);
-       char filename[UTIL_PATH_SIZE];
-
-       if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0)
-               return;
-
-       /* location of failed file */
-       util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/failed/",
-                     udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL);
-
-       switch (state) {
-       case DEVICE_FAILED:
-               /* record event in the failed directory */
-               udev_queue_export->failed_count++;
-               util_create_path(udev, filename);
-               symlink(udev_device_get_devpath(udev_device), filename);
-               break;
-
-       case DEVICE_QUEUED:
-               /* delete failed file */
-               if (unlink(filename) == 0) {
-                       util_delete_path(udev, filename);
-                       udev_queue_export->failed_count--;
-               }
-               break;
-
-       case DEVICE_FINISHED:
-               break;
-       }
-
-       return;
-}
-
 static int update(struct udev_queue_export *udev_queue_export,
                  struct udev_device *udev_device, enum device_state state)
 {
-       update_failed(udev_queue_export, udev_device, state);
-
        if (update_queue(udev_queue_export, udev_device, state) != 0)
                return -1;
 
@@ -450,8 +410,3 @@ int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_expor
 {
        return update(udev_queue_export, udev_device, DEVICE_FINISHED);
 }
-
-int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device)
-{
-       return update(udev_queue_export, udev_device, DEVICE_FAILED);
-}
index 744696df2b85499242051145e6542471069e4989..3d46b67d19024b9a993e932aa328f83765634478 100644 (file)
@@ -43,7 +43,6 @@ struct udev_queue {
        struct udev *udev;
        int refcount;
        struct udev_list queue_list;
-       struct udev_list failed_list;
 };
 
 /**
@@ -68,7 +67,6 @@ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev)
        udev_queue->refcount = 1;
        udev_queue->udev = udev;
        udev_list_init(udev, &udev_queue->queue_list, false);
-       udev_list_init(udev, &udev_queue->failed_list, false);
        return udev_queue;
 }
 
@@ -103,7 +101,6 @@ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue)
        if (udev_queue->refcount > 0)
                return;
        udev_list_cleanup(&udev_queue->queue_list);
-       udev_list_cleanup(&udev_queue->failed_list);
        free(udev_queue);
 }
 
@@ -469,47 +466,9 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev
        return udev_list_get_entry(&udev_queue->queue_list);
 }
 
-/**
- * udev_queue_get_failed_list_entry:
- * @udev_queue: udev queue context
- *
- * Returns: the first entry of the list of recorded failed events.
- **/
+struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
 UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
 {
-       char path[UTIL_PATH_SIZE];
-       DIR *dir;
-       struct dirent *dent;
-
-       if (udev_queue == NULL)
-               return NULL;
-       udev_list_cleanup(&udev_queue->failed_list);
-       util_strscpyl(path, sizeof(path), udev_get_run_path(udev_queue->udev), "/failed", NULL);
-       dir = opendir(path);
-       if (dir == NULL)
-               return NULL;
-       for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
-               char filename[UTIL_PATH_SIZE];
-               char syspath[UTIL_PATH_SIZE];
-               char *s;
-               size_t l;
-               ssize_t len;
-               struct stat statbuf;
-
-               if (dent->d_name[0] == '.')
-                       continue;
-               s = syspath;
-               l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL);
-               len = readlinkat(dirfd(dir), dent->d_name, s, l);
-               if (len <= 0 || (size_t)len == l)
-                       continue;
-               s[len] = '\0';
-               dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
-               util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL);
-               if (stat(filename, &statbuf) != 0)
-                       continue;
-               udev_list_entry_add(&udev_queue->failed_list, syspath, NULL);
-       }
-       closedir(dir);
-       return udev_list_get_entry(&udev_queue->failed_list);
+       errno = ENOSYS;
+       return NULL;
 }
index d8eb7dff77fc3c1c9dd669b70abfb6cbe4587aa5..47b56bb17ac417e36c6a16647466d08965de87f5 100644 (file)
@@ -173,7 +173,6 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
 int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
                                               unsigned long long int start, unsigned long long int end);
 struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue);
-struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
 
 #ifdef __cplusplus
 } /* extern "C" */
index 966a4065078f4077a37fd86cbc57302b792f9453..c325f8eef57b38d37356791c3eca6cd96c08f275 100644 (file)
@@ -323,10 +323,6 @@ static int test_queue(struct udev *udev)
        udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue))
                printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry));
        printf("\n");
-       printf("get failed list\n");
-       udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue))
-               printf("failed: '%s'\n", udev_list_entry_get_name(list_entry));
-       printf("\n");
 
        list_entry = udev_queue_get_queued_list_entry(udev_queue);
        if (list_entry != NULL) {
index b7592efcbd72622cf988be4790cf8f967cfd83cf..f93859c78c4979b14be4b1c1a47cf6ee59613db7 100755 (executable)
@@ -14,7 +14,7 @@
 # After creation and removal the result is checked against the
 # expected value and the result is printed.
 #
-# Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
+# Copyright (C) 2004-2011 Kay Sievers <kay.sievers@vrfy.org>
 # Copyright (C) 2004 Leann Ogasawara <ogasawara@osdl.org>
 
 use warnings;
index 6bf2726e1e4d9238398f2649323917efce7551a1..84033243c2e48d5b2f806d5fd24c6c17a71578c7 100644 (file)
@@ -198,7 +198,6 @@ struct token {
                        union {
                                unsigned int attr_off;
                                int devlink_unique;
-                               int fail_on_error;
                                unsigned int rule_goto;
                                mode_t  mode;
                                uid_t uid;
@@ -1066,7 +1065,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
                break;
        case TK_A_RUN:
                token->key.value_off = add_string(rule_tmp->rules, value);
-               token->key.fail_on_error = *(int *)data;
                break;
        case TK_A_INOTIFY_WATCH:
        case TK_A_DEVLINK_PRIO:
@@ -1191,9 +1189,6 @@ static int add_rule(struct udev_rules *rules, char *line,
        char *linepos;
        char *attr;
        struct rule_tmp rule_tmp;
-       bool bus_warn = false;
-       bool sysfs_warn = false;
-       bool id_warn = false;
 
        memset(&rule_tmp, 0x00, sizeof(struct rule_tmp));
        rule_tmp.rules = rules;
@@ -1287,21 +1282,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                        continue;
                }
 
-               if (strcmp(key, "ID") == 0) {
-                       if (!id_warn) {
-                               id_warn = true;
-                               err(rules->udev, "ID= will be removed in a future udev version, "
-                                   "please use KERNEL= to match the event device, or KERNELS= "
-                                   "to match a parent device, in %s:%u\n", filename, lineno);
-                       }
-                       if (op > OP_MATCH_MAX) {
-                               err(rules->udev, "invalid KERNELS operation\n");
-                               goto invalid;
-                       }
-                       rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL);
-                       continue;
-               }
-
                if (strcmp(key, "SUBSYSTEMS") == 0) {
                        if (op > OP_MATCH_MAX) {
                                err(rules->udev, "invalid SUBSYSTEMS operation\n");
@@ -1311,21 +1291,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                        continue;
                }
 
-               if (strcmp(key, "BUS") == 0) {
-                       if (!bus_warn) {
-                               bus_warn = true;
-                               err(rules->udev, "BUS= will be removed in a future udev version, "
-                                   "please use SUBSYSTEM= to match the event device, or SUBSYSTEMS= "
-                                   "to match a parent device, in %s:%u\n", filename, lineno);
-                       }
-                       if (op > OP_MATCH_MAX) {
-                               err(rules->udev, "invalid SUBSYSTEMS operation\n");
-                               goto invalid;
-                       }
-                       rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL);
-                       continue;
-               }
-
                if (strcmp(key, "DRIVERS") == 0) {
                        if (op > OP_MATCH_MAX) {
                                err(rules->udev, "invalid DRIVERS operation\n");
@@ -1364,26 +1329,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                        continue;
                }
 
-               if (strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) {
-                       if (!sysfs_warn) {
-                               sysfs_warn = true;
-                               err(rules->udev, "SYSFS{}= will be removed in a future udev version, "
-                                   "please use ATTR{}= to match the event device, or ATTRS{}= "
-                                   "to match a parent device, in %s:%u\n", filename, lineno);
-                       }
-                       if (op > OP_MATCH_MAX) {
-                               err(rules->udev, "invalid ATTRS operation\n");
-                               goto invalid;
-                       }
-                       attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1);
-                       if (attr == NULL) {
-                               err(rules->udev, "error parsing ATTRS attribute\n");
-                               goto invalid;
-                       }
-                       rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr);
-                       continue;
-               }
-
                if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) {
                        attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1);
                        if (attr == NULL) {
@@ -1509,13 +1454,8 @@ static int add_rule(struct udev_rules *rules, char *line,
                        continue;
                }
 
-               if (strncmp(key, "RUN", sizeof("RUN")-1) == 0) {
-                       int flag = 0;
-
-                       attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1);
-                       if (attr != NULL && strstr(attr, "fail_event_on_error"))
-                               flag = 1;
-                       rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag);
+               if (strcmp(key, "RUN") == 0) {
+                       rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL);
                        continue;
                }
 
@@ -2706,17 +2646,13 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                        break;
                }
                case TK_A_RUN: {
-                       struct udev_list_entry *list_entry;
-
                        if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL)
                                udev_list_cleanup(&event->run_list);
                        info(event->udev, "RUN '%s' %s:%u\n",
                             &rules->buf[cur->key.value_off],
                             &rules->buf[rule->rule.filename_off],
                             rule->rule.filename_line);
-                       list_entry = udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL);
-                       if (cur->key.fail_on_error)
-                               udev_list_entry_set_num(list_entry, true);
+                       udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL);
                        break;
                }
                case TK_A_GOTO:
index d94c9568d1793aa8da64bd3311111410783b585c..2cee2297d4940aa514ac69d23c5b7a24aec5bf05 100644 (file)
@@ -61,20 +61,6 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action)
        }
 }
 
-static int scan_failed(struct udev_enumerate *udev_enumerate)
-{
-       struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
-       struct udev_queue *udev_queue;
-       struct udev_list_entry *list_entry;
-
-       udev_queue = udev_queue_new(udev);
-       if (udev_queue == NULL)
-               return -1;
-       udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue))
-               udev_enumerate_add_syspath(udev_enumerate, udev_list_entry_get_name(list_entry));
-       return 0;
-}
-
 static const char *keyval(const char *str, const char **val, char *buf, size_t size)
 {
        char *pos;
@@ -110,7 +96,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
        enum {
                TYPE_DEVICES,
                TYPE_SUBSYSTEMS,
-               TYPE_FAILED,
        } device_type = TYPE_DEVICES;
        const char *action = "change";
        struct udev_enumerate *udev_enumerate;
@@ -145,8 +130,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
                                device_type = TYPE_DEVICES;
                        } else if (strcmp(optarg, "subsystems") == 0) {
                                device_type = TYPE_SUBSYSTEMS;
-                       } else if (strcmp(optarg, "failed") == 0) {
-                               device_type = TYPE_FAILED;
                        } else {
                                err(udev, "unknown type --type=%s\n", optarg);
                                rc = 2;
@@ -208,8 +191,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
                               "  --type=                         type of events to trigger\n"
                               "      devices                       sys devices (default)\n"
                               "      subsystems                    sys subsystems and drivers\n"
-                              "      failed                        trigger only the events which have been\n"
-                              "                                    marked as failed during a previous run\n"
                               "  --action=<action>               event action value, default is \"change\"\n"
                               "  --subsystem-match=<subsystem>   trigger devices from a matching subsystem\n"
                               "  --subsystem-nomatch=<subsystem> exclude devices from a matching subsystem\n"
@@ -228,11 +209,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
        }
 
        switch (device_type) {
-       case TYPE_FAILED:
-               err(udev, "--type=failed is deprecated and will be removed from a future udev release.\n");
-               scan_failed(udev_enumerate);
-               exec_list(udev_enumerate, action);
-               goto exit;
        case TYPE_SUBSYSTEMS:
                udev_enumerate_scan_subsystems(udev_enumerate);
                exec_list(udev_enumerate, action);
index 325ad034c2b2bc05554824acde20beadd39f7fca..77aec9d2ae7f530bdea8fe58c527983508c6b2cf 100644 (file)
@@ -155,11 +155,7 @@ static void event_queue_delete(struct event *event, bool export)
        udev_list_node_remove(&event->node);
 
        if (export) {
-               /* mark as failed, if "add" event returns non-zero */
-               if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0)
-                       udev_queue_export_device_failed(udev_queue_export, event->dev);
-               else
-                       udev_queue_export_device_finished(udev_queue_export, event->dev);
+               udev_queue_export_device_finished(udev_queue_export, event->dev);
                info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode);
        }
        udev_device_unref(event->dev);
@@ -284,7 +280,6 @@ static void worker_new(struct event *event)
                for (;;) {
                        struct udev_event *udev_event;
                        struct worker_message msg;
-                       int failed = 0;
                        int err;
 
                        info(udev, "seq %llu running\n", udev_device_get_seqnum(dev));
@@ -304,7 +299,7 @@ static void worker_new(struct event *event)
                        err = udev_event_execute_rules(udev_event, rules, &sigmask_orig);
 
                        if (err == 0)
-                               failed = udev_event_execute_run(udev_event, &sigmask_orig);
+                               udev_event_execute_run(udev_event, &sigmask_orig);
 
                        /* apply/restore inotify watch */
                        if (err == 0 && udev_event->inotify_watch) {
@@ -319,8 +314,6 @@ static void worker_new(struct event *event)
                        memset(&msg, 0, sizeof(struct worker_message));
                        if (err != 0)
                                msg.exitcode = err;
-                       else if (failed != 0)
-                               msg.exitcode = failed;
                        msg.pid = getpid();
                        send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0);