https://github.com/hreinecke/sg3_utils branch sles15 synced 20170914; change sg_ll_*() function's 'int noisy' to bool

git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@715 6180dd3e-e324-4e3e-922d-17de1ae2f315
diff --git a/ChangeLog b/ChangeLog
index 9ac2b4b..b4e137d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@
 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 sg3_utils-1.43 [20170912] [svn: r713]
+Changelog for sg3_utils-1.43 [20170917] [svn: r715]
   - sg_bg_ctl: new Background control command (spc4r08)
   - sg_senddiag: add --timeout=SEC option
   - sg_sanitize: add --timeout=SEC option
@@ -31,6 +31,8 @@
       fields to Environmental reporting lpage (spc5r10)
     - add zoned block device statistics lpage (zbc2r?,
       16-264r4)
+    - fixup enumeration in power condition transition
+      log page (from H. Reinecke, Suse)
   - sg_inq: fix potential unbounded loop in --export
     - update version descriptor list to 20170114
   - sg_inq+sg_vpd: update Extended inquiry data vpd
@@ -70,6 +72,8 @@
   - rescan-scsi-bus.sh: harden code
     - fixes from Suse; bump version to: 20160511
   - 55-scsi-sg3_id.rules: fixes from Suse
+  - https://github.com/hreinecke/sg3_utils
+    branch sles15 synced 20170914
   - clang --analyze static checker clean ups
   - shellcheck cleanup on scripts
   - automake: add AM_PROG_AR to configure.ac
@@ -121,6 +125,7 @@
   - sg_io_linux, sg_pt_linux: drop SUGGEST_* decoding
   - sg_unaligned.h: add 48 bit support and gets for
     variable length unsigned integers
+  - change sg_ll_*() function's 'int noisy' to bool
 
 Changelog for sg3_utils-1.41 [20150511] [svn: r644]
   - sg_zone: new utility for open, close and finish
diff --git a/debian/changelog b/debian/changelog
index 2294e20..f7b7397 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@
 
   * New upstream version
 
- -- Douglas Gilbert <[email protected]>  Tue, 17 May 2016 22:00:00 +0200
+ -- Douglas Gilbert <[email protected]>  Fri, 15 Sep 2017 22:00:00 -0400
 
 sg3-utils (1.42-0.1) unstable; urgency=low
 
diff --git a/doc/sg_compare_and_write.8 b/doc/sg_compare_and_write.8
index 4708318..9953792 100644
--- a/doc/sg_compare_and_write.8
+++ b/doc/sg_compare_and_write.8
@@ -1,4 +1,4 @@
-.TH "COMPARE AND WRITE" "8" "March 2014" "sg3_utils\-1.38" SG3_UTILS
+.TH "COMPARE AND WRITE" "8" "September 2017" "sg3_utils\-1.43" SG3_UTILS
 .SH NAME
 sg_compare_and_write \- send the SCSI COMPARE AND WRITE command
 .SH SYNOPSIS
@@ -19,7 +19,7 @@
 buffer is read from the file indicated by the \fI\-\-inw=WF\fR.
 .PP
 Those buffers are expected to each contain \fINUM\fR blocks of data. The
-compare starts at at logical block address \fILBA\fR on the \fIDEVICE\fR
+compare starts at logical block address \fILBA\fR on the \fIDEVICE\fR
 and if the comparison fails (i.e. the provided compare buffer does not
 equal at \fILBA\fR on the \fIDEVICE\fR) then the COMPARE AND WRITE command
 finishes with a sense key of MISCOMPARE. In this case this utility will
@@ -137,8 +137,7 @@
 .SH "REPORTING BUGS"
 Report bugs to [email protected] or [email protected]
 .SH COPYRIGHT
-Copyright \(co 2012\-2014 Kaminario Technologies LTD
-
+Copyright \(co 2012\-2017 Kaminario Technologies LTD
 .br
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
diff --git a/include/sg_cmds_basic.h b/include/sg_cmds_basic.h
index 7fcdb0f..bd769ea 100644
--- a/include/sg_cmds_basic.h
+++ b/include/sg_cmds_basic.h
@@ -2,7 +2,7 @@
 #define SG_CMDS_BASIC_H
 
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -13,8 +13,8 @@
  * sg_warnings_strm which is declared in sg_lib.h and can be set with
  * the sg_set_warnings_strm() function. If not given sg_warnings_strm
  * defaults to stderr.
- * If 'noisy' and 'verbose' are both zero then following functions should
- * not output anything to sg_warnings_strm. If 'noisy' is non-zero and
+ * If 'noisy' is false and 'verbose' is zero then following functions should
+ * not output anything to sg_warnings_strm. If 'noisy' is true and
  * 'verbose' is zero then Unit Attention, Recovered, Medium and Hardware
  * errors (sense keys) send output to sg_warnings_strm. Increasing values
  * of 'verbose' send increasing amounts of (debug) output to
@@ -33,7 +33,7 @@
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb,
  * SG_LIB_CAT_ABORTED_COMMAND, -1 -> other errors */
 int sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op, void * resp,
-                  int mx_resp_len, int noisy, int verbose);
+                  int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI LOG SELECT command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Log Select not supported,
@@ -42,7 +42,7 @@
  * -1 -> other failure */
 int sg_ll_log_select(int sg_fd, int pcr, int sp, int pc, int pg_code,
                      int subpg_code, unsigned char * paramp, int param_len,
-                     int noisy, int verbose);
+                     bool noisy, int verbose);
 
 /* Invokes a SCSI LOG SENSE command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Log Sense not supported,
@@ -51,7 +51,7 @@
  * -1 -> other failure */
 int sg_ll_log_sense(int sg_fd, int ppc, int sp, int pc, int pg_code,
                     int subpg_code, int paramp, unsigned char * resp,
-                    int mx_resp_len, int noisy, int verbose);
+                    int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI MODE SELECT (6) command.  Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_ILLEGAL_REQ ->
@@ -59,7 +59,7 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_mode_select6(int sg_fd, int pf, int sp, void * paramp,
-                        int param_len, int noisy, int verbose);
+                        int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI MODE SELECT (10) command.  Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_ILLEGAL_REQ ->
@@ -67,7 +67,7 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_mode_select10(int sg_fd, int pf, int sp, void * paramp,
-                        int param_len, int noisy, int verbose);
+                        int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI MODE SENSE (6) command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_ILLEGAL_REQ ->
@@ -76,7 +76,7 @@
  * -1 -> other failure */
 int sg_ll_mode_sense6(int sg_fd, int dbd, int pc, int pg_code,
                       int sub_pg_code, void * resp, int mx_resp_len,
-                      int noisy, int verbose);
+                      bool noisy, int verbose);
 
 /* Invokes a SCSI MODE SENSE (10) command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_ILLEGAL_REQ ->
@@ -85,7 +85,7 @@
  * -1 -> other failure */
 int sg_ll_mode_sense10(int sg_fd, int llbaa, int dbd, int pc, int pg_code,
                        int sub_pg_code, void * resp, int mx_resp_len,
-                       int noisy, int verbose);
+                       bool noisy, int verbose);
 
 /* Invokes a SCSI PREVENT ALLOW MEDIUM REMOVAL command (SPC-3)
  * prevent==0 allows removal, prevent==1 prevents removal ...
@@ -94,7 +94,7 @@
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
-int sg_ll_prevent_allow(int sg_fd, int prevent, int noisy, int verbose);
+int sg_ll_prevent_allow(int sg_fd, int prevent, bool noisy, int verbose);
 
 /* Invokes a SCSI READ CAPACITY (10) command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_UNIT_ATTENTION
@@ -102,7 +102,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_readcap_10(int sg_fd, int pmi, unsigned int lba, void * resp,
-                     int mx_resp_len, int noisy, int verbose);
+                     int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI READ CAPACITY (16) command. Returns 0 -> success,
  * SG_LIB_CAT_UNIT_ATTENTION -> media changed??, SG_LIB_CAT_INVALID_OP
@@ -110,21 +110,21 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_readcap_16(int sg_fd, int pmi, uint64_t llba, void * resp,
-                     int mx_resp_len, int noisy, int verbose);
+                     int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI REPORT LUNS command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Report Luns not supported,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_NOT_READY (shouldn't happen), -1 -> other failure */
 int sg_ll_report_luns(int sg_fd, int select_report, void * resp,
-                      int mx_resp_len, int noisy, int verbose);
+                      int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI REQUEST SENSE command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Request Sense not supported??,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
-                        int noisy, int verbose);
+                        bool noisy, int verbose);
 
 /* Invokes a SCSI START STOP UNIT command (SBC + MMC).
  * Return of 0 -> success,
@@ -138,7 +138,7 @@
  * pc_mod__fl_num and noflush__fl arguments to this function.  */
 int sg_ll_start_stop_unit(int sg_fd, int immed, int pc_mod__fl_num,
                           int power_cond, int noflush__fl, int loej,
-                          int start, int noisy, int verbose);
+                          int start, bool noisy, int verbose);
 
 /* Invokes a SCSI SYNCHRONIZE CACHE (10) command. Return of 0 -> success,
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND,
@@ -146,7 +146,7 @@
  * SG_LIB_CAT_IlLEGAL_REQ -> bad field in cdb
  * SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
 int sg_ll_sync_cache_10(int sg_fd, int sync_nv, int immed, int group,
-                        unsigned int lba, unsigned int count, int noisy,
+                        unsigned int lba, unsigned int count, bool noisy,
                         int verbose);
 
 /* Invokes a SCSI TEST UNIT READY command.
@@ -154,7 +154,7 @@
  * Return of 0 -> success, SG_LIB_CAT_UNIT_ATTENTION,
  * SG_LIB_CAT_NOT_READY -> device not ready,
  * SG_LIB_CAT_ABORTED_COMMAND, -1 -> other failure */
-int sg_ll_test_unit_ready(int sg_fd, int pack_id, int noisy, int verbose);
+int sg_ll_test_unit_ready(int sg_fd, int pack_id, bool noisy, int verbose);
 
 /* Invokes a SCSI TEST UNIT READY command.
  * 'pack_id' is just for diagnostics, safe to set to 0.
@@ -164,7 +164,7 @@
  * SG_LIB_CAT_ABORTED_COMMAND, SG_LIB_CAT_NOT_READY ->
  * device not ready, -1 -> other failure */
 int sg_ll_test_unit_ready_progress(int sg_fd, int pack_id, int * progress,
-                                   int noisy, int verbose);
+                                   bool noisy, int verbose);
 
 
 struct sg_simple_inquiry_resp {
@@ -187,7 +187,7 @@
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other errors */
 int sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
-                      int noisy, int verbose);
+                      bool noisy, int verbose);
 
 /* MODE SENSE commands yield a response that has block descriptors followed
  * by mode pages. In most cases users are interested in the first mode page.
@@ -251,7 +251,7 @@
  * categories also have data in bytes received; -2 is still returned. */
 int sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin,
                          int pt_res, int mx_di_len,
-                         const unsigned char * sense_b, int noisy,
+                         const unsigned char * sense_b, bool noisy,
                          int verbose, int * o_sense_cat);
 
 #ifdef __cplusplus
diff --git a/include/sg_cmds_extra.h b/include/sg_cmds_extra.h
index d46db1e..ba8f39c 100644
--- a/include/sg_cmds_extra.h
+++ b/include/sg_cmds_extra.h
@@ -55,11 +55,11 @@
  * -1 -> other failure */
 int sg_ll_format_unit(int sg_fd, int fmtpinfo, int longlist, int fmtdata,
                       int cmplist, int dlist_format, int timeout_secs,
-                      void * paramp, int param_len, int noisy, int verbose);
+                      void * paramp, int param_len, bool noisy, int verbose);
 int sg_ll_format_unit2(int sg_fd, int fmtpinfo, int longlist, int fmtdata,
                        int cmplist, int dlist_format, int ffmt,
                        int timeout_secs, void * paramp, int param_len,
-                       int noisy, int verbose);
+                       bool noisy, int verbose);
 
 /* Invokes a SCSI GET LBA STATUS(16) or GET LBA STATUS(32) command (SBC).
  * Returns 0 -> success,
@@ -68,21 +68,21 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure.
  * sg_ll_get_lba_status() calls the 16 byte variant with rt=0 . */
 int sg_ll_get_lba_status(int sg_fd, uint64_t start_llba, void * resp,
-                         int alloc_len, int noisy, int verbose);
+                         int alloc_len, bool noisy, int verbose);
 int sg_ll_get_lba_status16(int sg_fd, uint64_t start_llba, uint8_t rt,
-                           void * resp, int alloc_len, int noisy,
-			   int verbose);
+                           void * resp, int alloc_len, bool noisy,
+                           int verbose);
 int sg_ll_get_lba_status32(int sg_fd, uint64_t start_llba, uint32_t scan_len,
-			   uint32_t element_id, uint8_t rt,
-                           void * resp, int alloc_len, int noisy,
-			   int verbose);
+                           uint32_t element_id, uint8_t rt,
+                           void * resp, int alloc_len, bool noisy,
+                           int verbose);
 
 /* Invokes a SCSI PERSISTENT RESERVE IN command (SPC). Returns 0
  * when successful, SG_LIB_CAT_INVALID_OP if command not supported,
  * SG_LIB_CAT_ILLEGAL_REQ if field in cdb not supported,
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
 int sg_ll_persistent_reserve_in(int sg_fd, int rq_servact, void * resp,
-                                int mx_resp_len, int noisy, int verbose);
+                                int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI PERSISTENT RESERVE OUT command (SPC). Returns 0
  * when successful, SG_LIB_CAT_INVALID_OP if command not supported,
@@ -90,14 +90,14 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
 int sg_ll_persistent_reserve_out(int sg_fd, int rq_servact, int rq_scope,
                                  unsigned int rq_type, void * paramp,
-                                 int param_len, int noisy, int verbose);
+                                 int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI READ BLOCK LIMITS command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> READ BLOCK LIMITS not supported,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_NOT_READY (shouldn't happen), -1 -> other failure */
 int sg_ll_read_block_limits(int sg_fd, void * resp, int mx_resp_len,
-                            int noisy, int verbose);
+                            bool noisy, int verbose);
 
 /* Invokes a SCSI READ BUFFER command (SPC). Return of 0 ->
  * success, SG_LIB_CAT_INVALID_OP -> invalid opcode,
@@ -105,7 +105,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_read_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
-                      void * resp, int mx_resp_len, int noisy, int verbose);
+                      void * resp, int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI READ DEFECT DATA (10) command (SBC). Return of 0 ->
  * success, SG_LIB_CAT_INVALID_OP -> invalid opcode,
@@ -114,7 +114,7 @@
  * -1 -> other failure */
 int sg_ll_read_defect10(int sg_fd, int req_plist, int req_glist,
                         int dl_format, void * resp, int mx_resp_len,
-                        int noisy, int verbose);
+                        bool noisy, int verbose);
 
 /* Invokes a SCSI READ LONG (10) command (SBC). Note that 'xfer_len'
  * is in bytes. Returns 0 -> success,
@@ -125,7 +125,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_read_long10(int sg_fd, int pblock, int correct, unsigned int lba,
-                      void * resp, int xfer_len, int * offsetp, int noisy,
+                      void * resp, int xfer_len, int * offsetp, bool noisy,
                       int verbose);
 
 /* Invokes a SCSI READ LONG (16) command (SBC). Note that 'xfer_len'
@@ -137,7 +137,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  *  -1 -> other failure */
 int sg_ll_read_long16(int sg_fd, int pblock, int correct, uint64_t llba,
-                      void * resp, int xfer_len, int * offsetp, int noisy,
+                      void * resp, int xfer_len, int * offsetp, bool noisy,
                       int verbose);
 
 /* Invokes a SCSI READ MEDIA SERIAL NUMBER command. Return of 0 -> success,
@@ -146,14 +146,14 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_read_media_serial_num(int sg_fd, void * resp, int mx_resp_len,
-                                int noisy, int verbose);
+                                bool noisy, int verbose);
 
 /* Invokes a SCSI REASSIGN BLOCKS command.  Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> invalid opcode, SG_LIB_CAT_UNIT_ATTENTION,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_CAT_NOT_READY -> device not ready, -1 -> other failure */
 int sg_ll_reassign_blocks(int sg_fd, int longlba, int longlist, void * paramp,
-                          int param_len, int noisy, int verbose);
+                          int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI RECEIVE DIAGNOSTIC RESULTS command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Receive diagnostic results not supported,
@@ -161,7 +161,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_receive_diag(int sg_fd, int pcv, int pg_code, void * resp,
-                       int mx_resp_len, int noisy, int verbose);
+                       int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI REPORT IDENTIFYING INFORMATION command. This command was
  * called REPORT DEVICE IDENTIFIER prior to spc4r07. Return of 0 -> success,
@@ -170,22 +170,22 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_report_id_info(int sg_fd, int itype, void * resp, int max_resp_len,
-                         int noisy, int verbose);
+                         bool noisy, int verbose);
 
 /* Invokes a SCSI REPORT TARGET PORT GROUPS command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Report Target Port Groups not supported,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
 int sg_ll_report_tgt_prt_grp(int sg_fd, void * resp, int mx_resp_len,
-                             int noisy, int verbose);
+                             bool noisy, int verbose);
 int sg_ll_report_tgt_prt_grp2(int sg_fd, void * resp, int mx_resp_len,
-                              int extended, int noisy, int verbose);
+                              int extended, bool noisy, int verbose);
 
 /* Invokes a SCSI SET TARGET PORT GROUPS command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Report Target Port Groups not supported,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
-int sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp, int param_len, int noisy,
+int sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp, int param_len, bool noisy,
                           int verbose);
 
 /* Invokes a SCSI REPORT REFERRALS command. Return of 0 -> success,
@@ -193,7 +193,7 @@
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
 int sg_ll_report_referrals(int sg_fd, uint64_t start_llba, int one_seg,
-                           void * resp, int mx_resp_len, int noisy,
+                           void * resp, int mx_resp_len, bool noisy,
                            int verbose);
 
 /* Invokes a SCSI SEND DIAGNOSTIC command. Foreground, extended self tests can
@@ -206,7 +206,7 @@
  * -1 -> other failure */
 int sg_ll_send_diag(int sg_fd, int sf_code, int pf_bit, int sf_bit,
                     int devofl_bit, int unitofl_bit, int long_duration,
-                    void * paramp, int param_len, int noisy, int verbose);
+                    void * paramp, int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI SET IDENTIFYING INFORMATION command. This command was
  * called SET DEVICE IDENTIFIER prior to spc4r07. Return of 0 -> success,
@@ -215,18 +215,18 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_set_id_info(int sg_fd, int itype, void * paramp, int param_len,
-                      int noisy, int verbose);
+                      bool noisy, int verbose);
 
 /* Invokes a SCSI UNMAP (SBC-3) command. Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> command not supported,
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_ABORTED_COMMAND,
  * SG_LIB_CAT_UNIT_ATTENTION, -1 -> other failure */
 int sg_ll_unmap(int sg_fd, int group_num, int timeout_secs, void * paramp,
-                int param_len, int noisy, int verbose);
+                int param_len, bool noisy, int verbose);
 /* Invokes a SCSI UNMAP (SBC-3) command. Version 2 adds anchor field
  * (sbc3r22). Otherwise same as sg_ll_unmap() . */
 int sg_ll_unmap_v2(int sg_fd, int anchor, int group_num, int timeout_secs,
-                   void * paramp, int param_len, int noisy, int verbose);
+                   void * paramp, int param_len, bool noisy, int verbose);
 
 /* Invokes a SCSI VERIFY (10) command (SBC and MMC).
  * Note that 'veri_len' is in blocks while 'data_out_len' is in bytes.
@@ -239,7 +239,7 @@
  * SG_LIB_CAT_MISCOMPARE, -1 -> other failure */
 int sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytechk,
                    unsigned int lba, int veri_len, void * data_out,
