"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sg_turs.c" between
sg3_utils-1.47r908.tgz and sg3_utils-1.47r915.tar.xz

About: sg3_utils contains utilities that send SCSI commands to devices. Beta version.

sg_turs.c  (sg3_utils-1.47r908.tgz):sg_turs.c  (sg3_utils-1.47r915.tar.xz)
skipping to change at line 47 skipping to change at line 47
#elif defined(HAVE_GETTIMEOFDAY) #elif defined(HAVE_GETTIMEOFDAY)
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include "sg_lib.h" #include "sg_lib.h"
#include "sg_cmds_basic.h" #include "sg_cmds_basic.h"
#include "sg_pt.h" #include "sg_pt.h"
#include "sg_pr2serr.h" #include "sg_pr2serr.h"
static const char * version_str = "3.48 20210102"; static const char * version_str = "3.49 20210830";
#define DEF_PT_TIMEOUT 60 /* 60 seconds */ #define DEF_PT_TIMEOUT 60 /* 60 seconds */
static struct option long_options[] = { static struct option long_options[] = {
{"delay", required_argument, 0, 'd'}, {"delay", required_argument, 0, 'd'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"low", no_argument, 0, 'l'}, {"low", no_argument, 0, 'l'},
{"new", no_argument, 0, 'N'}, {"new", no_argument, 0, 'N'},
{"number", required_argument, 0, 'n'}, {"number", required_argument, 0, 'n'},
{"num", required_argument, 0, 'n'}, /* added in v3.32 (sg3_utils {"num", required_argument, 0, 'n'}, /* added in v3.32 (sg3_utils
skipping to change at line 389 skipping to change at line 389
wait_millisecs(op->delay); wait_millisecs(op->delay);
/* Might get Unit Attention on first invocation */ /* Might get Unit Attention on first invocation */
memset(cdb, 0, sizeof(cdb)); /* TUR's cdb is 6 zeros */ memset(cdb, 0, sizeof(cdb)); /* TUR's cdb is 6 zeros */
set_scsi_pt_cdb(ptvp, cdb, sizeof(cdb)); set_scsi_pt_cdb(ptvp, cdb, sizeof(cdb));
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
set_scsi_pt_packet_id(ptvp, ++packet_id); set_scsi_pt_packet_id(ptvp, ++packet_id);
rs = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, vb); rs = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, vb);
n = sg_cmds_process_resp(ptvp, "Test unit ready", rs, (0 == k), n = sg_cmds_process_resp(ptvp, "Test unit ready", rs, (0 == k),
vb, &sense_cat); vb, &sense_cat);
if (-1 == n) { if (-1 == n) {
resp->ret = sg_convert_errno(get_scsi_pt_os_err(ptvp)); if (get_scsi_pt_transport_err(ptvp))
resp->ret = SG_LIB_TRANSPORT_ERROR;
else
resp->ret = sg_convert_errno(get_scsi_pt_os_err(ptvp));
return k; return k;
} else if (-2 == n) { } else if (-2 == n) {
switch (sense_cat) { switch (sense_cat) {
case SG_LIB_CAT_RECOVERED: case SG_LIB_CAT_RECOVERED:
case SG_LIB_CAT_NO_SENSE: case SG_LIB_CAT_NO_SENSE:
break; break;
case SG_LIB_CAT_NOT_READY: case SG_LIB_CAT_NOT_READY:
++resp->num_errs; ++resp->num_errs;
if ((1 == op->do_number) || (op->delay > 0)) { if ((1 == op->do_number) || (op->delay > 0)) {
if (! check_for_lu_becoming(ptvp)) if (! check_for_lu_becoming(ptvp))
skipping to change at line 441 skipping to change at line 444
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
/* Might get Unit Attention on first invocation */ /* Might get Unit Attention on first invocation */
res = sg_ll_test_unit_ready_pt(ptvp, k, (0 == k), vb); res = sg_ll_test_unit_ready_pt(ptvp, k, (0 == k), vb);
if (res) { if (res) {
++resp->num_errs; ++resp->num_errs;
resp->ret = res; resp->ret = res;
if ((1 == op->do_number) || (op->delay > 0)) { if ((1 == op->do_number) || (op->delay > 0)) {
if (SG_LIB_CAT_NOT_READY == res) { if (SG_LIB_CAT_NOT_READY == res) {
if (! check_for_lu_becoming(ptvp)) if (! check_for_lu_becoming(ptvp))
printf("device not ready\n"); printf("device not ready\n");
continue; continue;
} else { } else {
sg_get_category_sense_str(res, sizeof(b), b, vb); sg_get_category_sense_str(res, sizeof(b), b, vb);
printf("%s\n", b); printf("%s\n", b);
} }
resp->reported = true; resp->reported = true;
break; break;
} }
} }
} }
return k; return k;
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)