From: Eugene Syromyatnikov Date: Mon, 14 Aug 2017 17:25:13 +0000 (+0200) Subject: Replace return 1 ioctl sub-decoder hack with proper flag X-Git-Tag: v4.19~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ca301fff889bf71a1c6b8a5116945335147640e;p=strace Replace return 1 ioctl sub-decoder hack with proper flag * defs.h (RVAL_IOCTL_PARSED): Introduce new flag for ioctl sub-decoders * to signalise that they have successfully printed argument. * ioctl.c (SYS_FUNC(ioctl)): Check for RVAL_IOCTL_PARSED flag, remove un-set it before returning the value. * block.c: Use RVAL_IOCTL_PARSED instead of 1. * btrfs.c: Likewise. * dm.c: Likewise. * evdev.c: Likewise. * file_ioctl.c: Likewise. * fs_x_ioctl.c: Likewise. * hdio.c: Likewise. * loop.c: Likewise. * mtd.c: Likewise. * nsfs.c: Likewise. * print_sg_req_info.c: Likewise. * ptp.c: Likewise. * rtc.c: Likewise. * scsi.c: Likewise. * sg_io_v3.c: Likewise. * sg_io_v4.c: Likewise. * sock.c: Likewise. * term.c: Likewise. * ubi.c: Likewise. * userfaultfd.c: Likewise. * v4l2.c: Likewise. --- diff --git a/block.c b/block.c index 486c6df0..06c5004c 100644 --- a/block.c +++ b/block.c @@ -265,5 +265,5 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/btrfs.c b/btrfs.c index 3c48e798..f4487d63 100644 --- a/btrfs.c +++ b/btrfs.c @@ -1345,6 +1345,6 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, default: return RVAL_DECODED; }; - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } #endif /* HAVE_LINUX_BTRFS_H */ diff --git a/defs.h b/defs.h index f82eef15..72bee85e 100644 --- a/defs.h +++ b/defs.h @@ -307,6 +307,8 @@ extern const struct xlat whence_codes[]; #define RVAL_NONE 040 /* Print nothing */ #define RVAL_DECODED 0100 /* syscall decoding finished */ +/* ioctl sub-parser successfully parsed (and printed) the argument */ +#define RVAL_IOCTL_PARSED 0200 #define IOCTL_NUMBER_UNKNOWN 0 #define IOCTL_NUMBER_HANDLED 1 diff --git a/dm.c b/dm.c index 327a5e1a..03216eb3 100644 --- a/dm.c +++ b/dm.c @@ -479,7 +479,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code, } if (exiting(tcp) && syserror(tcp) && !ioc_changed) - return 1; + return RVAL_IOCTL_PARSED; /* * device mapper code uses %d in some places and %u in another, but @@ -553,7 +553,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code, skip: tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } int diff --git a/evdev.c b/evdev.c index 983bf148..252fe5cb 100644 --- a/evdev.c +++ b/evdev.c @@ -83,7 +83,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) struct_ff_effect ffe; if (umove_or_printaddr(tcp, arg, &ffe)) - return 1; + return RVAL_IOCTL_PARSED; tprints("{type="); printxval(evdev_ff_types, ffe.type, "FF_???"); @@ -94,7 +94,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) if (abbrev(tcp)) { tprints("...}"); - return 1; + return RVAL_IOCTL_PARSED; } tprintf("trigger={button=%" PRIu16 @@ -150,7 +150,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -184,7 +184,7 @@ abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); } - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -200,7 +200,7 @@ keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) tprints("]"); } - return 1; + return RVAL_IOCTL_PARSED; } # ifdef EVIOCGKEYCODE_V2 @@ -212,7 +212,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) struct input_keymap_entry ike; if (umove_or_printaddr(tcp, arg, &ike)) - return 1; + return RVAL_IOCTL_PARSED; tprintf("{flags=%" PRIu8 ", len=%" PRIu8 ", ", @@ -237,7 +237,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } # endif /* EVIOCGKEYCODE_V2 */ @@ -258,7 +258,7 @@ getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) id.product, id.version); - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -276,7 +276,7 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg, char decoded_arg[size]; if (umove_or_printaddr(tcp, arg, &decoded_arg)) - return 1; + return RVAL_IOCTL_PARSED; tprints("["); @@ -300,7 +300,7 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg, tprints("]"); - return 1; + return RVAL_IOCTL_PARSED; } # ifdef EVIOCGMTSLOTS @@ -313,13 +313,13 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code, const size_t size = _IOC_SIZE(code) / sizeof(int); if (!size) { printaddr(arg); - return 1; + return RVAL_IOCTL_PARSED; } int buffer[size]; if (umove_or_printaddr(tcp, arg, &buffer)) - return 1; + return RVAL_IOCTL_PARSED; tprints("{code="); printxval(evdev_mtslots, buffer[0], "ABS_MT_???"); @@ -332,7 +332,7 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code, tprints("]}"); - return 1; + return RVAL_IOCTL_PARSED; } # endif /* EVIOCGMTSLOTS */ @@ -342,7 +342,7 @@ repeat_ioctl(struct tcb *const tcp, const kernel_ulong_t arg) { tprints(", "); printpair_int(tcp, arg, "%u"); - return 1; + return RVAL_IOCTL_PARSED; } # endif /* EVIOCGREP || EVIOCSREP */ @@ -386,14 +386,14 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr, case EV_PWR: tprints(", "); printnum_int(tcp, arg, "%d"); - return 1; + return RVAL_IOCTL_PARSED; case EV_FF_STATUS: return decode_bitset(tcp, arg, evdev_ff_status, FF_STATUS_MAX, "FF_STATUS_???"); default: tprints(", "); printaddr(arg); - return 1; + return RVAL_IOCTL_PARSED; } } @@ -406,11 +406,11 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code, case EVIOCGVERSION: tprints(", "); printnum_int(tcp, arg, "%#x"); - return 1; + return RVAL_IOCTL_PARSED; case EVIOCGEFFECTS: tprints(", "); printnum_int(tcp, arg, "%u"); - return 1; + return RVAL_IOCTL_PARSED; case EVIOCGID: return getid_ioctl(tcp, arg); # ifdef EVIOCGREP @@ -439,7 +439,7 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code, printaddr(arg); else printstrn(tcp, arg, tcp->u_rval); - return 1; + return RVAL_IOCTL_PARSED; # ifdef EVIOCGPROP case _IOC_NR(EVIOCGPROP(0)): return decode_bitset(tcp, arg, evdev_prop, @@ -492,18 +492,18 @@ evdev_write_ioctl(struct tcb *const tcp, const unsigned int code, return ff_effect_ioctl(tcp, arg); case EVIOCRMFF: tprintf(", %d", (int) arg); - return 1; + return RVAL_IOCTL_PARSED; case EVIOCGRAB: # ifdef EVIOCREVOKE case EVIOCREVOKE: # endif tprintf(", %" PRI_klu, arg); - return 1; + return RVAL_IOCTL_PARSED; # ifdef EVIOCSCLOCKID case EVIOCSCLOCKID: tprints(", "); printnum_int(tcp, arg, "%u"); - return 1; + return RVAL_IOCTL_PARSED; # endif } diff --git a/file_ioctl.c b/file_ioctl.c index cc2378f6..2391431e 100644 --- a/file_ioctl.c +++ b/file_ioctl.c @@ -245,5 +245,5 @@ file_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; }; - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/fs_x_ioctl.c b/fs_x_ioctl.c index 2fa30f56..0c8f60e1 100644 --- a/fs_x_ioctl.c +++ b/fs_x_ioctl.c @@ -62,5 +62,5 @@ fs_x_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/hdio.c b/hdio.c index 6e256d94..a987ad01 100644 --- a/hdio.c +++ b/hdio.c @@ -60,5 +60,5 @@ MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *const tcp, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/ioctl.c b/ioctl.c index a10c80b8..280bc24d 100644 --- a/ioctl.c +++ b/ioctl.c @@ -227,28 +227,31 @@ ioctl_decode_command_number(struct tcb *tcp) /** * Decode arg parameter of the ioctl call. * - * @return There are two bits of the return value important for the purposes of + * @return There are two flags of the return value important for the purposes of * processing by SYS_FUNC(ioctl): - * - 1 - indicates that ioctl decoder code has printed arg parameter. + * - RVAL_IOCTL_PARSED - indicates that ioctl decoder code has printed + * arg parameter. * - RVAL_DECODED - indicates that decoding is done. * As a result, the following behaviour is expected: * - on entering: * - 0 - decoding should be continued on exiting; * - RVAL_DECODED - decoding on exiting is not needed and generic * handler should print arg value; - * - 1 | RVAL_DECODED - decoding on exiting is not needed and decoder - * has printed arg value. + * - RVAL_IOCTL_PARSED | RVAL_DECODED - decoding on exiting is not + * needed and decoder + * has printed arg value. * - on exiting: * - 0 - generic handler should print arg value. - * - 1 - decoder has printed arg value. + * - RVAL_IOCTL_PARSED - decoder has printed arg value. * - * Note that it makes no sense to return just 1 (without RVAL_DECODED) - * on entering, or 1 | RVAL_DECODED on exiting, but, of course, it is - * not prohibited (for example, it may be useful in cases where the - * return path is common on entering and on exiting the syscall). + * Note that it makes no sense to return just RVAL_IOCTL_PARSED + * on entering, or RVAL_IOCTL_PARSED | RVAL_DECODED on exiting, but, + * of course, it is not prohibited (for example, it may be useful + * in cases where the return path is common on entering and on exiting + * the syscall). * - * SYS_FUNC(ioctl) clears bit 0 and passes all other bits of - * ioctl_decode return value unchanged. + * SYS_FUNC(ioctl) clears RVAL_IOCTL_PARSED flag and passes all other + * bits of ioctl_decode return value unchanged. */ static int ioctl_decode(struct tcb *tcp) @@ -345,10 +348,10 @@ SYS_FUNC(ioctl) ret = ioctl_decode(tcp) | RVAL_DECODED; } - if ((ret & RVAL_DECODED) && !(ret & 1)) + if ((ret & RVAL_DECODED) && !(ret & RVAL_IOCTL_PARSED)) tprintf(", %#" PRI_klx, tcp->u_arg[2]); - ret &= ~1; + ret &= ~RVAL_IOCTL_PARSED; return ret; } diff --git a/loop.c b/loop.c index e30b7ce5..9ed8a3e8 100644 --- a/loop.c +++ b/loop.c @@ -196,5 +196,5 @@ MPERS_PRINTER_DECL(int, loop_ioctl, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/mtd.c b/mtd.c index b0468595..cd6584bf 100644 --- a/mtd.c +++ b/mtd.c @@ -360,5 +360,5 @@ MPERS_PRINTER_DECL(int, mtd_ioctl, struct tcb *const tcp, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/nsfs.c b/nsfs.c index 1048f9a7..2b39eaf8 100644 --- a/nsfs.c +++ b/nsfs.c @@ -37,7 +37,7 @@ nsfs_ioctl(struct tcb *tcp, unsigned int code, kernel_ulong_t arg) switch (code) { case NS_GET_USERNS: case NS_GET_PARENT: - return 1 + RVAL_FD + RVAL_DECODED; + return RVAL_IOCTL_PARSED | RVAL_FD | RVAL_DECODED; case NS_GET_NSTYPE: if (entering(tcp)) return 0; @@ -46,10 +46,10 @@ nsfs_ioctl(struct tcb *tcp, unsigned int code, kernel_ulong_t arg) outstr = xlookup(setns_types, tcp->u_rval); if (outstr) { tcp->auxstr = outstr; - return 1 + RVAL_STR; + return RVAL_IOCTL_PARSED | RVAL_STR; } } - return 1; + return RVAL_IOCTL_PARSED; case NS_GET_OWNER_UID: if (entering(tcp)) return 0; @@ -58,7 +58,7 @@ nsfs_ioctl(struct tcb *tcp, unsigned int code, kernel_ulong_t arg) printuid("[", uid); tprints("]"); } - return 1; + return RVAL_IOCTL_PARSED; default: return RVAL_DECODED; } diff --git a/print_sg_req_info.c b/print_sg_req_info.c index cb34d4fd..c3bdba93 100644 --- a/print_sg_req_info.c +++ b/print_sg_req_info.c @@ -68,7 +68,7 @@ MPERS_PRINTER_DECL(int, decode_sg_req_info, tprintf(", duration=%u}", info.duration); } - return 1; + return RVAL_IOCTL_PARSED; } #endif /* HAVE_SCSI_SG_H */ diff --git a/ptp.c b/ptp.c index 6d3ddd8a..97853d89 100644 --- a/ptp.c +++ b/ptp.c @@ -136,5 +136,5 @@ ptp_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/rtc.c b/rtc.c index 43ea9466..38c1e424 100644 --- a/rtc.c +++ b/rtc.c @@ -150,5 +150,5 @@ MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *const tcp, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/scsi.c b/scsi.c index 43b829a3..343bd00f 100644 --- a/scsi.c +++ b/scsi.c @@ -46,7 +46,7 @@ decode_sg_io(struct tcb *const tcp, const uint32_t iid, return decode_sg_io_v4(tcp, arg); default: tprintf("[%u]", iid); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } } @@ -78,7 +78,7 @@ decode_sg_scsi_id(struct tcb *const tcp, const kernel_ulong_t arg) id.h_cmd_per_lun, id.d_queue_depth); } - return 1; + return RVAL_IOCTL_PARSED; } #endif /* HAVE_SCSI_SG_H */ @@ -179,5 +179,5 @@ scsi_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/sg_io_v3.c b/sg_io_v3.c index 1be078fb..f4d4be51 100644 --- a/sg_io_v3.c +++ b/sg_io_v3.c @@ -78,7 +78,7 @@ decode_request(struct tcb *const tcp, const kernel_ulong_t arg) if (umoven_or_printaddr(tcp, arg + skip_iid, sizeof(sg_io) - skip_iid, &sg_io.dxfer_direction)) { tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } PRINT_FIELD_XVAL("", sg_io, dxfer_direction, sg_io_dxfer_direction, @@ -117,12 +117,12 @@ decode_response(struct tcb *const tcp, const kernel_ulong_t arg) if (entering_sg_io->dxfer_direction == SG_DXFER_FROM_DEV) PRINT_FIELD_PTR(", ", *entering_sg_io, dxferp); PRINT_FIELD_PTR(", ", *entering_sg_io, sbp); - return 1; + return RVAL_IOCTL_PARSED; } if (sg_io.interface_id != entering_sg_io->interface_id) { PRINT_FIELD_U(" => ", sg_io, interface_id); - return 1; + return RVAL_IOCTL_PARSED; } if (sg_io.dxfer_direction == SG_DXFER_FROM_DEV || @@ -155,7 +155,7 @@ decode_response(struct tcb *const tcp, const kernel_ulong_t arg) PRINT_FIELD_U(", ", sg_io, duration); PRINT_FIELD_FLAGS(", ", sg_io, info, sg_io_info, "SG_INFO_???"); - return 1; + return RVAL_IOCTL_PARSED; } #else /* !HAVE_SCSI_SG_H */ @@ -164,7 +164,7 @@ static int decode_request(struct tcb *const tcp, const kernel_ulong_t arg) { tprints("{interface_id='S', ...}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } static int diff --git a/sg_io_v4.c b/sg_io_v4.c index 48442f2a..f3e88f09 100644 --- a/sg_io_v4.c +++ b/sg_io_v4.c @@ -64,7 +64,7 @@ decode_request(struct tcb *const tcp, const kernel_ulong_t arg) if (umoven_or_printaddr(tcp, arg + skip_iid, sizeof(sg_io) - skip_iid, &sg_io.protocol)) { tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } PRINT_FIELD_XVAL("", sg_io, protocol, bsg_protocol, "BSG_PROTOCOL_???"); @@ -111,12 +111,12 @@ decode_response(struct tcb *const tcp, const kernel_ulong_t arg) /* print i/o fields fetched on entering syscall */ PRINT_FIELD_X(", ", *entering_sg_io, response); PRINT_FIELD_X(", ", *entering_sg_io, din_xferp); - return 1; + return RVAL_IOCTL_PARSED; } if (sg_io.guard != entering_sg_io->guard) { PRINT_FIELD_U(" => ", sg_io, guard); - return 1; + return RVAL_IOCTL_PARSED; } PRINT_FIELD_U(", ", sg_io, response_len); @@ -138,7 +138,7 @@ decode_response(struct tcb *const tcp, const kernel_ulong_t arg) PRINT_FIELD_D(", ", sg_io, dout_resid); PRINT_FIELD_X(", ", sg_io, generated_tag); - return 1; + return RVAL_IOCTL_PARSED; } #else /* !HAVE_LINUX_BSG_H */ @@ -147,7 +147,7 @@ static int decode_request(struct tcb *const tcp, const kernel_ulong_t arg) { tprints("{guard='Q', ...}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } static int diff --git a/sock.c b/sock.c index c6bb6552..840b76ea 100644 --- a/sock.c +++ b/sock.c @@ -198,7 +198,7 @@ decode_ifconf(struct tcb *const tcp, const kernel_ulong_t addr) tprints("}"); } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } if (entering(tcp)) { @@ -237,7 +237,7 @@ decode_ifconf(struct tcb *const tcp, const kernel_ulong_t addr) tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } MPERS_PRINTER_DECL(int, sock_ioctl, @@ -371,5 +371,5 @@ MPERS_PRINTER_DECL(int, sock_ioctl, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/term.c b/term.c index 9a5d62d9..a52298c9 100644 --- a/term.c +++ b/term.c @@ -286,5 +286,5 @@ term_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/ubi.c b/ubi.c index 6611bd46..ab4f5ea0 100644 --- a/ubi.c +++ b/ubi.c @@ -196,5 +196,5 @@ ubi_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } diff --git a/userfaultfd.c b/userfaultfd.c index 150d98fb..94ed20a2 100644 --- a/userfaultfd.c +++ b/userfaultfd.c @@ -114,7 +114,7 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &uc)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; PRINT_FIELD_X("{", uc, dst); PRINT_FIELD_X(", ", uc, src); PRINT_FIELD_X(", ", uc, len); @@ -138,7 +138,7 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &ur)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; PRINT_FIELD_UFFDIO_RANGE("{", ur, range); PRINT_FIELD_FLAGS(", ", ur, mode, uffd_register_mode_flags, @@ -176,7 +176,7 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &uz)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; PRINT_FIELD_UFFDIO_RANGE("{", uz, range); PRINT_FIELD_FLAGS(", ", uz, mode, uffd_zeropage_flags, "UFFDIO_ZEROPAGE_???"); @@ -196,6 +196,6 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } #endif /* HAVE_LINUX_USERFAULTFD_H */ diff --git a/v4l2.c b/v4l2.c index a025620e..8b839b57 100644 --- a/v4l2.c +++ b/v4l2.c @@ -146,7 +146,7 @@ print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg) return 0; tprints(", "); if (umove_or_printaddr(tcp, arg, &caps)) - return 1; + return RVAL_IOCTL_PARSED; PRINT_FIELD_CSTRING("{", caps, driver); PRINT_FIELD_CSTRING(", ", caps, card); PRINT_FIELD_CSTRING(", ", caps, bus_info); @@ -162,7 +162,7 @@ print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg) "V4L2_CAP_???"); #endif tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_buf_types.h" @@ -176,7 +176,7 @@ print_v4l2_fmtdesc(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &f)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u, type=", f.index); printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???"); return 0; @@ -191,7 +191,7 @@ print_v4l2_fmtdesc(struct tcb *const tcp, const kernel_ulong_t arg) print_pixelformat(f.pixelformat); } tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_fields.h" @@ -354,14 +354,14 @@ print_v4l2_format(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &f)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{type="); printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???"); if (is_get) return 0; if (!print_v4l2_format_fmt(tcp, ", ", &f)) { tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } return 0; @@ -372,7 +372,7 @@ print_v4l2_format(struct tcb *const tcp, const kernel_ulong_t arg, tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_memories.h" @@ -386,7 +386,7 @@ print_v4l2_requestbuffers(struct tcb *const tcp, const kernel_ulong_t arg) tprints(", "); if (umove_or_printaddr(tcp, arg, &reqbufs)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{type="); printxval(v4l2_buf_types, reqbufs.type, "V4L2_BUF_TYPE_???"); @@ -408,7 +408,7 @@ print_v4l2_requestbuffers(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_buf_flags.h" @@ -422,7 +422,7 @@ print_v4l2_buffer(struct tcb *const tcp, const unsigned int code, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &b)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{type="); printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???"); if (code != VIDIOC_DQBUF) @@ -456,7 +456,7 @@ print_v4l2_buffer(struct tcb *const tcp, const unsigned int code, tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -472,7 +472,7 @@ print_v4l2_framebuffer(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } static int @@ -486,7 +486,7 @@ print_v4l2_buf_type(struct tcb *const tcp, const kernel_ulong_t arg) printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???"); tprints("]"); } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } #include "xlat/v4l2_streaming_capabilities.h" @@ -501,7 +501,7 @@ print_v4l2_streamparm(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &s)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{type="); printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???"); switch (s.type) { @@ -513,12 +513,12 @@ print_v4l2_streamparm(struct tcb *const tcp, const kernel_ulong_t arg, break; default: tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } } else { if (syserror(tcp) || umove(tcp, arg, &s) < 0) { tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } tprints(is_get ? ", " : " => "); } @@ -554,7 +554,7 @@ print_v4l2_streamparm(struct tcb *const tcp, const kernel_ulong_t arg, } if (exiting(tcp)) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -565,7 +565,7 @@ print_v4l2_standard(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &s)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u", s.index); return 0; @@ -580,7 +580,7 @@ print_v4l2_standard(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_input_types.h" @@ -593,7 +593,7 @@ print_v4l2_input(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &i)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u", i.index); return 0; @@ -607,7 +607,7 @@ print_v4l2_input(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_control_ids.h" @@ -621,7 +621,7 @@ print_v4l2_control(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{id="); printxval(v4l2_control_ids, c.id, "V4L2_CID_???"); if (!is_get) @@ -636,7 +636,7 @@ print_v4l2_control(struct tcb *const tcp, const kernel_ulong_t arg, tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_tuner_types.h" @@ -652,7 +652,7 @@ print_v4l2_tuner(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u", c.index); if (is_get) return 0; @@ -660,7 +660,7 @@ print_v4l2_tuner(struct tcb *const tcp, const kernel_ulong_t arg, } else { if (syserror(tcp) || umove(tcp, arg, &c) < 0) { tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } tprints(is_get ? ", " : " => "); } @@ -682,7 +682,7 @@ print_v4l2_tuner(struct tcb *const tcp, const kernel_ulong_t arg, if (exiting(tcp)) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #include "xlat/v4l2_control_types.h" @@ -696,12 +696,12 @@ print_v4l2_queryctrl(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{id="); } else { if (syserror(tcp) || umove(tcp, arg, &c) < 0) { tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } if (get_tcb_priv_ulong(tcp)) tprints(" => "); @@ -729,7 +729,7 @@ print_v4l2_queryctrl(struct tcb *const tcp, const kernel_ulong_t arg) printflags(v4l2_control_flags, c.flags, "V4L2_CTRL_FLAG_???"); tprints("}"); } - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -740,7 +740,7 @@ print_v4l2_cropcap(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{type="); printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???"); @@ -758,7 +758,7 @@ print_v4l2_cropcap(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } static int @@ -770,7 +770,7 @@ print_v4l2_crop(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{type="); printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???"); if (is_get) @@ -783,7 +783,7 @@ print_v4l2_crop(struct tcb *const tcp, const kernel_ulong_t arg, tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } #ifdef VIDIOC_S_EXT_CTRLS @@ -818,14 +818,14 @@ print_v4l2_ext_controls(struct tcb *const tcp, const kernel_ulong_t arg, if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &c)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprints("{ctrl_class="); printxval(v4l2_control_classes, c.ctrl_class, "V4L2_CTRL_CLASS_???"); tprintf(", count=%u", c.count); if (!c.count) { tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } if (is_get) return 0; @@ -833,7 +833,7 @@ print_v4l2_ext_controls(struct tcb *const tcp, const kernel_ulong_t arg, } else { if (umove(tcp, arg, &c) < 0) { tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } tprints(is_get ? ", " : " => "); } @@ -850,7 +850,7 @@ print_v4l2_ext_controls(struct tcb *const tcp, const kernel_ulong_t arg, if (exiting(tcp) || fail) { tprints("}"); - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; } /* entering */ @@ -869,7 +869,7 @@ print_v4l2_frmsizeenum(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &s)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u, pixel_format=", s.index); print_pixelformat(s.pixel_format); return 0; @@ -894,7 +894,7 @@ print_v4l2_frmsizeenum(struct tcb *const tcp, const kernel_ulong_t arg) } } tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #endif /* VIDIOC_ENUM_FRAMESIZES */ @@ -909,7 +909,7 @@ print_v4l2_frmivalenum(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &f)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{index=%u, pixel_format=", f.index); print_pixelformat(f.pixel_format); tprintf(", width=%u, height=%u", f.width, f.height); @@ -938,7 +938,7 @@ print_v4l2_frmivalenum(struct tcb *const tcp, const kernel_ulong_t arg) tprints("}"); - return 1; + return RVAL_IOCTL_PARSED; } #endif /* VIDIOC_ENUM_FRAMEINTERVALS */ @@ -954,7 +954,7 @@ print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) if (entering(tcp)) { tprints(", "); if (umove_or_printaddr(tcp, arg, &b)) - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; tprintf("{count=%u, memory=", b.count); printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???"); tprints(", format={type="); @@ -967,12 +967,12 @@ print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg) } if (syserror(tcp) || umove(tcp, arg, &b)) - return 1; + return RVAL_IOCTL_PARSED; sprintf(outstr, fmt, b.index, b.count); tcp->auxstr = outstr; - return 1 | RVAL_STR; + return RVAL_IOCTL_PARSED | RVAL_STR; } #endif /* VIDIOC_CREATE_BUFS */ @@ -1086,5 +1086,5 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp, return RVAL_DECODED; } - return RVAL_DECODED | 1; + return RVAL_DECODED | RVAL_IOCTL_PARSED; }