-                   int data_out_len, unsigned int * infop, int noisy,
+                   int data_out_len, unsigned int * infop, bool noisy,
                    int verbose);
 
 /* Invokes a SCSI VERIFY (16) command (SBC).
@@ -254,7 +254,7 @@
 int sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytechk,
                    uint64_t llba, int veri_len, int group_num,
                    void * data_out, int data_out_len, uint64_t * infop,
-                   int noisy, int verbose);
+                   bool noisy, int verbose);
 
 /* Invokes a SCSI WRITE BUFFER command (SPC). Return of 0 ->
  * success, SG_LIB_CAT_INVALID_OP -> invalid opcode,
@@ -262,7 +262,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_write_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
-                       void * paramp, int param_len, int noisy, int verbose);
+                       void * paramp, int param_len, bool noisy, int verbose);
 /* Need a sg_ll_write_buffer_v2() function because SPC-4 rev32 has added
  * a "mode specific" field. Wait for next rev change of this library */
 
@@ -276,7 +276,7 @@
  * -1 -> other failure */
 int sg_ll_write_long10(int sg_fd, int cor_dis, int wr_uncor, int pblock,
                        unsigned int lba, void * data_out, int xfer_len,
-                       int * offsetp, int noisy, int verbose);
+                       int * offsetp, bool noisy, int verbose);
 
 /* Invokes a SCSI WRITE LONG (16) command (SBC). Note that 'xfer_len'
  * is in bytes. Returns 0 -> success,
@@ -288,7 +288,7 @@
  * -1 -> other failure */
 int sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
                        uint64_t llba, void * data_out, int xfer_len,
-                       int * offsetp, int noisy, int verbose);
+                       int * offsetp, bool noisy, int verbose);
 
 /* Invokes a SPC-3 SCSI RECEIVE COPY RESULTS command. In SPC-4 this function
  * supports all service action variants of the THIRD-PARTY COPY IN opcode.
@@ -297,7 +297,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_receive_copy_results(int sg_fd, int sa, int list_id, void * resp,
-                               int mx_resp_len, int noisy, int verbose);
+                               int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI EXTENDED COPY(LID1) command. For EXTENDED COPY(LID4)
  * including POPULATE TOKEN and WRITE USING TOKEN use
@@ -306,7 +306,7 @@
  * SG_LIB_CAT_ILLEGAL_REQ -> bad field in cdb, SG_LIB_CAT_UNIT_ATTENTION,
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
-int sg_ll_extended_copy(int sg_fd, void * paramp, int param_len, int noisy,
+int sg_ll_extended_copy(int sg_fd, void * paramp, int param_len, bool noisy,
                         int verbose);
 
 /* Handles various service actions associated with opcode 0x83 which is
@@ -318,7 +318,7 @@
  * -1 -> other failure */
 int sg_ll_3party_copy_out(int sg_fd, int sa, unsigned int list_id,
                           int group_num, int timeout_secs, void * paramp,
-                          int param_len, int noisy, int verbose);
+                          int param_len, bool noisy, int verbose);
 
 #ifdef __cplusplus
 }
diff --git a/include/sg_cmds_mmc.h b/include/sg_cmds_mmc.h
index e0b76a7..3988b1d 100644
--- a/include/sg_cmds_mmc.h
+++ b/include/sg_cmds_mmc.h
@@ -2,7 +2,7 @@
 #define SG_CMDS_MMC_H
 
 /*
- * Copyright (c) 2008-2013 Douglas Gilbert.
+ * Copyright (c) 2008-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -18,7 +18,7 @@
  * supported, SG_LIB_CAT_ILLEGAL_REQ if field in cdb not supported,
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
 int sg_ll_get_config(int sg_fd, int rt, int starting, void * resp,
-                     int mx_resp_len, int noisy, int verbose);
+                     int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI GET PERFORMANCE command (MMC-3...6).
  * Returns 0 when successful, SG_LIB_CAT_INVALID_OP if command not
@@ -26,7 +26,7 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
 int sg_ll_get_performance(int sg_fd, int data_type, unsigned int starting_lba,
                           int max_num_desc, int type, void * resp,
-                          int mx_resp_len, int noisy, int verbose);
+                          int mx_resp_len, bool noisy, int verbose);
 
 /* Invokes a SCSI SET CD SPEED command (MMC).
  * Return of 0 -> success, SG_LIB_CAT_INVALID_OP -> command not supported,
@@ -34,7 +34,7 @@
  * SG_LIB_CAT_NOT_READY -> device not ready, SG_LIB_CAT_ABORTED_COMMAND,
  * -1 -> other failure */
 int sg_ll_set_cd_speed(int sg_fd, int rot_control, int drv_read_speed,
-                       int drv_write_speed, int noisy, int verbose);
+                       int drv_write_speed, bool noisy, int verbose);
 
 /* Invokes a SCSI SET STREAMING command (MMC). Return of 0 -> success,
  * SG_LIB_CAT_INVALID_OP -> Set Streaming not supported,
@@ -42,7 +42,7 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_NOT_READY -> device not ready,
  * -1 -> other failure */
 int sg_ll_set_streaming(int sg_fd, int type, void * paramp, int param_len,
-                        int noisy, int verbose);
+                        bool noisy, int verbose);
 
 
 #ifdef __cplusplus
diff --git a/include/sg_lib.h b/include/sg_lib.h
index 9b45112..8ec505e 100644
--- a/include/sg_lib.h
+++ b/include/sg_lib.h
@@ -421,18 +421,18 @@
 int dStrHexStr(const char * str, int len, const char * leadin, int format,
                int b_len, char * b);
 
-/* Returns 1 when executed on big endian machine; else returns 0.
+/* Returns true when executed on big endian machine; else returns false.
  * Useful for displaying ATA identify words (which need swapping on a
  * big endian machine).
 */
-int sg_is_big_endian();
+bool sg_is_big_endian();
 
 /* Extract character sequence from ATA words as in the model string
  * in a IDENTIFY DEVICE response. Returns number of characters
  * written to 'ochars' before 0 character is found or 'num' words
  * are processed. */
-int sg_ata_get_chars(const unsigned short * word_arr, int start_word,
-                     int num_words, int is_big_endian, char * ochars);
+int sg_ata_get_chars(const uint16_t * word_arr, int start_word,
+                     int num_words, bool is_big_endian, char * ochars);
 
 /* Print (to stdout) 16 bit 'words' in hex, 8 words per line optionally
  * followed at the right hand side of the line with an ASCII interpretation
@@ -444,10 +444,10 @@
  *     = -1    only the ASCII-hex words are listed (i.e. without address)
  *     = -2    only the ASCII-hex words, formatted for "hdparm --Istdin"
  *     < -2    same as -1
- * If 'swapb' non-zero then bytes in each word swapped. Needs to be set
+ * If 'swapb' is true then bytes in each word swapped. Needs to be set
  * for ATA IDENTIFY DEVICE response on big-endian machines.
 */
-void dWordHex(const unsigned short * words, int num, int no_ascii, int swapb);
+void dWordHex(const uint16_t * words, int num, int no_ascii, bool swapb);
 
 /* If the number in 'buf' can not be decoded or the multiplier is unknown
  * then -1 is returned. Accepts a hex prefix (0x or 0X) or a 'h' (or 'H')
@@ -455,7 +455,8 @@
  * multipliers: c C  *1;  w W  *2; b  B *512;  k K KiB  *1,024;
  * KB  *1,000;  m M MiB  *1,048,576; MB *1,000,000; g G GiB *1,073,741,824;
  * GB *1,000,000,000 and <n>x<m> which multiplies <n> by <m> . Ignore leading
- * spaces and tabs; accept comma, space, tab and hash as terminator. */
+ * spaces and tabs; accept comma, hyphen, space, tab and hash as terminator.
+ */
 int sg_get_num(const char * buf);
 
 /* If the number in 'buf' can not be decoded then -1 is returned. Accepts a
@@ -470,8 +471,8 @@
  * suffix. Otherwise a decimal multiplier suffix may be given. In addition
  * to supporting the multipliers of sg_get_num(), this function supports:
  * t T TiB  *(2**40); TB *(10**12); p P PiB  *(2**50); PB  *(10**15) .
- * Ignore leading spaces and tabs; accept comma, space, tab and hash as
- * terminator. */
+ * Ignore leading spaces and tabs; accept comma, hyphen, space, tab and hash
+ * as terminator. */
 int64_t sg_get_llnum(const char * buf);
 
 /* If the number in 'buf' can not be decoded then -1 is returned. Accepts a
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index bb9a3c8..c9da2f4 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2016 Douglas Gilbert.
+ * Copyright (c) 1999-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -35,7 +35,7 @@
 #endif
 
 
-static const char * const version_str = "1.74 20160528";
+static const char * const version_str = "1.75 20170917";
 
 
 #define SENSE_BUFF_LEN 64       /* Arbitrary, could be larger */
