aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-03-29 01:27:17 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-03-29 01:27:17 +0000
commit93e55163dc9978093b46b7000ae4aa7e8fbb02d4 (patch)
treebf0375f6bfa10f99184b094b0c1f6e12b8abbb0c
parent339d06ac2ba7a7126df065fa562baae738ce15a8 (diff)
downloadsg3_utils-93e55163dc9978093b46b7000ae4aa7e8fbb02d4.tar.gz
sg_vpd: fix vendor struct opts_t alignment; 3rd attempt to release 1.46
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@886 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog3
-rw-r--r--debian/changelog2
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_inq.c6
-rw-r--r--src/sg_inq_data.c2
-rw-r--r--src/sg_vpd.c6
-rw-r--r--src/sg_vpd_vendor.c12
-rw-r--r--testing/sg_mrq_dd.cpp18
-rw-r--r--testing/sgh_dd.cpp40
9 files changed, 57 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fa8937a..4bb2f988 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 released sg3_utils-1.46 [20210327] [svn: r884]
+Changelog for released sg3_utils-1.46 [20210328] [svn: r885]
- sg_rep_pip: new utility: report provisioning initialization
pattern command
- sg_turs: estimated time-to-ready [spc6r03]
@@ -10,6 +10,7 @@ Changelog for released sg3_utils-1.46 [20210327] [svn: r884]
- sg_requests: substantial cleanup
- sg_vpd: add Format presets and Concurrent positioning ranges
- add hot-pluggable field in standard Inquiry [spc6r05]
+ - fix vendor struct opts_t alignment
- sg_inq: add hot-pluggable field in standard Inquiry
- sg_dd: --verify : separate category for miscompare errors
- --verify : oflag=coe continue on miscompares, counts them
diff --git a/debian/changelog b/debian/changelog
index 513da142..f2c6eb08 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.46-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Sat, 27 Mar 2021 21:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Sun, 28 Mar 2021 18:00:00 -0400
sg3-utils (1.45-0.1) unstable; urgency=low
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 12a11c5d..1df98afb 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -84,7 +84,7 @@ fi
%{_libdir}/*.la
%changelog
-* Sat Mar 27 2021 - dgilbert at interlog dot com
+* Sun Mar 28 2021 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.46
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 60fcfa39..35635a35 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -51,7 +51,7 @@
#include "sg_pt_nvme.h"
#endif
-static const char * version_str = "2.09 20210226"; /* spc6r05 */
+static const char * version_str = "2.10 20210328"; /* spc6r05 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -159,8 +159,6 @@ struct opts_t;
static void prepare_ata_identify(const struct opts_t * op, int inhex_len);
#endif
-/* This structure is a duplicate of one of the same name in sg_vpd_vendor.c .
- Take care that both have the same fields (and types). */
struct svpd_values_name_t {
int value;
int subvalue;
@@ -3688,7 +3686,7 @@ vpd_decode(int sg_fd, const struct opts_t * op, int inhex_len)
} else {
if (op->do_hex < 2)
pr2serr(" Only hex output supported. The sg_vpd and sdparm "
- "utilies decode more VPD pages.\n");
+ "utilities decode more VPD pages.\n");
return vpd_mainly_hex(sg_fd, op, inhex_len);
}
}
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index cd33f755..e67ac576 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -1,6 +1,6 @@
/*
* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 2000-2018 D. Gilbert
+ * Copyright (C) 2000-2019 D. Gilbert
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 2d699c30..2dd82a08 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -40,7 +40,7 @@
*/
-static const char * version_str = "1.62 20210326"; /* spc6r05 + sbc4r22 */
+static const char * version_str = "1.63 20210328"; /* spc6r05 + sbc4r22 */
/* standard VPD pages, in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
@@ -104,8 +104,8 @@ static const char * version_str = "1.62 20210326"; /* spc6r05 + sbc4r22 */
#define DEF_PT_TIMEOUT 60 /* 60 seconds */
-/* These structures are duplicates of those of the same name in
- * sg_vpd_vendor.c . Take care that both are the same. */
+/* These two structures are duplicates of those of the same name in
+ * sg_vpd_vendor.c . <<< Take care that both are the same. >>> */
struct opts_t {
bool do_all;
bool do_enum;
diff --git a/src/sg_vpd_vendor.c b/src/sg_vpd_vendor.c
index 32fc3494..554a1f88 100644
--- a/src/sg_vpd_vendor.c
+++ b/src/sg_vpd_vendor.c
@@ -97,22 +97,24 @@
#define DEF_ALLOC_LEN 252
#define MX_ALLOC_LEN (0xc000 + 0x80)
-/* These structures are duplicates of those of the same name in
- * sg_vpd.c . Take care that both are the same. */
-
+/* These two structures are duplicates of those of the same name in
+ * sg_vpd.c . <<< Take care that both are the same. >>> */
struct opts_t {
bool do_all;
bool do_enum;
bool do_force;
bool do_long;
bool do_quiet;
+ bool verbose_given;
+ bool version_given;
int do_hex;
- int vpd_pn;
int do_ident;
- int maxlen;
int do_raw;
+ int examine;
+ int maxlen;
int vend_prod_num;
int verbose;
+ int vpd_pn;
const char * device_name;
const char * page_str;
const char * inhex_fn;
diff --git a/testing/sg_mrq_dd.cpp b/testing/sg_mrq_dd.cpp
index 9ce3eb5b..bed16233 100644
--- a/testing/sg_mrq_dd.cpp
+++ b/testing/sg_mrq_dd.cpp
@@ -30,7 +30,7 @@
*
*/
-static const char * version_str = "1.22 20210321";
+static const char * version_str = "1.23 20210328";
#define _XOPEN_SOURCE 600
#ifndef _GNU_SOURCE
@@ -62,7 +62,6 @@ static const char * version_str = "1.22 20210321";
#include <linux/major.h> /* for MEM_MAJOR, SCSI_GENERIC_MAJOR, etc */
#include <linux/fs.h> /* for BLKSSZGET and friends */
#include <sys/mman.h> /* for mmap() system call */
-#include <sys/random.h> /* for getrandom() system call */
#include <vector>
#include <array>
@@ -77,6 +76,10 @@ static const char * version_str = "1.22 20210321";
#include "config.h"
#endif
+#ifdef HAVE_GETRANDOM
+#include <sys/random.h> /* for getrandom() system call */
+#endif
+
#ifndef HAVE_LINUX_SG_V4_HDR
/* Kernel uapi header contain __user decorations on user space pointers
* to indicate they are unsafe in the kernel space. However glibc takes
@@ -1294,12 +1297,17 @@ read_write_thread(struct global_collection * clp, int id, bool singleton)
rep->same_sg = true;
}
if (clp->in_flags.random) {
- ssize_t ssz;
+#ifdef HAVE_GETRANDOM
+ ssize_t ssz = getrandom(&rep->seed, sizeof(rep->seed), GRND_NONBLOCK);
- ssz = getrandom(&rep->seed, sizeof(rep->seed), GRND_NONBLOCK);
- if (ssz < (ssize_t)sizeof(rep->seed))
+ if (ssz < (ssize_t)sizeof(rep->seed)) {
pr2serr_lk("[%d] %s: getrandom() failed, ret=%d\n", id, __func__,
(int)ssz);
+ rep->seed = (long)time(NULL);
+ }
+#else
+ rep->seed = (long)time(NULL); /* use seconds since epoch as proxy */
+#endif
if (vb > 1)
pr2serr_lk("[%d] %s: seed=%ld\n", id, __func__, rep->seed);
srand48_r(rep->seed, &rep->drand);
diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp
index a678cad5..c1b34218 100644
--- a/testing/sgh_dd.cpp
+++ b/testing/sgh_dd.cpp
@@ -36,7 +36,7 @@
* renamed [20181221]
*/
-static const char * version_str = "2.00 20210305";
+static const char * version_str = "2.01 20210328";
#define _XOPEN_SOURCE 600
#ifndef _GNU_SOURCE
@@ -68,7 +68,6 @@ static const char * version_str = "2.00 20210305";
#include <linux/major.h> /* for MEM_MAJOR, SCSI_GENERIC_MAJOR, etc */
#include <linux/fs.h> /* for BLKSSZGET and friends */
#include <sys/mman.h> /* for mmap() system call */
-#include <sys/random.h> /* for getrandom() system call */
#include <vector>
#include <array>
@@ -82,6 +81,10 @@ static const char * version_str = "2.00 20210305";
#include "config.h"
#endif
+#ifdef HAVE_GETRANDOM
+#include <sys/random.h> /* for getrandom() system call */
+#endif
+
#ifndef HAVE_LINUX_SG_V4_HDR
/* Kernel uapi header contain __user decorations on user space pointers
* to indicate they are unsafe in the kernel space. However glibc takes
@@ -1219,15 +1222,21 @@ mrq_abort_thread(void * v_maip)
int n = 0;
int seed;
unsigned int rn;
- ssize_t ssz;
Mrq_abort_info l_mai = *(Mrq_abort_info *)v_maip;
struct sg_io_v4 ctl_v4;
- ssz = getrandom(&rn, sizeof(rn), GRND_NONBLOCK);
- if (ssz < (ssize_t)sizeof(rn))
- pr2serr_lk("%s: getrandom() failed, returned %d\n", __func__,
- (int)ssz);
- seed = rn;
+#ifdef HAVE_GETRANDOM
+ {
+ ssize_t ssz = getrandom(&seed, sizeof(seed), GRND_NONBLOCK);
+
+ if (ssz < (ssize_t)sizeof(seed)) {
+ pr2serr("getrandom() failed, ret=%d\n", (int)ssz);
+ seed = (int)time(NULL);
+ }
+ }
+#else
+ seed = (int)time(NULL); /* use seconds since epoch as proxy */
+#endif
if (l_mai.debug)
pr2serr_lk("%s: from_id=%d: to abort mrq_pack_id=%d\n", __func__,
l_mai.from_tid, l_mai.mrq_id);
@@ -1469,12 +1478,17 @@ read_write_thread(void * v_tip)
rep->only_out_sg = true;
if (clp->in_flags.random) {
- ssize_t ssz;
+#ifdef HAVE_GETRANDOM
+ ssize_t ssz = getrandom(&rep->seed, sizeof(rep->seed), GRND_NONBLOCK);
- ssz = getrandom(&rep->seed, sizeof(rep->seed), 0);
- if (ssz < (ssize_t)sizeof(rep->seed))
- pr2serr_lk("thread=%d: getrandom() failed, ret=%d\n", rep->id,
- (int)ssz);
+ if (ssz < (ssize_t)sizeof(rep->seed)) {
+ pr2serr_lk("thread=%d: getrandom() failed, ret=%d\n",
+ rep->id, (int)ssz);
+ rep->seed = (long)time(NULL);
+ }
+#else
+ rep->seed = (long)time(NULL); /* use seconds since epoch as proxy */
+#endif
if (vb > 1)
pr2serr_lk("thread=%d: seed=%ld\n", rep->id, rep->seed);
srand48_r(rep->seed, &rep->drand);