diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2019-01-14 02:42:05 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2019-01-14 02:42:05 +0000 |
commit | 0b07dc9a41e495604add3b006c040b36e4ea50c7 (patch) | |
tree | 0cb11adaa2f3f93c3be95cf28de486d7dbe716d9 /testing | |
parent | 2433a22138f1b508c2765aa8499456cd6138a200 (diff) | |
download | sg3_utils-0b07dc9a41e495604add3b006c040b36e4ea50c7.tar.gz |
sg_lib: tweak sg_pt interface to better handle bidi; sg_cmds_process_resp(): two arguments removed
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@805 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'testing')
-rw-r--r-- | testing/bsg_queue_tst.c | 6 | ||||
-rw-r--r-- | testing/sg_queue_tst.c | 4 | ||||
-rw-r--r-- | testing/sg_tst_async.cpp | 1 | ||||
-rw-r--r-- | testing/sg_tst_bidi.c | 33 | ||||
-rw-r--r-- | testing/sg_tst_ioctl.c | 4 | ||||
-rw-r--r-- | testing/sg_tst_nvme.c | 7 |
6 files changed, 26 insertions, 29 deletions
diff --git a/testing/bsg_queue_tst.c b/testing/bsg_queue_tst.c index af0c42b8..011dcab3 100644 --- a/testing/bsg_queue_tst.c +++ b/testing/bsg_queue_tst.c @@ -20,7 +20,7 @@ The default behaviour is to "queue at head" which is useful for error processing but not for streaming READ and WRITE commands. -* Copyright (C) 2010-2016 D. Gilbert +* Copyright (C) 2010-2019 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -29,7 +29,7 @@ Invocation: bsg_queue_tst [-t] <bsg_device> -t queue at tail - Version 0.90 (20100324) + Version 0.91 (20190111) */ @@ -55,7 +55,7 @@ int main(int argc, char * argv[]) uint8_t inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; uint8_t sdiag_cdb[SDIAG_CMD_LEN] = - {0x1d, 0, 0, 0, 0, 0}; + {0x1d, 0x10 /* PF */, 0, 0, 0, 0}; uint8_t inqBuff[16][INQ_REPLY_LEN]; struct sg_io_v4 io_hdr[16]; struct sg_io_v4 rio_hdr; diff --git a/testing/sg_queue_tst.c b/testing/sg_queue_tst.c index dcdeabdd..064d3885 100644 --- a/testing/sg_queue_tst.c +++ b/testing/sg_queue_tst.c @@ -15,7 +15,7 @@ * Invocation: sg_queue_tst [-l=Q_LEN] [-t] <sg_device> * -t queue at tail * - * Version 0.94 (20190109) + * Version 0.95 (20190111) */ #include <unistd.h> @@ -104,7 +104,7 @@ int main(int argc, char * argv[]) uint8_t inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; uint8_t sdiag_cdb[SDIAG_CMD_LEN] = - {0x1d, 0, 0, 0, 0, 0}; + {0x1d, 0x10 /* PF */, 0, 0, 0, 0}; uint8_t inqBuff[MAX_Q_LEN][INQ_REPLY_LEN]; sg_io_hdr_t io_hdr[MAX_Q_LEN]; sg_io_hdr_t rio_hdr; diff --git a/testing/sg_tst_async.cpp b/testing/sg_tst_async.cpp index 6b7a3e84..9c34b7a3 100644 --- a/testing/sg_tst_async.cpp +++ b/testing/sg_tst_async.cpp @@ -811,7 +811,6 @@ work_sync_thread(int id, const char * dev_name, unsigned int /* hi_lba */, ++thr_sync_starts; rs = do_scsi_pt(ptp, -1, DEF_PT_TIMEOUT, vb); n = sg_cmds_process_resp(ptp, "Test unit ready", rs, - SG_NO_DATA_IN, sense_b, (0 == k), vb, &sense_cat); if (-1 == n) { ret = sg_convert_errno(get_scsi_pt_os_err(ptp)); diff --git a/testing/sg_tst_bidi.c b/testing/sg_tst_bidi.c index 7f6f54db..6a308995 100644 --- a/testing/sg_tst_bidi.c +++ b/testing/sg_tst_bidi.c @@ -52,7 +52,7 @@ is implemented by the scsi_debug driver is used. */ -static const char * version_str = "Version: 1.00 20190110"; +static const char * version_str = "Version: 1.01 20190111"; #define INQ_REPLY_LEN 96 #define INQ_CMD_OP 0x12 @@ -315,7 +315,7 @@ main(int argc, char * argv[]) uint8_t inq_cdb[INQ_CMD_LEN] = {INQ_CMD_OP, 0, 0, 0, INQ_REPLY_LEN, 0}; uint8_t sdiag_cdb[SDIAG_CMD_LEN] = - {SDIAG_CMD_OP, 0, 0, 0, 0, 0}; + {SDIAG_CMD_OP, 0x10 /* PF */, 0, 0, 0, 0}; uint8_t xdwrrd10_cdb[XDWRITEREAD_10_LEN] = {XDWRITEREAD_10_OP, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; uint8_t inqBuff[MAX_Q_LEN][INQ_REPLY_LEN]; @@ -424,7 +424,7 @@ main(int argc, char * argv[]) second_fname, sg_fd2); } -#if 0 +#if 1 printf("start write() calls\n"); for (k = 0; k < q_len; ++k) { io_v4p = &io_v4[k]; @@ -436,26 +436,25 @@ main(int argc, char * argv[]) if (0 == (k % 3)) { io_v4p->request_len = XDWRITEREAD_10_LEN; io_v4p->request = (uint64_t)xdwrrd10_cdb; - io_hdr[k].dxfer_direction = SG_DXFER_NONE; + // io_hdr[k].dxfer_direction = SG_DXFER_NONE; } else { - io_hdr[k].cmd_len = sizeof(inq_cdb); - io_hdr[k].cmdp = inq_cdb; - io_hdr[k].dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr[k].dxfer_len = INQ_REPLY_LEN; - io_hdr[k].dxferp = inqBuff[k]; + io_v4p->response_len = sizeof(inq_cdb); + io_v4p->response = inq_cdb; + io_v4p->din_xfer_len = INQ_REPLY_LEN; + io_v4p->din_xferp = (uint64_t)inqBuff[k]; } - io_hdr[k].sbp = sense_buffer[k]; - io_hdr[k].mx_sb_len = SENSE_BUFFER_LEN; - io_hdr[k].timeout = 20000; /* 20000 millisecs == 20 seconds */ - io_hdr[k].pack_id = k + 3; /* so pack_id doesn't start at 0 */ + io_v4p->response = (uint64_t)sense_buffer[k]; + io_v4p->max_response_len = SENSE_BUFFER_LEN; + io_v4p->timeout = 20000; /* 20000 millisecs == 20 seconds */ + io_v4p->request_extra = k + 3; /* so pack_id doesn't start at 0 */ /* default is to queue at head (in SCSI mid level) */ if (q_at_tail) - io_hdr[k].flags |= SG_FLAG_Q_AT_TAIL; + io_v4p->flags |= SG_FLAG_Q_AT_TAIL; else - io_hdr[k].flags |= SG_FLAG_Q_AT_HEAD; - /* io_hdr[k].usr_ptr = NULL; */ + io_v4p->flags |= SG_FLAG_Q_AT_HEAD; + /* io_v4p->usr_ptr = NULL; */ - if (write(sg_fd, &io_hdr[k], sizeof(sg_io_hdr_t)) < 0) { + if (write(sg_fd, io_v4p, sizeof(* io_v4p)) < 0) { pr2serr("%ssg write errno=%d [%s]\n", cp, errno, strerror(errno)); close(sg_fd); return 1; diff --git a/testing/sg_tst_ioctl.c b/testing/sg_tst_ioctl.c index e7127597..0ae34175 100644 --- a/testing/sg_tst_ioctl.c +++ b/testing/sg_tst_ioctl.c @@ -53,7 +53,7 @@ * later of the Linux sg driver. */ -static const char * version_str = "Version: 1.02 20190106"; +static const char * version_str = "Version: 1.02 20190111"; #define INQ_REPLY_LEN 96 #define INQ_CMD_LEN 6 @@ -451,7 +451,7 @@ main(int argc, char * argv[]) uint8_t inq_cdb[INQ_CMD_LEN] = {0x12, 0, 0, 0, INQ_REPLY_LEN, 0}; uint8_t sdiag_cdb[SDIAG_CMD_LEN] = - {0x1d, 0, 0, 0, 0, 0}; + {0x1d, 0x10 /* PF */, 0, 0, 0, 0}; uint8_t inqBuff[MAX_Q_LEN][INQ_REPLY_LEN]; sg_io_hdr_t io_hdr[MAX_Q_LEN]; sg_io_hdr_t rio_hdr; diff --git a/testing/sg_tst_nvme.c b/testing/sg_tst_nvme.c index 6ba16476..6ec9734e 100644 --- a/testing/sg_tst_nvme.c +++ b/testing/sg_tst_nvme.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Douglas Gilbert + * Copyright (c) 2018-2019 Douglas Gilbert * All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the BSD_LICENSE file. @@ -39,7 +39,7 @@ #include "sg_unaligned.h" #include "sg_pr2serr.h" -static const char * version_str = "1.05 20181207"; +static const char * version_str = "1.06 20190113"; #define ME "sg_tst_nvme: " @@ -539,8 +539,7 @@ sg_scsi_inquiry(struct sg_pt_base * ptvp, bool evpd, int pg_op, void * resp, set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_data_in(ptvp, (uint8_t *)resp, mx_resp_len); res = do_scsi_pt(ptvp, -1, timeout_secs, vb); - ret = sg_cmds_process_resp(ptvp, "inquiry", res, mx_resp_len, sense_b, - noisy, vb, &sense_cat); + ret = sg_cmds_process_resp(ptvp, "inquiry", res, noisy, vb, &sense_cat); resid = get_scsi_pt_resid(ptvp); if (residp) *residp = resid; |