text stringlengths 0 14.1k |
|---|
idx = p + 1; |
*p = '\0'; |
/* |
* If the types don't match then keep looking. |
*/ |
if (strncmp(val, type, strlen(val)) != 0) { |
free(type); |
break; |
} |
verify(strncmp(type, VDEV_TYPE_RAIDZ, |
strlen(VDEV_TYPE_RAIDZ)) == 0 || |
strncmp(type, VDEV_TYPE_MIRROR, |
strlen(VDEV_TYPE_MIRROR)) == 0); |
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID, |
&id) == 0); |
errno = 0; |
vdev_id = strtoull(idx, &end, 10); |
free(type); |
if (errno != 0) |
return (NULL); |
/* |
* Now verify that we have the correct vdev id. |
*/ |
if (vdev_id == id) |
return (nv); |
} |
/* |
* Common case |
*/ |
if (strcmp(srchval, val) == 0) |
return (nv); |
break; |
} |
default: |
break; |
} |
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, |
&child, &children) != 0) |
return (NULL); |
for (c = 0; c < children; c++) { |
if ((ret = vdev_to_nvlist_iter(child[c], search, |
avail_spare, l2cache, NULL)) != NULL) { |
/* |
* The 'is_log' value is only set for the toplevel |
* vdev, not the leaf vdevs. So we always lookup the |
* log device from the root of the vdev tree (where |
* 'log' is non-NULL). |
*/ |
if (log != NULL && |
nvlist_lookup_uint64(child[c], |
ZPOOL_CONFIG_IS_LOG, &is_log) == 0 && |
is_log) { |
*log = B_TRUE; |
} |
return (ret); |
} |
} |
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, |
&child, &children) == 0) { |
for (c = 0; c < children; c++) { |
if ((ret = vdev_to_nvlist_iter(child[c], search, |
avail_spare, l2cache, NULL)) != NULL) { |
*avail_spare = B_TRUE; |
return (ret); |
} |
} |
} |
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, |
&child, &children) == 0) { |
for (c = 0; c < children; c++) { |
if ((ret = vdev_to_nvlist_iter(child[c], search, |
avail_spare, l2cache, NULL)) != NULL) { |
*l2cache = B_TRUE; |
return (ret); |
} |
} |
} |
return (NULL); |
} |
/* |
* Given a physical path (minus the ""/devices"" prefix), find the |
* associated vdev. |
*/ |
nvlist_t * |
zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath, |
boolean_t *avail_spare, boolean_t *l2cache, boolean_t *log) |
{ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.