@@ -116,11 +116,11 @@
 
 static int
 sg_cmds_process_helper(const char * leadin, int mx_di_len, int resid,
-                       const unsigned char * sbp, int slen, int noisy,
+                       const unsigned char * sbp, int slen, bool noisy,
                        int verbose, int * o_sense_cat)
 {
     int scat, got;
-    int n = 0;
+    bool n = false;
     bool check_data_in = false;
     char b[512];
 
@@ -135,12 +135,15 @@
     case SG_LIB_CAT_PROTECTION:
     case SG_LIB_CAT_NO_SENSE:
     case SG_LIB_CAT_MISCOMPARE:
-        n = 0;
+        n = false;
         break;
     case SG_LIB_CAT_RECOVERED:
     case SG_LIB_CAT_MEDIUM_HARD:
         check_data_in = true;
-        /* drop through */
+#if defined(__GNUC__) || defined(__clang__)
+        __attribute__((fallthrough));
+        /* FALL THROUGH */
+#endif
     case SG_LIB_CAT_UNIT_ATTENTION:
     case SG_LIB_CAT_SENSE:
     default:
@@ -179,7 +182,7 @@
 int
 sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin,
                      int pt_res, int mx_di_len, const unsigned char * sbp,
-                     int noisy, int verbose, int * o_sense_cat)
+                     bool noisy, int verbose, int * o_sense_cat)
 {
     int got, cat, duration, slen, resid, resp_code, sstat;
     bool transport_sense;
@@ -325,7 +328,7 @@
  * successful, various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op, void * resp,
-              int mx_resp_len, int noisy, int verbose)
+              int mx_resp_len, bool noisy, int verbose)
 {
     int res, ret, k, sense_cat, resid;
     unsigned char inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
@@ -398,7 +401,7 @@
  * -1 -> other errors */
 int
 sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
-                  int noisy, int verbose)
+                  bool noisy, int verbose)
 {
     int res, ret, k, sense_cat;
     unsigned char inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
@@ -472,7 +475,7 @@
  * -1 -> other errors */
 int
 sg_ll_test_unit_ready_progress(int sg_fd, int pack_id, int * progress,
-                               int noisy, int verbose)
+                               bool noisy, int verbose)
 {
     static const char * const tur_s = "test unit ready";
     int res, ret, k, sense_cat;
@@ -525,7 +528,7 @@
  * Returns 0 when successful, various SG_LIB_CAT_* positive values or
  * -1 -> other errors */
 int
-sg_ll_test_unit_ready(int sg_fd, int pack_id, int noisy, int verbose)
+sg_ll_test_unit_ready(int sg_fd, int pack_id, bool noisy, int verbose)
 {
     return sg_ll_test_unit_ready_progress(sg_fd, pack_id, NULL, noisy,
                                           verbose);
@@ -535,7 +538,7 @@
  * SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
-                    int noisy, int verbose)
+                    bool noisy, int verbose)
 {
     static const char * const rq_s = "request sense";
     int k, ret, res, sense_cat;
@@ -595,7 +598,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_report_luns(int sg_fd, int select_report, void * resp, int mx_resp_len,
-                  int noisy, int verbose)
+                  bool noisy, int verbose)
 {
     static const char * const report_luns_s = "report luns";
     int k, ret, res, sense_cat;
diff --git a/lib/sg_cmds_basic2.c b/lib/sg_cmds_basic2.c
index e72c493..f74a064 100644
--- a/lib/sg_cmds_basic2.c
+++ b/lib/sg_cmds_basic2.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2016 Douglas Gilbert.
+ * Copyright (c) 1999-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -101,7 +101,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_sync_cache_10(int sg_fd, int sync_nv, int immed, int group,
-                    unsigned int lba, unsigned int count, int noisy,
+                    unsigned int lba, unsigned int count, bool noisy,
                     int verbose)
 {
     static const char * const cdb_name_s = "synchronize cache(10)";
@@ -159,7 +159,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_readcap_16(int sg_fd, int pmi, uint64_t llba, void * resp,
-                 int mx_resp_len, int noisy, int verbose)
+                 int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read capacity(16)";
     int k, ret, res, sense_cat;
@@ -212,7 +212,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_readcap_10(int sg_fd, int pmi, unsigned int lba, void * resp,
-                 int mx_resp_len, int noisy, int verbose)
+                 int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read capacity(10)";
     int k, ret, res, sense_cat;
@@ -262,7 +262,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_mode_sense6(int sg_fd, int dbd, int pc, int pg_code, int sub_pg_code,
-                  void * resp, int mx_resp_len, int noisy, int verbose)
+                  void * resp, int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "mode sense(6)";
     int res, ret, k, sense_cat, resid;
@@ -338,7 +338,7 @@
 int
 sg_ll_mode_sense10(int sg_fd, int llbaa, int dbd, int pc, int pg_code,
                    int sub_pg_code, void * resp, int mx_resp_len,
-                   int noisy, int verbose)
+                   bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "mode sense(10)";
     int res, ret, k, sense_cat, resid;
@@ -413,7 +413,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_mode_select6(int sg_fd, int pf, int sp, void * paramp, int param_len,
-                   int noisy, int verbose)
+                   bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "mode select(6)";
     int res, ret, k, sense_cat;
@@ -470,7 +470,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_mode_select10(int sg_fd, int pf, int sp, void * paramp, int param_len,
-                    int noisy, int verbose)
+                    bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "mode select(10)";
     int res, ret, k, sense_cat;
@@ -605,12 +605,12 @@
     memset(buff, 0, MODE10_RESP_HDR_LEN);
     if (mode6)  /* want first 8 bytes just in case */
         res = sg_ll_mode_sense6(sg_fd, dbd, 0 /* pc */, pg_code,
-                                sub_pg_code, buff, MODE10_RESP_HDR_LEN, 1,
+                                sub_pg_code, buff, MODE10_RESP_HDR_LEN, true,
                                 verbose);
     else
         res = sg_ll_mode_sense10(sg_fd, 0 /* llbaa */, dbd,
                                  0 /* pc */, pg_code, sub_pg_code, buff,
-                                 MODE10_RESP_HDR_LEN, 1, verbose);
+                                 MODE10_RESP_HDR_LEN, true, verbose);
     if (0 != res)
         return res;
     n = buff[0];
@@ -660,11 +660,11 @@
         if (mode6)
             res = sg_ll_mode_sense6(sg_fd, dbd, k /* pc */,
                                     pg_code, sub_pg_code, buff,
-                                    calc_len, 1, verbose);
+                                    calc_len, true, verbose);
         else
             res = sg_ll_mode_sense10(sg_fd, 0 /* llbaa */, dbd,
                                      k /* pc */, pg_code, sub_pg_code,
-                                     buff, calc_len, 1, verbose);
+                                     buff, calc_len, true, verbose);
         if (0 != res) {
             if (0 == first_err)
                 first_err = res;
@@ -686,7 +686,7 @@
 int
 sg_ll_log_sense(int sg_fd, int ppc, int sp, int pc, int pg_code,
                 int subpg_code, int paramp, unsigned char * resp,
-                int mx_resp_len, int noisy, int verbose)
+                int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "log sense";
     int res, ret, k, sense_cat, resid;
@@ -759,7 +759,7 @@
 int
 sg_ll_log_select(int sg_fd, int pcr, int sp, int pc, int pg_code,
                  int subpg_code, unsigned char * paramp, int param_len,
-                 int noisy, int verbose)
+                 bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "log select";
     int res, ret, k, sense_cat;
@@ -825,7 +825,7 @@
 int
 sg_ll_start_stop_unit(int sg_fd, int immed, int pc_mod__fl_num,
                       int power_cond, int noflush__fl, int loej, int start,
-                      int noisy, int verbose)
+                      bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "start stop unit";
     int k, res, ret, sense_cat;
@@ -875,7 +875,7 @@
  * Return of 0 -> success,
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
-sg_ll_prevent_allow(int sg_fd, int prevent, int noisy, int verbose)
+sg_ll_prevent_allow(int sg_fd, int prevent, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "prevent allow medium removal";
     int k, res, ret, sense_cat;
diff --git a/lib/sg_cmds_extra.c b/lib/sg_cmds_extra.c
index 1e8b88e..a090dd3 100644
--- a/lib/sg_cmds_extra.c
+++ b/lib/sg_cmds_extra.c
@@ -128,7 +128,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_get_lba_status16(int sg_fd, uint64_t start_llba, uint8_t rt,
-                      void * resp, int alloc_len, int noisy, int verbose)
+                      void * resp, int alloc_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "Get LBA status(16)";
     int k, res, sense_cat, ret;
@@ -189,7 +189,7 @@
 
 int
 sg_ll_get_lba_status(int sg_fd, uint64_t start_llba, void * resp,
-                     int alloc_len, int noisy, int verbose)
+                     int alloc_len, bool noisy, int verbose)
 {
     return sg_ll_get_lba_status16(sg_fd, start_llba, /* rt = */ 0x0, resp,
                                   alloc_len, noisy, verbose);
@@ -200,7 +200,7 @@
 int
 sg_ll_get_lba_status32(int sg_fd, uint64_t start_llba, uint32_t scan_len,
                        uint32_t element_id, uint8_t rt,
-                       void * resp, int alloc_len, int noisy,
+                       void * resp, int alloc_len, bool noisy,
                        int verbose)
 {
     static const char * const cdb_name_s = "Get LBA status(32)";
@@ -264,7 +264,7 @@
 
 int
 sg_ll_report_tgt_prt_grp(int sg_fd, void * resp, int mx_resp_len,
-                         int noisy, int verbose)
+                         bool noisy, int verbose)
 {
     return sg_ll_report_tgt_prt_grp2(sg_fd, resp, mx_resp_len, 0, noisy,
                                      verbose);
@@ -274,7 +274,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_report_tgt_prt_grp2(int sg_fd, void * resp, int mx_resp_len,
-                          int extended, int noisy, int verbose)
+                          int extended, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "report target port groups";
     int k, res, ret, sense_cat;
@@ -335,7 +335,7 @@
 /* Invokes a SCSI SET TARGET PORT GROUPS command. Return of 0 -> success,
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
-sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp, int param_len, int noisy,
+sg_ll_set_tgt_prt_grp(int sg_fd, void * paramp, int param_len, bool noisy,
                       int verbose)
 {
     static const char * const cdb_name_s = "set target port groups";
@@ -388,7 +388,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_report_referrals(int sg_fd, uint64_t start_llba, int one_seg,
-                       void * resp, int mx_resp_len, int noisy,
+                       void * resp, int mx_resp_len, bool noisy,
                        int verbose)
 {
     static const char * const cdb_name_s = "report referrals";
@@ -454,7 +454,7 @@
 int
 sg_ll_send_diag(int sg_fd, int sf_code, int pf_bit, int sf_bit, int devofl_bit,
                 int unitofl_bit, int long_duration, void * paramp,
-                int param_len, int noisy, int verbose)
+                int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "send diagnostic";
     int k, res, ret, sense_cat, tmout;
@@ -516,7 +516,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_receive_diag(int sg_fd, int pcv, int pg_code, void * resp,
-                   int mx_resp_len, int noisy, int verbose)
+                   int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "receive diagnostic results";
     int k, res, ret, sense_cat;
@@ -577,7 +577,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_defect10(int sg_fd, int req_plist, int req_glist, int dl_format,
-                    void * resp, int mx_resp_len, int noisy, int verbose)
+                    void * resp, int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read defect(10)";
     int res, k, ret, sense_cat;
@@ -641,7 +641,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_media_serial_num(int sg_fd, void * resp, int mx_resp_len,
-                            int noisy, int verbose)
+                            bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read media serial number";
     int k, res, ret, sense_cat;
@@ -701,7 +701,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_report_id_info(int sg_fd, int itype, void * resp, int max_resp_len,
-                     int noisy, int verbose)
+                     bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "report identifying information";
     int k, res, ret, sense_cat;
@@ -763,7 +763,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_set_id_info(int sg_fd, int itype, void * paramp, int param_len,
-                  int noisy, int verbose)
+                  bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "set identifying information";
     int k, res, ret, sense_cat;
@@ -818,7 +818,7 @@
 int
 sg_ll_format_unit(int sg_fd, int fmtpinfo, int longlist, int fmtdata,
                   int cmplst, int dlist_format, int timeout_secs,
-                  void * paramp, int param_len, int noisy, int verbose)
+                  void * paramp, int param_len, bool noisy, int verbose)
 {
     return sg_ll_format_unit2(sg_fd, fmtpinfo, longlist, fmtdata, cmplst,
                               dlist_format, 0, timeout_secs, paramp,
@@ -831,7 +831,7 @@
 int
 sg_ll_format_unit2(int sg_fd, int fmtpinfo, int longlist, int fmtdata,
                    int cmplst, int dlist_format, int ffmt, int timeout_secs,
-                   void * paramp, int param_len, int noisy, int verbose)
+                   void * paramp, int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "format unit";
     int k, res, ret, sense_cat, tmout;
@@ -898,7 +898,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_reassign_blocks(int sg_fd, int longlba, int longlist, void * paramp,
-                      int param_len, int noisy, int verbose)
+                      int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "reassign blocks";
     int res, k, ret, sense_cat;
@@ -952,7 +952,7 @@
  * -1 -> other errors */
 int
 sg_ll_persistent_reserve_in(int sg_fd, int rq_servact, void * resp,
-                            int mx_resp_len, int noisy, int verbose)
+                            int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "persistent reservation in";
     int res, k, ret, sense_cat;
@@ -1015,7 +1015,7 @@
 int
 sg_ll_persistent_reserve_out(int sg_fd, int rq_servact, int rq_scope,
                              unsigned int rq_type, void * paramp,
-                             int param_len, int noisy, int verbose)
+                             int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "persistent reservation out";
     int res, k, ret, sense_cat;
@@ -1090,7 +1090,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_long10(int sg_fd, int pblock, int correct, unsigned int lba,
-                  void * resp, int xfer_len, int * offsetp, int noisy,
+                  void * resp, int xfer_len, int * offsetp, bool noisy,
                   int verbose)
 {
     static const char * const cdb_name_s = "read long(10)";
@@ -1177,7 +1177,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_long16(int sg_fd, int pblock, int correct, uint64_t llba,
-                  void * resp, int xfer_len, int * offsetp, int noisy,
+                  void * resp, int xfer_len, int * offsetp, bool noisy,
                   int verbose)
 {
     static const char * const cdb_name_s = "read long(16)";
@@ -1266,7 +1266,7 @@
 int
 sg_ll_write_long10(int sg_fd, int cor_dis, int wr_uncor, int pblock,
                    unsigned int lba, void * data_out, int xfer_len,
-                   int * offsetp, int noisy, int verbose)
+                   int * offsetp, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "write long(10)";
     int k, res, sense_cat, ret;
@@ -1345,7 +1345,7 @@
 int
 sg_ll_write_long16(int sg_fd, int cor_dis, int wr_uncor, int pblock,
                    uint64_t llba, void * data_out, int xfer_len,
-                   int * offsetp, int noisy, int verbose)
+                   int * offsetp, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "write long(16)";
     int k, res, sense_cat, ret;
@@ -1426,7 +1426,7 @@
 int
 sg_ll_verify10(int sg_fd, int vrprotect, int dpo, int bytchk,
                unsigned int lba, int veri_len, void * data_out,
-               int data_out_len, unsigned int * infop, int noisy,
+               int data_out_len, unsigned int * infop, bool noisy,
                int verbose)
 {
     static const char * const cdb_name_s = "verify(10)";
@@ -1503,7 +1503,7 @@
 int
 sg_ll_verify16(int sg_fd, int vrprotect, int dpo, int bytchk, uint64_t llba,
                int veri_len, int group_num, void * data_out,
-               int data_out_len, uint64_t * infop, int noisy, int verbose)
+               int data_out_len, uint64_t * infop, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "verify(16)";
     int k, res, ret, sense_cat, slen;
@@ -1751,7 +1751,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
-                  void * resp, int mx_resp_len, int noisy, int verbose)
+                  void * resp, int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read buffer(10)";
     int res, k, ret, sense_cat;
@@ -1812,7 +1812,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_write_buffer(int sg_fd, int mode, int buffer_id, int buffer_offset,
-                   void * paramp, int param_len, int noisy, int verbose)
+                   void * paramp, int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "write buffer";
     int k, res, ret, sense_cat;
@@ -1874,7 +1874,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_unmap(int sg_fd, int group_num, int timeout_secs, void * paramp,
-            int param_len, int noisy, int verbose)
+            int param_len, bool noisy, int verbose)
 {
     return sg_ll_unmap_v2(sg_fd, 0, group_num, timeout_secs, paramp,
                           param_len, noisy, verbose);
@@ -1884,7 +1884,7 @@
  * (sbc3r22). Otherwise same as sg_ll_unmap() . */
 int
 sg_ll_unmap_v2(int sg_fd, int anchor, int group_num, int timeout_secs,
-               void * paramp, int param_len, int noisy, int verbose)
+               void * paramp, int param_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "unmap";
     int k, res, ret, sense_cat, tmout;
@@ -1939,7 +1939,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_read_block_limits(int sg_fd, void * resp, int mx_resp_len,
-                        int noisy, int verbose)
+                        bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "read block limits";
     int k, ret, res, sense_cat;
@@ -1997,7 +1997,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
 sg_ll_receive_copy_results(int sg_fd, int sa, int list_id, void * resp,
-                           int mx_resp_len, int noisy, int verbose)
+                           int mx_resp_len, bool noisy, int verbose)
 {
     int k, res, ret, sense_cat;
     unsigned char rcvcopyres_cdb[THIRD_PARTY_COPY_IN_CMDLEN] =
@@ -2056,7 +2056,7 @@
 /* Invokes a SCSI EXTENDED COPY (LID1) command. Return of 0 -> success,
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 int
-sg_ll_extended_copy(int sg_fd, void * paramp, int param_len, int noisy,
+sg_ll_extended_copy(int sg_fd, void * paramp, int param_len, bool noisy,
                     int verbose)
 {
     int k, res, ret, sense_cat;
@@ -2114,7 +2114,7 @@
 int
 sg_ll_3party_copy_out(int sg_fd, int sa, unsigned int list_id, int group_num,
                       int timeout_secs, void * paramp, int param_len,
-                      int noisy, int verbose)
+                      bool noisy, int verbose)
 {
     int k, res, ret, sense_cat, tmout;
     unsigned char xcopy_cdb[THIRD_PARTY_COPY_OUT_CMDLEN] =
diff --git a/lib/sg_cmds_mmc.c b/lib/sg_cmds_mmc.c
index 7498046..c418023 100644
--- a/lib/sg_cmds_mmc.c
+++ b/lib/sg_cmds_mmc.c
@@ -73,7 +73,7 @@
  * -1 -> other failure */
 int
 sg_ll_set_cd_speed(int sg_fd, int rot_control, int drv_read_speed,
-                   int drv_write_speed, int noisy, int verbose)
+                   int drv_write_speed, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "set cd speed";
     int res, ret, k, sense_cat;
@@ -131,7 +131,7 @@
  * SG_LIB_CAT_UNIT_ATTENTION, SG_LIB_CAT_ABORTED_COMMAND, else -1 */
 int
 sg_ll_get_config(int sg_fd, int rt, int starting, void * resp,
-                 int mx_resp_len, int noisy, int verbose)
+                 int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "get configuration";
     int res, k, ret, sense_cat;
@@ -221,7 +221,7 @@
 int
 sg_ll_get_performance(int sg_fd, int data_type, unsigned int starting_lba,
                       int max_num_desc, int ttype, void * resp,
-                      int mx_resp_len, int noisy, int verbose)
+                      int mx_resp_len, bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "get performance";
     int res, k, ret, sense_cat;
@@ -312,7 +312,7 @@
  * -1 -> other failure */
 int
 sg_ll_set_streaming(int sg_fd, int type, void * paramp, int param_len,
-                    int noisy, int verbose)
+                    bool noisy, int verbose)
 {
     static const char * const cdb_name_s = "set streaming";
     int k, res, ret, sense_cat;
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index 2c595ec..d0c173f 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -2566,15 +2566,15 @@
     return n;
 }
 
-/* Returns 1 when executed on big endian machine; else returns 0.
+/* Returns true when executed on big endian machine; else returns false.
  * Useful for displaying ATA identify words (which need swapping on a
  * big endian machine). */
-int
+bool
 sg_is_big_endian()
 {
     union u_t {
-        unsigned short s;
-        unsigned char c[sizeof(unsigned short)];
+        uint16_t s;
+        unsigned char c[sizeof(uint16_t)];
     } u;
 
     u.s = 0x0102;
@@ -2582,10 +2582,10 @@
                                     the most significant byte */
 }
 
-static unsigned short
-swapb_ushort(unsigned short u)
+static uint16_t
+swapb_uint16(uint16_t u)
 {
-    unsigned short r;
+    uint16_t r;
 
     r = (u >> 8) & 0xff;
     r |= ((u & 0xff) << 8);
@@ -2600,13 +2600,13 @@
  *     = -1    only the ASCII-hex words are listed (i.e. without address)
  *     = -2    only the ASCII-hex words, formatted for "hdparm --Istdin"
  *     < -2    same as -1
- * If 'swapb' non-zero then bytes in each word swapped. Needs to be set
+ * If 'swapb' is true then bytes in each word swapped. Needs to be set
  * for ATA IDENTIFY DEVICE response on big-endian machines. */
 void
-dWordHex(const unsigned short* words, int num, int no_ascii, int swapb)
+dWordHex(const uint16_t* words, int num, int no_ascii, bool swapb)
 {
-    const unsigned short * p = words;
-    unsigned short c;
+    const uint16_t * p = words;
+    uint16_t c;
     char buff[82];
     unsigned char upp, low;
     int a = 0;
@@ -2625,7 +2625,7 @@
         for (k = 0; k < num; k++) {
             c = *p++;
             if (swapb)
-                c = swapb_ushort(c);
+                c = swapb_uint16(c);
             bpos += 5;
             scnpr(buff + bpos, blen - bpos, "%.4x", (unsigned int)c);
             buff[bpos + 4] = ' ';
@@ -2653,7 +2653,7 @@
     for (i = 0; i < num; i++) {
         c = *p++;
         if (swapb)
-            c = swapb_ushort(c);
+            c = swapb_uint16(c);
         bpos += 5;
         scnpr(buff + bpos, blen - bpos, "%.4x", (unsigned int)c);
         buff[bpos + 4] = ' ';
@@ -2690,7 +2690,7 @@
  * then -1 is returned. Accepts a hex prefix (0x or 0X) or a decimal
  * multiplier suffix (as per GNU's dd (since 2002: SI and IEC 60027-2)).
  * Main (SI) multipliers supported: K, M, G. Ignore leading spaces and
- * tabs; accept comma, space, tab and hash as terminator. */
+ * tabs; accept comma, hyphen, space, tab and hash as terminator. */
 int
 sg_get_num(const char * buf)
 {
@@ -2714,7 +2714,7 @@
         len -=n;
     }
     /* following hack to keep C++ happy */
-    cp = strpbrk((char *)buf, " \t,#");
+    cp = strpbrk((char *)buf, " \t,#-");
     if (cp) {
         len = cp - buf;
         n = (int)sizeof(lb) - 1;
@@ -2825,7 +2825,7 @@
  * then -1LL is returned. Accepts a hex prefix (0x or 0X) or a decimal
  * multiplier suffix (as per GNU's dd (since 2002: SI and IEC 60027-2)).
  * Main (SI) multipliers supported: K, M, G, T, P. Ignore leading spaces
- * and tabs; accept comma, space, tab and hash as terminator. */
+ * and tabs; accept comma, hyphen, space, tab and hash as terminator. */
 int64_t
 sg_get_llnum(const char * buf)
 {
@@ -2850,7 +2850,7 @@
         len -= n;
     }
     /* following hack to keep C++ happy */
-    cp = strpbrk((char *)buf, " \t,#");
+    cp = strpbrk((char *)buf, " \t-,#");
     if (cp) {
         len = cp - buf;
         n = (int)sizeof(lb) - 1;
@@ -2972,11 +2972,11 @@
  * written to 'ochars' before 0 character is found or 'num' words
  * are processed. */
 int
-sg_ata_get_chars(const unsigned short * word_arr, int start_word,
-                 int num_words, int is_big_endian, char * ochars)
+sg_ata_get_chars(const uint16_t * word_arr, int start_word,
+                 int num_words, bool is_big_endian, char * ochars)
 {
     int k;
-    unsigned short s;
+    uint16_t s;
     char a, b;
     char * op = ochars;
 
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index 29ded31..bf7ca8c 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -17,7 +17,7 @@
 #endif
 
 
-const char * sg_lib_version_str = "2.26 20170910";/* spc5r16, sbc4r14 */
+const char * sg_lib_version_str = "2.28 20170917";/* spc5r16, sbc4r14 */
 
 
 /* indexed by pdt; those that map to own index do not decay */
diff --git a/scripts/40-usb-blacklist.rules b/scripts/40-usb-blacklist.rules
new file mode 100644
index 0000000..fd821f1
--- /dev/null
+++ b/scripts/40-usb-blacklist.rules
@@ -0,0 +1,10 @@
+#
+# Blacklist specific USB devices
+#
+# don't inquire sn and di on broken devices (https://bugzilla.suse.com/show_bug.cgi?id=840054)
+
+# unkown device
+ATTRS{idVendor}=="0aec", ATTRS{idProduct}=="3260", ENV{ID_SCSI_DI}="1"
+# Sony/JMicron port replicator
+ATTRS{idVendor}=="054c", ATTRS{idProduct}=="06a0", ENV{ID_SCSI_DI}="1"
+
diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
index 8c7356b..4975bc5 100644
--- a/scripts/55-scsi-sg3_id.rules
+++ b/scripts/55-scsi-sg3_id.rules
@@ -11,7 +11,10 @@
 # have scanned for VPD pages, so if the vpd page attribute is not
 # present it is not supported (or deemed unsafe to access).
 # Hence we can skip the call to sg_inq and avoid I/O altogether.
-KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/inquiry --raw", ENV{ID_SCSI}="1", ENV{ID_SCSI_SN}="1", ENV{ID_SCSI_DI}="1"
+# Set 'ID_SCSI_INQUIRY=0' in an earlier udev rule if the kernel
+# fails to scan VPD pages correctly; the rules will then fall
+# back to calling sg_vpd directly.
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI_INQUIRY}!="?*", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/inquiry --raw", ENV{ID_SCSI}="1", ENV{ID_SCSI_INQUIRY}="1"
 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}!="1", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
 # scsi_id compat mappings
 ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
@@ -21,11 +24,11 @@
 ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
 ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
 # SCSI EVPD page 0x80 values
-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_SN}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg80 --raw"
-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_SN}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg80 --raw"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
 # SCSI EVPD page 0x83 values
-KERNEL=="sd*[!0-9]", ENV{ID_SCSI}=="1", ENV{ID_SCSI_DI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg83 --raw"
-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_DI}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
+KERNEL=="sd*[!0-9]", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg83 --raw"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_INQUIRY}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
 
 # ID_WWN compat mapping
 ENV{SCSI_IDENT_LUN_NAA_REGEXT}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_REGEXT}"
@@ -48,4 +51,5 @@
 ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="1$env{SCSI_IDENT_LUN_T10}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_T10}"
 ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_LOCAL}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA_LOCAL}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_LOCAL}"
 ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_SERIAL}"
 LABEL="sg3_utils_id_end"
diff --git a/scripts/59-fc-wwpn-id.rules b/scripts/59-fc-wwpn-id.rules
new file mode 100644
index 0000000..81a20ad
--- /dev/null
+++ b/scripts/59-fc-wwpn-id.rules
@@ -0,0 +1,17 @@
+#
+# FC WWPN-based by-path links
+#
+
+ACTION!="add|change", GOTO="fc_wwpn_end"
+KERNEL!="sd*", GOTO="fc_wwpn_end"
+
+ENV{DEVTYPE}=="disk", IMPORT{program}="fc_wwpn_id %p"
+ENV{DEVTYPE}=="partition", IMPORT{parent}="FC_*"
+ENV{FC_TARGET_WWPN}!="$*"; GOTO="fc_wwpn_end"
+ENV{FC_INITIATOR_WWPN}!="$*"; GOTO="fc_wwpn_end"
+ENV{FC_TARGET_LUN}!="$*"; GOTO="fc_wwpn_end"
+
+ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}"
+ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}-part%n"
+
+LABEL="fc_wwpn_end"
diff --git a/scripts/59-scsi-cciss_id.rules b/scripts/59-scsi-cciss_id.rules
new file mode 100644
index 0000000..4eb4561
--- /dev/null
+++ b/scripts/59-scsi-cciss_id.rules
@@ -0,0 +1,18 @@
+# cciss compat rules
+
+ACTION!="add|change", GOTO="cciss_compat_end"
+KERNEL!="sd*", GOTO="cciss_compat_end"
+ENV{ID_VENDOR}!="HP", ENV{ID_VENDOR}!="COMPAQ", GOTO="cciss_compat_end"
+ENV{ID_MODEL}!="LOGICAL_VOLUME", GOTO="cciss_compat_end"
+
+ENV{DEVTYPE}=="disk", DRIVERS=="hpsa", IMPORT{program}="cciss_id %p"
+ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+ENV{ID_CCISS}!="?*", GOTO="cciss_compat_end"
+
+ENV{DEVTYPE}=="disk", SYMLINK+="cciss/$env{ID_CCISS}"
+ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/cciss-$env{ID_SERIAL}"
+
+ENV{DEVTYPE}=="partition", SYMLINK+="cciss/$env{ID_CCISS}p%n"
+ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/cciss-$env{ID_SERIAL}-part%n"
+
+LABEL="cciss_compat_end"
diff --git a/scripts/cciss_id b/scripts/cciss_id
new file mode 100755
index 0000000..8ac11d5
--- /dev/null
+++ b/scripts/cciss_id
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# cciss_id
+#
+# Generates device node names according to the cciss naming rules
+#
+# Copyright (C) 2011 SUSE Linux Products GmbH
+# Author:
+#       Hannes Reinecke <[email protected]>
+#
+#
+#       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 version 2 of the License.
+#
+# This script generates a device node name which is compatible
+# with the 'cciss' device naming rules.
+# It is intended to provide backward-compatible names for the
+# 'hpsa' driver.
+#
+
+cciss_enumerate()
+{
+    local last_pci_dev=${1##0000:}
+    local cur_pci_dev
+    local cciss_num=0
+
+    for cur_pci_dev in $(lspci -n | tac | sed -n 's/\(..:..\..\) .* 103c:\(3220\|3230\|3238\|323a\|323b\) .*/\1/p') ; do
+	if [ "$cur_pci_dev" == "$last_pci_dev" ] ; then
+	    echo "$cciss_num"
+	    return;
+	fi
+	cciss_num=$(($cciss_num + 1))
+    done
+    echo "$cciss_num"
+}
+
+hpsa_lun_offset()
+{
+    local scsi_host=$1
+
+    scsi_id=$(lsscsi 2>/dev/null | sed -n "s/.\(${scsi_host}:[0-9]*:[0-9]*:[0-9]*\)..*disk .*/\1/p" | head -1)
+    echo ${scsi_id##*:}
+}
+
+DEVPATH=$1
+SCSIPATH=$(cd -P /sys$DEVPATH/device; echo $PWD)
+SCSIID=${SCSIPATH##*/}
+HOSTID=${SCSIID%%:*}
+LUNID=${SCSIID##*:}
+PCIPATH=${SCSIPATH%%/host*}
+PCIDEV=${PCIPATH##*/}
+HOSTPATH=${PCIPATH}/host${HOSTID}/scsi_host/host${HOSTID}
+read controller 2>/dev/null <${HOSTPATH}/ctlr_num || controller=$(cciss_enumerate $PCIDEV)
+
+# hpsa lies about the LUN ...
+disk_offset=$(hpsa_lun_offset $HOSTID)
+if [ "$disk_offset" ] ; then
+    disk=$(( $LUNID - $disk_offset ))
+else
+    disk=$LUNID
+fi
+
+if [ "$controller" ] && [ "$disk" ] ; then
+    echo "ID_CCISS=c${controller}d${disk}"
+fi
diff --git a/scripts/fc_wwpn_id b/scripts/fc_wwpn_id
new file mode 100644
index 0000000..c8d0189
--- /dev/null
+++ b/scripts/fc_wwpn_id
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# fc_wwpn_id
+#
+# Generates device node names links based on FC WWPN
+# Copyright (c) 2016 Hannes Reinecke, SUSE Linux GmbH
+#
+# 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 version 2 of the License.
+#
+
+DEVPATH=$1
+SCSIPATH=$(cd -P "/sys$DEVPATH/device" || exit; echo "$PWD")
+
+d=$SCSIPATH
+[ -d "$d/scsi_disk" ] || exit 0
+target_lun=${d##*:}
+
+while [ -n "$d" ] ; do
+    d=${d%/*}
+    e=${d##*/}
+    case "$e" in
+	rport*)
+	    rport=$e
+	    rport_dir="/sys/class/fc_remote_ports/$rport"
+	    if [ -d "$rport_dir" ] ; then
+		rport_wwpn=$(cat "$rport_dir/port_name")
+	    fi
+	    ;;
+	host*)
+	    host=$e
+	    host_dir="/sys/class/fc_host/$host"
+	    if [ -d "$host_dir" ] ; then
+		host_wwpn=$(cat "$host_dir/port_name")
+		break;
+	    fi
+    esac
+done
+
+echo "FC_TARGET_LUN=$target_lun"
+
+if [ -n "$rport_wwpn" ] ; then
+    echo "FC_TARGET_WWPN=$rport_wwpn"
+fi
+
+if [ -n "$host_wwpn" ] ; then
+    echo "FC_INITIATOR_WWPN=$host_wwpn"
+fi
diff --git a/scripts/lunmask.service b/scripts/lunmask.service
new file mode 100644
index 0000000..03fdd96
--- /dev/null
+++ b/scripts/lunmask.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Disable LUN masking and scan SCSI Hosts
+After=systemd-udev-trigger.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/systemd/scripts/scsi-enable-target-scan.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index fad4868..bbe2228 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -715,7 +715,16 @@
     else
       match=1
     fi
-    test $match -eq 1 && doreportlun
+
+    test $match -eq 0 && continue
+
+    if [ -z "$lunsearch" ] ; then
+      doreportlun
+    else
+      for lun in $lunsearch ; do
+        dolunscan
+      done
+    fi
   done
 }
 
@@ -993,7 +1002,7 @@
 # Find resized luns
 findresized()
 {
-  local devs=`ls /sys/class/scsi_device/`
+  local devs=
   local size=
   local new_size=
   local sysfs_path=
@@ -1003,6 +1012,14 @@
   local mpathsize=
   declare -a mpathsizes
 
+  if [ -z "$lunsearch" ] ; then
+    devs=`ls /sys/class/scsi_device/`
+  else
+    for lun in $lunsearch ; do
+      devs="$devs `(cd /sys/class/scsi_device/ && ls -d *:${lun})`"
+    done
+  fi
+
   for hctl in $devs ; do
     sysfs_path="/sys/class/scsi_device/$hctl/device"
     if [ -d "$sysfs_path/block" ] ; then
@@ -1070,8 +1087,8 @@
     echo "--channels=LIST: Scan only channel(s) in LIST"
     echo "--color:         use coloured prefixes OLD/NEW/DEL"
     echo "--flush:         same as -f"
-    echo "--forceremove:   Remove and readd every device (DANGEROUS)"
-    echo "--forcerescan:   Rescan existing devices"
+    echo "--forceremove:   Remove stale devices (DANGEROUS)"
+    echo "--forcerescan:   Remove and readd existing devices (DANGEROUS)"
     echo "--help:          print this usage message then exit"
     echo "--hosts=LIST:    Scan only host(s) in LIST"
     echo "--ids=LIST:      Scan only target ID(s) in LIST"
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 190841e..eac9e49 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@
 %{_libdir}/*.la
 
 %changelog
-* Mon Sep 04 2017 - dgilbert at interlog dot com
+* Fri Sep 15 2017 - dgilbert at interlog dot com
 - track t10 changes
   * sg3_utils-1.43
 
diff --git a/src/sg_bg_ctl.c b/src/sg_bg_ctl.c
index 92b7162..72ce415 100644
--- a/src/sg_bg_ctl.c
+++ b/src/sg_bg_ctl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Douglas Gilbert.
+ * Copyright (c) 2016-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -32,7 +32,7 @@
  * device. Based on sbc4r10.pdf .
  */
 
-static const char * version_str = "1.00 20160518";
+static const char * version_str = "1.01 20170917";
 
 #define BACKGROUND_CONTROL_SA 0x15
 
@@ -84,7 +84,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
 sg_ll_background_control(int sg_fd, unsigned int bo_ctl, unsigned int bo_time,
-                         int noisy, int verbose)
+                         bool noisy, int verbose)
 {
     int k, ret, res, sense_cat;
     unsigned char bcCDB[16] = {SG_SERVICE_ACTION_IN_16,
@@ -207,7 +207,7 @@
         return SG_LIB_FILE_ERROR;
     }
 
-    res = sg_ll_background_control(sg_fd, ctl, time_tnth, 1, verbose);
+    res = sg_ll_background_control(sg_fd, ctl, time_tnth, true, verbose);
     ret = res;
     if (res) {
         if (SG_LIB_CAT_INVALID_OP == res)
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c
index 02f9106..7abb90f 100644
--- a/src/sg_compare_and_write.c
+++ b/src/sg_compare_and_write.c
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2012-2016, Kaminario Technologies LTD
+*  Copyright (c) 2012-2017, Kaminario Technologies LTD
 *  All rights reserved.
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
@@ -332,7 +332,7 @@
 static int
 sg_compare_and_write(int sg_fd, unsigned char * buff, int blocks,
                      int64_t lba, int xfer_len, struct caw_flags flags,
-                     int noisy, int verbose)
+                     bool noisy, int verbose)
 {
         int k, sense_cat, valid, slen, res, ret;
         unsigned char cawCmd[COMPARE_AND_WRITE_CDB_SIZE];
diff --git a/src/sg_copy_results.c b/src/sg_copy_results.c
index 235ca61..443495d 100644
--- a/src/sg_copy_results.c
+++ b/src/sg_copy_results.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 Hannes Reinecke, SUSE Labs
+ * Copyright (c) 2011-2017 Hannes Reinecke, SUSE Labs
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -36,7 +36,7 @@
    and the optional list identifier passed as the list_id argument.
 */
 
-static const char * version_str = "1.13 20160227";
+static const char * version_str = "1.14 20170923";
 
 
 #define MAX_XFER_LEN 10000
@@ -421,7 +421,7 @@
                 PRIu32 "\n", cp, device_name, xfer_len, xfer_len, list_id);
 
     res = sg_ll_receive_copy_results(sg_fd, sa, list_id, cpResultBuff,
-                                     xfer_len, 1, verbose);
+                                     xfer_len, true, verbose);
     ret = res;
     if (res) {
         char b[80];
diff --git a/src/sg_dd.c b/src/sg_dd.c
index 834e89b..0ae6878 100644
--- a/src/sg_dd.c
+++ b/src/sg_dd.c
@@ -1,7 +1,7 @@
 /* A utility program for copying files. Specialised for "files" that
  * represent devices that understand the SCSI command set.
  *
- * Copyright (C) 1999 - 2016 D. Gilbert and P. Allworth
+ * Copyright (C) 1999 - 2017 D. Gilbert and P. Allworth
  * 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)
@@ -60,7 +60,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "5.86 20151219";
+static const char * version_str = "5.88 20170917";
 
 
 #define ME "sg_dd: "
@@ -418,7 +418,8 @@
     int verb;
 
     verb = (verbose ? verbose - 1: 0);
-    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, 1, verb);
+    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, true,
+                           verb);
     if (0 != res)
         return res;
 
@@ -426,7 +427,7 @@
         (0xff == rcBuff[3])) {
         int64_t ls;
 
-        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, 1,
+        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, true,
                                verb);
         if (0 != res)
             return res;
@@ -685,7 +686,10 @@
                 return SG_LIB_CAT_MEDIUM_HARD;
             }
         }
-        /* drop through */
+#if defined(__GNUC__) || defined(__clang__)
+        __attribute__((fallthrough));
+        /* FALL THROUGH */
+#endif
     default:
         ++unrecovered_errs;
         if (verbose > 0)
@@ -774,6 +778,10 @@
             goto err_out;
         case SG_LIB_CAT_MEDIUM_HARD:
             may_coe = 1;
+#if defined(__GNUC__) || defined(__clang__)
+            __attribute__((fallthrough));
+            /* FALL THROUGH */
+#endif
         default:
             if (retries_tmp > 0) {
                 pr2serr(">>> retrying a sgio read, lba=0x%" PRIx64 "\n",
@@ -864,7 +872,7 @@
             }
             corrct = (ifp->coe > 2) ? 1 : 0;
             res = sg_ll_read_long10(sg_fd, /* pblock */0, corrct, lba, buffp,
-                                    bs + read_long_blk_inc, &offset, 1,
+                                    bs + read_long_blk_inc, &offset, true,
                                     verbose);
             ok = 0;
             switch (res) {
@@ -884,7 +892,7 @@
                 if (verbose)
                     pr2serr("read_long(10): adjusted len=%d\n", nl);
                 r = sg_ll_read_long10(sg_fd, 0, corrct, lba, buffp, nl,
-                                      &offset, 1, verbose);
+                                      &offset, true, verbose);
                 if (0 == r) {
                     ok = 1;
                     ++read_longs;
diff --git a/src/sg_emc_trespass.c b/src/sg_emc_trespass.c
index ac7191c..1c603f9 100644
--- a/src/sg_emc_trespass.c
+++ b/src/sg_emc_trespass.c
@@ -2,7 +2,7 @@
  * LUN ownership from one Service-Processor to this one on an EMC
  * CLARiiON and potentially other devices.
  *
- * Copyright (C) 2004-2015 Lars Marowsky-Bree <[email protected]>
+ * Copyright (C) 2004-2017 Lars Marowsky-Bree <[email protected]>
  *
  * Based on sg_start.c; credits from there also apply.
  * Minor modifications for sg_lib, D. Gilbert 2004/10/19
@@ -29,7 +29,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "0.20 20141219";
+static const char * version_str = "0.21 20170917";
 
 static int debug = 0;
 
@@ -64,11 +64,11 @@
         if (short_cmd)
                 res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
                                  short_trespass_pg, sizeof(short_trespass_pg),
-                                 1, (debug ? 2 : 0));
+                                 true, (debug ? 2 : 0));
         else
                 res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
                                  long_trespass_pg, sizeof(long_trespass_pg),
-                                 1, (debug ? 2 : 0));
+                                 true, (debug ? 2 : 0));
 
         switch (res) {
         case 0:
diff --git a/src/sg_format.c b/src/sg_format.c
index 826b3c5..2bd20e3 100644
--- a/src/sg_format.c
+++ b/src/sg_format.c
@@ -226,7 +226,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
 sg_ll_format_medium(int sg_fd, int verify, int immed, int format,
-                    void * paramp, int transfer_len, int timeout, int noisy,
+                    void * paramp, int transfer_len, int timeout, bool noisy,
                     int verbose)
 {
         int k, ret, res, sense_cat;
diff --git a/src/sg_get_config.c b/src/sg_get_config.c
index 0b3efac..a5b3366 100644
--- a/src/sg_get_config.c
+++ b/src/sg_get_config.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -29,7 +29,7 @@
 
 */
 
-static const char * version_str = "0.42 20160423";    /* mmc6r02 */
+static const char * version_str = "0.43 20170917";    /* mmc6r02 */
 
 #define MX_ALLOC_LEN 8192
 #define NAME_BUFF_SZ 64
@@ -1080,7 +1080,7 @@
     }
 
     res = sg_ll_get_config(sg_fd, rt, starting, resp_buffer,
-                              sizeof(resp_buffer), 1, verbose);
+                              sizeof(resp_buffer), true, verbose);
     ret = res;
     if (0 == res) {
         len = sg_get_unaligned_be32(resp_buffer + 0) + 4;
diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c
index ceb9e32..de253ba 100644
--- a/src/sg_get_lba_status.c
+++ b/src/sg_get_lba_status.c
@@ -30,7 +30,7 @@
  * device.
  */
 
-static const char * version_str = "1.09 20170912";
+static const char * version_str = "1.10 20170917";
 
 #ifndef UINT32_MAX
 #define UINT32_MAX ((uint32_t)-1)
@@ -304,11 +304,11 @@
     }
 
     if (do_16)
-        res = sg_ll_get_lba_status16(sg_fd, lba, rt, glbasBuffp, maxlen, 1,
+        res = sg_ll_get_lba_status16(sg_fd, lba, rt, glbasBuffp, maxlen, true,
                                      verbose);
     else
         res = sg_ll_get_lba_status32(sg_fd, lba, element_id, scan_len, rt,
-                                     glbasBuffp, maxlen, 1, verbose);
+                                     glbasBuffp, maxlen, true, verbose);
 
     ret = res;
     if (0 == res) {
diff --git a/src/sg_ident.c b/src/sg_ident.c
index 220d757..06701c8 100644
--- a/src/sg_ident.c
+++ b/src/sg_ident.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2016 Douglas Gilbert.
+ * Copyright (c) 2005-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -29,7 +29,7 @@
  * DEVICE IDENTIFIER and SET DEVICE IDENTIFIER prior to spc4r07.
  */
 
-static const char * version_str = "1.15 20160423";
+static const char * version_str = "1.16 20170917";
 
 #define ME "sg_ident: "
 
@@ -221,10 +221,10 @@
                 goto err_out;
             }
             ii_len = res;
-            res = sg_ll_set_id_info(sg_fd, itype, rdi_buff, ii_len, 1,
+            res = sg_ll_set_id_info(sg_fd, itype, rdi_buff, ii_len, true,
                                     verbose);
         } else    /* do_clear */
-            res = sg_ll_set_id_info(sg_fd, itype, rdi_buff, 0, 1, verbose);
+            res = sg_ll_set_id_info(sg_fd, itype, rdi_buff, 0, true, verbose);
         if (res) {
             ret = res;
             sg_get_category_sense_str(res, sizeof(b), b, verbose);
@@ -233,7 +233,7 @@
                 pr2serr("    try '-v' for more information\n");
         }
     } else {    /* do report identifying information */
-        res = sg_ll_report_id_info(sg_fd, itype, rdi_buff, 4, 1, verbose);
+        res = sg_ll_report_id_info(sg_fd, itype, rdi_buff, 4, true, verbose);
         if (0 == res) {
             ii_len = sg_get_unaligned_be32(rdi_buff + 0);
             if ((! raw) && (verbose > 0))
@@ -252,7 +252,7 @@
                 goto err_out;
             }
             bp = rdi_buff;
-            res = sg_ll_report_id_info(sg_fd, itype, bp, ii_len + 4, 1,
+            res = sg_ll_report_id_info(sg_fd, itype, bp, ii_len + 4, true,
                                        verbose);
             if (0 == res) {
                 ii_len = sg_get_unaligned_be32(bp + 0);
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 5e7c6e8..39cf0ab 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -43,7 +43,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.64 20170912";    /* SPC-5 rev 14 */
+static const char * version_str = "1.66 20170917";    /* SPC-5 rev 14 */
 
 /* INQUIRY notes:
  * It is recommended that the initial allocation length given to a
@@ -938,7 +938,7 @@
  * passes back resid. Same return values as sg_ll_inquiry() (0 is good). */
 static int
 pt_inquiry(int sg_fd, int evpd, int pg_op, void * resp, int mx_resp_len,
-           int * residp, int noisy, int verbose)
+           int * residp, bool noisy, int verbose)
 {
     int res, ret, k, sense_cat, resid;
     unsigned char inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
@@ -1831,7 +1831,7 @@
                 printf("%02x", (unsigned int)ip[2 + m]);
             }
             printf("\n");
-                break;
+            break;
         default: /* reserved */
             pr2serr("      reserved designator=0x%x\n", desig_type);
             dStrHexErr((const char *)ip, i_len, -1);
@@ -1850,6 +1850,7 @@
     unsigned char * bp;
     unsigned char * ip;
     const char * assoc_str;
+    const char * suffix;
 
     if (buff[2] != 0) {
         /*
@@ -1979,61 +1980,25 @@
              * So add a suffix to differentiate between them.
              */
             naa = (ip[0] >> 4) & 0xff;
-            if ((naa < 2) || (naa > 6) || (4 == naa)) {
-                if (verbose) {
-                    pr2serr("      << unexpected naa [0x%x]>>\n", naa);
-                    dStrHexErr((const char *)ip, i_len, 0);
-                }
-                break;
+            switch (naa) {
+                case 6:
+                    suffix="REGEXT";
+                    break;
+                case 5:
+                    suffix="REG";
+                    break;
+                case 2:
+                    suffix="EXT";
+                    break;
+                case 3:
+                default:
+                    suffix="LOCAL";
+                    break;
             }
-            if (6 != naa) {
-                const char *suffix;
-
-                if (8 != i_len) {
-                    if (verbose) {
-                        pr2serr("      << unexpected NAA %d identifier "
-                                "length: 0x%x>>\n", naa, i_len);
-                        dStrHexErr((const char *)ip, i_len, 0);
-                    }
-                    break;
-                }
-                if (naa != 2 && naa != 3 && naa != 5) {
-                    if (verbose) {
-                        pr2serr("      << unexpected NAA format %d>>\n", naa);
-                        dStrHexErr((const char *)ip, i_len, 0);
-                    }
-                    break;
-                }
-                switch (naa) {
-                    case 5:
-                        suffix="REG";
-                        break;
-                    case 2:
-                        suffix="EXT";
-                        break;
-                    case 3:
-                    default:
-                        suffix="LOCAL";
-                        break;
-                }
-                printf("SCSI_IDENT_%s_NAA_%s=", assoc_str, suffix);
-                for (m = 0; m < 8; ++m)
-                    printf("%02x", (unsigned int)ip[m]);
-                printf("\n");
-            } else {      /* NAA IEEE Registered extended */
-                if (16 != i_len) {
-                    if (verbose) {
-                        pr2serr("      << unexpected NAA 6 identifier "
-                                "length: 0x%x>>\n", i_len);
-                        dStrHexErr((const char *)ip, i_len, 0);
-                    }
-                    break;
-                }
-                printf("SCSI_IDENT_%s_NAA_REGEXT=", assoc_str);
-                for (m = 0; m < 16; ++m)
-                    printf("%02x", (unsigned int)ip[m]);
-                printf("\n");
-            }
+            printf("SCSI_IDENT_%s_NAA_%s=", assoc_str, suffix);
+            for (m = 0; m < i_len; ++m)
+                printf("%02x", (unsigned int)ip[m]);
+            printf("\n");
             break;
         case 4: /* Relative target port */
             if ((1 != c_set) || (1 != assoc) || (4 != i_len)) {
@@ -3276,7 +3241,7 @@
         printf("Supported command list:\n");
         for (k = 0; k < 256; ++k) {
             res = sg_ll_inquiry(sg_fd, 1, 0, k, rsp_buff, DEF_ALLOC_LEN,
-                                1, op->do_verbose);
+                                true, op->do_verbose);
             if (0 == res) {
                 peri_type = rsp_buff[0] & 0x1f;
                 support_num = rsp_buff[1] & 7;
@@ -3309,7 +3274,7 @@
     }
     else {
         res = sg_ll_inquiry(sg_fd, 1, 0, op->page_num, rsp_buff,
-                            DEF_ALLOC_LEN, 1, op->do_verbose);
+                            DEF_ALLOC_LEN, true, op->do_verbose);
         if (0 == res) {
             peri_type = rsp_buff[0] & 0x1f;
             if (! op->do_raw) {
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 44bd9e2..272551b 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -31,7 +31,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.48 20170912";    /* spc5r11 + sbc4r11 */
+static const char * version_str = "1.50 20170917";    /* spc5r11 + sbc4r11 */
 
 #define MX_ALLOC_LEN (0xfffc)
 #define SHORT_RESP_LEN 128
@@ -182,7 +182,7 @@
     int subpg_code;     /* only unless subpg_high>0 then this is only */
     int subpg_high;     /* when >0 this is high end of subpage range */
     int pdt;            /* -1 for all */
-    int flags;          /* bit mask; or-ed MVP_* constants */
+    int flags;          /* bit mask; or-ed with MVP_* constants */
     const char * name;
     const char * acron;
     bool (*show_pagep)(const uint8_t * resp, int len,
@@ -623,6 +623,7 @@
            "Performs a SCSI LOG SENSE (or LOG SELECT) command\n");
 }
 
+/* Return vendor product mask given vendor product number */
 static int
 get_vp_mask(int vpn)
 {
@@ -633,29 +634,6 @@
                                             (1 << (vpn + MVP_OFFSET));
 }
 
-#if 0
-static int
-mask_to_vendor(int vp_mask)
-{
-    if (MVP_SEAG & vp_mask)
-        return VP_SEAG;
-    else if (MVP_HITA & vp_mask)
-        return VP_HITA;
-    else if (MVP_WDC & vp_mask)
-        return VP_WDC;
-    else if (MVP_TOSH & vp_mask)
-        return VP_TOSH;
-    else if (MVP_SMSTR & vp_mask)
-        return VP_SMSTR;
-    else if (MVP_LTO5 & vp_mask)
-        return VP_LTO5;
-    else if (MVP_LTO6 & vp_mask)
-        return VP_LTO6;
-    else
-        return VP_NONE;
-}
-#endif
-
 static int
 asort_comp(const void * lp, const void * rp)
 {
@@ -1334,7 +1312,7 @@
         if (0xff != *xp)
             return false;
     }
-    return true;  /* also in degenerate case when original (num_bytes <= 0) */
+    return true;  /* also in degenerate case when 'num_bytes' <= 0 */
 }
 
 /* Returns 'xp' with "unknown" if all bits set; otherwise decoded (big endian)
@@ -1576,7 +1554,7 @@
                                    op->page_control, op->pg_code,
                                    op->subpg_code, op->paramp,
                                    resp, LOG_SENSE_PROBE_ALLOC_LEN,
-                                   1 /* noisy */, vb)))
+                                   true /* noisy */, vb)))
             return res;
         actual_len = sg_get_unaligned_be16(resp + 2) + 4;
         if ((0 == op->do_raw) && (vb > 1)) {
@@ -1604,7 +1582,7 @@
     if ((res = sg_ll_log_sense(sg_fd, op->do_ppc, op->do_sp,
                                op->page_control, op->pg_code,
                                op->subpg_code, op->paramp,
-                               resp, actual_len, 1 /* noisy */, vb)))
+                               resp, actual_len, true /* noisy */, vb)))
         return res;
     if ((0 == op->do_raw) && (vb > 1)) {
         pr2serr("  Log sense response:\n");
@@ -1989,13 +1967,13 @@
             }
         }
         switch (pc) {
-        case 0:
-            printf("  Accumulated transitions to active"); break;
         case 1:
-            printf("  Accumulated transitions to idle_a"); break;
+            printf("  Accumulated transitions to active"); break;
         case 2:
-            printf("  Accumulated transitions to idle_b"); break;
+            printf("  Accumulated transitions to idle_a"); break;
         case 3:
+            printf("  Accumulated transitions to idle_b"); break;
+        case 4:
             printf("  Accumulated transitions to idle_c"); break;
         case 8:
             printf("  Accumulated transitions to standby_z"); break;
@@ -2923,8 +2901,8 @@
     char b[256];
     char bb[32];
     bool full, decoded, has_header;
-    bool is_smstr = (VP_SMSTR == op->vend_prod_num) ||
-                    (VP_SMSTR == op->deduced_vpn);
+    bool is_smstr = op->lep ? (MVP_SMSTR & op->lep->flags) :
+                              (VP_SMSTR == op->vend_prod_num);
 
     full = ! op->do_temperature;
     num = len - 4;
@@ -4111,18 +4089,17 @@
             }
             if (0x3 == pc)      /* resource percentage log parameter */
                 printf("  %s: %u %%\n", cp, sg_get_unaligned_be16(bp + 4));
