From: Eugene Syromyatnikov Date: Mon, 27 Aug 2018 20:16:17 +0000 (+0200) Subject: ioprio: add print_ioprio function X-Git-Tag: v5.3~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5801540ea97a37146e4100b176d665c6ad2c2b63;p=strace ioprio: add print_ioprio function That respects xlat style settings. * ioprio.c (print_ioprio): New function. * defs.h (print_ioprio): New declaration. --- diff --git a/defs.h b/defs.h index 93b35d71..2b1d7a00 100644 --- a/defs.h +++ b/defs.h @@ -828,6 +828,7 @@ extern void print_numeric_long_umask(unsigned long); extern void print_dev_t(unsigned long long dev); extern void print_kernel_version(unsigned long version); extern void print_abnormal_hi(kernel_ulong_t); +extern void print_ioprio(unsigned int ioprio); extern bool print_int32_array_member(struct tcb *, void *elem_buf, size_t elem_size, void *data); diff --git a/ioprio.c b/ioprio.c index d4770ef2..873c8ce5 100644 --- a/ioprio.c +++ b/ioprio.c @@ -34,6 +34,21 @@ sprint_ioprio(unsigned int ioprio) return outstr; } +void +print_ioprio(unsigned int ioprio) +{ + if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV) + tprintf("%#x", ioprio); + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return; + + const char *str = sprint_ioprio(ioprio); + + (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE + ? tprints_comment : tprints)(str); +} + SYS_FUNC(ioprio_get) { if (entering(tcp)) {