From: Gollu Appalanaidu Date: Sun, 4 Apr 2021 05:44:18 +0000 (+0530) Subject: nvme: fix human-readable format option in primary ctrl caps X-Git-Tag: v1.14~19 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=068363dd335d0932108b7797aa3457409ada0a7f;p=users%2Fsagi%2Fnvme-cli.git nvme: fix human-readable format option in primary ctrl caps In Primary controller caps though it supports human readable format, currently there is no option to view it, adding human-readable foramt option. Signed-off-by: Gollu Appalanaidu --- diff --git a/nvme.c b/nvme.c index e5a8925e..e4fa8cd7 100644 --- a/nvme.c +++ b/nvme.c @@ -2426,6 +2426,7 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct const char *desc = "Send an Identify Primary Controller Capabilities "\ "command to the given device and report the information in a "\ "decoded format (default), json or binary."; + const char *human_readable = "show info in readable format"; struct nvme_primary_ctrl_caps caps; int err, fd; @@ -2433,6 +2434,7 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct struct config { char *output_format; + int human_readable; }; struct config cfg = { @@ -2440,7 +2442,8 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct }; OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), + OPT_FMT("output-format", 'o', &cfg.output_format, output_format), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable), OPT_END() }; @@ -2451,6 +2454,8 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct err = flags = validate_output_format(cfg.output_format); if (flags < 0) goto close_fd; + if (cfg.human_readable) + flags |= VERBOSE; err = nvme_identify_primary_ctrl_caps(fd, &caps); if (!err)