MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zfs_ioc_pool_create

Function zfs_ioc_pool_create

freebsd/contrib/openzfs/module/zfs/zfs_ioctl.c:1447–1527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1445}
1446
1447static int
1448zfs_ioc_pool_create(zfs_cmd_t *zc)
1449{
1450 int error;
1451 nvlist_t *config, *props = NULL;
1452 nvlist_t *rootprops = NULL;
1453 nvlist_t *zplprops = NULL;
1454 dsl_crypto_params_t *dcp = NULL;
1455 const char *spa_name = zc->zc_name;
1456 boolean_t unload_wkey = B_TRUE;
1457
1458 if ((error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size,
1459 zc->zc_iflags, &config)))
1460 return (error);
1461
1462 if (zc->zc_nvlist_src_size != 0 && (error =
1463 get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
1464 zc->zc_iflags, &props))) {
1465 nvlist_free(config);
1466 return (error);
1467 }
1468
1469 if (props) {
1470 nvlist_t *nvl = NULL;
1471 nvlist_t *hidden_args = NULL;
1472 uint64_t version = SPA_VERSION;
1473 char *tname;
1474
1475 (void) nvlist_lookup_uint64(props,
1476 zpool_prop_to_name(ZPOOL_PROP_VERSION), &version);
1477 if (!SPA_VERSION_IS_SUPPORTED(version)) {
1478 error = SET_ERROR(EINVAL);
1479 goto pool_props_bad;
1480 }
1481 (void) nvlist_lookup_nvlist(props, ZPOOL_ROOTFS_PROPS, &nvl);
1482 if (nvl) {
1483 error = nvlist_dup(nvl, &rootprops, KM_SLEEP);
1484 if (error != 0)
1485 goto pool_props_bad;
1486 (void) nvlist_remove_all(props, ZPOOL_ROOTFS_PROPS);
1487 }
1488
1489 (void) nvlist_lookup_nvlist(props, ZPOOL_HIDDEN_ARGS,
1490 &hidden_args);
1491 error = dsl_crypto_params_create_nvlist(DCP_CMD_NONE,
1492 rootprops, hidden_args, &dcp);
1493 if (error != 0)
1494 goto pool_props_bad;
1495 (void) nvlist_remove_all(props, ZPOOL_HIDDEN_ARGS);
1496
1497 VERIFY(nvlist_alloc(&zplprops, NV_UNIQUE_NAME, KM_SLEEP) == 0);
1498 error = zfs_fill_zplprops_root(version, rootprops,
1499 zplprops, NULL);
1500 if (error != 0)
1501 goto pool_props_bad;
1502
1503 if (nvlist_lookup_string(props,
1504 zpool_prop_to_name(ZPOOL_PROP_TNAME), &tname) == 0)

Callers

nothing calls this directly

Calls 15

get_nvlistFunction · 0.85
nvlist_lookup_uint64Function · 0.85
zpool_prop_to_nameFunction · 0.85
nvlist_lookup_nvlistFunction · 0.85
nvlist_dupFunction · 0.85
nvlist_remove_allFunction · 0.85
nvlist_allocFunction · 0.85
zfs_fill_zplprops_rootFunction · 0.85
nvlist_lookup_stringFunction · 0.85
spa_createFunction · 0.85
zfs_set_prop_nvlistFunction · 0.85

Tested by

no test coverage detected