]> granicus.if.org Git - strace/commit
sg_io: decode structures on exiting syscall in case of syserror
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 8 Jan 2017 17:43:21 +0000 (17:43 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 10 Jan 2017 00:05:17 +0000 (00:05 +0000)
commit84ecd6365189cca5b2402546df4d92e388a1611c
tree16980a36c037fa5196d0dc9b780a9b98489d417b
parentf18b0ae42c8bab4ece39c4204e1351e9db9fe885
sg_io: decode structures on exiting syscall in case of syserror

The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
translates its "struct request.errors" to ioctl errors after
filling in all the output members of the SG_IO header structure.

As there is no easy way to tell SCSI layer errors from other syscall
errors, decode the structure on exiting syscall in case of syserror,
too.

* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
unconditionally.
* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
scsi.c
sg_io_v3.c
sg_io_v4.c