text stringlengths 0 14.1k |
|---|
if (bytes_left != 0) { |
physpath[pos] = 0; |
} |
return (EZFS_NOSPC); |
} |
return (0); |
} |
static int |
vdev_get_physpaths(nvlist_t *nv, char *physpath, size_t phypath_size, |
size_t *rsz, boolean_t is_spare) |
{ |
char *type; |
int ret; |
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) != 0) |
return (EZFS_INVALCONFIG); |
if (strcmp(type, VDEV_TYPE_DISK) == 0) { |
/* |
* An active spare device has ZPOOL_CONFIG_IS_SPARE set. |
* For a spare vdev, we only want to boot from the active |
* spare device. |
*/ |
if (is_spare) { |
uint64_t spare = 0; |
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_SPARE, |
&spare); |
if (!spare) |
return (EZFS_INVALCONFIG); |
} |
if (vdev_online(nv)) { |
if ((ret = vdev_get_one_physpath(nv, physpath, |
phypath_size, rsz)) != 0) |
return (ret); |
} |
} else if (strcmp(type, VDEV_TYPE_MIRROR) == 0 || |
strcmp(type, VDEV_TYPE_REPLACING) == 0 || |
(is_spare = (strcmp(type, VDEV_TYPE_SPARE) == 0))) { |
nvlist_t **child; |
uint_t count; |
int i, ret; |
if (nvlist_lookup_nvlist_array(nv, |
ZPOOL_CONFIG_CHILDREN, &child, &count) != 0) |
return (EZFS_INVALCONFIG); |
for (i = 0; i < count; i++) { |
ret = vdev_get_physpaths(child[i], physpath, |
phypath_size, rsz, is_spare); |
if (ret == EZFS_NOSPC) |
return (ret); |
} |
} |
return (EZFS_POOL_INVALARG); |
} |
/* |
* Get phys_path for a root pool config. |
* Return 0 on success; non-zero on failure. |
*/ |
static int |
zpool_get_config_physpath(nvlist_t *config, char *physpath, size_t phypath_size) |
{ |
size_t rsz; |
nvlist_t *vdev_root; |
nvlist_t **child; |
uint_t count; |
char *type; |
rsz = 0; |
if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, |
&vdev_root) != 0) |
return (EZFS_INVALCONFIG); |
if (nvlist_lookup_string(vdev_root, ZPOOL_CONFIG_TYPE, &type) != 0 || |
nvlist_lookup_nvlist_array(vdev_root, ZPOOL_CONFIG_CHILDREN, |
&child, &count) != 0) |
return (EZFS_INVALCONFIG); |
/* |
* root pool can not have EFI labeled disks and can only have |
* a single top-level vdev. |
*/ |
#if 0 |
if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1 || |
pool_uses_efi(vdev_root)) |
return (EZFS_POOL_INVALARG); |
#endif |
(void) vdev_get_physpaths(child[0], physpath, phypath_size, &rsz, |
B_FALSE); |
/* No online devices */ |
if (rsz == 0) |
return (EZFS_NODEVICE); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.