summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-device-private.c4
-rw-r--r--src/libudev/libudev-device.c10
-rw-r--r--src/libudev/libudev-monitor.c28
-rw-r--r--src/libudev/libudev-private.h6
-rw-r--r--src/libudev/libudev-queue-private.c8
-rw-r--r--src/libudev/libudev-queue.c4
-rw-r--r--src/libudev/libudev-util.c12
-rw-r--r--src/libudev/libudev.c6
8 files changed, 39 insertions, 39 deletions
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index 2c50e174c6..234773662b 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -122,7 +122,7 @@ int udev_device_update_db(struct udev_device *udev_device)
mkdir_parents(filename_tmp, 0755);
f = fopen(filename_tmp, "we");
if (f == NULL) {
- err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp);
+ udev_err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp);
return -1;
}
@@ -162,7 +162,7 @@ int udev_device_update_db(struct udev_device *udev_device)
fclose(f);
rename(filename_tmp, filename);
- dbg(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
+ udev_dbg(udev, "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 97cf6654ee..9ef4610a6a 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -485,7 +485,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
f = fopen(dbfile, "re");
if (f == NULL) {
- dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
+ udev_dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
return -1;
}
udev_device->is_initialized = true;
@@ -525,7 +525,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
}
fclose(f);
- dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
+ udev_dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
return 0;
}
@@ -643,7 +643,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
/* path starts in sys */
if (!startswith(syspath, TEST_PREFIX "/sys")) {
- dbg(udev, "not in sys :%s\n", syspath);
+ udev_dbg(udev, "not in sys :%s\n", syspath);
return NULL;
}
@@ -675,7 +675,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
udev_device_set_syspath(udev_device, path);
- dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
+ udev_dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
return udev_device;
}
@@ -877,7 +877,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) {
- dbg(udev, "missing values, invalid device\n");
+ udev_dbg(udev, "missing values, invalid device\n");
udev_device_unref(udev_device);
udev_device = NULL;
}
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 73a9c48993..5f448e6d47 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -109,7 +109,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
_public_ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path)
{
- err(udev, "udev_monitor_new_from_socket() does not do anything; please migrate to netlink\n");
+ udev_err(udev, "udev_monitor_new_from_socket() does not do anything; please migrate to netlink\n");
errno = ENOSYS;
return NULL;
}
@@ -138,7 +138,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) {
- err(udev, "error getting socket: %m\n");
+ udev_err(udev, "error getting socket: %m\n");
free(udev_monitor);
return NULL;
}
@@ -358,7 +358,7 @@ _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 {
- err(udev_monitor->udev, "bind failed: %m\n");
+ udev_err(udev_monitor->udev, "bind failed: %m\n");
return err;
}
@@ -547,12 +547,12 @@ retry:
buflen = recvmsg(udev_monitor->sock, &smsg, 0);
if (buflen < 0) {
if (errno != EINTR)
- dbg(udev_monitor->udev, "unable to receive message\n");
+ udev_dbg(udev_monitor->udev, "unable to receive message\n");
return NULL;
}
if (buflen < 32 || (size_t)buflen >= sizeof(buf)) {
- dbg(udev_monitor->udev, "invalid message length\n");
+ udev_dbg(udev_monitor->udev, "invalid message length\n");
return NULL;
}
@@ -561,12 +561,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) {
- dbg(udev_monitor->udev, "unicast netlink message ignored\n");
+ udev_dbg(udev_monitor->udev, "unicast netlink message ignored\n");
return NULL;
}
} else if (snl.nl.nl_groups == UDEV_MONITOR_KERNEL) {
if (snl.nl.nl_pid > 0) {
- dbg(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
+ udev_dbg(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
snl.nl.nl_pid);
return NULL;
}
@@ -575,13 +575,13 @@ retry:
cmsg = CMSG_FIRSTHDR(&smsg);
if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
- dbg(udev_monitor->udev, "no sender credentials received, message ignored\n");
+ udev_dbg(udev_monitor->udev, "no sender credentials received, message ignored\n");
return NULL;
}
cred = (struct ucred *)CMSG_DATA(cmsg);
if (cred->uid != 0) {
- dbg(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
+ udev_dbg(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
return NULL;
}
@@ -589,7 +589,7 @@ retry:
/* udev message needs proper version magic */
nlh = (struct udev_monitor_netlink_header *) buf;
if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) {
- err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n",
+ udev_err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n",
nlh->magic, htonl(UDEV_MONITOR_MAGIC));
return NULL;
}
@@ -600,13 +600,13 @@ retry:
/* kernel message with header */
bufpos = strlen(buf) + 1;
if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) {
- dbg(udev_monitor->udev, "invalid message length\n");
+ udev_dbg(udev_monitor->udev, "invalid message length\n");
return NULL;
}
/* check message header */
if (strstr(buf, "@/") == NULL) {
- dbg(udev_monitor->udev, "unrecognized message header\n");
+ udev_dbg(udev_monitor->udev, "unrecognized message header\n");
return NULL;
}
}
@@ -629,7 +629,7 @@ retry:
}
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
- dbg(udev_monitor->udev, "missing values, invalid device\n");
+ udev_dbg(udev_monitor->udev, "missing values, invalid device\n");
udev_device_unref(udev_device);
return NULL;
}
@@ -716,7 +716,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);
- dbg(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor);
+ udev_dbg(udev_monitor->udev, "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 eb2657a74e..4eb4a598e0 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -36,9 +36,9 @@
udev_log(udev, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \
} while (0)
-#define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg)
-#define info(udev, arg...) udev_log_cond(udev, LOG_INFO, ## arg)
-#define err(udev, arg...) udev_log_cond(udev, LOG_ERR, ## arg)
+#define udev_dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg)
+#define udev_info(udev, arg...) udev_log_cond(udev, LOG_INFO, ## arg)
+#define udev_err(udev, arg...) udev_log_cond(udev, LOG_ERR, ## arg)
/* libudev.c */
void udev_log(struct udev *udev,
diff --git a/src/libudev/libudev-queue-private.c b/src/libudev/libudev-queue-private.c
index f653e6db4c..3df99bef3a 100644
--- a/src/libudev/libudev-queue-private.c
+++ b/src/libudev/libudev-queue-private.c
@@ -151,7 +151,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e
/* allocate the table */
range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max;
if (range - 1 > INT_MAX) {
- err(udev_queue_export->udev, "queue file overflow\n");
+ udev_err(udev_queue_export->udev, "queue file overflow\n");
return NULL;
}
devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long));
@@ -188,7 +188,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e
return devpaths;
read_error:
- err(udev_queue_export->udev, "queue file corrupted\n");
+ udev_err(udev_queue_export->udev, "queue file corrupted\n");
free(devpaths);
return NULL;
}
@@ -256,7 +256,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export)
return 0;
error:
- err(udev_queue_export->udev, "failed to create queue file: %m\n");
+ udev_err(udev_queue_export->udev, "failed to create queue file: %m\n");
udev_queue_export_cleanup(udev_queue_export);
if (udev_queue_export->queue_file != NULL) {
@@ -303,7 +303,7 @@ static int write_queue_record(struct udev_queue_export *udev_queue_export,
write_error:
/* if we failed half way through writing a record to a file,
we should not try to write any further records to it. */
- err(udev_queue_export->udev, "error writing to queue file: %m\n");
+ udev_err(udev_queue_export->udev, "error writing to queue file: %m\n");
fclose(udev_queue_export->queue_file);
udev_queue_export->queue_file = NULL;
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index e2e6319188..81f40db208 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -216,7 +216,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i
return NULL;
if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) {
- err(udev_queue->udev, "corrupt queue file\n");
+ udev_err(udev_queue->udev, "corrupt queue file\n");
fclose(queue_file);
return NULL;
}
@@ -473,7 +473,7 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu
struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
_public_ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
{
- err(udev_queue->udev, "udev_queue_get_failed_list_entry() does not return anything; failed events are not recorded\n");
+ udev_err(udev_queue->udev, "udev_queue_get_failed_list_entry() does not return anything; failed events are not recorded\n");
errno = ENOSYS;
return NULL;
}
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 944d9dfcbb..8e6d5b621d 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -85,9 +85,9 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
if (pw != NULL)
return pw->pw_uid;
if (errno == 0 || errno == ENOENT || errno == ESRCH)
- err(udev, "specified user '%s' unknown\n", user);
+ udev_err(udev, "specified user '%s' unknown\n", user);
else
- err(udev, "error resolving user '%s': %m\n", user);
+ udev_err(udev, "error resolving user '%s': %m\n", user);
return 0;
}
@@ -120,9 +120,9 @@ gid_t util_lookup_group(struct udev *udev, const char *group)
buflen *= 2;
continue;
} else if (errno == 0 || errno == ENOENT || errno == ESRCH) {
- err(udev, "specified group '%s' unknown\n", group);
+ udev_err(udev, "specified group '%s' unknown\n", group);
} else {
- err(udev, "error resolving group '%s': %m\n", group);
+ udev_err(udev, "error resolving group '%s': %m\n", group);
}
break;
}
@@ -178,7 +178,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
util_strscpy(result, maxsize, val);
else
result[0] = '\0';
- dbg(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
+ udev_dbg(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
} else {
size_t l;
char *s;
@@ -187,7 +187,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL);
if (attr != NULL)
util_strpcpyl(&s, l, "/", attr, NULL);
- dbg(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
+ udev_dbg(udev, "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 212c5fdd75..a0ec39d027 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -143,7 +143,7 @@ _public_ struct udev *udev_new(void)
/* split key/value */
val = strchr(key, '=');
if (val == NULL) {
- err(udev, "missing <key>=<value> in " SYSCONFDIR "/udev/udev.conf[%i]; skip line\n", line_nr);
+ udev_err(udev, "missing <key>=<value> in " SYSCONFDIR "/udev/udev.conf[%i]; skip line\n", line_nr);
continue;
}
val[0] = '\0';
@@ -175,7 +175,7 @@ _public_ struct udev *udev_new(void)
/* unquote */
if (val[0] == '"' || val[0] == '\'') {
if (val[len-1] != val[0]) {
- err(udev, "inconsistent quoting in " SYSCONFDIR "/udev/udev.conf[%i]; skip line\n", line_nr);
+ udev_err(udev, "inconsistent quoting in " SYSCONFDIR "/udev/udev.conf[%i]; skip line\n", line_nr);
continue;
}
val[len-1] = '\0';
@@ -249,7 +249,7 @@ _public_ void udev_set_log_fn(struct udev *udev,
const char *format, va_list args))
{
udev->log_fn = log_fn;
- dbg(udev, "custom logging function %p registered\n", log_fn);
+ udev_dbg(udev, "custom logging function %p registered\n", log_fn);
}
/**