summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-25 16:30:19 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-01-25 16:30:19 -0500
commitd98458c3c486f80dbf43287fb6b285d4e3806444 (patch)
treef9767be2886d7d338af2ed15e887dc05a0de1ce7 /src/udev
parent3bbbd500c9ae7afe80540e95d8b3dfc15e20c8e1 (diff)
Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable. Too bad. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-builtin-blkid.c2
-rw-r--r--src/udev/udev-builtin-input_id.c2
-rw-r--r--src/udev/udev-builtin-keyboard.c22
-rw-r--r--src/udev/udev-builtin-net_id.c8
-rw-r--r--src/udev/udev-ctrl.c4
-rw-r--r--src/udev/udev-event.c20
-rw-r--r--src/udev/udev-node.c2
-rw-r--r--src/udev/udevadm-hwdb.c2
-rw-r--r--src/udev/udevadm-info.c6
-rw-r--r--src/udev/udevd.c25
10 files changed, 47 insertions, 46 deletions
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 93563d867b..966c58f320 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -189,7 +189,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
if (err < 0)
goto out;
- log_debug("probe %s %sraid offset=%"PRIu64,
+ log_debug("probe %s %sraid offset=%"PRIi64,
udev_device_get_devnode(dev),
noraid ? "no" : "", offset);
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 26c723225d..46f1c539d2 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -111,7 +111,7 @@ static void get_cap_mask(struct udev_device *dev,
if (test) {
/* printf pattern with the right unsigned long number of hex chars */
- snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long));
+ snprintf(text, sizeof(text), " bit %%4u: %%0%zulX\n", 2 * sizeof(unsigned long));
log_debug("%s decoded bit map:", attr);
val = bitmask_size / sizeof (unsigned long);
/* skip over leading zeros */
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index 118e797c96..d8ee4cbb61 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -28,17 +28,17 @@
#include "udev.h"
-static const struct key *keyboard_lookup_key(const char *str, unsigned int len);
+static const struct key *keyboard_lookup_key(const char *str, unsigned len);
#include "keyboard-keys-from-name.h"
#include "keyboard-keys-to-name.h"
-static int install_force_release(struct udev_device *dev, const unsigned int *release, unsigned int release_count) {
+static int install_force_release(struct udev_device *dev, const unsigned *release, unsigned release_count) {
struct udev_device *atkbd;
const char *cur;
char codes[4096];
char *s;
size_t l;
- unsigned int i;
+ unsigned i;
int ret;
atkbd = udev_device_get_parent_with_subsystem_devtype(dev, "serio", NULL);
@@ -57,7 +57,7 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re
/* append new codes */
for (i = 0; i < release_count; i++)
- l = strpcpyf(&s, l, ",%d", release[i]);
+ l = strpcpyf(&s, l, ",%u", release[i]);
log_debug("keyboard: updating force-release list with '%s'", codes);
ret = udev_device_set_sysattr_value(atkbd, "force_release", codes);
@@ -69,16 +69,16 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re
static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], bool test) {
struct udev_list_entry *entry;
struct {
- unsigned int scan;
- unsigned int key;
+ unsigned scan;
+ unsigned key;
} map[1024];
- unsigned int map_count = 0;
- unsigned int release[1024];
- unsigned int release_count = 0;
+ unsigned map_count = 0;
+ unsigned release[1024];
+ unsigned release_count = 0;
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) {
const char *key;
- unsigned int scancode, keycode_num;
+ unsigned scancode, keycode_num;
char *endptr;
const char *keycode;
const struct key *k;
@@ -130,7 +130,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
if (map_count > 0 || release_count > 0) {
const char *node;
int fd;
- unsigned int i;
+ unsigned i;
node = udev_device_get_devnode(dev);
if (!node) {
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 5f350abd68..70ba06b297 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -191,12 +191,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
s = names->pci_path;
l = sizeof(names->pci_path);
if (domain > 0)
- l = strpcpyf(&s, l, "P%d", domain);
- l = strpcpyf(&s, l, "p%ds%d", bus, slot);
+ l = strpcpyf(&s, l, "P%u", domain);
+ l = strpcpyf(&s, l, "p%us%u", bus, slot);
if (func > 0 || is_pci_multifunction(names->pcidev))
- l = strpcpyf(&s, l, "f%d", func);
+ l = strpcpyf(&s, l, "f%u", func);
if (dev_port > 0)
- l = strpcpyf(&s, l, "d%d", dev_port);
+ l = strpcpyf(&s, l, "d%u", dev_port);
if (l == 0)
names->pci_path[0] = '\0';
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 898ef54514..2d8149e820 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -220,7 +220,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) {
goto err;
}
if (ucred.uid > 0) {
- log_error("sender uid=%i, message ignored", ucred.uid);
+ log_error("sender uid="UID_FMT", message ignored", ucred.uid);
goto err;
}
@@ -408,7 +408,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) {
}
if (cred->uid != 0) {
- log_error("sender uid=%i, message ignored", cred->uid);
+ log_error("sender uid="UID_FMT", message ignored", cred->uid);
goto err;
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 5c1352b1b9..ae645457ac 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -219,14 +219,14 @@ subst:
case SUBST_MAJOR: {
char num[UTIL_PATH_SIZE];
- sprintf(num, "%d", major(udev_device_get_devnum(dev)));
+ sprintf(num, "%u", major(udev_device_get_devnum(dev)));
l = strpcpy(&s, l, num);
break;
}
case SUBST_MINOR: {
char num[UTIL_PATH_SIZE];
- sprintf(num, "%d", minor(udev_device_get_devnum(dev)));
+ sprintf(num, "%u", minor(udev_device_get_devnum(dev)));
l = strpcpy(&s, l, num);
break;
}
@@ -510,7 +510,7 @@ static void spawn_read(struct udev_event *event,
memcpy(&result[respos], buf, count);
respos += count;
} else {
- log_error("'%s' ressize %zd too short", cmd, ressize);
+ log_error("'%s' ressize %zu too short", cmd, ressize);
}
}
@@ -581,7 +581,7 @@ static int spawn_wait(struct udev_event *event,
goto out;
}
if (fdcount == 0) {
- log_warning("slow: '%s' [%u]", cmd, pid);
+ log_warning("slow: '%s' ["PID_FMT"]", cmd, pid);
fdcount = poll(pfd, 1, timeout);
if (fdcount < 0) {
@@ -592,7 +592,7 @@ static int spawn_wait(struct udev_event *event,
goto out;
}
if (fdcount == 0) {
- log_error("timeout: killing '%s' [%u]", cmd, pid);
+ log_error("timeout: killing '%s' ["PID_FMT"]", cmd, pid);
kill(pid, SIGKILL);
}
}
@@ -614,20 +614,20 @@ static int spawn_wait(struct udev_event *event,
if (waitpid(pid, &status, WNOHANG) < 0)
break;
if (WIFEXITED(status)) {
- log_debug("'%s' [%u] exit with return code %i", cmd, pid, WEXITSTATUS(status));
+ log_debug("'%s' ["PID_FMT"] exit with return code %i", cmd, pid, WEXITSTATUS(status));
if (WEXITSTATUS(status) != 0)
err = -1;
} else if (WIFSIGNALED(status)) {
- log_error("'%s' [%u] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+ log_error("'%s' ["PID_FMT"] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
err = -1;
} else if (WIFSTOPPED(status)) {
- log_error("'%s' [%u] stopped", cmd, pid);
+ log_error("'%s' ["PID_FMT"] stopped", cmd, pid);
err = -1;
} else if (WIFCONTINUED(status)) {
- log_error("'%s' [%u] continued", cmd, pid);
+ log_error("'%s' ["PID_FMT"] continued", cmd, pid);
err = -1;
} else {
- log_error("'%s' [%u] exit with status 0x%04x", cmd, pid, status);
+ log_error("'%s' ["PID_FMT"] exit with status 0x%04x", cmd, pid, status);
err = -1;
}
pid = 0;
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index c30a428ea1..3ac6b9c11f 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -340,7 +340,7 @@ void udev_node_add(struct udev_device *dev, bool apply,
char filename[UTIL_PATH_SIZE];
struct udev_list_entry *list_entry;
- log_debug("handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d",
+ log_debug("handling device node '%s', devnum=%s, mode=%#o, uid="UID_FMT", gid="GID_FMT,
udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid);
if (node_permissions_apply(dev, apply, mode, uid, gid, seclabel_list) < 0)
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index a3f93ba343..9df0438353 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -407,7 +407,7 @@ static int trie_store(struct trie *trie, const char *filename) {
}
log_debug("=== trie on-disk ===");
- log_debug("size: %8"PRIu64" bytes", size);
+ log_debug("size: %8"PRIi64" bytes", size);
log_debug("header: %8zu bytes", sizeof(struct trie_header_f));
log_debug("nodes: %8"PRIu64" bytes (%8"PRIu64")",
t.nodes_count * sizeof(struct trie_node_f), t.nodes_count);
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index c845df7a23..48c0e79406 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -163,12 +163,12 @@ static int stat_device(const char *name, bool export, const char *prefix) {
if (export) {
if (prefix == NULL)
prefix = "INFO_";
- printf("%sMAJOR=%d\n"
- "%sMINOR=%d\n",
+ printf("%sMAJOR=%u\n"
+ "%sMINOR=%u\n",
prefix, major(statbuf.st_dev),
prefix, minor(statbuf.st_dev));
} else
- printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev));
+ printf("%u:%u\n", major(statbuf.st_dev), minor(statbuf.st_dev));
return 0;
}
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index e835bef8df..99b77c524b 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -156,7 +156,7 @@ static void worker_unref(struct worker *worker) {
worker->refcount--;
if (worker->refcount > 0)
return;
- log_debug("worker [%u] cleaned up", worker->pid);
+ log_debug("worker ["PID_FMT"] cleaned up", worker->pid);
worker_cleanup(worker);
}
@@ -404,7 +404,7 @@ out:
event->state = EVENT_RUNNING;
udev_list_node_append(&worker->node, &worker_list);
children++;
- log_debug("seq %llu forked new worker [%u]", udev_device_get_seqnum(event->dev), pid);
+ log_debug("seq %llu forked new worker ["PID_FMT"]", udev_device_get_seqnum(event->dev), pid);
break;
}
}
@@ -421,7 +421,8 @@ static void event_run(struct event *event) {
count = udev_monitor_send_device(monitor, worker->monitor, event->dev);
if (count < 0) {
- log_error_errno(errno, "worker [%u] did not accept message %zi (%m), kill it", worker->pid, count);
+ log_error_errno(errno, "worker ["PID_FMT"] did not accept message %zi (%m), kill it",
+ worker->pid, count);
kill(worker->pid, SIGKILL);
worker->state = WORKER_KILLED;
continue;
@@ -859,26 +860,26 @@ static void handle_signal(struct udev *udev, int signo) {
if (worker->pid != pid)
continue;
- log_debug("worker [%u] exit", pid);
+ log_debug("worker ["PID_FMT"] exit", pid);
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0)
- log_error("worker [%u] exit with return code %i",
+ log_error("worker ["PID_FMT"] exit with return code %i",
pid, WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
- log_error("worker [%u] terminated by signal %i (%s)",
+ log_error("worker ["PID_FMT"] terminated by signal %i (%s)",
pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
} else if (WIFSTOPPED(status)) {
- log_error("worker [%u] stopped", pid);
+ log_error("worker ["PID_FMT"] stopped", pid);
} else if (WIFCONTINUED(status)) {
- log_error("worker [%u] continued", pid);
+ log_error("worker ["PID_FMT"] continued", pid);
} else {
- log_error("worker [%u] exit with status 0x%04x", pid, status);
+ log_error("worker ["PID_FMT"] exit with status 0x%04x", pid, status);
}
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
if (worker->event) {
- log_error("worker [%u] failed while handling '%s'",
+ log_error("worker ["PID_FMT"] failed while handling '%s'",
pid, worker->event->devpath);
worker->event->exitcode = -32;
event_queue_delete(worker->event);
@@ -1423,7 +1424,7 @@ int main(int argc, char *argv[]) {
if ((ts - worker->event_start_usec) > arg_event_timeout_warn_usec) {
if ((ts - worker->event_start_usec) > arg_event_timeout_usec) {
- log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath);
+ log_error("worker ["PID_FMT"] %s timeout; kill it", worker->pid, worker->event->devpath);
kill(worker->pid, SIGKILL);
worker->state = WORKER_KILLED;
@@ -1434,7 +1435,7 @@ int main(int argc, char *argv[]) {
event_queue_delete(worker->event);
worker->event = NULL;
} else if (!worker->event_warned) {
- log_warning("worker [%u] %s is taking a long time", worker->pid, worker->event->devpath);
+ log_warning("worker ["PID_FMT"] %s is taking a long time", worker->pid, worker->event->devpath);
worker->event_warned = true;
}
}