"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sg_stream_ctl.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_stream_ctl.c  (sg3_utils-1.47r908.tgz):sg_stream_ctl.c  (sg3_utils-1.47r915.tar.xz)
/* /*
* Copyright (c) 2018-2020 Douglas Gilbert. * Copyright (c) 2018-2021 Douglas Gilbert.
* All rights reserved. * All rights reserved.
* Use of this source code is governed by a BSD-style * Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file. * license that can be found in the BSD_LICENSE file.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
skipping to change at line 38 skipping to change at line 38
#include "sg_pt.h" #include "sg_pt.h"
#include "sg_cmds_basic.h" #include "sg_cmds_basic.h"
#include "sg_unaligned.h" #include "sg_unaligned.h"
#include "sg_pr2serr.h" #include "sg_pr2serr.h"
/* /*
* This program issues the SCSI STREAM CONTROL or GET STREAM STATUS command * This program issues the SCSI STREAM CONTROL or GET STREAM STATUS command
* to the given SCSI device. Based on sbc4r15.pdf . * to the given SCSI device. Based on sbc4r15.pdf .
*/ */
static const char * version_str = "1.09 20200724"; static const char * version_str = "1.10 20210830";
#define STREAM_CONTROL_SA 0x14 #define STREAM_CONTROL_SA 0x14
#define GET_STREAM_STATUS_SA 0x16 #define GET_STREAM_STATUS_SA 0x16
#define STREAM_CONTROL_OPEN 0x1 #define STREAM_CONTROL_OPEN 0x1
#define STREAM_CONTROL_CLOSE 0x2 #define STREAM_CONTROL_CLOSE 0x2
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */ #define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
#define DEF_PT_TIMEOUT 60 /* 60 seconds */ #define DEF_PT_TIMEOUT 60 /* 60 seconds */
skipping to change at line 143 skipping to change at line 143
if (NULL == ptvp) { if (NULL == ptvp) {
pr2serr("%s: out of memory\n", cmd_name); pr2serr("%s: out of memory\n", cmd_name);
return -1; return -1;
} }
set_scsi_pt_cdb(ptvp, gssCdb, sizeof(gssCdb)); set_scsi_pt_cdb(ptvp, gssCdb, sizeof(gssCdb));
set_scsi_pt_data_in(ptvp, resp, alloc_len); set_scsi_pt_data_in(ptvp, resp, alloc_len);
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
res = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, verbose); res = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, verbose);
ret = sg_cmds_process_resp(ptvp, cmd_name, res, noisy, verbose, ret = sg_cmds_process_resp(ptvp, cmd_name, res, noisy, verbose,
&sense_cat); &sense_cat);
if (-1 == ret) if (-1 == ret) {
ret = sg_convert_errno(get_scsi_pt_os_err(ptvp)); if (get_scsi_pt_transport_err(ptvp))
else if (-2 == ret) { ret = SG_LIB_TRANSPORT_ERROR;
else
ret = sg_convert_errno(get_scsi_pt_os_err(ptvp));
} else if (-2 == ret) {
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:
ret = 0; ret = 0;
break; break;
default: default:
ret = sense_cat; ret = sense_cat;
break; break;
} }
} else } else
skipping to change at line 210 skipping to change at line 213
if (NULL == ptvp) { if (NULL == ptvp) {
pr2serr("%s: out of memory\n", cmd_name); pr2serr("%s: out of memory\n", cmd_name);
return -1; return -1;
} }
set_scsi_pt_cdb(ptvp, scCdb, sizeof(scCdb)); set_scsi_pt_cdb(ptvp, scCdb, sizeof(scCdb));
set_scsi_pt_data_in(ptvp, resp, alloc_len); set_scsi_pt_data_in(ptvp, resp, alloc_len);
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
res = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, verbose); res = do_scsi_pt(ptvp, -1, DEF_PT_TIMEOUT, verbose);
ret = sg_cmds_process_resp(ptvp, cmd_name, res, noisy, verbose, ret = sg_cmds_process_resp(ptvp, cmd_name, res, noisy, verbose,
&sense_cat); &sense_cat);
if (-1 == ret) if (-1 == ret) {
ret = sg_convert_errno(get_scsi_pt_os_err(ptvp)); if (get_scsi_pt_transport_err(ptvp))
else if (-2 == ret) { ret = SG_LIB_TRANSPORT_ERROR;
else
ret = sg_convert_errno(get_scsi_pt_os_err(ptvp));
} else if (-2 == ret) {
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:
ret = 0; ret = 0;
break; break;
default: default:
ret = sense_cat; ret = sense_cat;
break; break;
} }
} else } else
 End of changes. 4 change blocks. 
8 lines changed or deleted 14 lines changed or added

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