From: Bart Van Assche Date: Fri, 6 Feb 2015 12:36:26 +0000 (+0100) Subject: scsi: Add iovec support X-Git-Tag: v4.10~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=791145ee6e373f510cfb2c87723df2f61e98d2ba;p=strace scsi: Add iovec support * scsi.c (print_sg_io_req, print_sg_io_res): Add support for decoding iovecs passed via the SG I/O v3 interface. Decode the "data in" and "data out" buffers in hex instead of in ASCII. Signed-off-by: Bart Van Assche Signed-off-by: Dmitry V. Levin --- diff --git a/scsi.c b/scsi.c index 5a6838f6..da7851ec 100644 --- a/scsi.c +++ b/scsi.c @@ -76,10 +76,14 @@ print_sg_io_req(struct tcb *tcp, struct sg_io_hdr *sg_io) if (sg_io->dxfer_direction == SG_DXFER_TO_DEV || sg_io->dxfer_direction == SG_DXFER_TO_FROM_DEV) { - tprintf(", data[%u]=[", sg_io->dxfer_len); - printstr(tcp, (unsigned long) sg_io->dxferp, - sg_io->dxfer_len); - tprints("]"); + tprintf(", data[%u]=", sg_io->dxfer_len); + if (sg_io->iovec_count) + tprint_iov_upto(tcp, sg_io->iovec_count, + (unsigned long) sg_io->dxferp, 1, + sg_io->dxfer_len); + else + print_sg_io_buffer(tcp, (unsigned long) sg_io->dxferp, + sg_io->dxfer_len); } } @@ -92,10 +96,14 @@ print_sg_io_res(struct tcb *tcp, struct sg_io_hdr *sg_io) if (sg_io->resid > 0) din_len -= sg_io->resid; - - tprintf(", data[%u]=[", din_len); - printstr(tcp, (unsigned long) sg_io->dxferp, din_len); - tprints("]"); + tprintf(", data[%u]=", din_len); + if (sg_io->iovec_count) + tprint_iov_upto(tcp, sg_io->iovec_count, + (unsigned long) sg_io->dxferp, 1, + din_len); + else + print_sg_io_buffer(tcp, (unsigned long) sg_io->dxferp, + din_len); } tprintf(", status=%02x, ", sg_io->status); tprintf("masked_status=%02x, ", sg_io->masked_status);