aboutsummaryrefslogtreecommitdiff
path: root/src/sg_luns.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-06-29 09:46:13 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-06-29 09:46:13 +0000
commit3ef8550a26c95c97f9fdc4ef249a5767fd573e7a (patch)
treeae1e82f2ff36a06a02184a3eeb19cffe217fcb2f /src/sg_luns.c
parent11f6f1f439415e57696f473b1475f190018741c7 (diff)
downloadsg3_utils-3ef8550a26c95c97f9fdc4ef249a5767fd573e7a.tar.gz
sg_opcode: support MLU, Multiple Logical Units (18-045r1); sg_lib: sg_simple_inquiry_pt(); ./configure: option --enable-debug added for testing
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@779 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_luns.c')
-rw-r--r--src/sg_luns.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/sg_luns.c b/src/sg_luns.c
index e73d47e6..904b2cef 100644
--- a/src/sg_luns.c
+++ b/src/sg_luns.c
@@ -32,7 +32,7 @@
* and decodes the response.
*/
-static const char * version_str = "1.41 20180522";
+static const char * version_str = "1.42 20180626";
#define MAX_RLUNS_BUFF_LEN (1024 * 1024)
#define DEF_RLUNS_BUFF_LEN (1024 * 8)
@@ -368,6 +368,8 @@ main(int argc, char * argv[])
bool test_linux_out = false;
#endif
bool trunc;
+ bool verbose_given = false;
+ bool version_given = false;
int sg_fd, k, m, off, res, c, list_len, len_cap, luns;
int decode_arg = 0;
int do_hex = 0;
@@ -446,11 +448,12 @@ main(int argc, char * argv[])
test_arg = optarg;
break;
case 'v':
+ verbose_given = true;
++verbose;
break;
case 'V':
- pr2serr("version: %s\n", version_str);
- return 0;
+ version_given = true;
+ break;
default:
pr2serr("unrecognised option code 0x%x ??\n", c);
usage();
@@ -469,6 +472,26 @@ main(int argc, char * argv[])
return SG_LIB_SYNTAX_ERROR;
}
}
+#ifdef DEBUG
+ pr2serr("In DEBUG mode, ");
+ if (verbose_given && version_given) {
+ pr2serr("but override: '-vV' given, zero verbose and continue\n");
+ verbose_given = false;
+ version_given = false;
+ verbose = 0;
+ } else if (! verbose_given) {
+ pr2serr("set '-vv'\n");
+ verbose = 2;
+ } else
+ pr2serr("keep verbose=%d\n", verbose);
+#else
+ if (verbose_given && version_given)
+ pr2serr("Not in DEBUG mode, so '-vV' has no special action\n");
+#endif
+ if (version_given) {
+ pr2serr("version: %s\n", version_str);
+ return 0;
+ }
if (test_arg) {
memset(lun_arr, 0, sizeof(lun_arr));