Eliminate illumos whole disk special case when searching for a ZFS vdev

This special case prevented locating vdevs which start with c[0-9] e.g.
gptid/c6cde092-504b-11e4-ba52-c45444453598 hence it was impossible to
online a vdev via its path.

Submitted by:	Peter Xu <xzpeter@gmail.com>
MFC after:	2 weeks
Sponsored by:	Multiplay
This commit is contained in:
Steven Hartland 2015-01-16 10:44:39 +00:00
parent 29e0d65d7a
commit 828a2d9e5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277239

View File

@ -1916,6 +1916,7 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func)
} }
} }
#ifdef illumos
/* /*
* This provides a very minimal check whether a given string is likely a * This provides a very minimal check whether a given string is likely a
* c#t#d# style string. Users of this are expected to do their own * c#t#d# style string. Users of this are expected to do their own
@ -1947,6 +1948,7 @@ ctd_check_path(char *str) {
} }
return (CTD_CHECK(str)); return (CTD_CHECK(str));
} }
#endif
/* /*
* Find a vdev that matches the search criteria specified. We use the * Find a vdev that matches the search criteria specified. We use the
@ -2002,6 +2004,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
* *
* Otherwise, all other searches are simple string compares. * Otherwise, all other searches are simple string compares.
*/ */
#ifdef illumos
if (strcmp(srchkey, ZPOOL_CONFIG_PATH) == 0 && if (strcmp(srchkey, ZPOOL_CONFIG_PATH) == 0 &&
ctd_check_path(val)) { ctd_check_path(val)) {
uint64_t wholedisk = 0; uint64_t wholedisk = 0;
@ -2041,6 +2044,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
break; break;
} }
} else if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) { } else if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
#else
if (strcmp(srchkey, ZPOOL_CONFIG_TYPE) == 0 && val) {
#endif
char *type, *idx, *end, *p; char *type, *idx, *end, *p;
uint64_t id, vdev_id; uint64_t id, vdev_id;