aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-09-26 01:56:11 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-09-26 01:56:11 +0000
commit20704a875ab548d2861227256ed4ba9b068aa0ac (patch)
treeff17ab625bf0b78214a31660f7a024c0f3e921b2
parent6aa4d33cce95c534665f3f8e057f13a69ab10835 (diff)
downloadsg3_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
-rw-r--r--ChangeLog5
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_dd.82
-rw-r--r--inhex/README4
-rw-r--r--inhex/vpd_zbdc.hex25
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/sg_pt_freebsd.c2
-rw-r--r--lib/sg_pt_linux.c6
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile.in1
-rw-r--r--src/sg_logs.c6
-rw-r--r--src/sg_rep_zones.c3
-rw-r--r--src/sg_vpd.c36
-rw-r--r--src/sg_write_x.c10
16 files changed, 81 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 85420e55..9cea8a15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for pre-release sg3_utils-1.47 [20210912] [svn: r913]
+Changelog for pre-release sg3_utils-1.47 [20210924] [svn: r914]
- transport error handling improved. To fix report of a
BAD_TARGET transport error but the utility still continued.
- introduce SG_LIB_TRANSPORT_ERROR [35] exit status
@@ -14,6 +14,8 @@ Changelog for pre-release sg3_utils-1.47 [20210912] [svn: r913]
- guard against smaller '--maxlen=' values
- sg_logs: additions to Volume statistics lpage [ssc5r05c]
- sg_vpd: fix do_hex type on some recent pages
+ - zoned block dev char vpd: add zone alignment mode and
+ zone starting LBA granularity [zbc2r11]
- sg_read_buffer: fix --length= problem
- sg_dd, sgm_dd, sgp_dd: don't close negative file descriptors
- sg_dd: srand48_r() and mrand48_r() are GNU libc specific,
@@ -34,6 +36,7 @@ Changelog for pre-release sg3_utils-1.47 [20210912] [svn: r913]
library with sg_pt_dummy.c instead of OS specific code.
For experimenting with --inhex= decoding on netbsd
- pt: add Haiku OS support
+ - gcc -fanalyzer fixes: in sg_pt_linux.c + sg_write_x.c
- sg_pt_dummy.c: add list of functions that a new pt
needs to define
- move some hex files from examples to inhex directory
diff --git a/debian/changelog b/debian/changelog
index acbc2ef4..2ff6baad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.47-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Sun, 12 Sep 2021 14:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Sat, 25 Sep 2021 00:01:00 -0400
sg3-utils (1.46-0.1) unstable; urgency=low
diff --git a/doc/sg_dd.8 b/doc/sg_dd.8
index 23c3246e..23b40b07 100644
--- a/doc/sg_dd.8
+++ b/doc/sg_dd.8
@@ -394,7 +394,7 @@ random
this flag is only active with \fIiflag=\fR and when given replaces
\fIif=IFILE\fR. If both are given an error is generated. The input will
be a stream of pseudo random bytes. The Linux getrandom(2) system call is
-used to create a seed and thereadter mrand48(3) is used to generate a
+used to create a seed and there after mrand48(3) is used to generate a
pseudo random sequence, 4 bytes at a time. The quality of the randomness
can be viewed with the ent(1) utility. This is not a high quality random
number generator, it is built for speed, not quality. One application is
diff --git a/inhex/README b/inhex/README
index d7654665..cdc2e1ae 100644
--- a/inhex/README
+++ b/inhex/README
@@ -2,7 +2,7 @@
========================================
The files in this folder contain hexadecimal data (in ASCII) and associated
-comments (prefixed with the hash mark symbol ('#')).
+comments (prefixed with the hash mark symbol: '#' ).
The utility that each hex file is associated with can be determined by
prepending "sg_" to these filenames then going to the 'src' folder (a
@@ -47,4 +47,4 @@ that support --inhex and don't have hex data already. Special cases are
also welcome. They help the author test this code.
Douglas Gilbert
-28th August 2019
+25th September 2021
diff --git a/inhex/vpd_zbdc.hex b/inhex/vpd_zbdc.hex
new file mode 100644
index 00000000..4fb63497
--- /dev/null
+++ b/inhex/vpd_zbdc.hex
@@ -0,0 +1,25 @@
+# Zoned block device characteristics VPD page [0xb6]
+# Host managed zoned block device model; pdt=0x14
+14 b6 00 3c
+# ZBD extension=0; AAORb=0; URSWRZ=0
+00 00 00 00
+
+# Optimal # of open sequential write preferred
+00 00 00 00
+
+# Optimal # of open non-sequentailly written sequential write preferred
+00 00 00 00
+
+# maximum # of open sequential write required
+00 00 00 08
+
+# Zone alignment mode=0 (therefore no gaps)
+00 00 00 00
+
+# Zone starting LBA granularity
+00 00 00 02 00 00 00 00
+
+
+# pad to total length of 64 bytes
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 97410dc3..16efe9e5 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -84,6 +84,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/lib/Makefile.in b/lib/Makefile.in
index 0fdc8a37..458a246a 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -394,6 +394,7 @@ libsgutils2_la_SOURCES = sg_lib.c sg_lib_data.c sg_cmds_basic.c \
# -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/lib/sg_pt_freebsd.c b/lib/sg_pt_freebsd.c
index 47eaf7c4..645d9bef 100644
--- a/lib/sg_pt_freebsd.c
+++ b/lib/sg_pt_freebsd.c
@@ -583,7 +583,7 @@ destruct_scsi_pt_obj(struct sg_pt_base * vp)
if ((ptp = &vp->impl)) {
if (ptp->ccb)
cam_freeccb(ptp->ccb);
- free(ptp);
+ free(vp);
}
}
diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c
index c65c5f94..6d282f50 100644
--- a/lib/sg_pt_linux.c
+++ b/lib/sg_pt_linux.c
@@ -7,7 +7,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-/* sg_pt_linux version 1.53 20210830 */
+/* sg_pt_linux version 1.54 20210923 */
#include <stdio.h>
@@ -439,8 +439,8 @@ destruct_scsi_pt_obj(struct sg_pt_base * vp)
ptp->free_nvme_id_ctlp = NULL;
ptp->nvme_id_ctlp = NULL;
}
- if (ptp)
- free(ptp);
+ if (vp)
+ free(vp);
}
}
diff --git a/sg3_utils.spec b/sg3_utils.spec
index fd1b26ea..35b4b35b 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -84,7 +84,7 @@ fi
%{_libdir}/*.la
%changelog
-* Sun Sep 12 2021 - dgilbert at interlog dot com
+* Sat Sep 25 2021 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.47
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 */
}