sg_get_elem_status.c (sg3_utils-1.47r908.tgz) | : | sg_get_elem_status.c (sg3_utils-1.47r915.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
#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 GET PHYSICAL ELEMENT STATUS command to the | * This program issues the SCSI GET PHYSICAL ELEMENT STATUS command to the | |||
* given SCSI device. | * given SCSI device. | |||
*/ | */ | |||
static const char * version_str = "1.04 20210803"; /* sbc4r19 */ | static const char * version_str = "1.06 20210831"; /* sbc5r01 */ | |||
#ifndef UINT32_MAX | #ifndef UINT32_MAX | |||
#define UINT32_MAX ((uint32_t)-1) | #define UINT32_MAX ((uint32_t)-1) | |||
#endif | #endif | |||
#define GET_PHY_ELEM_STATUS_SA 0x17 | #define GET_PHY_ELEM_STATUS_SA 0x17 | |||
#define DEF_GPES_BUFF_LEN 32 | #define DEF_GPES_BUFF_LEN 32 | |||
#define MAX_GPES_BUFF_LEN ((1024 * 1024) + DEF_GPES_BUFF_LEN) | #define MAX_GPES_BUFF_LEN ((1024 * 1024) + DEF_GPES_BUFF_LEN) | |||
#define GPES_DESC_OFFSET 32 /* descriptors starts at this byte offset */ | #define GPES_DESC_OFFSET 32 /* descriptors starts at this byte offset */ | |||
#define GPES_DESC_LEN 32 | #define GPES_DESC_LEN 32 | |||
skipping to change at line 175 | skipping to change at line 175 | |||
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, gpesCmd, sizeof(gpesCmd)); | set_scsi_pt_cdb(ptvp, gpesCmd, sizeof(gpesCmd)); | |||
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 292 | skipping to change at line 295 | |||
break; | break; | |||
case 'm': | case 'm': | |||
maxlen = sg_get_num(optarg); | maxlen = sg_get_num(optarg); | |||
if ((maxlen < 0) || (maxlen > MAX_GPES_BUFF_LEN)) { | if ((maxlen < 0) || (maxlen > MAX_GPES_BUFF_LEN)) { | |||
pr2serr("argument to '--maxlen' should be %d or less\n", | pr2serr("argument to '--maxlen' should be %d or less\n", | |||
MAX_GPES_BUFF_LEN); | MAX_GPES_BUFF_LEN); | |||
return SG_LIB_SYNTAX_ERROR; | return SG_LIB_SYNTAX_ERROR; | |||
} | } | |||
if (0 == maxlen) | if (0 == maxlen) | |||
maxlen = DEF_GPES_BUFF_LEN; | maxlen = DEF_GPES_BUFF_LEN; | |||
else if (n < MIN_MAXLEN) { | else if (maxlen < MIN_MAXLEN) { | |||
pr2serr("Warning: --maxlen=LEN less than %d ignored\n", | pr2serr("Warning: --maxlen=LEN less than %d ignored\n", | |||
MIN_MAXLEN); | MIN_MAXLEN); | |||
maxlen = DEF_GPES_BUFF_LEN; | maxlen = DEF_GPES_BUFF_LEN; | |||
} | } | |||
break; | break; | |||
case 'r': | case 'r': | |||
do_raw = true; | do_raw = true; | |||
break; | break; | |||
case 'R': | case 'R': | |||
o_readonly = true; | o_readonly = true; | |||
skipping to change at line 547 | skipping to change at line 550 | |||
printf("health: "); | printf("health: "); | |||
j = a_ped.phys_elem_health; | j = a_ped.phys_elem_health; | |||
if (0 == j) | if (0 == j) | |||
printf("not reported"); | printf("not reported"); | |||
else if (j < 0x64) | else if (j < 0x64) | |||
printf("within manufacturer's specification limits <%d>", j); | printf("within manufacturer's specification limits <%d>", j); | |||
else if (0x64 == j) | else if (0x64 == j) | |||
printf("at manufacturer's specification limits <%d>", j); | printf("at manufacturer's specification limits <%d>", j); | |||
else if (j < 0xd0) | else if (j < 0xd0) | |||
printf("outside manufacturer's specification limits <%d>", j); | printf("outside manufacturer's specification limits <%d>", j); | |||
else if (j < 0xfd) | else if (j < 0xfb) | |||
printf("reserved [0x%x]", j); | printf("reserved [0x%x]", j); | |||
else if (0xfb == j) | ||||
printf("depopulation revocation completed, errors detected"); | ||||
else if (0xfc == j) | ||||
printf("depopulation revocation in progress"); | ||||
else if (0xfd == j) | else if (0xfd == j) | |||
printf("depopulation completed, errors detected"); | printf("depopulation completed, errors detected"); | |||
else if (0xfe == j) | else if (0xfe == j) | |||
printf("depopulation operations in progress"); | printf("depopulation operations in progress"); | |||
else if (0xff == j) | else if (0xff == j) | |||
printf("depopulation completed, no errors"); | printf("depopulation completed, no errors"); | |||
if (a_ped.restoration_allowed) | if (a_ped.restoration_allowed) | |||
printf(" [restoration allowed [RALWD]]"); | printf(" [restoration allowed [RALWD]]"); | |||
printf("\n"); | printf("\n"); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 13 lines changed or added |