engines/sg: add cmdp and dxferp for trims to sg error string
authorVincent Fu <vincent.fu@wdc.com>
Wed, 25 Jul 2018 20:00:26 +0000 (13:00 -0700)
committerVincent Fu <vincent.fu@wdc.com>
Thu, 26 Jul 2018 16:35:52 +0000 (09:35 -0700)
engines/sg.c

index 33e38c2..800f473 100644 (file)
@@ -1110,6 +1110,23 @@ static char *fio_sgio_errdetails(struct io_u *io_u)
                        snprintf(msgchunk, MAXMSGCHUNK, "SG Driver: %d bytes out of %d not transferred. ", hdr->resid, hdr->dxfer_len);
                        strlcat(msg, msgchunk, MAXERRDETAIL);
                }
+               if (hdr->cmdp) {
+                       strlcat(msg, "cdb:", MAXERRDETAIL);
+                       for (i = 0; i < hdr->cmd_len; i++) {
+                               snprintf(msgchunk, MAXMSGCHUNK, " %02x", hdr->cmdp[i]);
+                               strlcat(msg, msgchunk, MAXERRDETAIL);
+                       }
+                       strlcat(msg, ". ", MAXERRDETAIL);
+                       if (io_u->ddir == DDIR_TRIM) {
+                               unsigned char *param_list = hdr->dxferp;
+                               strlcat(msg, "dxferp:", MAXERRDETAIL);
+                               for (i = 0; i < hdr->dxfer_len; i++) {
+                                       snprintf(msgchunk, MAXMSGCHUNK, " %02x", param_list[i]);
+                                       strlcat(msg, msgchunk, MAXERRDETAIL);
+                               }
+                               strlcat(msg, ". ", MAXERRDETAIL);
+                       }
+               }
        }
 
        if (!(hdr->info & SG_INFO_CHECK) && !strlen(msg))