summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-11-14 20:46:11 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-11-14 20:46:11 -0500
commitdacd994fda3fadeb1fa01accbd37d61d0359e0ee (patch)
tree165d90b9b0c99689d76fd5f7ec129901c82d05ea /src/udev
parentaec5d2b9b4159cab7357e311fd558790037cd04b (diff)
udev: switch to systemd logging functions
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-event.c7
-rw-r--r--src/udev/udevadm.c8
-rw-r--r--src/udev/udevd.c22
3 files changed, 9 insertions, 28 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index e86f9cb059..317a593f2b 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -677,7 +677,6 @@ int udev_event_spawn(struct udev_event *event,
usec_t timeout_warn_usec,
const char *cmd, char **envp, const sigset_t *sigmask,
char *result, size_t ressize) {
- struct udev *udev = event->udev;
int outpipe[2] = {-1, -1};
int errpipe[2] = {-1, -1};
pid_t pid;
@@ -690,14 +689,14 @@ int udev_event_spawn(struct udev_event *event,
udev_build_argv(event->udev, arg, NULL, argv);
/* pipes from child to parent */
- if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) {
+ if (result != NULL || log_get_max_level() >= LOG_INFO) {
if (pipe2(outpipe, O_NONBLOCK) != 0) {
err = -errno;
log_error("pipe failed: %m");
goto out;
}
}
- if (udev_get_log_priority(udev) >= LOG_INFO) {
+ if (log_get_max_level() >= LOG_INFO) {
if (pipe2(errpipe, O_NONBLOCK) != 0) {
err = -errno;
log_error("pipe failed: %m");
@@ -864,7 +863,7 @@ void udev_event_execute_rules(struct udev_event *event,
if (major(udev_device_get_devnum(dev)) != 0)
udev_watch_end(event->udev, dev);
- udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask);
+ udev_rules_apply_to_event(rules, event,timeout_usec, timeout_warn_usec, sigmask);
if (major(udev_device_get_devnum(dev)) != 0)
udev_node_remove(dev);
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index fda5aecd83..330b487161 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -26,12 +26,6 @@
#include "udev.h"
-void udev_main_log(struct udev *udev, int priority,
- const char *file, int line, const char *fn,
- const char *format, va_list args) {
- log_metav(priority, file, line, fn, format, args);
-}
-
static int adm_version(struct udev *udev, int argc, char *argv[]) {
printf("%s\n", UDEV_VERSION);
return 0;
@@ -97,7 +91,6 @@ int main(int argc, char *argv[]) {
goto out;
log_open();
- udev_set_log_fn(udev, udev_main_log);
mac_selinux_init("/dev");
while ((c = getopt_long(argc, argv, "+dhV", options, NULL)) >= 0)
@@ -105,7 +98,6 @@ int main(int argc, char *argv[]) {
case 'd':
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
break;
case 'h':
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 5090dfae37..510712a1b9 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -53,12 +53,6 @@
#include "dev-setup.h"
#include "fileio.h"
-void udev_main_log(struct udev *udev, int priority,
- const char *file, int line, const char *fn,
- const char *format, va_list args) {
- log_metav(priority, file, line, fn, format, args);
-}
-
static struct udev_rules *rules;
static struct udev_ctrl *udev_ctrl;
static struct udev_monitor *monitor;
@@ -80,6 +74,7 @@ static sigset_t sigmask_orig;
static UDEV_LIST(event_list);
static UDEV_LIST(worker_list);
static char *udev_cgroup;
+static struct udev_list properties_list;
static bool udev_exit;
enum event_state {
@@ -636,7 +631,6 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) {
if (i >= 0) {
log_debug("udevd message (SET_LOG_LEVEL) received, log_priority=%i", i);
log_set_max_level(i);
- udev_set_log_priority(udev, i);
worker_kill(udev);
}
@@ -669,10 +663,10 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) {
val = &val[1];
if (val[0] == '\0') {
log_debug("udevd message (ENV) received, unset '%s'", key);
- udev_add_property(udev, key, NULL);
+ udev_list_entry_add(&properties_list, key, NULL);
} else {
log_debug("udevd message (ENV) received, set '%s=%s'", key, val);
- udev_add_property(udev, key, val);
+ udev_list_entry_add(&properties_list, key, val);
}
} else {
log_error("wrong key format '%s'", key);
@@ -1011,7 +1005,6 @@ static void kernel_cmdline_options(struct udev *udev) {
prio = util_log_priority(value);
log_set_max_level(prio);
- udev_set_log_priority(udev, prio);
} else if ((value = startswith(opt, "udev.children-max="))) {
r = safe_atoi(value, &arg_children_max);
if (r < 0)
@@ -1146,19 +1139,14 @@ int main(int argc, char *argv[]) {
log_set_target(LOG_TARGET_AUTO);
log_open();
- udev_set_log_fn(udev, udev_main_log);
- log_set_max_level(udev_get_log_priority(udev));
-
r = parse_argv(argc, argv);
if (r <= 0)
goto exit;
kernel_cmdline_options(udev);
- if (arg_debug) {
+ if (arg_debug)
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
- }
if (getuid() != 0) {
log_error("root privileges required");
@@ -1180,6 +1168,8 @@ int main(int argc, char *argv[]) {
umask(022);
+ udev_list_init(udev, &properties_list, true);
+
r = mkdir("/run/udev", 0755);
if (r < 0 && errno != EEXIST) {
log_error("could not create /run/udev: %m");