Skip to content

Commit

Permalink
nvme: fix verbose logging for certain commands
Browse files Browse the repository at this point in the history
Verbose logging for certain nvme commands like id-ctrl, id-ns,
smart-log, sanitize-log, etc. does not print anything additional
or verbose compared to the regular output. These commands already
implement a human-readable option which works fine, but it is the
verbose option that is broken. So fix the verbose option here to
ensure it is on par with the human-readable option. Later if
required, we can eliminate any one of these options for these
commands to avoid redundancy.

Signed-off-by: Martin George <[email protected]>
  • Loading branch information
martin-gpy committed Jul 8, 2024
1 parent 24a6bfd commit 9c4b119
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug
if (cfg.raw_binary)
flags = BINARY;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

if (cfg.fahrenheit)
Expand Down Expand Up @@ -1091,7 +1091,7 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl
if (cfg.raw_binary)
flags = BINARY;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

list_head_init(&log_pages);
Expand Down Expand Up @@ -2432,7 +2432,7 @@ static int sanitize_log(int argc, char **argv, struct command *command, struct p
if (cfg.raw_binary)
flags = BINARY;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

sanitize_log = nvme_alloc(sizeof(*sanitize_log));
Expand Down Expand Up @@ -2481,7 +2481,7 @@ static int get_fid_support_effects_log(int argc, char **argv, struct command *cm
return err;
}

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

fid_support_log = nvme_alloc(sizeof(*fid_support_log));
Expand Down Expand Up @@ -2530,7 +2530,7 @@ static int get_mi_cmd_support_effects_log(int argc, char **argv, struct command
return err;
}

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

mi_cmd_support_log = nvme_alloc(sizeof(*mi_cmd_support_log));
Expand Down Expand Up @@ -3455,7 +3455,7 @@ int __id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin,
if (cfg.vendor_specific)
flags |= VS;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

ctrl = nvme_alloc(sizeof(*ctrl));
Expand Down Expand Up @@ -3775,7 +3775,7 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug
if (cfg.vendor_specific)
flags |= VS;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

if (!cfg.namespace_id) {
Expand Down Expand Up @@ -3847,7 +3847,7 @@ static int cmd_set_independent_id_ns(int argc, char **argv, struct command *cmd,
if (cfg.raw_binary)
flags = BINARY;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

if (!cfg.namespace_id) {
Expand Down Expand Up @@ -4001,7 +4001,7 @@ static int id_uuid(int argc, char **argv, struct command *cmd, struct plugin *pl
if (cfg.raw_binary)
flags = BINARY;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

uuid_list = nvme_alloc(sizeof(*uuid_list));
Expand Down Expand Up @@ -4241,7 +4241,7 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct
return err;
}

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

caps = nvme_alloc(sizeof(*caps));
Expand Down Expand Up @@ -5440,7 +5440,7 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu
return err;
}

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

bar = mmap_registers(dev, false);
Expand Down Expand Up @@ -5716,7 +5716,7 @@ static int get_register(int argc, char **argv, struct command *cmd, struct plugi
return err;
}

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;

bar = mmap_registers(dev, false);
Expand Down Expand Up @@ -8509,7 +8509,7 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin
if (err)
return err;

if (cfg.human_readable)
if (cfg.human_readable || argconfig_parse_seen(opts, "verbose"))
flags |= VERBOSE;
if (cfg.raw_binary)
flags = BINARY;
Expand Down

0 comments on commit 9c4b119

Please sign in to comment.