Commit Graph

9 Commits

Author SHA1 Message Date
84ecd63651 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.
2017-01-10 00:05:17 +00:00
e2de9acdbc sg_io_v3: print sg_io_hdr.duration field as unsigned integer
* sg_io_v3.c (decode_response): Print duration field using %u format.
2017-01-08 19:53:53 +03:00
16d336702f sg_io_v3: print msg_status field
* sg_io_v3.c (decode_response): Print msg_status field.
2017-01-08 19:52:05 +03:00
1538b9dff3 sg_io: print names of array fields and corresponding length fields
* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
and dxferp fields.
(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
* sg_io_v4.c (decode_request): Print names of request_len, request,
dout_xfer_len, and dout_xferp fields.
(decode_response): Print names of response_len, response,
and din_xferp fields.
2017-01-08 16:00:01 +00:00
e257082643 sg_io_v3: print status fields using %#x format specifier
The formerly used format string %02x led to misleading output as there
was no clear indication sometimes whether the printed integer was
decimal or hexadecimal.

* sg_io_v3.c (decode_response): Print status and masked_status fields
using %#x format specifier instead of %02x.
2017-01-08 15:51:59 +00:00
0503b69486 sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info
Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.

* xlat/sg_io_info.in: New file.
* defs.h (sg_io_info): New xlat prototype.
* sg_io_v3.c: Include "xlat/sg_io_info.h".
(decode_response): Print struct_sg_io_hdr.info using printflags.
* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
using printflags.
2017-01-08 03:30:23 +00:00
0f774151a4 sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags
Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.

* xlat/sg_io_flags.in: New file.
* sg_io_v3.c: Include "xlat/sg_io_flags.h".
(decode_request): Print struct_sg_io_hdr.flags using printflags.
* xlat/bsg_flags.in: New file.
* sg_io_v4.c: Include "xlat/bsg_flags.h".
(decode_request): Print struct sg_io_v4.flags using printflags.
2017-01-08 03:30:02 +00:00
d30a9bf779 Mpersify struct sg_io_hdr
struct sg_io_hdr contains pointers and therefore has to be mpersified.

* defs.h (decode_sg_io_v3): Remove prototype.
* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
Mpersify it.
(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.
2017-01-08 01:05:50 +00:00
768d7cb78f Split scsi.c
Move decoders of SG_IO v3 and v4 APIs into separate files,
compile generic SG_IO decoder unconditionally.

* sg_io_v3.c: New file.
* sg_io_v4.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
* scsi.c: (print_sg_io_res): Remove.
(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
compile uncoditionally.
(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
with decode_sg_io, compile uncoditionally.
Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
2017-01-08 00:01:03 +00:00