summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-07-12 08:00:00 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-07-12 08:00:00 +0000
commit10c8c42b07061b1720403931b8c8d8942ce715a7 (patch)
tree4bb69ec39d62eeb31970794339d963c5156ec894
parentfc4f6d65cb25197f8582d09924579812e8a9fd9b (diff)
downloadstrace-10c8c42b07061b1720403931b8c8d8942ce715a7.tar.gz
evdev: use print_fields.h macros
* evdev.c (abs_ioctl, keycode_V2_ioctl): Use PRINT_FIELD_* macros from print_fields.h.
-rw-r--r--evdev.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/evdev.c b/evdev.c
index e79e157a9..1d4e9aef3 100644
--- a/evdev.c
+++ b/evdev.c
@@ -76,27 +76,21 @@ abs_ioctl(struct tcb *const tcp, const unsigned int code,
if (umoven_or_printaddr(tcp, arg, read_sz, &absinfo))
return RVAL_IOCTL_DECODED;
- tprintf("{value=%u"
- ", minimum=%u, ",
- absinfo.value,
- absinfo.minimum);
+ PRINT_FIELD_U("{", absinfo, value);
+ PRINT_FIELD_U(", ", absinfo, minimum);
if (!abbrev(tcp)) {
- tprintf("maximum=%u"
- ", fuzz=%u"
- ", flat=%u",
- absinfo.maximum,
- absinfo.fuzz,
- absinfo.flat);
- if (sz >= res_sz) {
- tprintf(", resolution=%u%s",
- absinfo.resolution,
- sz > res_sz ? ", ..." : "");
- } else if (sz > orig_sz) {
- tprints(", ...");
+ PRINT_FIELD_U(", ", absinfo, maximum);
+ PRINT_FIELD_U(", ", absinfo, fuzz);
+ PRINT_FIELD_U(", ", absinfo, flat);
+ if (sz > orig_sz) {
+ if (sz >= res_sz)
+ PRINT_FIELD_U(", ", absinfo, resolution);
+ if (sz != res_sz)
+ tprints(", ...");
}
} else {
- tprints("...");
+ tprints(", ...");
}
tprints("}");
@@ -130,17 +124,15 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
if (umove_or_printaddr(tcp, arg, &ike))
return RVAL_IOCTL_DECODED;
- tprintf("{flags=%" PRIu8
- ", len=%" PRIu8 ", ",
- ike.flags,
- ike.len);
+ PRINT_FIELD_U("{", ike, flags);
+ PRINT_FIELD_U(", ", ike, len);
if (!abbrev(tcp)) {
- tprintf("index=%" PRIu16 ", keycode=", ike.index);
- printxval(evdev_keycode, ike.keycode, "KEY_???");
+ PRINT_FIELD_U(", ", ike, index);
+ PRINT_FIELD_XVAL(", ", ike, keycode, evdev_keycode, "KEY_???");
PRINT_FIELD_X_ARRAY(", ", ike, scancode);
} else {
- tprints("...");
+ tprints(", ...");
}
tprints("}");