aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2023-12-20 23:40:36 -0500
committerDouglas Gilbert <dgilbert@interlog.com>2023-12-20 23:40:36 -0500
commit2355dc4b451989291df695148cd8d8d03b3d987e (patch)
treec904c95db016567b5cbd5d3b85691e57747f7f23
parentd6513410d5ee0883d753cf8679cf0773d20238f1 (diff)
parentbc99b8db2cf8afd04b1f9d68e9bd4f9d847b3c6f (diff)
downloadsg3_utils-upstream-main.tar.gz
rescan-scsi-bus.sh: fix for github issue 46upstream-main
rescan-scsi-bus.sh: fix for github.com/doug-gilbert/sg3_utils/issues/46 git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1076 6180dd3e-e324-4e3e-922d-17de1ae2f315 cppcheck cleanups git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1075 6180dd3e-e324-4e3e-922d-17de1ae2f315 Merge branch 'svn_sync'
-rw-r--r--ChangeLog3
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/sg_lib.c19
-rw-r--r--lib/sg_pt_freebsd.c12
-rw-r--r--lib/sg_pt_linux_nvme.c90
-rwxr-xr-xscripts/rescan-scsi-bus.sh4
-rw-r--r--src/Makefile.am6
-rw-r--r--src/sgp_dd.c7
-rw-r--r--testing/sg_take_snap.c3
9 files changed, 77 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 614e87d6..115ded7a 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.49 [20231213] [svn: r1074]
+Changelog for pre-release sg3_utils-1.49 [20231219] [svn: r1076]
- JSON: make output more consistent so most command
responses have a *_paramter_data or similar sub-object
- apply https://github.com/doug-gilbert/sg3_utils/pull/39
@@ -30,6 +30,7 @@ Changelog for pre-release sg3_utils-1.49 [20231213] [svn: r1074]
- rescan-scsi-bus.sh: fix multipath resize without update
https://github.com/doug-gilbert/sg3_utils/pull/43.diff
and 44.diff
+ - fix for github.com/doug-gilbert/sg3_utils/issues/46
- start complying with T10 23-047r1 "Broadcom SNT Reference"
document assuming T10 SNT drafts are coming
- sg_lib: add sg_last_n_non_blank() for SNT FR field
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ffa15c4e..4966dbe7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -71,8 +71,10 @@ endif
if DEBUG
# This is active if --enable-debug given to ./configure
# removed -Wduplicated-branches because needs gcc-8
-DBG_CFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init -Wunused -Wsizeof-array-argument
-DBG_CXXFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference -Wshadow -Wunused -Wsizeof-array-argument
+DBG_CFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference \
+ -Wshadow -Wjump-misses-init -Wunused -Wsizeof-array-argument -Wparentheses
+DBG_CXXFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference \
+ -Wshadow -Wunused -Wsizeof-array-argument -Wparentheses
DBG_CPPFLAGS = -DDEBUG
else
DBG_CFLAGS =
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index f3c11649..bc939a24 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -69,8 +69,9 @@ my_isprint(int ch)
return ((ch >= ' ') && (ch < 0x7f));
}
-void sg_rep_invocation(const char * util_name, const char * ver_str,
- int argc, char *argv[], FILE * fgp)
+void
+sg_rep_invocation(const char * util_name, const char * ver_str,
+ int argc, char *argv[], FILE * fgp)
{
int k;
FILE * fp = fgp ? fgp : stdout;
@@ -344,9 +345,9 @@ sg_get_sense_key_str(int sense_key, int buff_len, char * buff)
return buff;
}
if ((sense_key >= 0) && (sense_key < 16))
- sg_scnpr(buff, buff_len, "%s", sg_lib_sense_key_desc[sense_key]);
+ sg_scnpr(buff, buff_len, "%s", sg_lib_sense_key_desc[sense_key]);
else
- sg_scnpr(buff, buff_len, "invalid value: 0x%x", sense_key);
+ sg_scnpr(buff, buff_len, "invalid value: 0x%x", sense_key);
return buff;
}
@@ -366,8 +367,7 @@ sg_get_additional_sense_str(int asc, int ascq, bool add_sense_leadin,
const struct sg_lib_asc_ascq_range_t * ei2p =
&sg_lib_asc_ascq_range[k];
- if ((ei2p->asc == asc) &&
- (ascq >= ei2p->ascq_min) &&
+ if ((ei2p->asc == asc) && (ascq >= ei2p->ascq_min) &&
(ascq <= ei2p->ascq_max)) {
found = true;
if (add_sense_leadin)
@@ -384,8 +384,7 @@ sg_get_additional_sense_str(int asc, int ascq, bool add_sense_leadin,
for (k = 0; sg_lib_asc_ascq[k].text; ++k) {
const struct sg_lib_asc_ascq_t * eip = &sg_lib_asc_ascq[k];
- if (eip->asc == asc &&
- eip->ascq == ascq) {
+ if (eip->asc == asc && eip->ascq == ascq) {
found = true;
if (add_sense_leadin)
sg_scnpr(buff, buff_len, "Additional sense: %s", eip->text);
@@ -433,7 +432,7 @@ sg_scsi_sense_desc_find(const uint8_t * sbp, int sb_len,
int add_d_len;
descp += desc_len;
- add_d_len = (k < (add_sb_len - 1)) ? descp[1]: -1;
+ add_d_len = (k < (add_sb_len - 1)) ? descp[1] : -1;
desc_len = add_d_len + 2;
if (descp[0] == desc_type)
return descp;
@@ -541,7 +540,7 @@ sg_get_sense_filemark_eom_ili(const uint8_t * sbp, int sb_len,
return false;
case 0x72:
case 0x73:
- /* Look for stream commands sense data descriptor */
+ /* Look for stream commands sense data descriptor */
bp = sg_scsi_sense_desc_find(sbp, sb_len, 4);
if (bp && (bp[1] >= 2)) {
if (bp[3] & 0xe0) {
diff --git a/lib/sg_pt_freebsd.c b/lib/sg_pt_freebsd.c
index 85adfa65..bf38cce4 100644
--- a/lib/sg_pt_freebsd.c
+++ b/lib/sg_pt_freebsd.c
@@ -591,13 +591,11 @@ destruct_scsi_pt_obj(struct sg_pt_base * vp)
void
clear_scsi_pt_obj(struct sg_pt_base * vp)
{
- struct sg_pt_freebsd_scsi * ptp;
-
if (NULL == vp) {
pr2ws(">>>>> %s: NULL pointer given\n", __func__);
return;
- }
- if ((ptp = &vp->impl)) {
+ } else {
+ struct sg_pt_freebsd_scsi * ptp = &vp->impl;
int dev_han = ptp->dev_han;
struct freebsd_dev_channel *fdc_p = ptp->mchanp;
@@ -636,14 +634,12 @@ partial_clear_scsi_pt_obj(struct sg_pt_base * vp)
int
set_pt_file_handle(struct sg_pt_base * vp, int dev_han, int vb)
{
- struct sg_pt_freebsd_scsi * ptp;
-
if (NULL == vp) {
if (vb)
pr2ws(">>>> %s: pointer to object is NULL\n", __func__);
return EINVAL;
- }
- if ((ptp = &vp->impl)) {
+ } else {
+ struct sg_pt_freebsd_scsi * ptp = &vp->impl;
struct freebsd_dev_channel *fdc_p;
if (dev_han < 0) {
diff --git a/lib/sg_pt_linux_nvme.c b/lib/sg_pt_linux_nvme.c
index 1a51b792..480782cb 100644
--- a/lib/sg_pt_linux_nvme.c
+++ b/lib/sg_pt_linux_nvme.c
@@ -415,7 +415,7 @@ sg_nvme_admin_cmd_f(struct sg_pt_linux_scsi * ptp,
/* see NVME MI document, NVMSR is NVM Subsystem Report */
static void
-sg_snt_check_enclosure_override(struct sg_pt_linux_scsi * ptp, int vb)
+sg_nvme_check_enclosure_override(struct sg_pt_linux_scsi * ptp, int vb)
{
uint8_t * up = ptp->nvme_id_ctlp;
uint8_t nvmsr;
@@ -468,8 +468,8 @@ sg_snt_check_enclosure_override(struct sg_pt_linux_scsi * ptp, int vb)
}
static int
-sg_snt_do_identify(struct sg_pt_linux_scsi * ptp, int cns, int nsid,
- int time_secs, int u_len, uint8_t * up, int vb)
+sg_nvme_do_identify(struct sg_pt_linux_scsi * ptp, int cns, int nsid,
+ int time_secs, int u_len, uint8_t * up, int vb)
{
struct sg_nvme_passthru_cmd cmd;
@@ -485,8 +485,8 @@ sg_snt_do_identify(struct sg_pt_linux_scsi * ptp, int cns, int nsid,
/* Currently only caches associated identify controller response (4096 bytes).
* Returns 0 on success; otherwise a positive value is returned */
static int
-sg_snt_cache_identify_ctl(struct sg_pt_linux_scsi * ptp, int time_secs,
- int vb)
+sg_nvme_cache_identify_ctl(struct sg_pt_linux_scsi * ptp, int time_secs,
+ int vb)
{
int ret;
uint32_t pg_sz = sg_get_page_size();
@@ -498,18 +498,18 @@ sg_snt_cache_identify_ctl(struct sg_pt_linux_scsi * ptp, int time_secs,
pr2ws("%s: sg_memalign() failed to get memory\n", __func__);
return sg_convert_errno(ENOMEM);
}
- ret = sg_snt_do_identify(ptp, 0x1 /* CNS */, 0 /* nsid */, time_secs,
- pg_sz, up, vb);
+ ret = sg_nvme_do_identify(ptp, 0x1 /* CNS */, 0 /* nsid */, time_secs,
+ pg_sz, up, vb);
if (0 == ret)
- sg_snt_check_enclosure_override(ptp, vb);
+ sg_nvme_check_enclosure_override(ptp, vb);
return (ret < 0) ? sg_convert_errno(-ret) : ret;
}
/* If nsid==0 then set cmdp->nsid to SG_NVME_BROADCAST_NSID. */
static int
-sg_snt_get_features(struct sg_pt_linux_scsi * ptp, int feature_id,
- int select, uint32_t nsid, uint64_t din_addr,
- int time_secs, int vb)
+sg_nvme_get_features(struct sg_pt_linux_scsi * ptp, int feature_id,
+ int select, uint32_t nsid, uint64_t din_addr,
+ int time_secs, int vb)
{
int res;
struct sg_nvme_passthru_cmd cmd;
@@ -536,10 +536,10 @@ sg_snt_get_features(struct sg_pt_linux_scsi * ptp, int feature_id,
}
static int
-sg_snt_set_features(struct sg_pt_linux_scsi * ptp, int feature_id,
- bool save, uint32_t nsid, uint64_t dout_addr,
- uint32_t cdw11, uint32_t cdw12, uint32_t cdw13,
- uint32_t cdw15, int time_secs, int vb)
+sg_nvme_set_features(struct sg_pt_linux_scsi * ptp, int feature_id,
+ bool save, uint32_t nsid, uint64_t dout_addr,
+ uint32_t cdw11, uint32_t cdw12, uint32_t cdw13,
+ uint32_t cdw15, int time_secs, int vb)
{
int res;
struct sg_nvme_passthru_cmd cmd;
@@ -553,7 +553,7 @@ sg_snt_set_features(struct sg_pt_linux_scsi * ptp, int feature_id,
cmdp->nsid = nsid ? nsid : SG_NVME_BROADCAST_NSID;
cmdp->cdw10 = (feature_id & 0xff);
if (save)
- cmdp->cdw10 |= (1 << 31); /* set bit 31 */
+ cmdp->cdw10 |= (1U << 31); /* set bit 31 */
cmdp->cdw11 = cdw11;
cmdp->cdw12 = cdw12;
cmdp->cdw13 = cdw13;
@@ -599,7 +599,7 @@ sg_ln_snt_inq(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
return 0;
}
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -613,8 +613,8 @@ sg_ln_snt_inq(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
(ptp->nvme_nsid < SG_NVME_BROADCAST_NSID)) {
nvme_id_nsp = sg_memalign(pg_sz, pg_sz, &free_nvme_id_nsp, false);
if (nvme_id_nsp) { /* CNS=0x0 Identify namespace */
- res = sg_snt_do_identify(ptp, 0x0, ptp->nvme_nsid,
- time_secs, pg_sz, nvme_id_nsp, vb);
+ res = sg_nvme_do_identify(ptp, 0x0, ptp->nvme_nsid,
+ time_secs, pg_sz, nvme_id_nsp, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -650,7 +650,7 @@ sg_ln_snt_rluns(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
pr2ws("%s: time_secs=%d\n", __func__, time_secs);
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -727,15 +727,15 @@ sg_snt_tur(struct sg_pt_linux_scsi * ptp, int time_secs, int vb)
if (vb > 5)
pr2ws("%s: start\n", __func__);
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
} else if (res)
return res;
}
- res = sg_snt_get_features(ptp, 2 /* Power Management */, 0 /* current */,
- 0, 0, time_secs, vb);
+ res = sg_nvme_get_features(ptp, 2 /* Power Management */, 0 /* current */,
+ 0, 0, time_secs, vb);
if (0 != res) {
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
@@ -766,7 +766,7 @@ sg_snt_req_sense(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (vb > 5)
pr2ws("%s: time_secs=%d\n", __func__, time_secs);
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -775,8 +775,8 @@ sg_snt_req_sense(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
}
desc = !!(0x1 & cdbp[1]);
alloc_len = cdbp[4];
- res = sg_snt_get_features(ptp, 0x2 /* Power Management */,
- 0 /* current */, 0, 0, time_secs, vb);
+ res = sg_nvme_get_features(ptp, 0x2 /* Power Management */,
+ 0 /* current */, 0, 0, time_secs, vb);
if (0 != res) {
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
@@ -820,7 +820,7 @@ sg_ln_snt_mode_ss(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (vb > 5)
pr2ws("%s: mode se%s\n", __func__, (is_msense ? "nse" : "lect"));
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -834,8 +834,8 @@ sg_ln_snt_mode_ss(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if ((0x3f == mp_t10) || (0x8 /* caching mpage */ == mp_t10)) {
/* 0x6 is "Volatile write cache" feature id */
- res = sg_snt_get_features(ptp, 0x6, pc_t10_2_select[pc_t10], 0,
- 0, time_secs, vb);
+ res = sg_nvme_get_features(ptp, 0x6, pc_t10_2_select[pc_t10], 0,
+ 0, time_secs, vb);
if (0 != res) {
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
@@ -861,14 +861,14 @@ sg_ln_snt_mode_ss(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
&sg_snt_result);
if (ptp->dev_stat.wce_changed) {
/* feature_id=0x6 for "volatile write cache" */
- res = sg_snt_set_features(ptp, 0x6, sp, ptp->nvme_nsid, 0,
- ptp->dev_stat.wce, 0, 0, 0, time_secs,
- vb);
+ res = sg_nvme_set_features(ptp, 0x6, sp, ptp->nvme_nsid, 0,
+ ptp->dev_stat.wce, 0, 0, 0, time_secs,
+ vb);
if (res)
return res;
}
if (pre_enc_ov != ptp->dev_stat.enclosure_override)
- sg_snt_check_enclosure_override(ptp, vb);/* ENC_OV has changed */
+ sg_nvme_check_enclosure_override(ptp, vb);/* ENC_OV has changed */
}
if (n < 0) {
mk_sense_from_snt_result(ptp, &sg_snt_result, vb);
@@ -1130,8 +1130,8 @@ sg_snt_readcap(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
pr2ws("%s: sg_memalign() failed to get memory\n", __func__);
return sg_convert_errno(ENOMEM);
}
- res = sg_snt_do_identify(ptp, 0x0 /* CNS */, ptp->nvme_nsid, time_secs,
- pg_sz, up, vb);
+ res = sg_nvme_do_identify(ptp, 0x0 /* CNS */, ptp->nvme_nsid, time_secs,
+ pg_sz, up, vb);
if (res < 0) {
res = sg_convert_errno(-res);
goto fini;
@@ -1275,8 +1275,8 @@ do_nvm_pt_low(struct sg_pt_linux_scsi * ptp,
* common to both (and takes a timeout). The difficult is that
* NVME_IOCTL_IO_CMD takes a nvme_passthru_cmd object point. */
static int
-sg_snt_do_nvm_cmd(struct sg_pt_linux_scsi * ptp, struct sg_nvme_user_io * iop,
- uint32_t dlen, bool is_read, int time_secs, int vb)
+sg_do_nvm_cmd(struct sg_pt_linux_scsi * ptp, struct sg_nvme_user_io * iop,
+ uint32_t dlen, bool is_read, int time_secs, int vb)
{
struct sg_nvme_passthru_cmd nvme_pt_cmd;
@@ -1333,8 +1333,8 @@ sg_snt_rread(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (have_fua)
iop->control |= SG_NVME_RW_CONTROL_FUA;
iop->addr = (uint64_t)ptp->io_hdr.din_xferp;
- res = sg_snt_do_nvm_cmd(ptp, iop, ptp->io_hdr.din_xfer_len,
- true /* is_read */, time_secs, vb);
+ res = sg_do_nvm_cmd(ptp, iop, ptp->io_hdr.din_xfer_len,
+ true /* is_read */, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -1379,8 +1379,8 @@ sg_snt_write(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (have_fua)
iop->control |= SG_NVME_RW_CONTROL_FUA;
iop->addr = (uint64_t)ptp->io_hdr.dout_xferp;
- res = sg_snt_do_nvm_cmd(ptp, iop, ptp->io_hdr.dout_xfer_len, false,
- time_secs, vb);
+ res = sg_do_nvm_cmd(ptp, iop, ptp->io_hdr.dout_xfer_len, false,
+ time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -1430,7 +1430,7 @@ sg_snt_verify(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
iop->addr = (uint64_t)ptp->io_hdr.dout_xferp;
dlen = ptp->io_hdr.dout_xfer_len;
}
- res = sg_snt_do_nvm_cmd(ptp, iop, dlen, false, time_secs, vb);
+ res = sg_do_nvm_cmd(ptp, iop, dlen, false, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -1460,7 +1460,7 @@ sg_snt_write_same(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (dp == NULL)
return sg_convert_errno(ENOMEM);
if (NULL == ptp->nvme_id_ctlp) {
- res = sg_snt_cache_identify_ctl(ptp, time_secs, vb);
+ res = sg_nvme_cache_identify_ctl(ptp, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -1502,7 +1502,7 @@ sg_snt_write_same(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
return 0;
}
iop->nblocks = nblks_t10 - 1;
- res = sg_snt_do_nvm_cmd(ptp, iop, 0, false, time_secs, vb);
+ res = sg_do_nvm_cmd(ptp, iop, 0, false, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
@@ -1526,7 +1526,7 @@ sg_snt_sync_cache(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
iop->opcode = SG_NVME_NVM_FLUSH;
if (vb > 4)
pr2ws("%s: immed bit, lba and num_lbs fields ignored\n", __func__);
- res = sg_snt_do_nvm_cmd(ptp, iop, 0, false, time_secs, vb);
+ res = sg_do_nvm_cmd(ptp, iop, 0, false, time_secs, vb);
if (SG_LIB_NVME_STATUS == res) {
mk_sense_from_nvme_status(ptp, vb);
return 0;
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 188d071c..52991e1e 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -1240,7 +1240,9 @@ if [ -x /usr/bin/sg_inq ] ; then
if [ "$sg_turs_version" -gt 353 ] ; then
sg_turs_opt="--ascq=0x3a"
else
- sg_turs_opt=""
+ # Not really interested in timing a TUR but an empty string such as
+ # "" gets interpreted on the command line as a positional parameter.
+ sg_turs_opt="-t"
fi
else
echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils"
diff --git a/src/Makefile.am b/src/Makefile.am
index 1147e460..820de476 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,8 +39,10 @@ endif
# This is active if --enable-debug given to ./configure
# removed -Wduplicated-branches because needs gcc-8
if DEBUG
-DBG_CFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference -Wshadow -Wjump-misses-init -Wunused -Wsizeof-array-argument
-DBG_CXXFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference -Wshadow -Wunused -Wsizeof-array-argument
+DBG_CFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference \
+ -Wshadow -Wjump-misses-init -Wunused -Wsizeof-array-argument -Wparentheses
+DBG_CXXFLAGS = -Wextra -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference \
+ -Wshadow -Wunused -Wsizeof-array-argument -Wparentheses
DBG_CPPFLAGS = -DDEBUG
else
DBG_CFLAGS =
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index 236abcf1..81ffef26 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -1649,11 +1649,12 @@ main(int argc, char * argv[])
char str[STR_SZ];
char * key;
char * buf;
- int res, k, err, keylen;
+ int res, k, err, keylen, status, n, flags;
int64_t in_num_sect = 0;
int64_t out_num_sect = 0;
int64_t seek_skip;
- int in_sect_sz, out_sect_sz, status, n, flags;
+ int in_sect_sz = 0;
+ int out_sect_sz = 0;
void * vp;
struct opts_t * clp = &my_opts;
char ebuff[EBUFF_SZ];
@@ -1983,7 +1984,7 @@ main(int argc, char * argv[])
return -clp->outfd;
} else if (FT_DEV_NULL == clp->out_type) {
clp->outfd = -1; /* don't bother opening */
- out_is_dev_null = true;
+ out_is_dev_null = true;
} else {
if (FT_RAW != clp->out_type) {
flags = O_WRONLY | O_CREAT;
diff --git a/testing/sg_take_snap.c b/testing/sg_take_snap.c
index c714a409..a39395c2 100644
--- a/testing/sg_take_snap.c
+++ b/testing/sg_take_snap.c
@@ -93,7 +93,8 @@ usage(void)
int main(int argc, char * argv[])
{
bool clear_first = false;
- int c, k, sg_fd, res;
+ int c, k, res;
+ int sg_fd = -1;
int ret = 0;
int verbose = 0;
const char * device_name = NULL;