Lines Matching defs:conf
114 static const char static_location[] = "/etc/pooladm.conf";
175 pool_conf_status(const pool_conf_t *conf)
177 return (conf->pc_state);
186 pool_conf_t *conf;
189 if ((conf = pool_conf_alloc()) == NULL)
192 if (pool_conf_open(conf, pool_dynamic_location(), PO_RDONLY) < 0) {
193 pool_conf_free(conf);
198 result = conf->pc_prov->pc_set_binding(conf, pool_name, idtype, id);
200 (void) pool_conf_close(conf);
201 pool_conf_free(conf);
212 pool_conf_t *conf;
222 if ((conf = pool_conf_alloc()) == NULL)
225 if (pool_conf_open(conf, pool_dynamic_location(), PO_RDONLY)
228 pool_conf_free(conf);
231 result = conf->pc_prov->pc_get_resource_binding(conf, type, pid);
232 (void) pool_conf_close(conf);
233 pool_conf_free(conf);
244 pool_conf_t *conf;
247 if ((conf = pool_conf_alloc()) == NULL)
250 if (pool_conf_open(conf, pool_dynamic_location(), PO_RDONLY)
253 pool_conf_free(conf);
256 result = conf->pc_prov->pc_get_binding(conf, pid);
257 (void) pool_conf_close(conf);
258 pool_conf_free(conf);
339 pool_conf_t *conf = TO_CONF(pe);
372 if (pool_walk_properties(conf, (pool_elem_t *)pe, cb,
386 if ((rs = pool_query_pool_resources(conf, pool_elem_pool(pe),
427 if ((ps = pool_query_pools(conf, &nelem, NULL)) !=
439 if ((rs = pool_query_resources(conf, &nelem, NULL)) !=
453 if ((rs = pool_query_pool_resources(conf,
466 if ((cs = pool_query_resource_components(conf,
495 * Errors If the status of the conf is INVALID or the supplied
501 pool_info(const pool_conf_t *conf, const pool_t *pool, int deep)
507 if (TO_CONF(pe) != conf) {
512 if (pool_conf_status(conf) == POF_INVALID || (deep & ~1)) {
523 * Errors If the status of the conf is INVALID or the supplied
529 pool_resource_info(const pool_conf_t *conf, const pool_resource_t *res,
536 if (TO_CONF(pe) != conf) {
541 if (pool_conf_status(conf) == POF_INVALID || (deep & ~1)) {
552 * Errors If the status of the conf is INVALID or the supplied
558 pool_component_info(const pool_conf_t *conf, const pool_component_t *comp,
565 if (TO_CONF(pe) != conf) {
570 if (pool_conf_status(conf) == POF_INVALID || (deep & ~1)) {
579 * Returns The information on the specified conf or NULL.
581 * Errors If the status of the conf is INVALID or the supplied
587 pool_conf_info(const pool_conf_t *conf, int deep)
591 if (pool_conf_status(conf) == POF_INVALID || (deep & ~1)) {
595 if ((pe = pool_conf_to_elem(conf)) == NULL) {
856 pool_get_property(const pool_conf_t *conf, const pool_elem_t *pe,
861 if (pool_conf_status(conf) == POF_INVALID) {
916 pool_put_property(pool_conf_t *conf, pool_elem_t *pe, const char *name,
921 if (pool_conf_check(conf) != PO_SUCCESS)
924 if (TO_CONF(pe) != conf) {
981 pool_set_temporary(pool_conf_t *conf, pool_elem_t *pe)
987 if (pool_conf_check(conf) != PO_SUCCESS)
990 if (TO_CONF(pe) != conf) {
1097 pool_rm_property(pool_conf_t *conf, pool_elem_t *pe, const char *name)
1101 if (pool_conf_check(conf) != PO_SUCCESS)
1104 if (TO_CONF(pe) != conf) {
1164 pool_create(pool_conf_t *conf, const char *name)
1170 if (pool_conf_check(conf) != PO_SUCCESS)
1173 if (!is_valid_name(name) || pool_get_pool(conf, name) != NULL) {
1180 if ((pe = conf->pc_prov->pc_elem_create(conf, PEC_POOL, PREC_INVALID,
1192 (void) pool_destroy(conf, pool_elem_pool(pe));
1198 (void) pool_destroy(conf, pool_elem_pool(pe));
1202 if (pool_put_property(conf, pe, "pool.name", &val) == PO_FAIL) {
1203 (void) pool_destroy(conf, pool_elem_pool(pe));
1211 if (conf->pc_prov->pc_oflags & PO_TEMP) {
1212 if (pool_set_temporary(conf, pe) == PO_FAIL) {
1213 (void) pool_destroy(conf, pool_elem_pool(pe));
1225 pool_resource_create(pool_conf_t *conf, const char *sz_type, const char *name)
1237 if (pool_conf_check(conf) != PO_SUCCESS)
1251 if (!is_valid_name(name) || pool_get_resource(conf, sz_type, name) !=
1267 if ((resources = pool_query_resources(conf, &nelem, props)) == NULL) {
1288 if ((pe = conf->pc_prov->pc_elem_create(conf, elem_class, type,
1304 (void) pool_resource_destroy(conf,
1312 (void) pool_resource_destroy(conf, pool_elem_res(pe));
1319 (void) pool_resource_destroy(conf, pool_elem_res(pe));
1327 if (conf->pc_prov->pc_oflags & PO_TEMP) {
1328 if (pool_set_temporary(conf, pe) != PO_SUCCESS) {
1329 (void) pool_resource_destroy(conf, pool_elem_res(pe));
1341 pool_component_create(pool_conf_t *conf, const pool_resource_t *res,
1349 if ((pe = conf->pc_prov->pc_elem_create(conf, PEC_COMP,
1409 pool_conf_location(const pool_conf_t *conf)
1411 if (pool_conf_status(conf) == POF_INVALID) {
1415 return (conf->pc_location);
1422 pool_conf_close(pool_conf_t *conf)
1426 if (pool_conf_status(conf) == POF_INVALID) {
1430 rv = conf->pc_prov->pc_close(conf);
1431 conf->pc_prov = NULL;
1432 free((void *)conf->pc_location);
1433 conf->pc_location = NULL;
1434 conf->pc_state = POF_INVALID;
1444 pool_conf_remove(pool_conf_t *conf)
1448 if (pool_conf_status(conf) == POF_INVALID) {
1452 rv = conf->pc_prov->pc_remove(conf);
1453 conf->pc_state = POF_INVALID;
1463 pool_conf_t *conf;
1465 if ((conf = calloc(1, sizeof (pool_conf_t))) == NULL) {
1469 conf->pc_state = POF_INVALID;
1470 return (conf);
1477 pool_conf_free(pool_conf_t *conf)
1479 free(conf);
1487 pool_conf_open(pool_conf_t *conf, const char *location, int oflags)
1496 if (pool_conf_status(conf) != POF_INVALID) {
1520 if ((conf->pc_location = strdup(location)) == NULL) {
1538 if (pool_knl_connection_alloc(conf, PO_TEMP) != PO_SUCCESS) {
1539 conf->pc_state = POF_INVALID;
1543 conf->pc_prov->pc_oflags |= PO_RDWR;
1546 if (pool_knl_connection_alloc(conf, oflags) != PO_SUCCESS) {
1547 conf->pc_state = POF_INVALID;
1551 if (pool_xml_connection_alloc(conf, oflags) != PO_SUCCESS) {
1552 conf->pc_state = POF_INVALID;
1564 pool_conf_rollback(pool_conf_t *conf)
1566 if (pool_conf_status(conf) == POF_INVALID) {
1570 return (conf->pc_prov->pc_rollback(conf));
1581 pool_conf_commit(pool_conf_t *conf, int active)
1585 if (pool_conf_status(conf) == POF_INVALID) {
1592 if (conf_is_dynamic(conf) == PO_TRUE) {
1603 oflags = conf->pc_prov->pc_oflags;
1604 conf->pc_prov->pc_oflags |= PO_RDWR;
1605 retval = pool_conf_commit_sys(conf, active);
1606 conf->pc_prov->pc_oflags = oflags;
1611 retval = conf->pc_prov->pc_commit(conf);
1621 pool_conf_export(const pool_conf_t *conf, const char *location,
1624 if (pool_conf_status(conf) == POF_INVALID) {
1628 return (conf->pc_prov->pc_export(conf, location, fmt));
1636 pool_conf_validate(const pool_conf_t *conf, pool_valid_level_t level)
1638 if (pool_conf_status(conf) == POF_INVALID) {
1642 return (conf->pc_prov->pc_validate(conf, level));
1650 pool_conf_update(const pool_conf_t *conf, int *changed)
1652 if (pool_conf_status(conf) == POF_INVALID ||
1653 conf_is_dynamic(conf) == PO_FALSE) {
1665 return (pool_knl_update((pool_conf_t *)conf, changed));
1674 pool_walk_properties(pool_conf_t *conf, pool_elem_t *elem, void *arg,
1678 return (pool_walk_any_properties(conf, elem, arg, prop_callback, 0));
1700 pool_walk_any_properties(pool_conf_t *conf, pool_elem_t *elem, void *arg,
1709 if (pool_conf_status(conf) == POF_INVALID) {
1747 if (prop_callback(conf, elem, props[i].pp_pname,
1781 if (prop_callback(conf, elem, props[i].pp_pname,
1798 if (prop_callback(conf, elem, name, pvals[i],
1818 pool_get_pool(const pool_conf_t *conf, const char *name)
1828 if (pool_conf_status(conf) == POF_INVALID) {
1837 rs = pool_query_pools(conf, &size, props);
1858 pool_query_pools(const pool_conf_t *conf, uint_t *size, pool_value_t **props)
1865 if (pool_conf_status(conf) == POF_INVALID) {
1869 rs = pool_exec_query(conf, NULL, NULL, PEC_QRY_POOL, props);
1901 pool_get_resource(const pool_conf_t *conf, const char *sz_type,
1912 if (pool_conf_status(conf) == POF_INVALID) {
1945 rs = pool_query_resources(conf, &size, props);
1966 pool_query_resources(const pool_conf_t *conf, uint_t *size,
1974 if (pool_conf_status(conf) == POF_INVALID) {
1981 rs = pool_exec_query(conf, NULL, NULL, PEC_QRY_RES, props);
2017 pool_query_components(const pool_conf_t *conf, uint_t *size,
2020 return (pool_query_resource_components(conf, NULL, size, props));
2029 pool_destroy(pool_conf_t *conf, pool_t *pp)
2033 if (pool_conf_check(conf) != PO_SUCCESS)
2056 pool_resource_destroy(pool_conf_t *conf, pool_resource_t *prs)
2065 if (pool_conf_check(conf) != PO_SUCCESS)
2078 if ((pl = pool_query_pools(conf, &npool, NULL)) != NULL) {
2084 if ((rl = pool_query_pool_resources(conf, pl[i], &nres,
2088 if (pool_dissociate(conf, pl[i],
2110 if ((rl = pool_query_resource_components(conf, prs, &res_size,
2112 int ostate = conf->pc_state;
2113 conf->pc_state = POF_DESTROY;
2114 if (pool_resource_xtransfer(conf, prs, default_set_res,
2117 conf->pc_state = ostate;
2120 conf->pc_state = ostate;
2162 pool_exec_query(const pool_conf_t *conf, const pool_elem_t *src,
2165 return (conf->pc_prov->pc_exec_query(conf, src, src_attr, classes,
2253 pool_conf_t *conf = TO_CONF(TO_ELEM(src));
2260 if ((components = pool_query_resource_components(conf, src, &ncomponent,
2274 if (pool_resource_xtransfer(conf, src, dst, moved) ==
2288 if (pool_resource_xtransfer(conf, src, dst, moved) ==
2311 setup_transfer(pool_conf_t *conf, pool_resource_t *src, pool_resource_t *tgt,
2317 if (pool_conf_check(conf) != PO_SUCCESS)
2348 if (pool_conf_status(conf) != POF_DESTROY) {
2354 dprintf("conf is %s\n", pool_conf_location(conf));
2374 pool_resource_transfer(pool_conf_t *conf, pool_resource_t *src,
2381 if ((ret = setup_transfer(conf, src, tgt, size, &src_size, &tgt_size))
2392 ret = conf->pc_prov->pc_res_xfer(src, tgt, size);
2416 pool_resource_xtransfer(pool_conf_t *conf, pool_resource_t *src,
2434 dprintf("in conf %s\n", pool_conf_location(conf));
2443 if (pool_get_owning_resource(conf, rl[i]) != src) {
2451 if ((ret = setup_transfer(conf, src, tgt, size, &src_size, &tgt_size))
2455 ret = conf->pc_prov->pc_res_xxfer(src, tgt, rl);
2484 pool_get_owning_resource(const pool_conf_t *conf, const pool_component_t *comp)
2486 if (pool_conf_status(conf) == POF_INVALID) {
2524 pool_conf_to_elem(const pool_conf_t *conf)
2528 if (pool_conf_status(conf) == POF_INVALID) {
2532 if ((sys = pool_conf_system(conf)) == NULL) {
2540 pool_to_elem(const pool_conf_t *conf, const pool_t *pp)
2542 if (pool_conf_status(conf) == POF_INVALID) {
2550 pool_resource_to_elem(const pool_conf_t *conf, const pool_resource_t *prs)
2552 if (pool_conf_status(conf) == POF_INVALID) {
2560 pool_component_to_elem(const pool_conf_t *conf, const pool_component_t *pr)
2562 if (pool_conf_status(conf) == POF_INVALID) {
2574 pool_walk_pools(pool_conf_t *conf, void *arg,
2575 int (*callback)(pool_conf_t *conf, pool_t *pool, void *arg))
2582 if (pool_conf_status(conf) == POF_INVALID) {
2587 if ((rs = pool_query_pools(conf, &size, NULL)) == NULL) /* None */
2590 if (callback(conf, rs[i], arg) != PO_SUCCESS) {
2603 pool_walk_components(pool_conf_t *conf, pool_resource_t *prs, void *arg,
2604 int (*callback)(pool_conf_t *conf, pool_component_t *pr, void *arg))
2611 if (pool_conf_status(conf) == POF_INVALID) {
2616 if ((rs = pool_query_resource_components(conf, prs, &size, NULL)) ==
2620 if (callback(conf, rs[i], arg) != PO_SUCCESS) {
2632 pool_query_pool_resources(const pool_conf_t *conf, const pool_t *pp,
2640 if (pool_conf_status(conf) == POF_INVALID) {
2647 rs = pool_exec_query(conf, pe, "res", PEC_QRY_RES, props);
2681 pool_walk_resources(pool_conf_t *conf, pool_t *pp, void *arg,
2689 if (pool_conf_status(conf) == POF_INVALID) {
2693 if ((rs = pool_query_pool_resources(conf, pp, &size, NULL)) == NULL)
2696 if (callback(conf, rs[i], arg) != PO_SUCCESS) {
2708 pool_query_resource_components(const pool_conf_t *conf,
2716 if (pool_conf_status(conf) == POF_INVALID) {
2722 rs = pool_exec_query(conf, pe, NULL, PEC_QRY_COMP, props);
2777 pool_associate(pool_conf_t *conf, pool_t *pool, const pool_resource_t *res)
2779 if (pool_conf_check(conf) != PO_SUCCESS)
2791 pool_dissociate(pool_conf_t *conf, pool_t *pool, const pool_resource_t *res)
2793 if (pool_conf_check(conf) != PO_SUCCESS)
2932 pool_conf_check(const pool_conf_t *conf)
2934 if (pool_conf_status(conf) == POF_INVALID) {
2939 if ((conf->pc_prov->pc_oflags & PO_RDWR) == 0) {