ioctl: print ioctl number in accordance with xlat verbosity setting

* ioctl.c (SYS_FUNC(ioctl)): Print ioctl command name in accordance
with the current xlat_verbosity setting.
* tests/btrfs.c (sprint_xlat_): New function.
(ioc): New macro, a wrapper for sprint_xlat_.
Update expected output.
This commit is contained in:
Eugene Syromyatnikov 2018-03-19 05:27:41 +01:00 committed by Dmitry V. Levin
parent a2b07d60d7
commit 9f1a22244f
2 changed files with 288 additions and 213 deletions

32
ioctl.c
View File

@ -339,19 +339,29 @@ SYS_FUNC(ioctl)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
ret = ioctl_decode_command_number(tcp);
if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
if (ret)
tprints(" or ");
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else if (!ret) {
ioctl_print_code(tcp->u_arg[1]);
if (xlat_verbosity != XLAT_STYLE_ABBREV)
tprintf("%#x", (unsigned int) tcp->u_arg[1]);
if (xlat_verbosity == XLAT_STYLE_VERBOSE)
tprints(" /* ");
if (xlat_verbosity != XLAT_STYLE_RAW) {
ret = ioctl_decode_command_number(tcp);
if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
if (ret)
tprints(" or ");
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else if (!ret) {
ioctl_print_code(tcp->u_arg[1]);
}
}
}
if (xlat_verbosity == XLAT_STYLE_VERBOSE)
tprints(" */");
ret = ioctl_decode(tcp);
} else {
ret = ioctl_decode(tcp) | RVAL_DECODED;

File diff suppressed because it is too large Load Diff