Skip to content

Commit f0ff03c

Browse files
committed
nvme: track verbose level
The command line option parser is able to count how many times 'verbose' is provided by the user. This increases the verbosity level. Use this for mapping it to the correct log_level. Signed-off-by: Daniel Wagner <dwagner@suse.de>
1 parent a50c569 commit f0ff03c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

nvme.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct passthru_config {
110110

111111
#define NVME_ARGS(n, ...) \
112112
struct argconfig_commandline_options n[] = { \
113-
OPT_FLAG("verbose", 'v', NULL, verbose), \
113+
OPT_INCR("verbose", 'v', &verbose_level, verbose), \
114114
OPT_FMT("output-format", 'o', &output_format_val, output_format), \
115115
##__VA_ARGS__, \
116116
OPT_END() \
@@ -188,6 +188,7 @@ static const char dash[51] = {[0 ... 49] = '=', '\0'};
188188
static const char space[51] = {[0 ... 49] = ' ', '\0'};
189189

190190
static char *output_format_val = "normal";
191+
int verbose_level;
191192

192193
static void *mmap_registers(nvme_root_t r, struct nvme_dev *dev);
193194

@@ -3223,7 +3224,7 @@ static int list_subsys(int argc, char **argv, struct command *cmd,
32233224
if (argconfig_parse_seen(opts, "verbose"))
32243225
flags |= VERBOSE;
32253226

3226-
log_level = map_log_level(!!(flags & VERBOSE), false);
3227+
log_level = map_log_level(verbose_level, false);
32273228

32283229
r = nvme_create_root(stderr, log_level);
32293230
if (!r) {
@@ -3282,7 +3283,7 @@ static int list(int argc, char **argv, struct command *cmd, struct plugin *plugi
32823283
if (argconfig_parse_seen(opts, "verbose"))
32833284
flags |= VERBOSE;
32843285

3285-
log_level = map_log_level(!!(flags & VERBOSE), false);
3286+
log_level = map_log_level(verbose_level, false);
32863287

32873288
r = nvme_create_root(stderr, log_level);
32883289
if (!r) {
@@ -8865,7 +8866,7 @@ static int show_topology_cmd(int argc, char **argv, struct command *command, str
88658866
return -EINVAL;
88668867
}
88678868

8868-
log_level = map_log_level(!!(flags & VERBOSE), false);
8869+
log_level = map_log_level(verbose_level, false);
88698870

88708871
r = nvme_create_root(stderr, log_level);
88718872
if (!r) {

0 commit comments

Comments
 (0)