From: Dmitry V. Levin Date: Mon, 9 Jan 2017 13:53:27 +0000 (+0000) Subject: scsi: prepare for decoding of other SG_* ioctl commands X-Git-Tag: v4.16~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6919e370f9f97e6dac0478f64f8b3e4b7a329bcf;p=strace scsi: prepare for decoding of other SG_* ioctl commands * scsi.c (scsi_ioctl): Introduce a switch statement. --- diff --git a/scsi.c b/scsi.c index 7da6dece..1f6fafa3 100644 --- a/scsi.c +++ b/scsi.c @@ -54,23 +54,27 @@ int scsi_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg) { - if (SG_IO != code) - return RVAL_DECODED; - - if (entering(tcp)) { - uint32_t iid; + switch (code) { + case SG_IO: + if (entering(tcp)) { + uint32_t iid; - tprints(", "); - if (umove_or_printaddr(tcp, arg, &iid)) { - return RVAL_DECODED | 1; + tprints(", "); + if (umove_or_printaddr(tcp, arg, &iid)) { + break; + } else { + return decode_sg_io(tcp, iid, arg); + } } else { - return decode_sg_io(tcp, iid, arg); + uint32_t *piid = get_tcb_priv_data(tcp); + if (piid) + decode_sg_io(tcp, *piid, arg); + tprints("}"); + break; } - } else { - uint32_t *piid = get_tcb_priv_data(tcp); - if (piid) - decode_sg_io(tcp, *piid, arg); - tprints("}"); - return RVAL_DECODED | 1; + default: + return RVAL_DECODED; } + + return RVAL_DECODED | 1; }