-            else {              /* resource count log parameters */
+            else                /* resource count log parameters */
                 printf("  %s resource count: %u\n", cp,
                        sg_get_unaligned_be32(bp + 4));
-                if (pl > 8) {
-                    switch (bp[8] & 0x3) {      /* SCOPE field */
-                    case 0: cp = "not reported"; break;
-                    case 1: cp = "dedicated to lu"; break;
-                    case 2: cp = "not dedicated to lu"; break;
-                    case 3: cp = "reserved"; break;
-                    }
-                    printf("    Scope: %s\n", cp);
+            if (pl > 8) {
+                switch (bp[8] & 0x3) {      /* SCOPE field */
+                case 0: cp = "not reported"; break;
+                case 1: cp = "dedicated to lu"; break;
+                case 2: cp = "not dedicated to lu"; break;
+                case 3: cp = "reserved"; break;
                 }
+                printf("    Scope: %s\n", cp);
             }
         } else if ((pc >= 0xfff0) && (pc <= 0xffff)) {
             printf("  Vendor specific [0x%x]:", pc);
@@ -5144,10 +5121,10 @@
                 printf("<unexpected pc=0 parameter length=%d>\n", bp[4]);
             break;
         default:
-            if (pc <= 0xf000) {
+            if (pc <= 0xf000) {         /* parameter codes 0x1 to 0xf000 */
                 if (8 == bp[3])
                     printf("  LBA of misaligned block: 0x%" PRIx64 "\n",
-                           sg_get_unaligned_be64(bp + 8));
+                           sg_get_unaligned_be64(bp + 4));
                 else
                     printf("<unexpected pc=0x%x parameter length=%d>\n",
                            pc, bp[4]);
@@ -6770,7 +6747,7 @@
         k = sg_ll_log_select(sg_fd, !!(op->do_pcreset), op->do_sp,
                              op->page_control, op->pg_code, op->subpg_code,
                              rsp_buff, ((in_len > 0) ? in_len : 0),
-                             1, op->verbose);
+                             true, op->verbose);
         if (k) {
             if (SG_LIB_CAT_NOT_READY == k)
                 pr2serr("log_select: device not ready\n");
diff --git a/src/sg_luns.c b/src/sg_luns.c
index 84e7b24..d332ea0 100644
--- a/src/sg_luns.c
+++ b/src/sg_luns.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -31,7 +31,7 @@
  * and decodes the response.
  */
 
-static const char * version_str = "1.32 20160510";
+static const char * version_str = "1.33 20170917";
 
 #define MAX_RLUNS_BUFF_LEN (1024 * 1024)
 #define DEF_RLUNS_BUFF_LEN (1024 * 8)
@@ -599,7 +599,7 @@
     }
     trunc = 0;
 
-    res = sg_ll_report_luns(sg_fd, select_rep, reportLunsBuff, maxlen, 1,
+    res = sg_ll_report_luns(sg_fd, select_rep, reportLunsBuff, maxlen, true,
                             verbose);
     ret = res;
     if (0 == res) {
diff --git a/src/sg_map.c b/src/sg_map.c
index 6a15675..c5751d8 100644
--- a/src/sg_map.c
+++ b/src/sg_map.c
@@ -1,5 +1,5 @@
 /* Utility program for the Linux OS SCSI generic ("sg") device driver.
-*  Copyright (C) 2000-2007 D. Gilbert
+*  Copyright (C) 2000-2017 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)
@@ -42,7 +42,7 @@
 #include "sg_io_linux.h"
 
 
-static const char * version_str = "1.09 20130507";
+static const char * version_str = "1.10 20170917";
 
 static const char * devfs_id = "/dev/.devfsd";
 
@@ -300,7 +300,7 @@
             char buff[INQUIRY_RESP_INITIAL_LEN];
 
             if (0 == sg_ll_inquiry(sg_fd, 0, 0, 0, buff, sizeof(buff),
-                                   1, 0)) {
+                                   true, 0)) {
                 memcpy(map_arr[k].vendor, &buff[8], 8);
                 memcpy(map_arr[k].product, &buff[16], 16);
                 memcpy(map_arr[k].revision, &buff[32], 4);
diff --git a/src/sg_modes.c b/src/sg_modes.c
index 1190edd..13dbc2b 100644
--- a/src/sg_modes.c
+++ b/src/sg_modes.c
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2000-2016 D. Gilbert
+ *  Copyright (C) 2000-2017 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)
@@ -29,7 +29,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.48 20151219";
+static const char * version_str = "1.49 20170917";
 
 #define DEF_ALLOC_LEN (1024 * 4)
 #define DEF_6_ALLOC_LEN 252
@@ -882,7 +882,7 @@
     for (header = 0, k = 0; k < PG_CODE_MAX; ++k) {
         if (op->do_six) {
             res = sg_ll_mode_sense6(sg_fd, 0, 0, k, 0, rbuf, mresp_len,
-                                    1, op->do_verbose);
+                                    true, op->do_verbose);
             if (SG_LIB_CAT_INVALID_OP == res) {
                 pr2serr(">>>>>> try again without the '-6' switch for a 10 "
                         "byte MODE SENSE command\n");
@@ -893,7 +893,7 @@
             }
         } else {
             res = sg_ll_mode_sense10(sg_fd, 0, 0, 0, k, 0, rbuf, mresp_len,
-                                     1, op->do_verbose);
+                                     true, op->do_verbose);
             if (SG_LIB_CAT_INVALID_OP == res) {
                 pr2serr(">>>>>> try again with a '-6' switch for a 6 byte "
                         "MODE SENSE command\n");
@@ -1097,7 +1097,7 @@
     if (op->do_six) {
         res = sg_ll_mode_sense6(sg_fd, op->do_dbd, op->page_control,
                                 op->pg_code, op->subpg_code, rsp_buff,
-                                rsp_buff_size, 1, op->do_verbose);
+                                rsp_buff_size, true, op->do_verbose);
         if (SG_LIB_CAT_INVALID_OP == res)
             pr2serr(">>>>>> try again without the '-6' switch for a 10 byte "
                     "MODE SENSE command\n");
@@ -1105,7 +1105,7 @@
         res = sg_ll_mode_sense10(sg_fd, op->do_llbaa, op->do_dbd,
                                  op->page_control, op->pg_code,
                                  op->subpg_code, rsp_buff, rsp_buff_size,
-                                 1, op->do_verbose);
+                                 true, op->do_verbose);
         if (SG_LIB_CAT_INVALID_OP == res)
             pr2serr(">>>>>> try again with a '-6' switch for a 6 byte MODE "
                     "SENSE command\n");
diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c
index c956c93..01a92ec 100644
--- a/src/sg_opcodes.c
+++ b/src/sg_opcodes.c
@@ -1,5 +1,5 @@
 /* A utility program originally written for the Linux OS SCSI subsystem.
- *  Copyright (C) 2004-2016 D. Gilbert
+ *  Copyright (C) 2004-2017 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)
@@ -30,7 +30,7 @@
 
 #include "sg_pt.h"
 
-static const char * version_str = "0.48 20160531";    /* spc5r10 */
+static const char * version_str = "0.49 20170917";    /* spc5r10 */
 
 
 #define SENSE_BUFF_LEN 64       /* Arbitrary, could be larger */
@@ -178,7 +178,7 @@
 
 static int
 do_rsoc(int sg_fd, int rctd, int rep_opts, int rq_opcode, int rq_servact,
-        void * resp, int mx_resp_len, int noisy, int verbose)
+        void * resp, int mx_resp_len, bool noisy, int verbose)
 {
     int k, ret, res, sense_cat;
     unsigned char rsoc_cdb[RSOC_CMD_LEN] = {SG_MAINTENANCE_IN, RSOC_SA, 0,
@@ -241,7 +241,7 @@
                                     "functions";
 
 static int
-do_rstmf(int sg_fd, int repd, void * resp, int mx_resp_len, int noisy,
+do_rstmf(int sg_fd, int repd, void * resp, int mx_resp_len, bool noisy,
          int verbose)
 {
     int k, ret, res, sense_cat;
diff --git a/src/sg_persist.c b/src/sg_persist.c
index e76d8d2..7758bb3 100644
--- a/src/sg_persist.c
+++ b/src/sg_persist.c
@@ -1,5 +1,5 @@
 /* A utility program originally written for the Linux OS SCSI subsystem.
- *  Copyright (C) 2004-2016 D. Gilbert
+ *  Copyright (C) 2004-2017 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)
@@ -28,7 +28,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "0.54 20160426";
+static const char * version_str = "0.55 20170917";
 
 
 #define PRIN_RKEY_SA     0x0
@@ -246,7 +246,7 @@
 
     memset(pr_buff, 0, sizeof(pr_buff));
     res = sg_ll_persistent_reserve_in(sg_fd, op->prin_sa, pr_buff,
-                                      op->alloc_len, 1, op->verbose);
+                                      op->alloc_len, true, op->verbose);
     if (res) {
         char b[64];
         char bb[80];
@@ -452,7 +452,7 @@
         sg_put_unaligned_be32((uint32_t)t_arr_len, pr_buff + 24);
     }
     res = sg_ll_persistent_reserve_out(sg_fd, op->prout_sa, 0,
-                                       op->prout_type, pr_buff, len, 1,
+                                       op->prout_type, pr_buff, len, true,
                                        op->verbose);
     if (res || op->verbose) {
         if (op->prout_sa < num_prout_sa_strs)
@@ -498,7 +498,7 @@
         sg_put_unaligned_be32((uint32_t)t_arr_len, pr_buff + 20);
     }
     res = sg_ll_persistent_reserve_out(sg_fd, PROUT_REG_MOVE_SA, 0,
-                                       op->prout_type, pr_buff, len, 1,
+                                       op->prout_type, pr_buff, len, true,
                                        op->verbose);
     if (res) {
        if (SG_LIB_CAT_INVALID_OP == res)
diff --git a/src/sg_prevent.c b/src/sg_prevent.c
index 1771cad..29184d9 100644
--- a/src/sg_prevent.c
+++ b/src/sg_prevent.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2015 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -25,7 +25,7 @@
  * given SCSI device.
  */
 
-static const char * version_str = "1.08 20151219";
+static const char * version_str = "1.09 20170917";
 
 #define ME "sg_prevent: "
 
@@ -136,7 +136,7 @@
                 safe_strerror(-sg_fd));
         return SG_LIB_FILE_ERROR;
     }
-    res = sg_ll_prevent_allow(sg_fd, prevent, 1, verbose);
+    res = sg_ll_prevent_allow(sg_fd, prevent, true, verbose);
     ret = res;
     if (res) {
         char b[80];
diff --git a/src/sg_rdac.c b/src/sg_rdac.c
index 9b003cc..6eb0a0f 100644
--- a/src/sg_rdac.c
+++ b/src/sg_rdac.c
@@ -3,7 +3,7 @@
  *
  * Retrieve / set RDAC options.
  *
- * Copyright (C) 2006-2016 Hannes Reinecke <[email protected]>
+ * Copyright (C) 2006-2017 Hannes Reinecke <[email protected]>
  *
  * Based on sg_modes.c and sg_emc_trespass.c; credits from there apply.
  *
@@ -27,7 +27,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "1.11 20160429";
+static const char * version_str = "1.12 20170917";
 
 unsigned char mode6_hdr[] = {
     0x75, /* Length */
@@ -148,11 +148,11 @@
         if (use_6_byte) {
                 res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
                                         fail_paths_pg, 118,
-                                        1, (do_verbose ? 2 : 0));
+                                        true, (do_verbose ? 2 : 0));
         } else {
                 res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
                                         fail_paths_pg, 308,
-                                        1, (do_verbose ? 2: 0));
+                                        true, (do_verbose ? 2: 0));
         }
 
         switch (res) {
@@ -220,11 +220,11 @@
         if (use_6_byte) {
                 res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
                                         fail_paths_pg, 118,
-                                        1, (do_verbose ? 2 : 0));
+                                        true, (do_verbose ? 2 : 0));
         } else {
                 res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
                                         fail_paths_pg, 308,
-                                        1, (do_verbose ? 2: 0));
+                                        true, (do_verbose ? 2: 0));
         }
 
         switch (res) {
@@ -448,13 +448,13 @@
                 if (use_6_byte)
                         res = sg_ll_mode_sense6(fd, /* DBD */ 0, /* PC */0,
                                                 0x2c, 0, rsp_buff, 252,
-                                                1, do_verbose);
+                                                true, do_verbose);
                 else
                         res = sg_ll_mode_sense10(fd, /* llbaa */ 0,
                                                  /* DBD */ 0,
                                                  /* page control */0,
                                                  0x2c, 0x1, rsp_buff, 308,
-                                                 1, do_verbose);
+                                                 true, do_verbose);
 
                 if (!res) {
                         if (do_verbose)
diff --git a/src/sg_read_attr.c b/src/sg_read_attr.c
index a1436c4..7f11be7 100644
--- a/src/sg_read_attr.c
+++ b/src/sg_read_attr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Douglas Gilbert.
+ * Copyright (c) 2016-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -34,7 +34,7 @@
  * and decodes the response. Based on spc5r08.pdf
  */
 
-static const char * version_str = "1.02 20160528";
+static const char * version_str = "1.03 20170917";
 
 #define MAX_RATTR_BUFF_LEN (1024 * 1024)
 #define DEF_RATTR_BUFF_LEN (1024 * 8)
@@ -234,11 +234,10 @@
 /* Invokes a SCSI READ ATTRIBUTE command (SPC+SMC).  Return of 0 -> success,
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
-sg_ll_read_attr(int sg_fd, void * resp, int * residp,
+sg_ll_read_attr(int sg_fd, void * resp, int * residp, bool noisy,
                 const struct opts_t * op)
 {
     int k, ret, res, sense_cat;
-    int noisy = 1;
     unsigned char ra_cdb[SG_READ_ATTRIBUTE_CMDLEN] =
           {SG_READ_ATTRIBUTE_CMD, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
            0, 0, 0, 0};
@@ -1094,7 +1093,7 @@
         goto clean_up;
     }
 
-    res = sg_ll_read_attr(sg_fd, rabp, &resid, op);
+    res = sg_ll_read_attr(sg_fd, rabp, &resid, op->verbose > 0, op);
     ret = res;
     if (0 == res) {
         rlen = op->maxlen - resid;
diff --git a/src/sg_read_block_limits.c b/src/sg_read_block_limits.c
index 320dc5e..2269256 100644
--- a/src/sg_read_block_limits.c
+++ b/src/sg_read_block_limits.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2015 Douglas Gilbert.
+ * Copyright (c) 2009-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -30,7 +30,7 @@
  * SCSI device.
  */
 
-static const char * version_str = "1.04 20151219";
+static const char * version_str = "1.05 20170917";
 
 #define MAX_READ_BLOCK_LIMITS_LEN 6
 
@@ -142,8 +142,7 @@
     }
 
     memset(readBlkLmtBuff, 0x0, 6);
