Commit baa30fbc authored by Kay Sievers's avatar Kay Sievers

udev: switch to systemd logging functions

parent 64661ee7
......@@ -1297,7 +1297,8 @@ udevd_CFLAGS = \
$(udev_common_CFLAGS)
udevd_LDADD = \
$(udev_common_LDADD)
$(udev_common_LDADD) \
libsystemd-basic.la
udevd_CPPFLAGS = \
$(udev_common_CPPFLAGS)
......@@ -1317,7 +1318,8 @@ udevadm_CFLAGS = \
$(udev_common_CFLAGS)
udevadm_LDADD = \
$(udev_common_LDADD)
$(udev_common_LDADD) \
libsystemd-basic.la
udevadm_CPPFLAGS = \
$(udev_common_CPPFLAGS)
......@@ -1371,7 +1373,8 @@ ata_id_SOURCES = \
src/udev/ata_id/ata_id.c
ata_id_LDADD = \
libudev-private.la
libudev-private.la \
libsystemd-basic.la
udevlibexec_PROGRAMS += \
ata_id
......@@ -1381,7 +1384,8 @@ cdrom_id_SOURCES = \
src/udev/cdrom_id/cdrom_id.c
cdrom_id_LDADD = \
libudev-private.la
libudev-private.la \
libsystemd-basic.la
udevlibexec_PROGRAMS += \
cdrom_id
......@@ -1407,7 +1411,8 @@ scsi_id_SOURCES =\
src/udev/scsi_id/scsi_id.h
scsi_id_LDADD = \
libudev-private.la
libudev-private.la \
libsystemd-basic.la
udevlibexec_PROGRAMS += \
scsi_id
......@@ -1433,7 +1438,8 @@ accelerometer_SOURCES = \
src/udev/accelerometer/accelerometer.c
accelerometer_LDADD = \
libudev-private.la -lm
libudev-private.la -lm \
libsystemd-basic.la
udevlibexec_PROGRAMS += \
accelerometer
......
Bugfixes:
* do not link selinux and attr against all binaries
* swap units that are activated by one name but shown in the kernel under another are semi-broken
......
......@@ -263,7 +263,7 @@ int main (int argc, char** argv)
if (udev == NULL)
return 1;
udev_log_init("input_id");
log_open();
udev_set_log_fn(udev, log_fn);
/* CLI argument parsing */
......@@ -349,9 +349,9 @@ int main (int argc, char** argv)
return 0;
}
info(udev, "Opening accelerometer device %s\n", devnode);
log_debug("opening accelerometer device %s\n", devnode);
test_orientation(udev, dev, devnode);
free(devnode);
log_close();
return 0;
}
......@@ -43,6 +43,7 @@
#include "libudev.h"
#include "libudev-private.h"
#include "log.h"
#define COMMAND_TIMEOUT_MSEC (30 * 1000)
......@@ -462,7 +463,7 @@ int main(int argc, char *argv[])
if (udev == NULL)
goto exit;
udev_log_init("ata_id");
log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
......@@ -486,14 +487,14 @@ int main(int argc, char *argv[])
node = argv[optind];
if (node == NULL) {
err(udev, "no node specified\n");
log_error("no node specified\n");
rc = 1;
goto exit;
}
fd = open(node, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
err(udev, "unable to open '%s'\n", node);
log_error("unable to open '%s'\n", node);
rc = 1;
goto exit;
}
......@@ -525,7 +526,7 @@ int main(int argc, char *argv[])
} else {
/* If this fails, then try HDIO_GET_IDENTITY */
if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
info(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node);
log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
rc = 2;
goto close;
}
......@@ -709,6 +710,6 @@ close:
close(fd);
exit:
udev_unref(udev);
udev_log_close();
log_close();
return rc;
}
This diff is collapsed.
......@@ -165,7 +165,7 @@ int udev_device_update_db(struct udev_device *udev_device)
fclose(f);
rename(filename_tmp, filename);
info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
dbg(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
filename, udev_device_get_devpath(udev_device));
return 0;
}
......
......@@ -479,7 +479,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
f = fopen(dbfile, "re");
if (f == NULL) {
info(udev_device->udev, "no db file to read %s: %m\n", dbfile);
dbg(udev_device->udev, "no db file to read %s: %m\n", dbfile);
return -1;
}
udev_device->is_initialized = true;
......@@ -519,7 +519,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
}
fclose(f);
info(udev_device->udev, "device %p filled with db file data\n", udev_device);
dbg(udev_device->udev, "device %p filled with db file data\n", udev_device);
return 0;
}
......@@ -605,7 +605,6 @@ struct udev_device *udev_device_new(struct udev *udev)
udev_device_add_property(udev_device,
udev_list_entry_get_name(list_entry),
udev_list_entry_get_value(list_entry));
dbg(udev_device->udev, "udev_device: %p created\n", udev_device);
return udev_device;
}
......@@ -640,17 +639,15 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
/* path starts in sys */
len = strlen(udev_get_sys_path(udev));
if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) {
info(udev, "not in sys :%s\n", syspath);
dbg(udev, "not in sys :%s\n", syspath);
return NULL;
}
/* path is not a root directory */
subdir = &syspath[len+1];
pos = strrchr(subdir, '/');
if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
dbg(udev, "not a subdir :%s\n", syspath);
if (pos == NULL || pos[1] == '\0' || pos < &subdir[2])
return NULL;
}
/* resolve possible symlink to real path */
util_strscpy(path, sizeof(path), syspath);
......@@ -661,16 +658,12 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
/* all "devices" require a "uevent" file */
util_strscpyl(file, sizeof(file), path, "/uevent", NULL);
if (stat(file, &statbuf) != 0) {
dbg(udev, "not a device: %s\n", syspath);
if (stat(file, &statbuf) != 0)
return NULL;
}
} else {
/* everything else just needs to be a directory */
if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
dbg(udev, "directory not found: %s\n", syspath);
if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
return NULL;
}
}
udev_device = udev_device_new(udev);
......@@ -678,7 +671,7 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
udev_device_set_syspath(udev_device, path);
info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
dbg(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device));
return udev_device;
}
......@@ -885,7 +878,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) {
info(udev, "missing values, invalid device\n");
dbg(udev, "missing values, invalid device\n");
udev_device_unref(udev_device);
udev_device = NULL;
}
......@@ -942,8 +935,6 @@ _public_ struct udev_device *udev_device_get_parent(struct udev_device *udev_dev
udev_device->parent_set = true;
udev_device->parent_device = device_new_from_parent(udev_device);
}
if (udev_device->parent_device != NULL)
dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device);
return udev_device->parent_device;
}
......@@ -1058,7 +1049,6 @@ _public_ void udev_device_unref(struct udev_device *udev_device)
free(udev_device->id_filename);
free(udev_device->envp);
free(udev_device->monitor_buf);
dbg(udev_device->udev, "udev_device: %p released\n", udev_device);
free(udev_device);
}
......@@ -1310,15 +1300,11 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi
/* look for possibly already cached result */
list_entry = udev_list_get_entry(&udev_device->sysattr_value_list);
list_entry = udev_list_entry_get_by_name(list_entry, sysattr);
if (list_entry != NULL) {
dbg(udev_device->udev, "got '%s' (%s) from cache\n",
sysattr, udev_list_entry_get_value(list_entry));
if (list_entry != NULL)
return udev_list_entry_get_value(list_entry);
}
util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL);
if (lstat(path, &statbuf) != 0) {
dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path);
udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL);
goto out;
}
......@@ -1336,7 +1322,6 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi
if (util_get_sys_core_link_value(udev_device->udev, sysattr,
udev_device->syspath, value, sizeof(value)) < 0)
return NULL;
dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value);
list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value);
val = udev_list_entry_get_value(list_entry);
goto out;
......@@ -1365,10 +1350,8 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi
/* read attribute value */
fd = open(path, O_RDONLY|O_CLOEXEC);
if (fd < 0) {
dbg(udev_device->udev, "attribute '%s' can not be opened\n", path);
if (fd < 0)
goto out;
}
size = read(fd, value, sizeof(value));
close(fd);
if (size < 0)
......@@ -1379,7 +1362,6 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi
/* got a valid value, store it in cache and return it */
value[size] = '\0';
util_remove_trailing_chars(value, '\n');
dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value);
list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value);
val = udev_list_entry_get_value(list_entry);
out:
......@@ -1398,11 +1380,8 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device)
return 0;
dir = opendir(udev_device_get_syspath(udev_device));
if (!dir) {
dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n",
udev_device_get_syspath(udev_device));
if (!dir)
return -1;
}
for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
char path[UTIL_PATH_SIZE];
......@@ -1423,7 +1402,6 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device)
}
closedir(dir);
dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device));
udev_device->sysattr_list_read = true;
return num;
......@@ -1675,8 +1653,6 @@ static int update_envp_monitor_buf(struct udev_device *udev_device)
udev_device->envp[i] = NULL;
udev_device->monitor_buf_len = s - udev_device->monitor_buf;
udev_device->envp_uptodate = true;
dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n",
i, udev_device->monitor_buf_len);
return 0;
}
......
......@@ -209,10 +209,8 @@ static bool devices_delay_end(struct udev *udev, const char *syspath)
len = strlen(udev_get_sys_path(udev));
for (i = 0; delay_device_list[i] != NULL; i++) {
if (strstr(&syspath[len], delay_device_list[i]) != NULL) {
dbg(udev, "delaying: %s\n", syspath);
if (strstr(&syspath[len], delay_device_list[i]) != NULL)
return true;
}
}
return false;
}
......@@ -870,12 +868,9 @@ static int scan_devices_all(struct udev_enumerate *udev_enumerate)
util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL);
if (stat(base, &statbuf) == 0) {
/* we have /subsystem/, forget all the old stuff */
dbg(udev, "searching '/subsystem/*/devices/*' dir\n");
scan_dir(udev_enumerate, "subsystem", "devices", NULL);
} else {
dbg(udev, "searching '/bus/*/devices/*' dir\n");
scan_dir(udev_enumerate, "bus", "devices", NULL);
dbg(udev, "searching '/class/*' dir\n");
scan_dir(udev_enumerate, "class", NULL, NULL);
}
return 0;
......@@ -921,10 +916,8 @@ _public_ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerat
return -EINVAL;
/* all kernel modules */
if (match_subsystem(udev_enumerate, "module")) {
dbg(udev, "searching 'modules/*' dir\n");
if (match_subsystem(udev_enumerate, "module"))
scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL);
}
util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL);
if (stat(base, &statbuf) == 0)
......@@ -933,15 +926,11 @@ _public_ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerat
subsysdir = "bus";
/* all subsystems (only buses support coldplug) */
if (match_subsystem(udev_enumerate, "subsystem")) {
dbg(udev, "searching '%s/*' dir\n", subsysdir);
if (match_subsystem(udev_enumerate, "subsystem"))
scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL);
}
/* all subsystem drivers */
if (match_subsystem(udev_enumerate, "drivers")) {
dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir);
if (match_subsystem(udev_enumerate, "drivers"))
scan_dir(udev_enumerate, subsysdir, "drivers", "drivers");
}
return 0;
}
......@@ -148,17 +148,14 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
if (i >= 0) {
entry = list->entries[i];
dbg(list->udev, "'%s' is already in the list\n", name);
free(entry->value);
if (value == NULL) {
entry->value = NULL;
dbg(list->udev, "'%s' value unset\n", name);
return entry;
}
entry->value = strdup(value);
if (entry->value == NULL)
return NULL;
dbg(list->udev, "'%s' value replaced with '%s'\n", name, value);
return entry;
}
}
......@@ -216,7 +213,6 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
udev_list_entry_append(entry, list);
}
dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value);
return entry;
}
......
......@@ -157,7 +157,6 @@ _public_ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, co
return NULL;
}
dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path);
return udev_monitor;
}
......@@ -201,7 +200,6 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
udev_monitor->snl_destination.nl_family = AF_NETLINK;
udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV;
dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group);
return udev_monitor;
}
......@@ -485,7 +483,6 @@ _public_ void udev_monitor_unref(struct udev_monitor *udev_monitor)
close(udev_monitor->sock);
udev_list_cleanup(&udev_monitor->filter_subsystem_list);
udev_list_cleanup(&udev_monitor->filter_tag_list);
dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor);
free(udev_monitor);
}
......@@ -604,12 +601,12 @@ retry:
buflen = recvmsg(udev_monitor->sock, &smsg, 0);
if (buflen < 0) {
if (errno != EINTR)
info(udev_monitor->udev, "unable to receive message\n");
dbg(udev_monitor->udev, "unable to receive message\n");
return NULL;
}
if (buflen < 32 || (size_t)buflen >= sizeof(buf)) {
info(udev_monitor->udev, "invalid message length\n");
dbg(udev_monitor->udev, "invalid message length\n");
return NULL;
}
......@@ -618,12 +615,12 @@ retry:
/* unicast message, check if we trust the sender */
if (udev_monitor->snl_trusted_sender.nl_pid == 0 ||
snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) {
info(udev_monitor->udev, "unicast netlink message ignored\n");
dbg(udev_monitor->udev, "unicast netlink message ignored\n");
return NULL;
}
} else if (snl.nl_groups == UDEV_MONITOR_KERNEL) {
if (snl.nl_pid > 0) {
info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
dbg(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
snl.nl_pid);
return NULL;
}
......@@ -632,13 +629,13 @@ retry:
cmsg = CMSG_FIRSTHDR(&smsg);
if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
info(udev_monitor->udev, "no sender credentials received, message ignored\n");
dbg(udev_monitor->udev, "no sender credentials received, message ignored\n");
return NULL;
}
cred = (struct ucred *)CMSG_DATA(cmsg);
if (cred->uid != 0) {
info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
dbg(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
return NULL;
}
......@@ -657,13 +654,13 @@ retry:
/* kernel message with header */
bufpos = strlen(buf) + 1;
if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) {
info(udev_monitor->udev, "invalid message length\n");
dbg(udev_monitor->udev, "invalid message length\n");
return NULL;
}
/* check message header */
if (strstr(buf, "@/") == NULL) {
info(udev_monitor->udev, "unrecognized message header\n");
dbg(udev_monitor->udev, "unrecognized message header\n");
return NULL;
}
}
......@@ -686,7 +683,7 @@ retry:
}
if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) {
info(udev_monitor->udev, "missing values, invalid device\n");
dbg(udev_monitor->udev, "missing values, invalid device\n");
udev_device_unref(udev_device);
return NULL;
}
......@@ -748,7 +745,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
smsg.msg_name = &udev_monitor->sun;
smsg.msg_namelen = udev_monitor->addrlen;
count = sendmsg(udev_monitor->sock, &smsg, 0);
info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor);
dbg(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor);
return count;
}
......@@ -803,7 +800,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);
info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor);
dbg(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor);
return count;
}
......
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008-2010 Kay Sievers <kay.sievers@vrfy.org>
* Copyright (C) 2008-2012 Kay Sievers <kay.sievers@vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -20,36 +20,20 @@
#include "libudev.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define READ_END 0
#define WRITE_END 1
static inline void __attribute__((always_inline, format(printf, 2, 3)))
udev_log_null(struct udev *udev, const char *format, ...) {}
#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)
#ifdef ENABLE_DEBUG
# define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg)
#else
# define dbg(udev, arg...) udev_log_null(udev, ## arg)
#endif
#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)
static inline void udev_log_init(const char *program_name)
{
openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON);
}
static inline void udev_log_close(void)
{
closelog();
}
/* libudev.c */
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
......
......@@ -208,15 +208,11 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export)
/* read old queue file */
if (udev_queue_export->queue_file != NULL) {
dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n",
udev_queue_export->waste_bytes);
devpaths = build_index(udev_queue_export);
if (devpaths != NULL)
udev_queue_export->seqnum_max += devpaths->devpaths_first;
}
if (devpaths == NULL) {
dbg(udev_queue_export->udev, "creating empty queue file\n");
udev_queue_export->queued_count = 0;
udev_queue_export->seqnum_max = udev_queue_export->seqnum_min;
}
......@@ -292,10 +288,8 @@ static int write_queue_record(struct udev_queue_export *udev_queue_export,
{
unsigned short len;
if (udev_queue_export->queue_file == NULL) {
dbg(udev_queue_export->udev, "can't record event: queue file not available\n");
if (udev_queue_export->queue_file == NULL)
return -1;
}
if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1)
goto write_error;
......
......@@ -154,7 +154,6 @@ _public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *
return -EINVAL;
seqnum = udev_get_kernel_seqnum(udev_queue->udev);
dbg(udev_queue->udev, "seqnum=%llu\n", seqnum);
return seqnum;
}
......@@ -314,19 +313,13 @@ _public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
}
}
if (queued > 0) {
dbg(udev_queue->udev, "queue is not empty\n");
if (queued > 0)
goto out;
}
seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue);
if (seqnum_udev < seqnum_kernel) {
dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n",
seqnum_kernel, seqnum_udev);
if (seqnum_udev < seqnum_kernel)
goto out;
}
dbg(udev_queue->udev, "queue is empty\n");
is_empty = 1;
out:
......@@ -409,7 +402,6 @@ _public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, un
if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum))
return 0;
dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum);
return 1;
}
......
......@@ -26,7 +26,7 @@ void udev_selinux_init(struct udev *udev)
{
/* record the present security context */
selinux_enabled = (is_selinux_enabled() > 0);
info(udev, "selinux=%i\n", selinux_enabled);
dbg(udev, "selinux=%i\n", selinux_enabled);
if (!selinux_enabled)
return;
matchpathcon_init_prefix(NULL, udev_get_dev_path(udev));
......
......@@ -41,7 +41,6 @@ static int create_path(struct udev *udev, const char *path, bool selinux)
return 0;
pos[0] = '\0';
dbg(udev, "stat '%s'\n", p);
if (stat(p, &stats) == 0) {
if ((stats.st_mode & S_IFMT) == S_IFDIR)
return 0;
......@@ -53,7 +52,6 @@ static int create_path(struct udev *udev, const char *path, bool selinux)
if (err != 0)
return err;
dbg(udev, "mkdir '%s'\n", p);
if (selinux)
udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755);
err = mkdir(p, 0755);
......@@ -226,7 +224,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
util_strscpy(result, maxsize, val);
else
result[0] = '\0';
info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
dbg(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
} else {
size_t l;
char *s;
......@@ -235,7 +233,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);
info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
dbg(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result);
}
udev_device_unref(dev);
return 0;
......
......@@ -45,7 +45,6 @@ ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const
if (pos == NULL)
return -1;
pos = &pos[1];
dbg(udev, "resolved link to: '%s'\n", pos);
return util_strscpy(value, size, pos);
}
......@@ -62,11 +61,9 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
if (len <= 0 || len == (ssize_t)sizeof(link_target))
return -1;
link_target[len] = '\0';
dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target);
for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++)
;
dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back);
for (i = 0; i <= back; i++) {