ioprio: add print_ioprio function

That respects xlat style settings.

* ioprio.c (print_ioprio): New function.
* defs.h (print_ioprio): New declaration.
This commit is contained in:
Eugene Syromyatnikov
2018-08-27 22:16:17 +02:00
parent ea3b724cf0
commit ef560cb5d7
2 changed files with 16 additions and 0 deletions

1
defs.h
View File

@ -819,6 +819,7 @@ extern void print_numeric_umode_t(unsigned short);
extern void print_numeric_long_umask(unsigned long);
extern void print_dev_t(unsigned long long dev);
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);

View File

@ -54,6 +54,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)) {