sg_rep_zones.c (sg3_utils-1.47r908.tgz) | : | sg_rep_zones.c (sg3_utils-1.47r915.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#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 REPORT ZONES, REPORT ZONE DOMAINS or REPORT | * This program issues the SCSI REPORT ZONES, REPORT ZONE DOMAINS or REPORT | |||
* REALMS command to the given SCSI device and decodes the response. | * REALMS command to the given SCSI device and decodes the response. | |||
* Based on zbc2r10.pdf | * Based on zbc2r10.pdf | |||
*/ | */ | |||
static const char * version_str = "1.26 20210726"; | static const char * version_str = "1.28 20210922"; | |||
#define MAX_RZONES_BUFF_LEN (1024 * 1024) | #define MAX_RZONES_BUFF_LEN (1024 * 1024) | |||
#define DEF_RZONES_BUFF_LEN (1024 * 8) | #define DEF_RZONES_BUFF_LEN (1024 * 8) | |||
#define SG_ZONING_IN_CMDLEN 16 | #define SG_ZONING_IN_CMDLEN 16 | |||
#define REPORT_ZONES_SA 0x0 | #define REPORT_ZONES_SA 0x0 | |||
#define REPORT_ZONE_DOMAINS_SA 0x7 | #define REPORT_ZONE_DOMAINS_SA 0x7 | |||
#define REPORT_REALMS_SA 0x6 | #define REPORT_REALMS_SA 0x6 | |||
skipping to change at line 161 | skipping to change at line 161 | |||
" 0x3 list zones with a zone condition of EXPLICITLY " | " 0x3 list zones with a zone condition of EXPLICITLY " | |||
"OPENED\n" | "OPENED\n" | |||
" 0x4 list zones with a zone condition of CLOSED\n" | " 0x4 list zones with a zone condition of CLOSED\n" | |||
" 0x5 list zones with a zone condition of FULL\n" | " 0x5 list zones with a zone condition of FULL\n" | |||
" 0x6 list zones with a zone condition of READ ONLY\n" | " 0x6 list zones with a zone condition of READ ONLY\n" | |||
" 0x7 list zones with a zone condition of OFFLINE\n" | " 0x7 list zones with a zone condition of OFFLINE\n" | |||
" 0x8 list zones with a zone condition of INACTIVE\n" | " 0x8 list zones with a zone condition of INACTIVE\n" | |||
" 0x10 list zones with RWP Recommended set to true\n" | " 0x10 list zones with RWP Recommended set to true\n" | |||
" 0x11 list zones with Non-sequential write resources " | " 0x11 list zones with Non-sequential write resources " | |||
"active set to true\n" | "active set to true\n" | |||
" 0x3e list zones except those with zone type: GAP\n" | ||||
" 0x3f list zones with a zone condition of NOT WRITE " | " 0x3f list zones with a zone condition of NOT WRITE " | |||
"POINTER\n\n"); | "POINTER\n\n"); | |||
pr2serr("Reporting options for REPORT ZONE DOMAINS:\n" | pr2serr("Reporting options for REPORT ZONE DOMAINS:\n" | |||
" 0x0 list all zone domains\n" | " 0x0 list all zone domains\n" | |||
" 0x1 list all zone domains in which all zones are active\n" | " 0x1 list all zone domains in which all zones are active\n" | |||
" 0x2 list all zone domains that contain active zones\n" | " 0x2 list all zone domains that contain active zones\n" | |||
" 0x3 list all zone domains that do not contain any active " | " 0x3 list all zone domains that do not contain any active " | |||
"zones\n\n"); | "zones\n\n"); | |||
pr2serr("Reporting options for REPORT REALMS:\n" | pr2serr("Reporting options for REPORT REALMS:\n" | |||
" 0x0 list all realms\n" | " 0x0 list all realms\n" | |||
skipping to change at line 217 | skipping to change at line 218 | |||
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, rz_cdb, sizeof(rz_cdb)); | set_scsi_pt_cdb(ptvp, rz_cdb, sizeof(rz_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, mx_resp_len); | set_scsi_pt_data_in(ptvp, (uint8_t *)resp, mx_resp_len); | |||
res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, vb); | res = do_scsi_pt(ptvp, sg_fd, DEF_PT_TIMEOUT, vb); | |||
ret = sg_cmds_process_resp(ptvp, "report zone/domain/realm", res, noisy, | ret = sg_cmds_process_resp(ptvp, "report zone/domain/realm", res, noisy, | |||
vb, &sense_cat); | vb, &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. 3 change blocks. | ||||
4 lines changed or deleted | 8 lines changed or added |