sg_read_attr.c (sg3_utils-1.47r908.tgz) | : | sg_read_attr.c (sg3_utils-1.47r915.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#include "sg_unaligned.h" | #include "sg_unaligned.h" | |||
#include "sg_pr2serr.h" | #include "sg_pr2serr.h" | |||
/* A utility program originally written for the Linux OS SCSI subsystem. | /* A utility program originally written for the Linux OS SCSI subsystem. | |||
* | * | |||
* | * | |||
* This program issues the SCSI READ ATTRIBUTE command to the given SCSI device | * This program issues the SCSI READ ATTRIBUTE command to the given SCSI device | |||
* and decodes the response. Based on spc5r08.pdf | * and decodes the response. Based on spc5r08.pdf | |||
*/ | */ | |||
static const char * version_str = "1.14 20210610"; | static const char * version_str = "1.15 20210830"; | |||
#define MAX_RATTR_BUFF_LEN (1024 * 1024) | #define MAX_RATTR_BUFF_LEN (1024 * 1024) | |||
#define DEF_RATTR_BUFF_LEN (1024 * 8) | #define DEF_RATTR_BUFF_LEN (1024 * 8) | |||
#define SG_READ_ATTRIBUTE_CMD 0x8c | #define SG_READ_ATTRIBUTE_CMD 0x8c | |||
#define SG_READ_ATTRIBUTE_CMDLEN 16 | #define SG_READ_ATTRIBUTE_CMDLEN 16 | |||
#define RA_ATTR_VAL_SA 0x0 | #define RA_ATTR_VAL_SA 0x0 | |||
#define RA_ATTR_LIST_SA 0x1 | #define RA_ATTR_LIST_SA 0x1 | |||
#define RA_LV_LIST_SA 0x2 | #define RA_LV_LIST_SA 0x2 | |||
skipping to change at line 284 | skipping to change at line 284 | |||
if (NULL == ptvp) { | if (NULL == ptvp) { | |||
pr2serr("%s: out of memory\n", __func__); | pr2serr("%s: out of memory\n", __func__); | |||
return -1; | return -1; | |||
} | } | |||
set_scsi_pt_cdb(ptvp, ra_cdb, sizeof(ra_cdb)); | set_scsi_pt_cdb(ptvp, ra_cdb, sizeof(ra_cdb)); | |||
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); | set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b)); | |||
set_scsi_pt_data_in(ptvp, (uint8_t *)resp, op->maxlen); | set_scsi_pt_data_in(ptvp, (uint8_t *)resp, op->maxlen); | |||
res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, op->verbose); | res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, op->verbose); | |||
ret = sg_cmds_process_resp(ptvp, "read attribute", res, noisy, | ret = sg_cmds_process_resp(ptvp, "read attribute", res, noisy, | |||
op->verbose, &sense_cat); | op->verbose, &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. 2 change blocks. | ||||
4 lines changed or deleted | 7 lines changed or added |