From: jsmart2021@gmail.com (James Smart) Date: Fri, 3 May 2019 17:04:52 -0700 Subject: [PATCH nvme-cli rfc 1/5] fabrics: ignore arguments that pass in "none" In-Reply-To: <20190504000456.3888-1-jsmart2021@gmail.com> References: <20190504000456.3888-1-jsmart2021@gmail.com> Message-ID: <20190504000456.3888-2-jsmart2021@gmail.com> As we want to support discovery uevents over different transports, we want to allow the kernel to provide missing information in the form of none and have nvme-cli properly ignore it. One example is the host_traddr. If it is not set (which means that the default route determined the host address) we will want to do the same for newly discovered controllers. So allow users to pass 'none' arguments as well. Signed-off-by: Sagi Grimberg Signed-off-by: James Smart --- Patch originated from Sagi in an RFC Fixed typo in Sagi's patch on cfg.hostid --- fabrics.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fabrics.c b/fabrics.c index 511de06..c6ff734 100644 --- a/fabrics.c +++ b/fabrics.c @@ -565,7 +565,7 @@ add_argument(char **argstr, int *max_len, char *arg_str, char *arg) { int len; - if (arg) { + if (arg && strcmp(arg, "none")) { len = snprintf(*argstr, *max_len, ",%s=%s", arg_str, arg); if (len < 0) return -EINVAL; @@ -658,14 +658,14 @@ retry: return -EINVAL; p += len; - if (cfg.hostnqn) { + if (cfg.hostnqn && strcmp(cfg.hostnqn, "none")) { len = sprintf(p, ",hostnqn=%s", cfg.hostnqn); if (len < 0) return -EINVAL; p += len; } - if (cfg.hostid) { + if (cfg.hostid && strcmp(cfg.hostid, "none")) { len = sprintf(p, ",hostid=%s", cfg.hostid); if (len < 0) return -EINVAL; @@ -700,7 +700,7 @@ retry: p += len; } - if (cfg.host_traddr) { + if (cfg.host_traddr && strcmp(cfg.host_traddr, "none")) { len = sprintf(p, ",host_traddr=%s", cfg.host_traddr); if (len < 0) return -EINVAL; -- 2.13.7