From c468637dba25c2b8021ec0cfb8d20dd3ec0c5df3 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 14 Jul 2017 00:08:09 +0000 Subject: [PATCH] dm: use PRINT_FIELD_* macros * dm.c (dm_decode_values, dm_decode_dm_target_spec, dm_decode_dm_target_deps, dm_decode_dm_target_msg, dm_known_ioctl): Use PRINT_FIELD_D, PRINT_FIELD_U, and PRINT_FIELD_FLAGS. --- dm.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/dm.c b/dm.c index 41de9018..bf122d94 100644 --- a/dm.c +++ b/dm.c @@ -83,8 +83,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code, if (entering(tcp)) { switch (code) { case DM_TABLE_LOAD: - tprintf(", target_count=%" PRIu32, - ioc->target_count); + PRINT_FIELD_U(", ", *ioc, target_count); break; case DM_DEV_SUSPEND: if (ioc->flags & DM_SUSPEND_FLAG) @@ -93,8 +92,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code, case DM_DEV_RENAME: case DM_DEV_REMOVE: case DM_DEV_WAIT: - tprintf(", event_nr=%" PRIu32, - ioc->event_nr); + PRINT_FIELD_U(", ", *ioc, event_nr); break; } } else if (!syserror(tcp)) { @@ -109,12 +107,9 @@ dm_decode_values(struct tcb *tcp, const unsigned int code, case DM_TABLE_DEPS: case DM_TABLE_STATUS: case DM_TARGET_MSG: - tprintf(", target_count=%" PRIu32, - ioc->target_count); - tprintf(", open_count=%" PRIu32, - ioc->open_count); - tprintf(", event_nr=%" PRIu32, - ioc->event_nr); + PRINT_FIELD_U(", ", *ioc, target_count); + PRINT_FIELD_U(", ", *ioc, open_count); + PRINT_FIELD_U(", ", *ioc, event_nr); break; } } @@ -125,8 +120,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code, static void dm_decode_flags(const struct dm_ioctl *ioc) { - tprints(", flags="); - printflags(dm_flags, ioc->flags, "DM_???"); + PRINT_FIELD_FLAGS(", ", *ioc, flags, dm_flags, "DM_???"); } static void @@ -167,11 +161,11 @@ dm_decode_dm_target_spec(struct tcb *const tcp, const kernel_ulong_t addr, if (umove_or_printaddr(tcp, addr + offset, &s)) break; - tprintf("{sector_start=%" PRI__u64 ", length=%" PRI__u64, - s.sector_start, s.length); + PRINT_FIELD_U("{", s, sector_start); + PRINT_FIELD_U(", ", s, length); if (exiting(tcp)) - tprintf(", status=%" PRId32, s.status); + PRINT_FIELD_D(", ", s, status); PRINT_FIELD_CSTRING(", ", s, target_type); @@ -236,8 +230,9 @@ dm_decode_dm_target_deps(struct tcb *const tcp, const kernel_ulong_t addr, if (s.count > space) goto misplaced; - tprintf("{count=%u, deps=", s.count); + PRINT_FIELD_U("{", s, count); + tprints(", deps="); print_array(tcp, addr + offset_end, s.count, &dev_buf, sizeof(dev_buf), umoven_or_printaddr, dm_print_dev, NULL); @@ -389,7 +384,8 @@ dm_decode_dm_target_msg(struct tcb *const tcp, const kernel_ulong_t addr, if (umove_or_printaddr(tcp, addr + offset, &s)) return; - tprintf("{sector=%" PRI__u64 ", message=", s.sector); + PRINT_FIELD_U("{", s, sector); + tprints(", message="); printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end, QUOTE_0_TERMINATED); tprints("}"); @@ -500,7 +496,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code, goto skip; } - tprintf(", data_size=%u", ioc->data_size); + PRINT_FIELD_U(", ", *ioc, data_size); if (ioc->data_size < offsetof(struct dm_ioctl, data)) { tprints_comment("data_size too small"); @@ -508,7 +504,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code, } if (dm_ioctl_has_params(code)) - tprintf(", data_start=%u", ioc->data_start); + PRINT_FIELD_U(", ", *ioc, data_start); dm_decode_device(code, ioc); dm_decode_values(tcp, code, ioc); -- 2.40.0