diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2021-09-26 01:56:11 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2021-09-26 01:56:11 +0000 |
commit | 20704a875ab548d2861227256ed4ba9b068aa0ac (patch) | |
tree | ff17ab625bf0b78214a31660f7a024c0f3e921b2 /src | |
parent | 6aa4d33cce95c534665f3f8e057f13a69ab10835 (diff) | |
download | sg3_utils-20704a875ab548d2861227256ed4ba9b068aa0ac.tar.gz |
sg_vpd: zoned block dev char vpd: add zone alignment mode and zone starting LBA granularity; gcc -fanalyzer fixes: in sg_pt_linux.c + sg_write_x.c
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@914 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/Makefile.in | 1 | ||||
-rw-r--r-- | src/sg_logs.c | 6 | ||||
-rw-r--r-- | src/sg_rep_zones.c | 3 | ||||
-rw-r--r-- | src/sg_vpd.c | 36 | ||||
-rw-r--r-- | src/sg_write_x.c | 10 |
6 files changed, 41 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 1b0a44a2..9007642f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,7 @@ endif # -Wall is no longer all warnings. Add -W (since renamed to -Wextra) for more AM_CPPFLAGS = -iquote ${top_srcdir}/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(DBG_CPPFLAGS) AM_CFLAGS = -Wall -W $(DBG_CFLAGS) +# AM_CFLAGS = -Wall -W $(DBG_CFLAGS) -fanalyzer # AM_CFLAGS = -Wall -W -Wextra -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init # AM_CFLAGS = -Wall -W -pedantic -std=c11 # AM_CFLAGS = -Wall -W -pedantic -std=c11 --analyze diff --git a/src/Makefile.in b/src/Makefile.in index a388234c..41d760f7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -639,6 +639,7 @@ sg_scan_SOURCES = $(am__append_2) $(am__append_4) $(am__append_6) # -Wall is no longer all warnings. Add -W (since renamed to -Wextra) for more AM_CPPFLAGS = -iquote ${top_srcdir}/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(DBG_CPPFLAGS) AM_CFLAGS = -Wall -W $(DBG_CFLAGS) +# AM_CFLAGS = -Wall -W $(DBG_CFLAGS) -fanalyzer # AM_CFLAGS = -Wall -W -Wextra -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init # AM_CFLAGS = -Wall -W -pedantic -std=c11 # AM_CFLAGS = -Wall -W -pedantic -std=c11 --analyze diff --git a/src/sg_logs.c b/src/sg_logs.c index bc93a7e0..ef9c8fbc 100644 --- a/src/sg_logs.c +++ b/src/sg_logs.c @@ -36,7 +36,7 @@ #include "sg_unaligned.h" #include "sg_pr2serr.h" -static const char * version_str = "1.85 20210802"; /* spc6r05 + sbc5r01 */ +static const char * version_str = "1.86 20210924"; /* spc6r05 + sbc5r01 */ #define MX_ALLOC_LEN (0xfffc) #define SHORT_RESP_LEN 128 @@ -4861,8 +4861,8 @@ static const char * bms_status[] = { "background scan halted due to medium formatted without P-List", "background scan halted - vendor specific cause", "background scan halted due to temperature out of range", - "background scan enabled, none active (waiting for BMS interval timer " - "to expire)", /* 8 */ + ("background scan enabled, none active (waiting for BMS interval timer " + "to expire)"), /* clang warns about this, add parens to quieten */ "background scan halted - scan results list full", "background scan halted - pre-scan time limit timer expired" /* 10 */, }; diff --git a/src/sg_rep_zones.c b/src/sg_rep_zones.c index e968d295..7453ee22 100644 --- a/src/sg_rep_zones.c +++ b/src/sg_rep_zones.c @@ -39,7 +39,7 @@ * Based on zbc2r10.pdf */ -static const char * version_str = "1.27 20210830"; +static const char * version_str = "1.28 20210922"; #define MAX_RZONES_BUFF_LEN (1024 * 1024) #define DEF_RZONES_BUFF_LEN (1024 * 8) @@ -160,6 +160,7 @@ h_twoormore: " 0x10 list zones with RWP Recommended set to true\n" " 0x11 list zones with Non-sequential write resources " "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 " "POINTER\n\n"); pr2serr("Reporting options for REPORT ZONE DOMAINS:\n" diff --git a/src/sg_vpd.c b/src/sg_vpd.c index 21d412c9..82924da5 100644 --- a/src/sg_vpd.c +++ b/src/sg_vpd.c @@ -40,7 +40,7 @@ */ -static const char * version_str = "1.66 20210702"; /* spc6r05 + sbc5r01 */ +static const char * version_str = "1.66 20210923"; /* spc6r05 + sbc5r01 */ /* standard VPD pages, in ascending page number order */ #define VPD_SUPPORTED_VPDS 0x0 @@ -2549,6 +2549,7 @@ static void decode_zbdch_vpd(uint8_t * b, int len, int do_hex) { uint32_t u; + char d[32]; if (do_hex) { hex2stdout(b, len, (1 == do_hex) ? 0 : -1); @@ -2559,10 +2560,12 @@ decode_zbdch_vpd(uint8_t * b, int len, int do_hex) "short=%d\n", len); return; } + printf(" Peripheral device type: %s\n", + sg_get_pdt_str(0x1f & b[0], sizeof(d), d)); printf(" Zoned block device extension: "); switch ((b[4] >> 4) & 0xf) { case 0: - printf("not reported\n"); + printf("not reported [0]\n"); break; case 1: printf("host aware zone block device model\n"); @@ -2596,6 +2599,23 @@ decode_zbdch_vpd(uint8_t * b, int len, int do_hex) printf("no limit\n"); else printf("%" PRIu32 "\n", u); + printf(" Zone alignment mode: "); /* zbc2r11 */ + switch (b[23] & 0xf) { + case 0: + printf("not reported [0]\n"); + break; + case 1: + printf("use constant zone lengths\n"); + break; + case 0x8: + printf("zone length given by REPORT ZONES\n"); + break; + default: + printf("Unknown [0x%x]\n", (b[23] & 0xf)); + break; + } + printf(" Zone starting LBA granularity: 0x%" PRIx64 "\n", + sg_get_unaligned_be64(b + 24)); } /* VPD_BLOCK_LIMITS_EXT [0xb7] sbc */ @@ -3733,8 +3753,8 @@ svpd_examine_all(int sg_fd, struct opts_t * op) } if (op->do_long) snprintf(b, sizeof(b), "[0x%x] ", k); - else - b[0] = '\0'; + else + b[0] = '\0'; res = svpd_decode_t10(sg_fd, op, 0, 0, b); if (SG_LIB_CAT_OTHER == res) { res = svpd_decode_vendor(sg_fd, op, 0); @@ -3825,11 +3845,11 @@ main(int argc, char * argv[]) MX_ALLOC_LEN); return SG_LIB_SYNTAX_ERROR; } - if ((op->maxlen > 0) && (op->maxlen < MIN_MAXLEN)) { + if ((op->maxlen > 0) && (op->maxlen < MIN_MAXLEN)) { pr2serr("Warning: overriding '--maxlen' < %d, using " - "default\n", MIN_MAXLEN); - op->maxlen = 0; - } + "default\n", MIN_MAXLEN); + op->maxlen = 0; + } break; case 'M': if (op->vend_prod) { diff --git a/src/sg_write_x.c b/src/sg_write_x.c index 3e6d1fae..504fe26f 100644 --- a/src/sg_write_x.c +++ b/src/sg_write_x.c @@ -38,7 +38,7 @@ #include "sg_unaligned.h" #include "sg_pr2serr.h" -static const char * version_str = "1.27 20210830"; +static const char * version_str = "1.28 20210923"; /* Protection Information refers to 8 bytes of extra information usually * associated with each logical block and is often abbreviated to PI while @@ -803,6 +803,7 @@ build_t10_scat(const char * scat_fname, bool do_16, bool parse_one, uint32_t * sum_num, uint32_t max_list_blen) { bool have_stdin = false; + bool del_fp = false; bool bit0, ok; int off = 0; int in_len, k, j, m, n, res, err; @@ -833,6 +834,7 @@ build_t10_scat(const char * scat_fname, bool do_16, bool parse_one, safe_strerror(err)); return sg_convert_errno(err); } + del_fp = true; } for (j = 0; j < 1024; ++j) {/* loop over lines in file */ if ((max_list_blen > 0) && ((n + lbard_sz) > max_list_blen)) @@ -927,15 +929,15 @@ build_t10_scat(const char * scat_fname, bool do_16, bool parse_one, } fini: *num_scat_elems = (n / lbard_sz) - 1; - if (fp && (stdin != fp)) + if (del_fp) fclose(fp); return 0; bad_exit: - if (fp && (stdin != fp)) + if (del_fp) fclose(fp); return SG_LIB_SYNTAX_ERROR; bad_mem_exit: - if (fp && (stdin != fp)) + if (del_fp) fclose(fp); return SG_LIB_CAT_NOT_READY; /* flag output buffer too small */ } |