summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-05-25 14:52:56 -0700
committerBrian Behlendorf <[email protected]>2012-06-01 08:55:24 -0700
commitb04c9fc009ca0a0cabb7550625ff273b9edd9729 (patch)
treec62c81aa6422d44d7cf0794a9d3dd1b1ee8768e9 /lib
parent821b683436423593a1f3ee597f40a61bd4569bdd (diff)
Add /dev/mapper/ to search path
When creating pools short device names may be used when those devices appear in certain well known locations under /dev/. This change adds /dev/mapper/ to that list. Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_util.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
index 3983f5c01..982a6f05f 100644
--- a/lib/libzfs/libzfs_util.c
+++ b/lib/libzfs/libzfs_util.c
@@ -824,14 +824,26 @@ zfs_resolve_shortname(const char *name, char *path, size_t pathlen)
char dirs[6][9] = {"by-id", "by-label", "by-path", "by-uuid", "zpool",
"by-vdev"};
+ /* /dev/ */
(void) snprintf(path, pathlen, "%s/%s", DISK_ROOT, name);
err = access(path, F_OK);
+ if (err == 0)
+ return (err);
+
+ /* /dev/mapper/ */
+ (void) snprintf(path, pathlen, "%s/mapper/%s", DISK_ROOT, name);
+ err = access(path, F_OK);
+ if (err == 0)
+ return (err);
+
+ /* /dev/disk/<dirs>/ */
for (i = 0; i < 6 && err < 0; i++) {
(void) snprintf(path, pathlen, "%s/%s/%s",
UDISK_ROOT, dirs[i], name);
err = access(path, F_OK);
}
- return err;
+
+ return (err);
}
/*