From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH V6 2/6] fabrics: Do not return in the middle of the subcommand
Date: Wed, 5 Jun 2019 00:40:30 +0900 [thread overview]
Message-ID: <20190604154034.23386-3-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20190604154034.23386-1-minwoo.im.dev@gmail.com>
This patch also makes fabrics module to not return the internal error
status in the middle of the subcommands to support uniformed mapped
error value which will be introduced in the next patches.
Cc: Keith Busch <kbusch at kernel.org>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Cc: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Minwoo Im <minwoo.im.dev at gmail.com>
---
fabrics.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index 573a6ef..7be7f59 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -984,20 +984,23 @@ int discover(const char *desc, int argc, char **argv, bool connect)
ret = argconfig_parse(argc, argv, desc, command_line_options, &cfg,
sizeof(cfg));
if (ret)
- return ret;
+ goto out;
cfg.nqn = NVME_DISC_SUBSYS_NAME;
if (!cfg.transport && !cfg.traddr) {
- return discover_from_conf_file(desc, argstr,
+ ret = discover_from_conf_file(desc, argstr,
command_line_options, connect);
} else {
ret = build_options(argstr, BUF_SIZE);
if (ret)
- return ret;
+ goto out;
- return do_discover(argstr, connect);
+ ret = do_discover(argstr, connect);
}
+
+out:
+ return ret;
}
int connect(const char *desc, int argc, char **argv)
@@ -1029,21 +1032,23 @@ int connect(const char *desc, int argc, char **argv)
ret = argconfig_parse(argc, argv, desc, command_line_options, &cfg,
sizeof(cfg));
if (ret)
- return ret;
+ goto out;
ret = build_options(argstr, BUF_SIZE);
if (ret)
- return ret;
+ goto out;
if (!cfg.nqn) {
fprintf(stderr, "need a -n argument\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
instance = add_ctrl(argstr);
if (instance < 0)
- return instance;
- return 0;
+ ret = instance;
+out:
+ return ret;
}
static int scan_sys_nvme_filter(const struct dirent *d)
@@ -1148,11 +1153,12 @@ int disconnect(const char *desc, int argc, char **argv)
ret = argconfig_parse(argc, argv, desc, command_line_options, &cfg,
sizeof(cfg));
if (ret)
- return ret;
+ goto out;
if (!cfg.nqn && !cfg.device) {
fprintf(stderr, "need a -n or -d argument\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out;
}
if (cfg.nqn) {
@@ -1174,6 +1180,7 @@ int disconnect(const char *desc, int argc, char **argv)
cfg.device);
}
+out:
return ret;
}
@@ -1188,7 +1195,7 @@ int disconnect_all(const char *desc, int argc, char **argv)
ret = argconfig_parse(argc, argv, desc, command_line_options, &cfg,
sizeof(cfg));
if (ret)
- return ret;
+ goto out;
slist = get_subsys_list(&subcnt, NULL, NVME_NSID_ALL);
for (i = 0; i < subcnt; i++) {
--
2.21.0
next prev parent reply other threads:[~2019-06-04 15:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 15:40 [PATCH V6 0/6] nvme-cli: Introduce nvme-status mapping with errno Minwoo Im
2019-06-04 15:40 ` [PATCH V6 1/6] nvme: Do not return in the middle of the subcommand Minwoo Im
2019-06-08 19:16 ` Chaitanya Kulkarni
2019-06-08 19:48 ` Minwoo Im
2019-06-08 20:00 ` Chaitanya Kulkarni
2019-06-04 15:40 ` Minwoo Im [this message]
2019-06-08 19:19 ` [PATCH V6 2/6] fabrics: " Chaitanya Kulkarni
2019-06-04 15:40 ` [PATCH V6 3/6] nvme: Return negative error value for internal errors Minwoo Im
2019-06-04 15:40 ` [PATCH V6 4/6] nvme-status: Introduce nvme status module to map errno Minwoo Im
2019-06-04 15:40 ` [PATCH V6 5/6] nvme: Return errno mapped for nvme error status Minwoo Im
2019-06-04 15:40 ` [PATCH V6 6/6] fabrics: Return errno mapped for fabrics " Minwoo Im
2019-06-08 19:36 ` Chaitanya Kulkarni
2019-06-08 20:01 ` Minwoo Im
2019-06-08 20:13 ` Chaitanya Kulkarni
2019-06-10 9:17 ` Minwoo Im
2019-06-10 9:26 ` Minwoo Im
2019-06-11 0:01 ` Sagi Grimberg
2019-06-11 5:13 ` Minwoo Im
2019-06-11 17:36 ` Sagi Grimberg
2019-06-12 12:26 ` Minwoo Im
2019-06-17 17:39 ` Sagi Grimberg
2019-06-18 4:17 ` Minwoo Im
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=20190604154034.23386-3-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).