summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-device-private.c5
-rw-r--r--src/libudev/libudev-device.c10
-rw-r--r--src/libudev/libudev-hwdb.c22
-rw-r--r--src/libudev/libudev-monitor.c32
-rw-r--r--src/libudev/libudev-private.h9
-rw-r--r--src/libudev/libudev-util.c4
-rw-r--r--src/libudev/libudev.c99
-rw-r--r--src/libudev/libudev.h6
-rw-r--r--src/test/test-libudev.c15
-rw-r--r--src/udev/accelerometer/accelerometer.c11
-rw-r--r--src/udev/ata_id/ata_id.c10
-rw-r--r--src/udev/cdrom_id/cdrom_id.c11
-rw-r--r--src/udev/scsi_id/scsi_id.c11
-rw-r--r--src/udev/udev-event.c5
-rw-r--r--src/udev/udevadm.c2
-rw-r--r--src/udev/udevd.c9
16 files changed, 67 insertions, 194 deletions
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index d80100cd61..df1fc0c9bf 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -102,7 +102,6 @@ static bool device_has_info(struct udev_device *udev_device)
int udev_device_update_db(struct udev_device *udev_device)
{
- struct udev *udev = udev_device_get_udev(udev_device);
bool has_info;
const char *id;
char filename[UTIL_PATH_SIZE];
@@ -130,7 +129,7 @@ int udev_device_update_db(struct udev_device *udev_device)
mkdir_parents(filename_tmp, 0755);
f = fopen(filename_tmp, "we");
if (f == NULL) {
- udev_dbg(udev, "unable to create temporary db file '%s': %m\n", filename_tmp);
+ log_debug("unable to create temporary db file '%s': %m\n", filename_tmp);
return -errno;
}
@@ -172,7 +171,7 @@ int udev_device_update_db(struct udev_device *udev_device)
r = rename(filename_tmp, filename);
if (r < 0)
return -1;
- udev_dbg(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
+ log_debug("created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
filename, udev_device_get_devpath(udev_device));
return 0;
}
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 2699374072..506798f22e 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -535,7 +535,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
f = fopen(dbfile, "re");
if (f == NULL) {
- udev_dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
+ log_debug("no db file to read %s: %m\n", dbfile);
return -errno;
}
@@ -577,7 +577,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
}
fclose(f);
- udev_dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
+ log_debug("device %p filled with db file data\n", udev_device);
return 0;
}
@@ -704,7 +704,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
/* path starts in sys */
if (!startswith(syspath, "/sys")) {
- udev_dbg(udev, "not in sys :%s\n", syspath);
+ log_debug("not in sys :%s\n", syspath);
errno = EINVAL;
return NULL;
}
@@ -739,7 +739,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
udev_device_set_syspath(udev_device, path);
- udev_dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
+ log_debug("device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
return udev_device;
}
@@ -971,7 +971,7 @@ _public_ struct udev_device *udev_device_new_from_environment(struct udev *udev)
udev_device_add_property_from_string_parse(udev_device, environ[i]);
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
- udev_dbg(udev, "missing values, invalid device\n");
+ log_debug("missing values, invalid device\n");
udev_device_unref(udev_device);
udev_device = NULL;
}
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 0716072d9a..5ab821f626 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -289,45 +289,45 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
else if (errno == ENOENT)
continue;
else {
- udev_dbg(udev, "error reading %s: %m", hwdb_bin_path);
+ log_debug("error reading %s: %m", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
}
if (!hwdb->f) {
- udev_dbg(udev, "hwdb.bin does not exist, please run udevadm hwdb --update");
+ log_debug("hwdb.bin does not exist, please run udevadm hwdb --update");
udev_hwdb_unref(hwdb);
return NULL;
}
if (fstat(fileno(hwdb->f), &hwdb->st) < 0 ||
(size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) {
- udev_dbg(udev, "error reading %s: %m", hwdb_bin_path);
+ log_debug("error reading %s: %m", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
if (hwdb->map == MAP_FAILED) {
- udev_dbg(udev, "error mapping %s: %m", hwdb_bin_path);
+ log_debug("error mapping %s: %m", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
(size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) {
- udev_dbg(udev, "error recognizing the format of %s", hwdb_bin_path);
+ log_debug("error recognizing the format of %s", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
- udev_dbg(udev, "=== trie on-disk ===\n");
- udev_dbg(udev, "tool version: %"PRIu64, le64toh(hwdb->head->tool_version));
- udev_dbg(udev, "file size: %8"PRIu64" bytes\n", hwdb->st.st_size);
- udev_dbg(udev, "header size %8"PRIu64" bytes\n", le64toh(hwdb->head->header_size));
- udev_dbg(udev, "strings %8"PRIu64" bytes\n", le64toh(hwdb->head->strings_len));
- udev_dbg(udev, "nodes %8"PRIu64" bytes\n", le64toh(hwdb->head->nodes_len));
+ log_debug("=== trie on-disk ===\n");
+ log_debug("tool version: %"PRIu64, le64toh(hwdb->head->tool_version));
+ log_debug("file size: %8"PRIu64" bytes\n", hwdb->st.st_size);
+ log_debug("header size %8"PRIu64" bytes\n", le64toh(hwdb->head->header_size));
+ log_debug("strings %8"PRIu64" bytes\n", le64toh(hwdb->head->strings_len));
+ log_debug("nodes %8"PRIu64" bytes\n", le64toh(hwdb->head->nodes_len));
return hwdb;
}
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 890df9c595..893ecb483e 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -121,7 +121,7 @@ static bool udev_has_devtmpfs(struct udev *udev) {
r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0);
if (r < 0) {
if (errno != EOPNOTSUPP)
- udev_dbg(udev, "name_to_handle_at on /dev: %m\n");
+ log_debug("name_to_handle_at on /dev: %m\n");
return false;
}
@@ -174,7 +174,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
* will not receive any messages.
*/
if (access("/run/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) {
- udev_dbg(udev, "the udev service seems not to be active, disable the monitor\n");
+ log_debug("the udev service seems not to be active, disable the monitor\n");
group = UDEV_MONITOR_NONE;
} else
group = UDEV_MONITOR_UDEV;
@@ -190,7 +190,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
if (fd < 0) {
udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
if (udev_monitor->sock == -1) {
- udev_dbg(udev, "error getting socket: %m\n");
+ log_debug("error getting socket: %m\n");
free(udev_monitor);
return NULL;
}
@@ -407,14 +407,14 @@ _public_ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
if (err == 0)
udev_monitor->snl.nl.nl_pid = snl.nl.nl_pid;
} else {
- udev_dbg(udev_monitor->udev, "bind failed: %m\n");
+ log_debug("bind failed: %m\n");
return -errno;
}
/* enable receiving of sender credentials */
err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
if (err < 0)
- udev_dbg(udev_monitor->udev, "setting SO_PASSCRED failed: %m\n");
+ log_debug("setting SO_PASSCRED failed: %m\n");
return 0;
}
@@ -602,12 +602,12 @@ retry:
buflen = recvmsg(udev_monitor->sock, &smsg, 0);
if (buflen < 0) {
if (errno != EINTR)
- udev_dbg(udev_monitor->udev, "unable to receive message\n");
+ log_debug("unable to receive message\n");
return NULL;
}
if (buflen < 32 || (size_t)buflen >= sizeof(buf)) {
- udev_dbg(udev_monitor->udev, "invalid message length\n");
+ log_debug("invalid message length\n");
return NULL;
}
@@ -615,12 +615,12 @@ retry:
/* unicast message, check if we trust the sender */
if (udev_monitor->snl_trusted_sender.nl.nl_pid == 0 ||
snl.nl.nl_pid != udev_monitor->snl_trusted_sender.nl.nl_pid) {
- udev_dbg(udev_monitor->udev, "unicast netlink message ignored\n");
+ log_debug("unicast netlink message ignored\n");
return NULL;
}
} else if (snl.nl.nl_groups == UDEV_MONITOR_KERNEL) {
if (snl.nl.nl_pid > 0) {
- udev_dbg(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
+ log_debug("multicast kernel netlink message from pid %d ignored\n",
snl.nl.nl_pid);
return NULL;
}
@@ -628,13 +628,13 @@ retry:
cmsg = CMSG_FIRSTHDR(&smsg);
if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
- udev_dbg(udev_monitor->udev, "no sender credentials received, message ignored\n");
+ log_debug("no sender credentials received, message ignored\n");
return NULL;
}
cred = (struct ucred *)CMSG_DATA(cmsg);
if (cred->uid != 0) {
- udev_dbg(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
+ log_debug("sender uid=%d, message ignored\n", cred->uid);
return NULL;
}
@@ -648,7 +648,7 @@ retry:
/* udev message needs proper version magic */
nlh = (struct udev_monitor_netlink_header *) buf;
if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) {
- udev_dbg(udev_monitor->udev, "unrecognized message signature (%x != %x)\n",
+ log_debug("unrecognized message signature (%x != %x)\n",
nlh->magic, htonl(UDEV_MONITOR_MAGIC));
udev_device_unref(udev_device);
return NULL;
@@ -666,14 +666,14 @@ retry:
/* kernel message with header */
bufpos = strlen(buf) + 1;
if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) {
- udev_dbg(udev_monitor->udev, "invalid message length\n");
+ log_debug("invalid message length\n");
udev_device_unref(udev_device);
return NULL;
}
/* check message header */
if (strstr(buf, "@/") == NULL) {
- udev_dbg(udev_monitor->udev, "unrecognized message header\n");
+ log_debug("unrecognized message header\n");
udev_device_unref(udev_device);
return NULL;
}
@@ -694,7 +694,7 @@ retry:
}
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
- udev_dbg(udev_monitor->udev, "missing values, invalid device\n");
+ log_debug("missing values, invalid device\n");
udev_device_unref(udev_device);
return NULL;
}
@@ -778,7 +778,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
smsg.msg_name = &udev_monitor->snl_destination;
smsg.msg_namelen = sizeof(struct sockaddr_nl);
count = sendmsg(udev_monitor->sock, &smsg, 0);
- udev_dbg(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor);
+ log_debug("passed %zi bytes to netlink monitor %p\n", count, udev_monitor);
return count;
}
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 17803c2f43..2bad13997f 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -33,15 +33,6 @@
#define READ_END 0
#define WRITE_END 1
-/* avoid (sometimes expensive) calculations of parameters for debug output */
-#define udev_log_cond(udev, prio, arg...) \
- do { \
- if (udev_get_log_priority(udev) >= prio) \
- udev_log(udev, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \
- } while (0)
-
-#define udev_dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg)
-
/* libudev.c */
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 0bc10f3470..361c21f4c9 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -93,7 +93,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
strscpy(result, maxsize, val);
else
result[0] = '\0';
- udev_dbg(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
+ log_debug("value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
} else {
size_t l;
char *s;
@@ -102,7 +102,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
l = strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL);
if (attr != NULL)
strpcpyl(&s, l, "/", attr, NULL);
- udev_dbg(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
+ log_debug("path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
}
udev_device_unref(dev);
return 0;
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 6744658789..64fe7c42fd 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -1,7 +1,7 @@
/***
This file is part of systemd.
- Copyright 2008-2012 Kay Sievers <kay@vrfy.org>
+ Copyright 2008-2014 Kay Sievers <kay@vrfy.org>
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
@@ -51,40 +51,18 @@ struct udev {
const char *format, va_list args);
void *userdata;
struct udev_list properties_list;
- int log_priority;
};
-void udev_log(struct udev *udev,
- int priority, const char *file, int line, const char *fn,
- const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- udev->log_fn(udev, priority, file, line, fn, format, args);
- va_end(args);
-}
-
-_printf_(6,0)
-static void log_stderr(struct udev *udev,
- int priority, const char *file, int line, const char *fn,
- const char *format, va_list args)
-{
- fprintf(stderr, "libudev: %s: ", fn);
- vfprintf(stderr, format, args);
-}
-
/**
* udev_get_userdata:
* @udev: udev library context
*
* Retrieve stored data pointer from library context. This might be useful
- * to access from callbacks like a custom log function.
+ * to access from callbacks.
*
* Returns: stored userdata
**/
-_public_ void *udev_get_userdata(struct udev *udev)
-{
+_public_ void *udev_get_userdata(struct udev *udev) {
if (udev == NULL)
return NULL;
return udev->userdata;
@@ -97,8 +75,7 @@ _public_ void *udev_get_userdata(struct udev *udev)
*
* Store custom @userdata in the library context.
**/
-_public_ void udev_set_userdata(struct udev *udev, void *userdata)
-{
+_public_ void udev_set_userdata(struct udev *udev, void *userdata) {
if (udev == NULL)
return;
udev->userdata = userdata;
@@ -115,18 +92,14 @@ _public_ void udev_set_userdata(struct udev *udev, void *userdata)
*
* Returns: a new udev library context
**/
-_public_ struct udev *udev_new(void)
-{
+_public_ struct udev *udev_new(void) {
struct udev *udev;
- const char *env;
_cleanup_fclose_ FILE *f = NULL;
udev = new0(struct udev, 1);
if (udev == NULL)
return NULL;
udev->refcount = 1;
- udev->log_fn = log_stderr;
- udev->log_priority = LOG_INFO;
udev_list_init(udev, &udev->properties_list, true);
f = fopen("/etc/udev/udev.conf", "re");
@@ -153,7 +126,7 @@ _public_ struct udev *udev_new(void)
/* split key/value */
val = strchr(key, '=');
if (val == NULL) {
- udev_dbg(udev, "/etc/udev/udev.conf:%u: missing assignment, skipping line.\n", line_nr);
+ log_debug("/etc/udev/udev.conf:%u: missing assignment, skipping line.\n", line_nr);
continue;
}
val[0] = '\0';
@@ -185,7 +158,7 @@ _public_ struct udev *udev_new(void)
/* unquote */
if (val[0] == '"' || val[0] == '\'') {
if (val[len-1] != val[0]) {
- udev_dbg(udev, "/etc/udev/udev.conf:%u: inconsistent quoting, skipping line.\n", line_nr);
+ log_debug("/etc/udev/udev.conf:%u: inconsistent quoting, skipping line.\n", line_nr);
continue;
}
val[len-1] = '\0';
@@ -197,26 +170,14 @@ _public_ struct udev *udev_new(void)
prio = util_log_priority(val);
if (prio < 0)
- udev_dbg(udev, "/etc/udev/udev.conf:%u: invalid log level '%s', ignoring.\n", line_nr, val);
+ log_debug("/etc/udev/udev.conf:%u: invalid log level '%s', ignoring.\n", line_nr, val);
else
- udev_set_log_priority(udev, prio);
+ log_set_max_level(prio);
continue;
}
}
}
- /* environment overrides config */
- env = secure_getenv("UDEV_LOG");
- if (env != NULL) {
- int prio;
-
- prio = util_log_priority(env);
- if (prio < 0)
- udev_dbg(udev, "$UDEV_LOG specifies invalid log level '%s', ignoring.\n", env);
- else
- udev_set_log_priority(udev, prio);
- }
-
return udev;
}
@@ -228,8 +189,7 @@ _public_ struct udev *udev_new(void)
*
* Returns: the passed udev library context
**/
-_public_ struct udev *udev_ref(struct udev *udev)
-{
+_public_ struct udev *udev_ref(struct udev *udev) {
if (udev == NULL)
return NULL;
udev->refcount++;
@@ -245,8 +205,7 @@ _public_ struct udev *udev_ref(struct udev *udev)
*
* Returns: the passed udev library context if it has still an active reference, or #NULL otherwise.
**/
-_public_ struct udev *udev_unref(struct udev *udev)
-{
+_public_ struct udev *udev_unref(struct udev *udev) {
if (udev == NULL)
return NULL;
udev->refcount--;
@@ -262,31 +221,25 @@ _public_ struct udev *udev_unref(struct udev *udev)
* @udev: udev library context
* @log_fn: function to be called for log messages
*
- * The built-in logging writes to stderr. It can be
- * overridden by a custom function, to plug log messages
- * into the users' log functionality.
+ * This function is deprecated.
*
**/
_public_ void udev_set_log_fn(struct udev *udev,
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
- const char *format, va_list args))
-{
- udev->log_fn = log_fn;
- udev_dbg(udev, "custom log function %p registered\n", log_fn);
+ const char *format, va_list args)) {
+ return;
}
/**
* udev_get_log_priority:
* @udev: udev library context
*
- * The initial log level is read from the udev config file at startup.
+ * This function is deprecated.
*
- * Returns: the current log level
**/
-_public_ int udev_get_log_priority(struct udev *udev)
-{
- return udev->log_priority;
+_public_ int udev_get_log_priority(struct udev *udev) {
+ return log_get_max_level();
}
/**
@@ -294,19 +247,14 @@ _public_ int udev_get_log_priority(struct udev *udev)
* @udev: udev library context
* @priority: the new log priority
*
- * Set the log level. This value controls which messages are logged.
+ * This function is deprecated.
+ *
**/
-_public_ void udev_set_log_priority(struct udev *udev, int priority)
-{
- char num[32];
-
- udev->log_priority = priority;
- snprintf(num, sizeof(num), "%u", udev->log_priority);
- udev_add_property(udev, "UDEV_LOG", num);
+_public_ void udev_set_log_priority(struct udev *udev, int priority) {
+ log_set_max_level(priority);
}
-struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value)
-{
+struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) {
if (value == NULL) {
struct udev_list_entry *list_entry;
@@ -319,7 +267,6 @@ struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, co
return udev_list_entry_add(&udev->properties_list, key, value);
}
-struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev)
-{
+struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) {
return udev_list_get_entry(&udev->properties_list);
}
diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
index 4f2f11502c..a94505c09e 100644
--- a/src/libudev/libudev.h
+++ b/src/libudev/libudev.h
@@ -41,9 +41,9 @@ struct udev *udev_new(void);
void udev_set_log_fn(struct udev *udev,
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
- const char *format, va_list args));
-int udev_get_log_priority(struct udev *udev);
-void udev_set_log_priority(struct udev *udev, int priority);
+ const char *format, va_list args)) __attribute__ ((deprecated));
+int udev_get_log_priority(struct udev *udev) __attribute__ ((deprecated));
+void udev_set_log_priority(struct udev *udev, int priority) __attribute__ ((deprecated));
void *udev_get_userdata(struct udev *udev);
void udev_set_userdata(struct udev *udev, void *userdata);
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index a51814df95..293c151d42 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -34,14 +34,6 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-_printf_(6,0)
-static void log_fn(struct udev *udev,
- int priority, const char *file, int line, const char *fn,
- const char *format, va_list args) {
- printf("test-libudev: %s %s:%d ", fn, file, line);
- vprintf(format, args);
-}
-
static void print_device(struct udev_device *device) {
const char *str;
dev_t devnum;
@@ -431,9 +423,6 @@ int main(int argc, char *argv[]) {
printf("no context\n");
return 1;
}
- udev_set_log_fn(udev, log_fn);
- printf("set log: %p\n", log_fn);
-
while ((c = getopt_long(argc, argv, "p:s:dhV", options, NULL)) >= 0)
switch (c) {
@@ -447,8 +436,8 @@ int main(int argc, char *argv[]) {
break;
case 'd':
- if (udev_get_log_priority(udev) < LOG_INFO)
- udev_set_log_priority(udev, LOG_INFO);
+ if (log_get_max_level() < LOG_INFO)
+ log_set_max_level(LOG_INFO);
break;
case 'h':
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 4513bc63c2..dd4b7dc8a2 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -69,14 +69,6 @@
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
-_printf_(6,0)
-static void log_fn(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);
-}
-
typedef enum {
ORIENTATION_UNDEFINED,
ORIENTATION_NORMAL,
@@ -233,8 +225,6 @@ int main (int argc, char** argv)
if (udev == NULL)
return 1;
- udev_set_log_fn(udev, log_fn);
-
/* CLI argument parsing */
while (1) {
int option;
@@ -247,7 +237,6 @@ int main (int argc, char** argv)
case 'd':
log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
log_open();
break;
case 'h':
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index bfde57223a..0d56f9b09d 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -405,14 +405,6 @@ out:
return ret;
}
-_printf_(6,0)
-static void log_fn(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);
-}
-
int main(int argc, char *argv[])
{
struct udev *udev;
@@ -442,8 +434,6 @@ int main(int argc, char *argv[])
if (udev == NULL)
goto exit;
- udev_set_log_fn(udev, log_fn);
-
while (1) {
int option;
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 5fe3fb535b..48ceb657e0 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -37,14 +37,6 @@
#include "libudev.h"
#include "libudev-private.h"
-_printf_(6,0)
-static void log_fn(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);
-}
-
/* device info */
static unsigned int cd_cd_rom;
static unsigned int cd_cd_r;
@@ -875,8 +867,6 @@ int main(int argc, char *argv[])
if (udev == NULL)
goto exit;
- udev_set_log_fn(udev, log_fn);
-
while (1) {
int option;
@@ -897,7 +887,6 @@ int main(int argc, char *argv[])
case 'd':
log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
log_open();
break;
case 'h':
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 48c6cf7dba..1c269084aa 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -63,14 +63,6 @@ static char model_enc_str[256];
static char revision_str[16];
static char type_str[16];
-_printf_(6,0)
-static void log_fn(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 void set_type(const char *from, char *to, size_t len)
{
int type_num;
@@ -390,7 +382,6 @@ static int set_options(struct udev *udev,
case 'v':
log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
log_open();
break;
@@ -591,8 +582,6 @@ int main(int argc, char **argv)
if (udev == NULL)
goto exit;
- udev_set_log_fn(udev, log_fn);
-
/*
* Get config file options.
*/
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 30a6708901..5585b78cc3 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -676,7 +676,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;
@@ -689,14 +688,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");
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 7026c50d2b..daa9387bf1 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -98,7 +98,6 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
- udev_set_log_fn(udev, udev_main_log);
mac_selinux_init("/dev");
while ((c = getopt_long(argc, argv, "+dhV", options, NULL)) >= 0)
@@ -106,7 +105,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 a040529e6f..e03297de5b 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -644,7 +644,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);
}
@@ -984,7 +983,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)
@@ -1120,19 +1118,14 @@ int main(int argc, char *argv[]) {
log_parse_environment();
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");