]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: skip '/dev/' prefix for persistent discovery controllers
authorHannes Reinecke <hare@suse.de>
Thu, 12 Aug 2021 08:19:53 +0000 (10:19 +0200)
committerKeith Busch <kbusch@kernel.org>
Thu, 12 Aug 2021 15:47:09 +0000 (09:47 -0600)
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 <hare@suse.de>
fabrics.c

index 258da50cc8a8578a5bdded2ebd939bb643782743..fb55e331a9a5446f6ba560552613c2aaae80ac15 100644 (file)
--- 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);