-    res = sg_ll_read_block_limits(sg_fd, readBlkLmtBuff, 6, 1,
-                            verbose);
+    res = sg_ll_read_block_limits(sg_fd, readBlkLmtBuff, 6, true, verbose);
     ret = res;
     if (0 == res) {
       if (do_hex) {
diff --git a/src/sg_read_buffer.c b/src/sg_read_buffer.c
index e6dc7ef..c9c8ad3 100644
--- a/src/sg_read_buffer.c
+++ b/src/sg_read_buffer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2016 Luben Tuikov and Douglas Gilbert.
+ * Copyright (c) 2006-2017 Luben Tuikov and Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -30,7 +30,7 @@
  * device.
  */
 
-static const char * version_str = "1.17 20160531";
+static const char * version_str = "1.18 20170917";
 
 
 #ifndef SG_READ_BUFFER_10_CMD
@@ -143,7 +143,7 @@
 static int
 ll_read_buffer_10(int sg_fd, int rb_mode, int rb_mode_sp, int rb_id,
                   uint32_t rb_offset, void * resp, int mx_resp_len,
-                  int * residp, int noisy, int verbose)
+                  int * residp, bool noisy, int verbose)
 {
     int k, ret, res, sense_cat;
     uint8_t rb10_cb[SG_READ_BUFFER_10_CMDLEN] =
@@ -206,7 +206,7 @@
 static int
 ll_read_buffer_16(int sg_fd, int rb_mode, int rb_mode_sp, int rb_id,
                   uint64_t rb_offset, void * resp, int mx_resp_len,
-                  int * residp, int noisy, int verbose)
+                  int * residp, bool noisy, int verbose)
 {
     int k, ret, res, sense_cat;
     uint8_t rb16_cb[SG_READ_BUFFER_16_CMDLEN] =
@@ -452,7 +452,7 @@
 
     if (do_long)
         res = ll_read_buffer_16(sg_fd, rb_mode, rb_mode_sp, rb_id, rb_offset,
-                                resp, rb_len, &resid, 1, verbose);
+                                resp, rb_len, &resid, true, verbose);
     else if (rb_offset > 0xffffff) {
         pr2serr("--offset value is too large for READ BUFFER(10), try "
                 "--16\n");
@@ -460,8 +460,8 @@
         goto fini;
     } else
         res = ll_read_buffer_10(sg_fd, rb_mode, rb_mode_sp, rb_id,
-                                (uint32_t)rb_offset, resp, rb_len, &resid, 1,
-                                verbose);
+                                (uint32_t)rb_offset, resp, rb_len, &resid,
+                                true, verbose);
     if (0 != res) {
         char b[80];
 
diff --git a/src/sg_read_long.c b/src/sg_read_long.c
index 9514787..f495204 100644
--- a/src/sg_read_long.c
+++ b/src/sg_read_long.c
@@ -1,5 +1,5 @@
 /* A utility program for the Linux OS SCSI subsystem.
-   *  Copyright (C) 2004-2016 D. Gilbert
+   *  Copyright (C) 2004-2017 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)
@@ -30,7 +30,7 @@
 #include "sg_cmds_extra.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.21 20160121";
+static const char * version_str = "1.22 20170917";
 
 #define MAX_XFER_LEN 10000
 
@@ -94,10 +94,10 @@
 
     if (do_16)
         res = sg_ll_read_long16(sg_fd, pblock, correct, llba, data_out,
-                                xfer_len, &offset, 1, verbose);
+                                xfer_len, &offset, true, verbose);
     else
         res = sg_ll_read_long10(sg_fd, pblock, correct, (unsigned int)llba,
-                                data_out, xfer_len, &offset, 1, verbose);
+                                data_out, xfer_len, &offset, true, verbose);
     ten_or = do_16 ? "16" : "10";
     switch (res) {
     case 0:
diff --git a/src/sg_readcap.c b/src/sg_readcap.c
index e05f791..6011fc8 100644
--- a/src/sg_readcap.c
+++ b/src/sg_readcap.c
@@ -1,7 +1,7 @@
 /* This code is does a SCSI READ CAPACITY command on the given device
    and outputs the result.
 
-*  Copyright (C) 1999 - 2015 D. Gilbert
+*  Copyright (C) 1999 - 2017 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)
@@ -31,7 +31,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "3.95 20151219";
+static const char * version_str = "3.96 20170917";
 
 #define ME "sg_readcap: "
 
@@ -451,7 +451,8 @@
 
     if (! op->do_long) {
         res = sg_ll_readcap_10(sg_fd, op->do_pmi, (unsigned int)op->llba,
-                               resp_buff, RCAP_REPLY_LEN, 1, op->do_verbose);
+                               resp_buff, RCAP_REPLY_LEN, true,
+                               op->do_verbose);
         ret = res;
         if (0 == res) {
             if (op->do_hex || op->do_raw) {
@@ -524,7 +525,7 @@
     }
     if (op->do_long) {
         res = sg_ll_readcap_16(sg_fd, op->do_pmi, op->llba, resp_buff,
-                               RCAP16_REPLY_LEN, 1, op->do_verbose);
+                               RCAP16_REPLY_LEN, true, op->do_verbose);
         ret = res;
         if (0 == res) {
             if (op->do_hex || op->do_raw) {
diff --git a/src/sg_reassign.c b/src/sg_reassign.c
index c43fd0d..f51aa4d 100644
--- a/src/sg_reassign.c
+++ b/src/sg_reassign.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2016 Douglas Gilbert.
+ * Copyright (c) 2005-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -35,7 +35,7 @@
  * vendor specific data is written.
  */
 
-static const char * version_str = "1.20 20160701";
+static const char * version_str = "1.21 20170917";
 
 #define DEF_DEFECT_LIST_FORMAT 4        /* bytes from index */
 
@@ -376,7 +376,7 @@
             return 0;
         }
         res = sg_ll_reassign_blocks(sg_fd, eight, longlist, param_arr,
-                                    param_len, 1, verbose);
+                                    param_len, true, verbose);
         ret = res;
         if (res) {
             sg_get_category_sense_str(res, sizeof(b), b, verbose);
@@ -393,7 +393,7 @@
         param_len = 4;
         memset(param_arr, 0, param_len);
         res = sg_ll_read_defect10(sg_fd, primary, grown, dl_format,
-                                  param_arr, param_len, 0, verbose);
+                                  param_arr, param_len, false, verbose);
         ret = res;
         if (res) {
             sg_get_category_sense_str(res, sizeof(b), b, verbose);
diff --git a/src/sg_referrals.c b/src/sg_referrals.c
index 1803bca..7bd71d9 100644
--- a/src/sg_referrals.c
+++ b/src/sg_referrals.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2016 Hannes Reinecke.
+ * Copyright (c) 2010-2017 Hannes Reinecke.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -31,7 +31,7 @@
  * SCSI device.
  */
 
-static const char * version_str = "1.06 20160423";    /* sbc4r10 */
+static const char * version_str = "1.07 20170917";    /* sbc4r10 */
 
 #define MAX_REFER_BUFF_LEN (1024 * 1024)
 #define DEF_REFER_BUFF_LEN 256
@@ -274,7 +274,7 @@
     }
 
     res = sg_ll_report_referrals(sg_fd, lba, do_one_segment, referralBuffp,
-                                 maxlen, 1, verbose);
+                                 maxlen, true, verbose);
     ret = res;
     if (0 == res) {
         if (maxlen >= 4)
diff --git a/src/sg_rep_zones.c b/src/sg_rep_zones.c
index 0dd75d1..8c1b55e 100644
--- a/src/sg_rep_zones.c
+++ b/src/sg_rep_zones.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 Douglas Gilbert.
+ * Copyright (c) 2014-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -32,7 +32,7 @@
  * and decodes the response. Based on zbc-r02.pdf
  */
 
-static const char * version_str = "1.09 20160528";
+static const char * version_str = "1.10 20170917";
 
 #define MAX_RZONES_BUFF_LEN (1024 * 1024)
 #define DEF_RZONES_BUFF_LEN (1024 * 8)
@@ -92,7 +92,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
 sg_ll_report_zones(int sg_fd, uint64_t zs_lba, int partial, int report_opts,
-                   void * resp, int mx_resp_len, int * residp, int noisy,
+                   void * resp, int mx_resp_len, int * residp, bool noisy,
                    int verbose)
 {
     int k, ret, res, sense_cat;
@@ -286,7 +286,7 @@
             }
             break;
         case 'o':
-           reporting_opt = sg_get_num(optarg);
+           reporting_opt = sg_get_num_nomult(optarg);
            if ((reporting_opt < 0) || (reporting_opt > 63)) {
                 pr2serr("bad argument to '--report=OPT', expect 0 to "
                         "63\n");
@@ -364,7 +364,7 @@
     }
 
     res = sg_ll_report_zones(sg_fd, st_lba, do_partial, reporting_opt,
-                             reportZonesBuff, maxlen, &resid, 1, verbose);
+                             reportZonesBuff, maxlen, &resid, true, verbose);
     ret = res;
     if (0 == res) {
         rlen = maxlen - resid;
diff --git a/src/sg_requests.c b/src/sg_requests.c
index fc691eb..ac3e038 100644
--- a/src/sg_requests.c
+++ b/src/sg_requests.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -26,7 +26,7 @@
  * This program issues the SCSI command REQUEST SENSE to the given SCSI device.
  */
 
-static const char * version_str = "1.27 20160226";
+static const char * version_str = "1.28 20170917";
 
 #define MAX_REQS_RESP_LEN 255
 #define DEF_REQS_RESP_LEN 252
@@ -223,7 +223,7 @@
                 sleep_for(30);
             memset(requestSenseBuff, 0x0, sizeof(requestSenseBuff));
             res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff, maxlen,
-                                      1, verbose);
+                                      true, verbose);
             if (res) {
                 ret = res;
                 if (SG_LIB_CAT_INVALID_OP == res)
@@ -275,7 +275,7 @@
     for (k = 0; k < num_rs; ++k) {
         memset(requestSenseBuff, 0x0, sizeof(requestSenseBuff));
         res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff, maxlen,
-                                  1, verbose);
+                                  true, verbose);
         ret = res;
         if (0 == res) {
             resp_len = requestSenseBuff[7] + 8;
diff --git a/src/sg_reset.c b/src/sg_reset.c
index e254910..49103d4 100644
--- a/src/sg_reset.c
+++ b/src/sg_reset.c
@@ -1,5 +1,5 @@
 /* A utility program originally written for the Linux OS SCSI subsystem.
- *  Copyright (C) 1999-2016 D. Gilbert
+ *  Copyright (C) 1999-2017 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)
@@ -29,7 +29,7 @@
 
 #define ME "sg_reset: "
 
-static const char * version_str = "0.61 20160405";
+static const char * version_str = "0.62 20170915";
 
 #ifndef SG_SCSI_RESET
 #define SG_SCSI_RESET 0x2284
@@ -266,6 +266,10 @@
             break;
         case EINVAL:
             pr2serr(ME "SG_SCSI_RESET not supported (for value=0x%x)\n", k);
+#if defined(__GNUC__) || defined(__clang__)
+            __attribute__((fallthrough));
+            /* FALL THROUGH */
+#endif
         default:
             perror(ME "SG_SCSI_RESET failed");
             break;
diff --git a/src/sg_reset_wp.c b/src/sg_reset_wp.c
index fc8c4a4..a8b20fa 100644
--- a/src/sg_reset_wp.c
+++ b/src/sg_reset_wp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 Douglas Gilbert.
+ * Copyright (c) 2014-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -32,7 +32,7 @@
  * device. Based on zbc-r04c.pdf .
  */
 
-static const char * version_str = "1.05 20160528";
+static const char * version_str = "1.06 20170917";
 
 #define SG_ZONING_OUT_CMDLEN 16
 #define RESET_WRITE_POINTER_SA 0x4
@@ -75,7 +75,7 @@
 /* Invokes a SCSI RESET WRITE POINTER command (ZBC).  Return of 0 -> success,
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
-sg_ll_reset_write_pointer(int sg_fd, uint64_t zid, int all, int noisy,
+sg_ll_reset_write_pointer(int sg_fd, uint64_t zid, int all, bool noisy,
                           int verbose)
 {
     int k, ret, res, sense_cat;
@@ -206,7 +206,7 @@
         return SG_LIB_FILE_ERROR;
     }
 
-    res = sg_ll_reset_write_pointer(sg_fd, zid, all, 1, verbose);
+    res = sg_ll_reset_write_pointer(sg_fd, zid, all, true, verbose);
     ret = res;
     if (res) {
         if (SG_LIB_CAT_INVALID_OP == res)
diff --git a/src/sg_rmsn.c b/src/sg_rmsn.c
index 9df15a0..ef0d708 100644
--- a/src/sg_rmsn.c
+++ b/src/sg_rmsn.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005-2016 Douglas Gilbert.
+ * Copyright (c) 2005-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -28,7 +28,7 @@
  * to the given SCSI device.
  */
 
-static const char * version_str = "1.12 20160423";
+static const char * version_str = "1.13 20170917";
 
 #define SERIAL_NUM_SANITY_LEN (16 * 1024)
 
@@ -134,7 +134,7 @@
     memset(rmsn_buff, 0x0, sizeof(rmsn_buff));
 
     res = sg_ll_read_media_serial_num(sg_fd, rmsn_buff, sizeof(rmsn_buff),
-                                      1, verbose);
+                                      true, verbose);
     ret = res;
     if (0 == res) {
         sn_len = sg_get_unaligned_be32(rmsn_buff + 0);
@@ -155,7 +155,7 @@
             pr2serr("    Out of memory (ram)\n");
             goto err_out;
         }
