From f46d2e54a82086eddcd9cd91e7908e87d7424148 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Dec 2009 15:23:45 +0100 Subject: [PATCH] remove UDEV_RUN environment variable It handles only RUN but not IMPORT and PROGRAM. There is no sane way to suppress program execution. Most important programs run with IMPORT these days. Also events can no longer suppressed with the libudev netlink messages, so UDEV_RUN does nothing useful and is just inconsistent. --- Makefile.am | 6 +++--- libudev/libudev-private.h | 1 - libudev/libudev.c | 11 ----------- udev/test-udev.c | 2 +- udev/udevadm-test.c | 3 +-- udev/udevd.c | 9 +++------ 6 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 126064b6..e037e607 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,9 +28,9 @@ CLEANFILES = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=5 -LIBUDEV_REVISION=2 -LIBUDEV_AGE=5 +LIBUDEV_CURRENT=6 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=6 SUBDIRS += libudev/docs diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index fe1575d6..c2fff002 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -59,7 +59,6 @@ void udev_log(struct udev *udev, const char *format, ...) __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); -int udev_get_run(struct udev *udev); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); diff --git a/libudev/libudev.c b/libudev/libudev.c index 19091387..411e9aec 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -45,7 +45,6 @@ struct udev { char *rules_path; struct udev_list_node properties_list; int log_priority; - int run; }; void udev_log(struct udev *udev, @@ -122,7 +121,6 @@ struct udev *udev_new(void) udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; udev_list_init(&udev->properties_list); - udev->run = 1; udev->dev_path = strdup("/dev"); udev->sys_path = strdup("/sys"); config_file = strdup(SYSCONFDIR "/udev/udev.conf"); @@ -140,10 +138,6 @@ struct udev *udev_new(void) udev_add_property(udev, "SYSFS_PATH", udev->sys_path); } - env = getenv("UDEV_RUN"); - if (env != NULL && strcmp(env, "0") == 0) - udev->run = 0; - env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { free(config_file); @@ -359,11 +353,6 @@ const char *udev_get_rules_path(struct udev *udev) return udev->rules_path; } -int udev_get_run(struct udev *udev) -{ - return udev->run; -} - /** * udev_get_sys_path: * @udev: udev library context diff --git a/udev/test-udev.c b/udev/test-udev.c index 75518f62..28c833a9 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) if (udev_device_get_event_timeout(dev) >= 0) alarm(udev_device_get_event_timeout(dev)); - if (err == 0 && udev_get_run(udev)) + if (err == 0) udev_event_execute_run(event, NULL); udev_event_unref(event); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 5dd515bc..89462007 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -119,14 +119,13 @@ 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 && udev_get_run(udev)) { + if (err == 0) udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); info(udev, "run: '%s'\n", program); } - } udev_event_unref(event); udev_device_unref(dev); exit: diff --git a/udev/udevd.c b/udev/udevd.c index 99647c68..170225d0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -292,12 +292,9 @@ static void worker_new(struct event *event) if (udev_device_get_event_timeout(dev) >= 0) alarm(udev_device_get_event_timeout(dev)); - /* execute RUN= */ - if (err == 0 && udev_get_run(udev_event->udev)) - failed = udev_event_execute_run(udev_event, - &orig_sigmask); + if (err == 0) + failed = udev_event_execute_run(udev_event, &orig_sigmask); - /* reset alarm */ alarm(0); /* apply/restore inotify watch */ @@ -309,7 +306,7 @@ static void worker_new(struct event *event) /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); - /* send back the result of the event execution */ + /* send udevd the result of the event execution */ if (err != 0) msg.exitcode = err; else if (failed != 0) -- 2.39.5