From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH] nvme-cli: convert iekey into a no_argument parameter
Date: Sat, 27 Jan 2018 02:49:42 +0900 [thread overview]
Message-ID: <1516988982-27969-1-git-send-email-minwoo.im.dev@gmail.com> (raw)
IEKEY(Ignore Existing Key) option is used widely in Reservation Acquire,
Reservation Register, and Reservation Release in a type of bool(1-bit).
Only resv_release() uses iekey field as a required_argument parameter.
It seems unnecessary because it will not be checked if this parameter
is given or not by a following condition because default value is 0.
if (cfg.iekey > 1)
So remove unnecessary if-statement and convert this field to a
no_argument type option.
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
nvme.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/nvme.c b/nvme.c
index aa2b8ec..f069622 100644
--- a/nvme.c
+++ b/nvme.c
@@ -3118,7 +3118,7 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi
{"crkey", 'c', "NUM", CFG_LONG_SUFFIX, &cfg.crkey, required_argument, crkey},
{"rtype", 't', "NUM", CFG_BYTE, &cfg.rtype, required_argument, rtype},
{"rrela", 'a', "NUM", CFG_BYTE, &cfg.rrela, required_argument, rrela},
- {"iekey", 'i', "NUM", CFG_BYTE, &cfg.iekey, required_argument, iekey},
+ {"iekey", 'i', "", CFG_NONE, &cfg.iekey, no_argument, iekey},
{NULL}
};
@@ -3128,10 +3128,6 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi
if (!cfg.namespace_id)
cfg.namespace_id = get_nsid(fd);
- if (cfg.iekey > 1) {
- fprintf(stderr, "invalid iekey:%d\n", cfg.iekey);
- return EINVAL;
- }
if (cfg.rrela > 7) {
fprintf(stderr, "invalid rrela:%d\n", cfg.rrela);
return EINVAL;
--
2.7.4
reply other threads:[~2018-01-26 17:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516988982-27969-1-git-send-email-minwoo.im.dev@gmail.com \
--to=minwoo.im.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).