-        res = sg_ll_read_media_serial_num(sg_fd, bp, sn_len, 1, verbose);
+        res = sg_ll_read_media_serial_num(sg_fd, bp, sn_len, true, verbose);
         if (0 == res) {
             sn_len = sg_get_unaligned_be32(bp + 0);
             if (raw) {
diff --git a/src/sg_rtpg.c b/src/sg_rtpg.c
index 4696d4c..0c1c2d9 100644
--- a/src/sg_rtpg.c
+++ b/src/sg_rtpg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Christophe Varoqui and Douglas Gilbert.
+ * Copyright (c) 2004-2017 Christophe Varoqui and Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -28,7 +28,7 @@
  * to the given SCSI device.
  */
 
-static const char * version_str = "1.20 20151219";
+static const char * version_str = "1.21 20170917";
 
 #define REPORT_TGT_GRP_BUFF_LEN 1024
 
@@ -223,7 +223,7 @@
 
     res = sg_ll_report_tgt_prt_grp2(sg_fd, reportTgtGrpBuff,
                                     sizeof(reportTgtGrpBuff),
-                                    extended, 1, verbose);
+                                    extended, true, verbose);
     ret = res;
     if (0 == res) {
         report_len = sg_get_unaligned_be32(reportTgtGrpBuff + 0) + 4;
diff --git a/src/sg_safte.c b/src/sg_safte.c
index 9e92b4e..c1b2216 100644
--- a/src/sg_safte.c
+++ b/src/sg_safte.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2015 Hannes Reinecke and Douglas Gilbert.
+ * Copyright (c) 2004-2017 Hannes Reinecke and Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -28,7 +28,7 @@
  *  to the 'SCSI Accessed Fault-Tolerant Enclosures' (SAF-TE) spec.
  */
 
-static const char * version_str = "0.26 20151219";
+static const char * version_str = "0.27 20170917";
 
 
 #define SENSE_BUFF_LEN 64       /* Arbitrary, could be larger */
@@ -84,7 +84,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=0 to fetch "
                 "configuration\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 0, 0,
-                            rb_buff, rb_len, 1, verbose);
+                            rb_buff, rb_len, true, verbose);
     if (res && res != SG_LIB_CAT_RECOVERED)
         return res;
 
@@ -136,7 +136,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=1 to read "
                 "enclosure status\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 1, 0,
-                            rb_buff, rb_len, 0, verbose);
+                            rb_buff, rb_len, false, verbose);
     if (res && res != SG_LIB_CAT_RECOVERED)
         return res;
 
@@ -277,7 +277,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=2 to read "
                 "usage statistics\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 2, 0,
-                            rb_buff, rb_len, 0, verbose);
+                            rb_buff, rb_len, false, verbose);
     if (res) {
         if (res == SG_LIB_CAT_ILLEGAL_REQ) {
             printf("Usage Statistics:\n\tNot implemented\n");
@@ -322,7 +322,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=3 to read "
                 "device insertions\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 3, 0,
-                            rb_buff, rb_len, 0, verbose);
+                            rb_buff, rb_len, false, verbose);
     if (res ) {
         if (res == SG_LIB_CAT_ILLEGAL_REQ) {
                 printf("Slot insertions:\n\tNot implemented\n");
@@ -366,7 +366,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=4 to read "
                 "device slot status\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 4, 0,
-                            rb_buff, rb_len, 0, verbose);
+                            rb_buff, rb_len, false, verbose);
     if (res && res != SG_LIB_CAT_RECOVERED) {
         free(rb_buff);
         return res;
@@ -415,7 +415,7 @@
         pr2serr("Use READ BUFFER,mode=vendor_specific,buff_id=5 to read "
                 "global flags\n");
     res = sg_ll_read_buffer(sg_fd, RWB_MODE_VENDOR, 5, 0,
-                            rb_buff, rb_len, 0, verbose);
+                            rb_buff, rb_len, false, verbose);
     if (res ) {
         if (res == SG_LIB_CAT_ILLEGAL_REQ) {
                 printf("Global Flags:\n\tNot implemented\n");
diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c
index 7370ab3..e4ca37f 100644
--- a/src/sg_sanitize.c
+++ b/src/sg_sanitize.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 Douglas Gilbert.
+ * Copyright (c) 2011-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -28,7 +28,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.02 20160531";
+static const char * version_str = "1.03 20170917";
 
 /* Not all environments support the Unix sleep() */
 #if defined(MSC_VER) || defined(__MINGW32__)
@@ -224,7 +224,7 @@
     set_scsi_pt_data_out(ptvp, (unsigned char *)param_lstp, param_lst_len);
     res = do_scsi_pt(ptvp, sg_fd, timeout, op->verbose);
     ret = sg_cmds_process_resp(ptvp, "Sanitize", res, 0, sense_b,
-                               1 /*noisy */, op->verbose, &sense_cat);
+                               true /*noisy */, op->verbose, &sense_cat);
     if (-1 == ret)
         ;
     else if (-2 == ret) {
diff --git a/src/sg_scan_win32.c b/src/sg_scan_win32.c
index a45b038..3b90a05 100644
--- a/src/sg_scan_win32.c
+++ b/src/sg_scan_win32.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2015 Douglas Gilbert.
+ * Copyright (c) 2006-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -38,14 +38,14 @@
 
 #include "sg_pt_win32.h"
 
-static const char * version_str = "1.15 (win32) 20140827";
+static const char * version_str = "1.16 (win32) 20170917";
 
-#define MAX_SCSI_ELEMS 1024
-#define MAX_ADAPTER_NUM 64
-#define MAX_PHYSICALDRIVE_NUM 512
+#define MAX_SCSI_ELEMS 2048
+#define MAX_ADAPTER_NUM 128
+#define MAX_PHYSICALDRIVE_NUM 1024
 #define MAX_CDROM_NUM 512
 #define MAX_TAPE_NUM 512
-#define MAX_HOLE_COUNT 8
+#define MAX_HOLE_COUNT 16
 
 // IOCTL_STORAGE_QUERY_PROPERTY
 
diff --git a/src/sg_senddiag.c b/src/sg_senddiag.c
index 29d28ba..fbdd89a 100644
--- a/src/sg_senddiag.c
+++ b/src/sg_senddiag.c
@@ -1,5 +1,5 @@
 /* A utility program originally written for the Linux OS SCSI subsystem
-*  Copyright (C) 2003-2016 D. Gilbert
+*  Copyright (C) 2003-2017 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)
@@ -28,7 +28,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "0.49 20160228";
+static const char * version_str = "0.50 20170917";
 
 #define ME "sg_senddiag: "
 
@@ -407,7 +407,7 @@
 static int
 do_senddiag(int sg_fd, int sf_code, int pf_bit, int sf_bit, int devofl_bit,
             int unitofl_bit, void * outgoing_pg, int outgoing_len, int tmout,
-            int noisy, int verbose)
+            bool noisy, int verbose)
 {
     int long_duration = 0;
 
@@ -425,7 +425,7 @@
 
 /* Get expected extended self-test time from mode page 0xa (for '-e') */
 static int
-do_modes_0a(int sg_fd, void * resp, int mx_resp_len, int noisy, int mode6,
+do_modes_0a(int sg_fd, void * resp, int mx_resp_len, bool noisy, bool mode6,
             int verbose)
 {
     int res;
@@ -710,7 +710,7 @@
                 usage_old();
             }
             ret = SG_LIB_SYNTAX_ERROR;
-	    goto fini;
+            goto fini;
         }
     }
 
@@ -723,7 +723,7 @@
             usage_old();
         }
         ret = SG_LIB_SYNTAX_ERROR;
