From mboxrd@z Thu Jan 1 00:00:00 1970 From: jsmart2021@gmail.com (James Smart) Date: Fri, 19 Jul 2019 15:52:56 -0700 Subject: [PATCH v2 01/10] nvme-cli: ignore arguments that pass in "none" In-Reply-To: <20190719225305.11397-1-jsmart2021@gmail.com> References: <20190719225305.11397-1-jsmart2021@gmail.com> Message-ID: <20190719225305.11397-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. Example: nvme connect-all ... --hostnqn=none --hostid=none --host_traddr=none Signed-off-by: Sagi Grimberg Signed-off-by: James Smart Reviewed-by: Hannes Reinecke Reviewed-by: Minwoo Im --- fabrics.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fabrics.c b/fabrics.c index 32c3a9c..5757aaf 100644 --- a/fabrics.c +++ b/fabrics.c @@ -578,7 +578,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; @@ -671,14 +671,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; @@ -713,7 +713,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