1386 /* avoid any tricks in the spec */
1387 verify(nvlist_lookup_nvlist_array(newroot,
1388 ZPOOL_CONFIG_CHILDREN, &child, &children) == 0);
1389 for (c = 0; c < children; c++) {
1390 char *path;
1391 const char *type;
1392 int min, max;
1393
1394 verify(nvlist_lookup_string(child[c],
1395 ZPOOL_CONFIG_PATH, &path) == 0);
1396 if ((type = is_grouping(path, &min, &max)) != NULL) {
1397 (void) fprintf(stderr, gettext("Cannot use "
1398 "'%s' as a device for splitting\n"), type);
1399 nvlist_free(newroot);
1400 return (NULL);
1401 }
1402 }
1403 }
1404
1405 if (zpool_vdev_split(zhp, newname, &newroot, props, flags) != 0) {
1406 if (newroot != NULL)
1407 nvlist_free(newroot);
1408 return (NULL);
1409 }
1410
1411 return (newroot);
1412 }
1413
1414 /*
1415 * Get and validate the contents of the given vdev specification. This ensures
1416 * that the nvlist returned is well-formed, that all the devices exist, and that
1417 * they are not currently in use by any other known consumer. The 'poolconfig'
1418 * parameter is the current configuration of the pool when adding devices
1419 * existing pool, and is used to perform additional checks, such as changing the
1420 * replication level of the pool. It can be 'NULL' to indicate that this is a
1421 * new pool. The 'force' flag controls whether devices should be forcefully
1422 * added, even if they appear in use.
1423 */
1424 nvlist_t *
1425 make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
1426 boolean_t replacing, boolean_t dryrun, int argc, char **argv)
|
1386 /* avoid any tricks in the spec */
1387 verify(nvlist_lookup_nvlist_array(newroot,
1388 ZPOOL_CONFIG_CHILDREN, &child, &children) == 0);
1389 for (c = 0; c < children; c++) {
1390 char *path;
1391 const char *type;
1392 int min, max;
1393
1394 verify(nvlist_lookup_string(child[c],
1395 ZPOOL_CONFIG_PATH, &path) == 0);
1396 if ((type = is_grouping(path, &min, &max)) != NULL) {
1397 (void) fprintf(stderr, gettext("Cannot use "
1398 "'%s' as a device for splitting\n"), type);
1399 nvlist_free(newroot);
1400 return (NULL);
1401 }
1402 }
1403 }
1404
1405 if (zpool_vdev_split(zhp, newname, &newroot, props, flags) != 0) {
1406 nvlist_free(newroot);
1407 return (NULL);
1408 }
1409
1410 return (newroot);
1411 }
1412
1413 /*
1414 * Get and validate the contents of the given vdev specification. This ensures
1415 * that the nvlist returned is well-formed, that all the devices exist, and that
1416 * they are not currently in use by any other known consumer. The 'poolconfig'
1417 * parameter is the current configuration of the pool when adding devices
1418 * existing pool, and is used to perform additional checks, such as changing the
1419 * replication level of the pool. It can be 'NULL' to indicate that this is a
1420 * new pool. The 'force' flag controls whether devices should be forcefully
1421 * added, even if they appear in use.
1422 */
1423 nvlist_t *
1424 make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
1425 boolean_t replacing, boolean_t dryrun, int argc, char **argv)
|