-	goto fini;
+        goto fini;
     }
     if ((op->do_selftest > 0) && op->do_deftest) {
         if (op->opt_new) {
@@ -734,7 +734,7 @@
             usage_old();
         }
         ret = SG_LIB_SYNTAX_ERROR;
-	goto fini;
+        goto fini;
     }
     if (op->do_raw) {
         if ((op->do_selftest > 0) || op->do_deftest || op->do_extdur ||
@@ -749,7 +749,7 @@
                 usage_old();
             }
             ret = SG_LIB_SYNTAX_ERROR;
-	    goto fini;
+            goto fini;
         }
         if (! op->do_pf) {
             if (op->opt_new)
@@ -775,16 +775,16 @@
         pr2serr(ME "error opening file: %s: %s\n", op->device_name,
                 safe_strerror(-sg_fd));
         ret = SG_LIB_FILE_ERROR;
-	goto fini;
+        goto fini;
     }
     rsp_buff = (unsigned char *)calloc(op->maxlen, 1);
     if (NULL == rsp_buff) {
         pr2serr("unable to allocate %d bytes (2)\n", op->maxlen);
         ret = SG_LIB_CAT_OTHER;
-	goto close_fini;
+        goto close_fini;
     }
     if (op->do_extdur) {
-        res = do_modes_0a(sg_fd, rsp_buff, 32, 1, 0, op->do_verbose);
+        res = do_modes_0a(sg_fd, rsp_buff, 32, true, false, op->do_verbose);
         if (0 == res) {
             /* Assume mode sense(10) response without block descriptors */
             num = sg_get_unaligned_be16(rsp_buff) - 6;
diff --git a/src/sg_ses.c b/src/sg_ses.c
index 017bda6..611749a 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -31,7 +31,7 @@
  * commands tailored for SES (enclosure) devices.
  */
 
-static const char * version_str = "2.20 20170904";    /* ses4r01 */
+static const char * version_str = "2.21 20170917";    /* ses4r01 */
 
 #define MX_ALLOC_LEN ((64 * 1024) - 4)  /* max allowable for big enclosures */
 #define MX_ELEM_HDR 1024
@@ -120,8 +120,8 @@
 struct opts_t {
     int byte1;
     bool byte1_given;
-    int do_control;
-    int do_data;
+    bool do_control;
+    bool do_data;
     int dev_slot_num;
     int enumerate;
     bool eiioe_auto;
@@ -1107,7 +1107,7 @@
             op->byte1_given = true;
             break;
         case 'c':
-            ++op->do_control;
+            op->do_control = true;
             break;
         case 'C':
             if (strlen(optarg) >= CGS_STR_MAX_SZ) {
@@ -1127,7 +1127,7 @@
             break;
         case 'd':
             data_arg = optarg;
-            op->do_data = 1;
+            op->do_data = true;
             break;
         case 'D':
             op->desc_name = optarg;
@@ -1301,7 +1301,7 @@
     }
     if (op->maxlen <= 0)
         op->maxlen = MX_ALLOC_LEN;
-    if (op->do_join && (op->do_control)) {
+    if (op->do_join && op->do_control) {
         pr2serr("cannot have '--join' and '--control'\n");
         goto err_help;
     }
@@ -1325,7 +1325,7 @@
                     "--dev-slot-num and --sas-addr\n");
             return SG_LIB_SYNTAX_ERROR;
         }
-        if ((0 == op->do_join) && (0 == op->do_control) &&
+        if ((0 == op->do_join) && (! op->do_control) &&
             (0 == op->num_cgs) && (! op->page_code_given)) {
             ++op->do_join;      /* implicit --join */
             if (op->verbose)
@@ -1333,7 +1333,7 @@
         }
     }
     if (op->ind_given) {
-        if ((0 == op->do_join) && (0 == op->do_control) &&
+        if ((0 == op->do_join) && (! op->do_control) &&
             (0 == op->num_cgs) && (! op->page_code_given)) {
             op->page_code_given = true;
             op->page_code = ENC_STATUS_DPC;  /* implicit status page */
@@ -1509,7 +1509,7 @@
  * failures */
 static int
 do_senddiag(int sg_fd, int pf_bit, void * outgoing_pg, int outgoing_len,
-            int noisy, int verbose)
+            bool noisy, int verbose)
 {
     const char * cp;
     int page_num;
@@ -1717,7 +1717,7 @@
                     page_code);
     }
     res = sg_ll_receive_diag(sg_fd, 1 /* pcv */, page_code, rsp_buff,
-                             rsp_buff_size, 1, op->verbose);
+                             rsp_buff_size, true, op->verbose);
     if (0 == res) {
         rsp_len = sg_get_unaligned_be16(rsp_buff + 2) + 4;
         if (rsp_len > rsp_buff_size) {
diff --git a/src/sg_ses_microcode.c b/src/sg_ses_microcode.c
index 4075733..8af89ae 100644
--- a/src/sg_ses_microcode.c
+++ b/src/sg_ses_microcode.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 Douglas Gilbert.
+ * Copyright (c) 2014-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -36,7 +36,7 @@
  * RESULTS commands in order to send microcode to the given SES device.
  */
 
-static const char * version_str = "1.05 20160610";    /* ses3r07 */
+static const char * version_str = "1.06 20170917";    /* ses3r07 */
 
 #define ME "sg_ses_microcode: "
 #define MAX_XFER_LEN (128 * 1024 * 1024)
@@ -316,7 +316,7 @@
     res = sg_ll_send_diag(sg_fd, 0 /* sf_code */, 1 /* pf */, 0 /* sf */,
                           0 /* devofl */, 0 /* unitofl */,
                           1 /* long_duration */, wp->doutp, do_len,
-                          1 /* noisy */, verb);
+                          true /* noisy */, verb);
     if (op->mc_non) {
         /* If non-standard, only call RDR after failed SD */
         if (0 == res)
@@ -349,7 +349,7 @@
     }
 
     res = sg_ll_receive_diag(sg_fd, 1 /* pcv */, DPC_DOWNLOAD_MICROCODE, dip,
-                             DEF_DI_LEN, 1, verb);
+                             DEF_DI_LEN, true, verb);
     if (res)
         return ret ? ret : res;
     rsp_len = sg_get_unaligned_be16(dip + 2) + 4;
@@ -692,7 +692,7 @@
     verb = (op->verbose > 1) ? op->verbose - 1 : 0;
     /* Fetch Download microcode status dpage for generation code ++ */
     res = sg_ll_receive_diag(sg_fd, 1 /* pcv */, DPC_DOWNLOAD_MICROCODE, dip,
-                             DEF_DI_LEN, 1, verb);
+                             DEF_DI_LEN, true, verb);
     if (0 == res) {
         rsp_len = sg_get_unaligned_be16(dip + 2) + 4;
         if (rsp_len > DEF_DI_LEN) {
diff --git a/src/sg_start.c b/src/sg_start.c
index 74ef1c9..dff2863 100644
--- a/src/sg_start.c
+++ b/src/sg_start.c
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 1999-2015 D. Gilbert
+ *  Copyright (C) 1999-2017 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)
@@ -32,7 +32,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "0.60 20151219";  /* sbc3r14; mmc6r01a */
+static const char * version_str = "0.61 20170917";  /* sbc3r14; mmc6r01a */
 
 static struct option long_options[] = {
         {"eject", 0, 0, 'e'},
@@ -535,15 +535,15 @@
     if (op->do_fl >= 0)
         res = sg_ll_start_stop_unit(fd, op->do_immed, op->do_fl, 0 /* pc */,
                                     1 /* fl */, 1 /* loej */,
-                                    1 /*start */, 1 /* noisy */,
+                                    1 /*start */, true /* noisy */,
                                     op->do_verbose);
     else if (op->do_pc > 0)
         res = sg_ll_start_stop_unit(fd, op->do_immed, op->do_mod,
-                                    op->do_pc, op->do_noflush, 0, 0, 1,
+                                    op->do_pc, op->do_noflush, 0, 0, true,
                                     op->do_verbose);
     else
         res = sg_ll_start_stop_unit(fd, op->do_immed, 0, 0, op->do_noflush,
-                                    op->do_loej, op->do_start, 1,
+                                    op->do_loej, op->do_start, true,
                                     op->do_verbose);
     ret = res;
     if (res) {
diff --git a/src/sg_stpg.c b/src/sg_stpg.c
index 05ce170..326ff72 100644
--- a/src/sg_stpg.c
+++ b/src/sg_stpg.c
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004-2016 Hannes Reinecke, Christophe Varoqui, Douglas Gilbert
+* Copyright (c) 2004-2017 Hannes Reinecke, Christophe Varoqui, Douglas Gilbert
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -30,7 +30,7 @@
  * to the given SCSI device.
  */
 
-static const char * version_str = "1.12 20160423";
+static const char * version_str = "1.13 20170917";
 
 #define TGT_GRP_BUFF_LEN 1024
 #define MX_ALLOC_LEN (0xc000 + 0x80)
@@ -564,7 +564,7 @@
 
     if (0 == port_arr_len) {
         res = sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rsp_buff,
-                            DEF_VPD_DEVICE_ID_LEN, 1, verbose);
+                            DEF_VPD_DEVICE_ID_LEN, true, verbose);
         if (0 == res) {
             report_len = sg_get_unaligned_be16(rsp_buff + 2) + 4;
             if (VPD_DEVICE_ID != rsp_buff[1]) {
@@ -582,7 +582,7 @@
                 return SG_LIB_CAT_MALFORMED;
             } else if (report_len > DEF_VPD_DEVICE_ID_LEN) {
                 if (sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rsp_buff,
-                                  report_len, 1, verbose))
+                                  report_len, true, verbose))
                     return SG_LIB_CAT_OTHER;
             }
             decode_target_port(rsp_buff + 4, report_len - 4, &relport,
@@ -595,7 +595,7 @@
         /* trunc = 0; */
 
         res = sg_ll_report_tgt_prt_grp2(sg_fd, reportTgtGrpBuff,
-                                        sizeof(reportTgtGrpBuff), 0, 1,
+                                        sizeof(reportTgtGrpBuff), 0, true,
                                         verbose);
         ret = res;
         if (0 == res) {
@@ -667,7 +667,8 @@
         report_len = port_arr_len * 4 + 4;
     }
 
-    res = sg_ll_set_tgt_prt_grp(sg_fd, setTgtGrpBuff, report_len, 1, verbose);
+    res = sg_ll_set_tgt_prt_grp(sg_fd, setTgtGrpBuff, report_len, true,
+                                verbose);
 
     if (0 == res)
         goto err_out;
diff --git a/src/sg_sync.c b/src/sg_sync.c
index 96aa15a..ae65586 100644
--- a/src/sg_sync.c
+++ b/src/sg_sync.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -27,7 +27,7 @@
  * (e.g. disks).
  */
 
-static const char * version_str = "1.15 20160528";
+static const char * version_str = "1.16 20170917";
 
 #define SYNCHRONIZE_CACHE16_CMD     0x91
 #define SYNCHRONIZE_CACHE16_CMDLEN  16
@@ -85,7 +85,7 @@
 static int
 ll_sync_cache_16(int sg_fd, int sync_nv, int immed, int group,
                  uint64_t lba, unsigned int num_lb, int to_secs,
-                 int noisy, int verbose)
+                 bool noisy, int verbose)
 {
     int res, ret, k, sense_cat;
     unsigned char sc_cdb[SYNCHRONIZE_CACHE16_CMDLEN] =
@@ -243,10 +243,10 @@
 
     if (do_16)
         res = ll_sync_cache_16(sg_fd, sync_nv, immed, group, lba, num_lb,
-                               to_secs, 1, verbose);
+                               to_secs, true, verbose);
     else
         res = sg_ll_sync_cache_10(sg_fd, sync_nv, immed, group,
-                                  (unsigned int)lba, num_lb, 1, verbose);
+                                  (unsigned int)lba, num_lb, true, verbose);
     ret = res;
     if (res) {
         char b[80];
diff --git a/src/sg_timestamp.c b/src/sg_timestamp.c
index 12f95ed..db88527 100644
--- a/src/sg_timestamp.c
+++ b/src/sg_timestamp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Douglas Gilbert.
+ * Copyright (c) 2015-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -33,7 +33,7 @@
  * to the given SCSI device. Based on spc5r07.pdf .
  */
 
-static const char * version_str = "1.02 20160528";
+static const char * version_str = "1.03 20170917";
 
 #define REP_TIMESTAMP_CMDLEN 12
 #define SET_TIMESTAMP_CMDLEN 12
@@ -121,7 +121,7 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
 sg_ll_rep_timestamp(int sg_fd, void * resp, int mx_resp_len, int * residp,
-                    int noisy, int verbose)
+                    bool noisy, int verbose)
 {
     int k, ret, res, sense_cat;
     unsigned char rt_cdb[REP_TIMESTAMP_CMDLEN] =
@@ -178,7 +178,7 @@
 /* Invokes the SET TIMESTAMP command.  Return of 0 -> success, various
  * SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
-sg_ll_set_timestamp(int sg_fd, void * paramp, int param_len, int noisy,
+sg_ll_set_timestamp(int sg_fd, void * paramp, int param_len, bool noisy,
                     int verbose)
 {
     int k, ret, res, sense_cat;
@@ -350,10 +350,10 @@
     if (do_set) {
         cmd_name = "Set timestamp";
         sg_put_unaligned_be48(secs_given ? (secs * 1000) : msecs, d_buff + 4);
-        res = sg_ll_set_timestamp(sg_fd, d_buff, 12, 1, verbose);
+        res = sg_ll_set_timestamp(sg_fd, d_buff, 12, true, verbose);
     } else {
         cmd_name = "Report timestamp";
-        res = sg_ll_rep_timestamp(sg_fd, d_buff, 12, NULL, 1, verbose);
+        res = sg_ll_rep_timestamp(sg_fd, d_buff, 12, NULL, true, verbose);
         if (0 == res) {
             if (do_raw)
                 dStrRaw((const char *)d_buff, 12);
diff --git a/src/sg_turs.c b/src/sg_turs.c
index 7c19c1b..f599261 100644
--- a/src/sg_turs.c
+++ b/src/sg_turs.c
@@ -3,7 +3,7 @@
  * data transfer (and no REQUEST SENSE command iff the unit is ready)
  * then this can be used for timing per SCSI command overheads.
  *
- * Copyright (C) 2000-2016 D. Gilbert
+ * Copyright (C) 2000-2017 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)
@@ -32,7 +32,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "3.33 20160525";
+static const char * version_str = "3.34 20170917";
 
 #if defined(MSC_VER) || defined(__MINGW32__)
 #define HAVE_MS_SLEEP
@@ -314,7 +314,7 @@
                 sleep_for(30);
             progress = -1;
             res = sg_ll_test_unit_ready_progress(sg_fd, k, &progress,
-                     ((1 == op->do_number) ? 1 : 0), op->do_verbose);
+                     (1 == op->do_number), op->do_verbose);
             if (progress < 0) {
                 ret = res;
                 break;
diff --git a/src/sg_unmap.c b/src/sg_unmap.c
index d8fe218..9e7a28f 100644
--- a/src/sg_unmap.c
+++ b/src/sg_unmap.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2016 Douglas Gilbert.
+ * Copyright (c) 2009-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -32,7 +32,7 @@
  * logical blocks.
  */
 
-static const char * version_str = "1.10 20160201";
+static const char * version_str = "1.11 20170917";
 
 
 #define DEF_TIMEOUT_SECS 60
@@ -485,7 +485,7 @@
     }
 
     res = sg_ll_unmap_v2(sg_fd, anchor, grpnum, timeout, param_arr, param_len,
-                         1, verbose);
+                         true, verbose);
     ret = res;
     if (SG_LIB_CAT_NOT_READY == res) {
         pr2serr("UNMAP failed, device not ready\n");
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index e3b0fc6..41da2d3 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -37,7 +37,7 @@
 
 */
 
-static const char * version_str = "1.26 20170911";  /* spc5r16 + sbc4r14 */
+static const char * version_str = "1.26 20170917";  /* spc5r16 + sbc4r14 */
 
 
 /* These structures are duplicates of those of the same name in
@@ -480,7 +480,7 @@
  * passes back resid. Same return values as sg_ll_inquiry() (0 is good). */
 static int
 pt_inquiry(int sg_fd, int evpd, int pg_op, void * resp, int mx_resp_len,
-           int * residp, int noisy, int verbose)
+           int * residp, bool noisy, int verbose)
 {
     int res, ret, k, sense_cat, resid;
     unsigned char inq_cdb[INQUIRY_CMDLEN] = {INQUIRY_CMD, 0, 0, 0, 0, 0};
diff --git a/src/sg_wr_mode.c b/src/sg_wr_mode.c
index 0476648..f3977bf 100644
--- a/src/sg_wr_mode.c
+++ b/src/sg_wr_mode.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2016 Douglas Gilbert.
+ * Copyright (c) 2004-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -27,7 +27,7 @@
  * mode page on the given device.
  */
 
-static const char * version_str = "1.16 20160208";
+static const char * version_str = "1.17 20170917";
 
 #define ME "sg_wr_mode: "
 
@@ -451,11 +451,12 @@
     alloc_len = mode_6 ? SHORT_ALLOC_LEN : MX_ALLOC_LEN;
     if (mode_6)
         res = sg_ll_mode_sense6(sg_fd, dbd, 0 /*current */, pg_code,
-                                sub_pg_code, ref_md, alloc_len, 1, verbose);
+                                sub_pg_code, ref_md, alloc_len, true,
+                                verbose);
      else
         res = sg_ll_mode_sense10(sg_fd, 0 /* llbaa */, dbd, 0 /* current */,
-                                 pg_code, sub_pg_code, ref_md, alloc_len, 1,
-                                 verbose);
+                                 pg_code, sub_pg_code, ref_md, alloc_len,
+                                 true, verbose);
     ret = res;
     if (res) {
         if (SG_LIB_CAT_INVALID_OP == res)
@@ -540,10 +541,10 @@
         memcpy(ref_md + off, read_in, read_in_len);
         if (mode_6)
             res = sg_ll_mode_select6(sg_fd, 1 /* PF */, save, ref_md, md_len,
-                                     1, verbose);
+                                     true, verbose);
         else
             res = sg_ll_mode_select10(sg_fd, 1 /* PF */, save, ref_md,
-                                      md_len, 1, verbose);
+                                      md_len, true, verbose);
         ret = res;
         if (res) {
             sg_get_category_sense_str(res, sizeof(b), b, verbose);
diff --git a/src/sg_write_buffer.c b/src/sg_write_buffer.c
index 17fa485..69ad1d0 100644
--- a/src/sg_write_buffer.c
+++ b/src/sg_write_buffer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2016 Luben Tuikov and Douglas Gilbert.
+ * Copyright (c) 2006-2017 Luben Tuikov and Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -29,7 +29,7 @@
  * This utility issues the SCSI WRITE BUFFER command to the given device.
  */
 
-static const char * version_str = "1.21 20160531";    /* spc5r10 */
+static const char * version_str = "1.22 20170917";    /* spc5r10 */
 
 #define ME "sg_write_buffer: "
 #define DEF_XFER_LEN (8 * 1024 * 1024)
@@ -178,7 +178,8 @@
 static int
 sg_ll_write_buffer_v2(int sg_fd, int mode, int m_specific, int buffer_id,
                       uint32_t buffer_offset, void * paramp,
-                      uint32_t param_len, int to_secs, int noisy, int verbose)
+                      uint32_t param_len, int to_secs, bool noisy,
+                      int verbose)
 {
     int k, res, ret, sense_cat;
     uint8_t wbuf_cdb[WRITE_BUFFER_CMDLEN] =
@@ -508,7 +509,7 @@
                         wb_offset + k, n);
             res = sg_ll_write_buffer_v2(sg_fd, wb_mode, wb_mspec, wb_id,
                                         wb_offset + k, dop + k, n,
-                                        wb_timeout, 1, verbose);
+                                        wb_timeout, true, verbose);
             if (res)
                 break;
         }
