]> granicus.if.org Git - strace/commitdiff
scsi: detect and print changes of interface id
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 7 Jan 2017 19:09:37 +0000 (19:09 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 7 Jan 2017 19:09:37 +0000 (19:09 +0000)
* scsi.c (print_sg_io_v3_res): Detect and print changes
of struct sg_io_hdr.interface_id field between entering and exiting
syscall.
(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
field between entering and exiting syscall.

scsi.c

diff --git a/scsi.c b/scsi.c
index 688245069dc10fd25b17c3abd229c229bb1b20f7..3431f3bfea721bd73e91ae54c2242ef31804b2f6 100644 (file)
--- a/scsi.c
+++ b/scsi.c
@@ -99,6 +99,11 @@ print_sg_io_v3_res(struct tcb *const tcp, const kernel_ulong_t arg)
                return;
        }
 
+       if (sg_io.interface_id != (unsigned char) 'S') {
+               tprintf(" => interface_id=%u", sg_io.interface_id);
+               return;
+       }
+
        if (sg_io.dxfer_direction == SG_DXFER_FROM_DEV ||
            sg_io.dxfer_direction == SG_DXFER_TO_FROM_DEV) {
                uint32_t din_len = sg_io.dxfer_len;
@@ -182,6 +187,11 @@ print_sg_io_v4_res(struct tcb *const tcp, const kernel_ulong_t arg)
                return;
        }
 
+       if (sg_io.guard != (unsigned char) 'Q') {
+               tprintf(" => guard=%u", sg_io.guard);
+               return;
+       }
+
        tprintf(", response[%u]=", sg_io.response_len);
        print_sg_io_buffer(tcp, sg_io.response, sg_io.response_len);
        din_len = sg_io.din_xfer_len;