diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-20 22:22:15 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-22 01:14:52 -0500 |
commit | 1fa2f38f0f011010bf57522b42fcc168856a7003 (patch) | |
tree | 7bd1a23716379826ef6cd37f98c2f02470a2d5c4 /src/udev | |
parent | 8facc3498ed037f842891ff55d1f60fe834f4ba0 (diff) |
Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-blkid.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-input_id.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-keyboard.c | 22 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 8 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 4 | ||||
-rw-r--r-- | src/udev/udev-event.c | 20 | ||||
-rw-r--r-- | src/udev/udev-node.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-info.c | 6 | ||||
-rw-r--r-- | src/udev/udevd.c | 25 |
10 files changed, 47 insertions, 46 deletions
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 548985ef70..03e3dc2867 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -273,7 +273,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 2e08467019..c310111eb9 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 9cece4a85d..538b342865 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -198,7 +198,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; } @@ -386,7 +386,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 6b184303d8..beb09439c7 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -218,14 +218,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; } @@ -509,7 +509,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); } } @@ -580,7 +580,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) { @@ -591,7 +591,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); } } @@ -613,20 +613,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 499feefceb..793b48469d 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -341,7 +341,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 7a2114a3a1..d65e40c011 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -401,7 +401,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 f52a03dfd0..0bab01a234 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -162,12 +162,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 009e39523c..009e2fed75 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -158,7 +158,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); } @@ -414,7 +414,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; } } @@ -431,7 +431,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; @@ -869,26 +870,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); @@ -1409,7 +1410,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; @@ -1420,7 +1421,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; } } |