From: Hannes Reinecke Date: Thu, 12 Aug 2021 08:19:53 +0000 (+0200) Subject: fabrics: skip '/dev/' prefix for persistent discovery controllers X-Git-Tag: v2.0-rc0~103 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6324f8df43906298ac93fb90a19d6ec25c508471;p=users%2Fsagi%2Fnvme-cli.git fabrics: skip '/dev/' prefix for persistent discovery controllers When calling 'nvme discover --device' one has to remember to strip the '/dev/' prefix from the nvme controller device name, which is quite cumbersome and pointless, as we might as well do it internally. So be a bit more lenient and accept full device node names on discover. Signed-off-by: Hannes Reinecke --- diff --git a/fabrics.c b/fabrics.c index 258da50c..fb55e331 100644 --- a/fabrics.c +++ b/fabrics.c @@ -439,8 +439,12 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) ret = ENOMEM; goto out_free; } - if (device && !strcmp(device, "none")) - device = NULL; + if (device) { + if (!strcmp(device, "none")) + device = NULL; + else if (!strncmp(device, "/dev/", 5)) + device += 5; + } if (!device && !transport && !traddr) { ret = discover_from_conf_file(h, desc, connect, &cfg);