Skip to content

Commit

Permalink
libzfs: Auto prepend /dev/ in zpool_find_vdev
Browse files Browse the repository at this point in the history
Restores functionality that has been in FreeBSD since 2007.

Signed-off-by: Ryan Moeller <[email protected]>
  • Loading branch information
Ryan Moeller authored and Ryan Moeller committed Mar 8, 2022
1 parent 203a43c commit 9d76c7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,7 @@ nvlist_t *
zpool_find_vdev(zpool_handle_t *zhp, const char *path, boolean_t *avail_spare,
boolean_t *l2cache, boolean_t *log)
{
char buf[MAXPATHLEN];
char *end;
nvlist_t *nvroot, *search, *ret;
uint64_t guid;
Expand All @@ -2925,6 +2926,9 @@ zpool_find_vdev(zpool_handle_t *zhp, const char *path, boolean_t *avail_spare,
fnvlist_add_uint64(search, ZPOOL_CONFIG_GUID, guid);
} else if (zpool_vdev_is_interior(path)) {
fnvlist_add_string(search, ZPOOL_CONFIG_TYPE, path);
} else if (path[0] != '/' &&
zfs_resolve_shortname(path, buf, sizeof (buf)) == 0) {
fnvlist_add_string(search, ZPOOL_CONFIG_PATH, buf);
} else {
fnvlist_add_string(search, ZPOOL_CONFIG_PATH, path);
}
Expand Down

0 comments on commit 9d76c7b

Please sign in to comment.