@@ -516,7 +517,7 @@
             if (verbose)
                 pr2serr("sending Activate deferred microcode [0xf]\n");
             res = sg_ll_write_buffer_v2(sg_fd, MODE_ACTIVATE_MC, 0, 0, 0,
-                                        NULL, 0, wb_timeout, 1, verbose);
+                                        NULL, 0, wb_timeout, true, verbose);
         }
     } else {
         if (verbose)
@@ -524,7 +525,7 @@
                     "id=%d, offset=%d, len=%d\n", wb_mode, wb_mspec, wb_id,
                     wb_offset, wb_len);
         res = sg_ll_write_buffer_v2(sg_fd, wb_mode, wb_mspec, wb_id,
-                                    wb_offset, dop, wb_len, wb_timeout, 1,
+                                    wb_offset, dop, wb_len, wb_timeout, true,
                                     verbose);
     }
     if (0 != res) {
diff --git a/src/sg_write_long.c b/src/sg_write_long.c
index f5a3229..6429c87 100644
--- a/src/sg_write_long.c
+++ b/src/sg_write_long.c
@@ -1,5 +1,5 @@
 /* A utility program for the Linux OS SCSI subsystem.
- *  Copyright (C) 2004-2016 D. Gilbert
+ *  Copyright (C) 2004-2017 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)
@@ -32,7 +32,7 @@
 #include "sg_cmds_extra.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.12 20160121";
+static const char * version_str = "1.13 20170917";
 
 
 #define MAX_XFER_LEN 10000
@@ -255,11 +255,12 @@
     ten_or = do_16 ? "16" : "10";
     if (do_16)
         res = sg_ll_write_long16(sg_fd, cor_dis, wr_uncor, pblock, llba,
-                                 writeLongBuff, xfer_len, &offset, 1, verbose);
+                                 writeLongBuff, xfer_len, &offset, true,
+                                 verbose);
     else
         res = sg_ll_write_long10(sg_fd, cor_dis, wr_uncor, pblock,
                                  (unsigned int)llba, writeLongBuff, xfer_len,
-                                 &offset, 1, verbose);
+                                 &offset, true, verbose);
     ret = res;
     switch (res) {
     case 0:
diff --git a/src/sg_write_same.c b/src/sg_write_same.c
index 6055b42..cb5d8b8 100644
--- a/src/sg_write_same.c
+++ b/src/sg_write_same.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2016 Douglas Gilbert.
+ * Copyright (c) 2009-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -29,7 +29,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.14 20160531";
+static const char * version_str = "1.15 20170917";
 
 
 #define ME "sg_write_same: "
@@ -267,7 +267,7 @@
     set_scsi_pt_data_out(ptvp, (unsigned char *)dataoutp, op->xfer_len);
     res = do_scsi_pt(ptvp, sg_fd, op->timeout, op->verbose);
     ret = sg_cmds_process_resp(ptvp, "Write same", res, 0, sense_b,
-                               1 /*noisy */, op->verbose, &sense_cat);
+                               true /*noisy */, op->verbose, &sense_cat);
     if (-1 == ret)
         ;
     else if (-2 == ret) {
@@ -496,11 +496,12 @@
         prot_en = 0;
         if (0 == op->xfer_len) {
             res = sg_ll_readcap_16(sg_fd, 0 /* pmi */, 0 /* llba */, resp_buff,
-                                   RCAP16_RESP_LEN, 1, (vb ? (vb - 1): 0));
+                                   RCAP16_RESP_LEN, true, (vb ? (vb - 1): 0));
             if (SG_LIB_CAT_UNIT_ATTENTION == res) {
                 pr2serr("Read capacity(16) unit attention, try again\n");
                 res = sg_ll_readcap_16(sg_fd, 0, 0, resp_buff,
-                                       RCAP16_RESP_LEN, 1, (vb ? (vb - 1): 0));
+                                       RCAP16_RESP_LEN, true,
+                                       (vb ? (vb - 1): 0));
             }
             if (0 == res) {
                 if (vb > 3)
@@ -516,7 +517,7 @@
                     pr2serr("Read capacity(16) not supported, try Read "
                             "capacity(10)\n");
                 res = sg_ll_readcap_10(sg_fd, 0 /* pmi */, 0 /* lba */,
-                                       resp_buff, RCAP10_RESP_LEN, 1,
+                                       resp_buff, RCAP10_RESP_LEN, true,
                                        (vb ? (vb - 1): 0));
                 if (0 == res) {
                     if (vb > 3)
diff --git a/src/sg_write_verify.c b/src/sg_write_verify.c
index 0f94a4c..3f12e1b 100644
--- a/src/sg_write_verify.c
+++ b/src/sg_write_verify.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 Douglas Gilbert
+ * Copyright (c) 2014-2017 Douglas Gilbert
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -35,7 +35,7 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "1.09 20160531";
+static const char * version_str = "1.10 20170917";
 
 
 #define ME "sg_write_verify: "
@@ -119,11 +119,11 @@
  * various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
 run_scsi_transaction(int sg_fd, const unsigned char *cdbp, int cdb_len,
-                     unsigned char *dop, int do_len, int timeout, int verbose)
+                     unsigned char *dop, int do_len, int timeout,
+                     bool noisy, int verbose)
 {
     int res, k, sense_cat, ret;
     unsigned char sense_b[SENSE_BUFF_LEN];
-    int noisy = 1;
     struct sg_pt_base * ptvp;
     char b[32];
 
@@ -188,7 +188,8 @@
 static int
 sg_ll_write_verify10(int sg_fd, int wrprotect, int dpo, int bytchk,
                      unsigned int lba, int num_lb, int group,
-                     unsigned char *dop, int do_len, int timeout, int verbose)
+                     unsigned char *dop, int do_len, int timeout,
+                     bool noisy, int verbose)
 {
     int ret;
     unsigned char wv_cdb[WRITE_VERIFY10_CMDLEN];
@@ -205,7 +206,7 @@
     wv_cdb[6] = group & 0x1f;
     sg_put_unaligned_be16((uint16_t)num_lb, wv_cdb + 7);
     ret = run_scsi_transaction(sg_fd, wv_cdb, sizeof(wv_cdb), dop, do_len,
-                               timeout, verbose);
+                               timeout, noisy, verbose);
     return ret;
 }
 
@@ -214,7 +215,7 @@
 static int
 sg_ll_write_verify16(int sg_fd, int wrprotect, int dpo, int bytchk,
                      uint64_t llba, int num_lb, int group, unsigned char *dop,
-                     int do_len, int timeout, int verbose)
+                     int do_len, int timeout, bool noisy, int verbose)
 {
     int ret;
     unsigned char wv_cdb[WRITE_VERIFY16_CMDLEN];
@@ -232,7 +233,7 @@
     sg_put_unaligned_be32((uint32_t)num_lb, wv_cdb + 10);
     wv_cdb[14] = group & 0x1f;
     ret = run_scsi_transaction(sg_fd, wv_cdb, sizeof(wv_cdb), dop, do_len,
-                               timeout, verbose);
+                               timeout, noisy, verbose);
     return ret;
 }
 
@@ -553,11 +554,12 @@
         if (do_16)
             res = sg_ll_write_verify16(sg_fd, wrprotect, dpo, bytchk, llba,
                                        snum_lb, group, wvb, ilen, timeout,
-                                       verbose);
+                                       verbose > 0, verbose);
         else
             res = sg_ll_write_verify10(sg_fd, wrprotect, dpo, bytchk,
                                        (unsigned int)llba, snum_lb, group,
-                                       wvb, ilen, timeout, verbose);
+                                       wvb, ilen, timeout, verbose > 0,
+                                       verbose);
         ret = res;
         if (repeat && (0 == ret))
             tnum_lb_wr += snum_lb;
diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c
index 571f9da..da707ae 100644
--- a/src/sg_xcopy.c
+++ b/src/sg_xcopy.c
@@ -1,7 +1,7 @@
 /* A utility program for copying files. Similar to 'dd' but using
  * the 'Extended Copy' command.
  *
- *  Copyright (c) 2011-2016 Hannes Reinecke, SUSE Labs
+ *  Copyright (c) 2011-2017 Hannes Reinecke, SUSE Labs
  *
  *  Largely taken from 'sg_dd', which has the
  *
@@ -64,13 +64,13 @@
 #include "sg_unaligned.h"
 #include "sg_pr2serr.h"
 
-static const char * version_str = "0.54 20160423";
+static const char * version_str = "0.56 20170917";
 
 #define ME "sg_xcopy: "
 
 #define STR_SZ 1024
 #define INOUTF_SZ 512
-#define EBUFF_SZ 512
+#define EBUFF_SZ 1024
 
 #define DEF_BLOCK_SIZE 512
 #define DEF_BLOCKS_PER_TRANSFER 128
@@ -628,7 +628,7 @@
     /* set noisy so if a UA happens it will be printed to stderr */
     res = sg_ll_3party_copy_out(sg_fd, SA_XCOPY_LID1, list_id,
                                 DEF_GROUP_NUM, DEF_3PC_OUT_TIMEOUT,
-                                xcopyBuff, desc_offset, 1, verb);
+                                xcopyBuff, desc_offset, true, verb);
     if (res) {
         sg_get_category_sense_str(res, sizeof(b), b, verb);
         pr2serr("Xcopy(LID1): %s\n", b);
@@ -648,7 +648,7 @@
 
     verb = (verbose ? verbose - 1: 0);
     res = sg_ll_readcap_10(xfp->sg_fd, 0, 0, rcBuff,
-                           READ_CAP_REPLY_LEN, 1, verb);
+                           READ_CAP_REPLY_LEN, true, verb);
     if (0 != res) {
         sg_get_category_sense_str(res, sizeof(b), b, verb);
         pr2serr("Read capacity(10): %s\n", b);
@@ -660,7 +660,7 @@
         uint64_t ls;
 
         res = sg_ll_readcap_16(xfp->sg_fd, 0, 0, rcBuff,
-                               RCAP16_REPLY_LEN, 1, verb);
+                               RCAP16_REPLY_LEN, true, verb);
         if (0 != res) {
             sg_get_category_sense_str(res, sizeof(b), b, verb);
             pr2serr("Read capacity(16): %s\n", b);
@@ -702,7 +702,7 @@
             ftype |= FT_ST;
     }
     res = sg_ll_receive_copy_results(xfp->sg_fd, SA_COPY_OP_PARAMS, 0, rcBuff,
-                                     rcBuffLen, 1, verb);
+                                     rcBuffLen, true, verb);
     if (0 != res) {
         sg_get_category_sense_str(res, sizeof(b), b, verb);
         pr2serr("Xcopy operating parameters: %s\n", b);
@@ -1013,7 +1013,7 @@
 
     verb = (verbose ? verbose - 1: 0);
     memset(rcBuff, 0xff, len);
-    res = sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rcBuff, 4, 1, verb);
+    res = sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rcBuff, 4, true, verb);
     if (0 != res) {
         if (SG_LIB_CAT_ILLEGAL_REQ == res)
             pr2serr("Device identification VPD page not found\n");
@@ -1028,7 +1028,7 @@
         return SG_LIB_CAT_MALFORMED;
     }
     len = sg_get_unaligned_be16(rcBuff + 2) + 4;
-    res = sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rcBuff, len, 1, verb);
+    res = sg_ll_inquiry(sg_fd, 0, 1, VPD_DEVICE_ID, rcBuff, len, true, verb);
     if (0 != res) {
         sg_get_category_sense_str(res, sizeof(b), b, verbose);
         pr2serr("VPD inquiry (Device ID): %s\n", b);
diff --git a/src/sg_zone.c b/src/sg_zone.c
index cbf3e77..86c55dd 100644
--- a/src/sg_zone.c
+++ b/src/sg_zone.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 Douglas Gilbert.
+ * Copyright (c) 2014-2017 Douglas Gilbert.
  * All rights reserved.
  * Use of this source code is governed by a BSD-style
  * license that can be found in the BSD_LICENSE file.
@@ -32,7 +32,7 @@
  * to the given SCSI device. Based on zbc-r04c.pdf .
  */
 
-static const char * version_str = "1.03 20160528";
+static const char * version_str = "1.04 20170917";
 
 #define SG_ZONING_OUT_CMDLEN 16
 #define CLOSE_ZONE_SA 0x1
@@ -90,7 +90,7 @@
 /* Invokes the zone out command indicated by 'sa' (ZBC).  Return of 0
  * -> success, various SG_LIB_CAT_* positive values or -1 -> other errors */
 static int
-sg_ll_zone_out(int sg_fd, int sa, uint64_t zid, int all, int noisy,
+sg_ll_zone_out(int sg_fd, int sa, uint64_t zid, int all, bool noisy,
                int verbose)
 {
     int k, ret, res, sense_cat;
@@ -243,7 +243,7 @@
         return SG_LIB_FILE_ERROR;
     }
 
-    res = sg_ll_zone_out(sg_fd, sa, zid, all, 1, verbose);
+    res = sg_ll_zone_out(sg_fd, sa, zid, all, true, verbose);
     ret = res;
     if (res) {
         if (SG_LIB_CAT_INVALID_OP == res)
diff --git a/src/sgm_dd.c b/src/sgm_dd.c
index e825967..a86d140 100644
--- a/src/sgm_dd.c
+++ b/src/sgm_dd.c
@@ -1,7 +1,7 @@
 /* A utility program for copying files. Specialised for "files" that
  * represent devices that understand the SCSI command set.
  *
- * Copyright (C) 1999 - 2016 D. Gilbert and P. Allworth
+ * Copyright (C) 1999 - 2017 D. Gilbert and P. Allworth
  * 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)
@@ -64,7 +64,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "1.46 20160518";
+static const char * version_str = "1.47 20170917";
 
 #define DEF_BLOCK_SIZE 512
 #define DEF_BLOCKS_PER_TRANSFER 128
@@ -309,7 +309,7 @@
     int verb;
 
     verb = (verbose ? verbose - 1: 0);
-    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, 0,
+    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, false,
                            verb);
     if (0 != res)
         return res;
@@ -317,7 +317,7 @@
     if ((0xff == rcBuff[0]) && (0xff == rcBuff[1]) && (0xff == rcBuff[2]) &&
         (0xff == rcBuff[3])) {
 
-        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, 0,
+        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, false,
                                verb);
         if (0 != res)
             return res;
@@ -1332,10 +1332,10 @@
     if (do_sync) {
         if (FT_SG == out_type) {
             pr2serr(">> Synchronizing cache on %s\n", outf);
-            res = sg_ll_sync_cache_10(outfd, 0, 0, 0, 0, 0, 0, 0);
+            res = sg_ll_sync_cache_10(outfd, 0, 0, 0, 0, 0, false, 0);
             if (SG_LIB_CAT_UNIT_ATTENTION == res) {
                 pr2serr("Unit attention(out), continuing\n");
-                res = sg_ll_sync_cache_10(outfd, 0, 0, 0, 0, 0, 0, 0);
+                res = sg_ll_sync_cache_10(outfd, 0, 0, 0, 0, 0, false, 0);
             }
             if (0 != res) {
                 sg_get_category_sense_str(res, sizeof(b), b, verbose);
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index e0a2deb..b6c94ea 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -1,7 +1,7 @@
 /* A utility program for copying files. Specialised for "files" that
  * represent devices that understand the SCSI command set.
  *
- * Copyright (C) 1999 - 2016 D. Gilbert and P. Allworth
+ * Copyright (C) 1999 - 2017 D. Gilbert and P. Allworth
  * 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)
@@ -58,7 +58,7 @@
 #include "sg_pr2serr.h"
 
 
-static const char * version_str = "5.53 20160518";
+static const char * version_str = "5.54 20170917";
 
 #define DEF_BLOCK_SIZE 512
 #define DEF_BLOCKS_PER_TRANSFER 128
@@ -402,14 +402,15 @@
     int res;
     unsigned char rcBuff[RCAP16_REPLY_LEN];
 
-    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, 0, 0);
+    res = sg_ll_readcap_10(sg_fd, 0, 0, rcBuff, READ_CAP_REPLY_LEN, false, 0);
     if (0 != res)
         return res;
 
     if ((0xff == rcBuff[0]) && (0xff == rcBuff[1]) && (0xff == rcBuff[2]) &&
         (0xff == rcBuff[3])) {
 
-        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, 0, 0);
+        res = sg_ll_readcap_16(sg_fd, 0, 0, rcBuff, RCAP16_REPLY_LEN, false,
+                               0);
         if (0 != res)
             return res;
         *num_sect = sg_get_unaligned_be64(rcBuff + 0) + 1;
@@ -1605,10 +1606,11 @@
     if (do_sync) {
         if (FT_SG == rcoll.out_type) {
             pr2serr(">> Synchronizing cache on %s\n", outf);
-            res = sg_ll_sync_cache_10(rcoll.outfd, 0, 0, 0, 0, 0, 0, 0);
+            res = sg_ll_sync_cache_10(rcoll.outfd, 0, 0, 0, 0, 0, false, 0);
             if (SG_LIB_CAT_UNIT_ATTENTION == res) {
                 pr2serr("Unit attention(out), continuing\n");
-                res = sg_ll_sync_cache_10(rcoll.outfd, 0, 0, 0, 0, 0, 0, 0);
+                res = sg_ll_sync_cache_10(rcoll.outfd, 0, 0, 0, 0, 0, false,
+                                          0);
             }
             if (0 != res)
                 pr2serr("Unable to synchronize cache\n");