Lines Matching defs:handle

292  * and lower limit.  The functions that handle rctl aliases step through
550 zone_dochandle_t handle = calloc(1, sizeof (struct zone_dochandle));
551 if (handle == NULL) {
564 return (handle);
568 zonecfg_check_handle(zone_dochandle_t handle)
570 if (handle == NULL || handle->zone_dh_doc == NULL)
576 zonecfg_fini_handle(zone_dochandle_t handle)
578 if (zonecfg_check_handle(handle) == Z_OK)
579 xmlFreeDoc(handle->zone_dh_doc);
580 if (handle != NULL)
581 free(handle);
743 getroot(zone_dochandle_t handle, xmlNodePtr *root)
745 if (zonecfg_check_handle(handle) == Z_BAD_HANDLE)
748 *root = xmlDocGetRootElement(handle->zone_dh_doc);
760 operation_prep(zone_dochandle_t handle)
765 if ((err = getroot(handle, &root)) != 0)
768 handle->zone_dh_cur = root;
769 handle->zone_dh_top = root;
780 get_brand_handle(zone_dochandle_t handle, brand_handle_t *bh)
784 if (zonecfg_get_brand(handle, brand, sizeof (brand)) != 0)
800 can_set_prop(zone_dochandle_t handle, const char *res,
805 if (get_brand_handle(handle, &bh) != Z_OK)
833 fetchfixedprop(zone_dochandle_t handle, const char *res,
838 if (get_brand_handle(handle, &bh) != Z_OK)
867 fetch_alloc_prop(zone_dochandle_t handle, xmlNodePtr cur, const xmlChar *prop,
884 (err = can_set_prop(handle, res, (char *)prop, val)) != Z_OK) {
900 return (fetchfixedprop(handle, res, prop, dst));
912 fetchprop(zone_dochandle_t handle, xmlNodePtr cur, const xmlChar *propname,
919 if ((err = fetch_alloc_prop(handle, cur, propname, &tmp)) != Z_OK)
933 getrootattr(zone_dochandle_t handle, const xmlChar *propname,
939 if ((err = getroot(handle, &root)) != 0)
942 return (fetchprop(handle, root, propname, propval, propsize));
946 get_alloc_rootattr(zone_dochandle_t handle, const xmlChar *propname,
952 if ((err = getroot(handle, &root)) != 0)
955 return (fetch_alloc_prop(handle, root, propname, propval));
959 can_add_res(zone_dochandle_t handle, const char *res)
963 if (get_brand_handle(handle, &bh) != Z_OK)
977 setprop(zone_dochandle_t handle, xmlNodePtr cur, const xmlChar *propname,
987 if ((err = can_set_prop(handle, dtd_to_rt(cur->name),
1007 setrootattr(zone_dochandle_t handle, const xmlChar *propname,
1013 if ((err = getroot(handle, &root)) != Z_OK)
1016 return (setprop(handle, root, propname, propval));
1020 addcomment(zone_dochandle_t handle, const char *comment)
1026 (void) xmlAddPrevSibling(handle->zone_dh_top, node);
1030 stripcomments(zone_dochandle_t handle)
1035 top = handle->zone_dh_doc;
1052 zone_dochandle_t handle)
1062 if ((handle->zone_dh_doc = xmlParseFile(filename)) == NULL) {
1072 valid = xmlValidateDocument(cvp, handle->zone_dh_doc);
1078 stripcomments(handle);
1082 if (zonecfg_get_brand(handle, brand, sizeof (brand)) == Z_OK &&
1094 (void) zonecfg_set_brand(handle, brand);
1097 (void) zonecfg_save(handle);
1103 zonecfg_get_handle(const char *zonename, zone_dochandle_t handle)
1109 handle->zone_dh_newzone = B_FALSE;
1111 return (zonecfg_get_handle_impl(zonename, path, handle));
1116 const char *zonename, zone_dochandle_t handle)
1133 if ((err = zonecfg_get_handle_impl(zonename, migpath, handle)) != Z_OK)
1136 handle->zone_dh_newzone = B_TRUE;
1137 if ((err = setrootattr(handle, DTD_ATTR_ZONEPATH, path)) != Z_OK)
1140 return (setrootattr(handle, DTD_ATTR_NAME, zonename));
1144 zonecfg_get_snapshot_handle(const char *zonename, zone_dochandle_t handle)
1150 handle->zone_dh_newzone = B_FALSE;
1151 return (zonecfg_get_handle_impl(zonename, path, handle));
1156 zone_dochandle_t handle)
1164 if ((err = zonecfg_get_handle_impl(template, path, handle)) != Z_OK)
1166 handle->zone_dh_newzone = B_TRUE;
1167 return (setrootattr(handle, DTD_ATTR_NAME, zonename));
1171 zonecfg_get_xml_handle(const char *path, zone_dochandle_t handle)
1179 if ((err = zonecfg_get_handle_impl("xml", path, handle)) != Z_OK)
1181 handle->zone_dh_newzone = B_TRUE;
1186 is_renaming(zone_dochandle_t handle)
1188 if (handle->zone_dh_newzone)
1190 if (strlen(handle->zone_dh_delete_name) > 0)
1196 is_new(zone_dochandle_t handle)
1198 return (handle->zone_dh_newzone || handle->zone_dh_snapshot);
1202 is_snapshot(zone_dochandle_t handle)
1204 return (handle->zone_dh_snapshot);
1244 zonecfg_get_name(zone_dochandle_t handle, char *name, size_t namesize)
1246 return (getrootattr(handle, DTD_ATTR_NAME, name, namesize));
1250 insert_admins(zone_dochandle_t handle, char *zonename)
1255 if ((err = zonecfg_setadminent(handle)) != Z_OK) {
1258 while (zonecfg_getadminent(handle, &admintab) == Z_OK) {
1259 err = zonecfg_insert_userauths(handle,
1262 (void) zonecfg_endadminent(handle);
1266 (void) zonecfg_endadminent(handle);
1271 zonecfg_set_name(zone_dochandle_t handle, char *name)
1277 if ((err = getrootattr(handle, DTD_ATTR_NAME, curname,
1299 if (strcmp(name, handle->zone_dh_delete_name) == 0) {
1300 err = setrootattr(handle, DTD_ATTR_NAME, name);
1301 handle->zone_dh_delete_name[0] = '\0';
1314 (void) strlcpy(old_delname, handle->zone_dh_delete_name,
1316 if (!is_new(handle) && !is_renaming(handle)) {
1329 (void) strlcpy(handle->zone_dh_delete_name, curname,
1330 sizeof (handle->zone_dh_delete_name));
1331 assert(is_renaming(handle));
1332 } else if (is_renaming(handle)) {
1333 err = zone_get_state(handle->zone_dh_delete_name, &state);
1342 if ((err = setrootattr(handle, DTD_ATTR_NAME, name)) != Z_OK) {
1347 (void) strlcpy(handle->zone_dh_delete_name, old_delname,
1348 sizeof (handle->zone_dh_delete_name));
1356 if ((err = insert_admins(handle, curname)) != Z_OK)
1363 zonecfg_get_zonepath(zone_dochandle_t handle, char *path, size_t pathsize)
1369 return (getrootattr(handle, DTD_ATTR_ZONEPATH, path + len,
1374 zonecfg_set_zonepath(zone_dochandle_t handle, char *zonepath)
1409 ret = setrootattr(handle, DTD_ATTR_ZONEPATH, curr_mp);
1416 i_zonecfg_get_brand(zone_dochandle_t handle, char *brand, size_t brandsize)
1420 ret = getrootattr(handle, DTD_ATTR_BRAND, brand, brandsize);
1428 zonecfg_get_brand(zone_dochandle_t handle, char *brand, size_t brandsize)
1432 if ((ret = i_zonecfg_get_brand(handle, brand, brandsize)) != Z_OK)
1438 zonecfg_set_brand(zone_dochandle_t handle, char *brand)
1462 if ((err = getroot(handle, &root)) != Z_OK)
1472 zonecfg_get_autoboot(zone_dochandle_t handle, boolean_t *autoboot)
1477 if ((ret = getrootattr(handle, DTD_ATTR_AUTOBOOT, autobootstr,
1491 zonecfg_set_autoboot(zone_dochandle_t handle, boolean_t autoboot)
1493 return (setrootattr(handle, DTD_ATTR_AUTOBOOT,
1498 zonecfg_is_readonly(zone_dochandle_t handle)
1502 if (zonecfg_get_mac_profile(handle, prof, sizeof (prof)) != Z_OK ||
1511 zonecfg_get_pool(zone_dochandle_t handle, char *pool, size_t poolsize)
1513 return (getrootattr(handle, DTD_ATTR_POOL, pool, poolsize));
1517 zonecfg_set_pool(zone_dochandle_t handle, char *pool)
1519 return (setrootattr(handle, DTD_ATTR_POOL, pool));
1523 zonecfg_get_limitpriv(zone_dochandle_t handle, char **limitpriv)
1525 return (get_alloc_rootattr(handle, DTD_ATTR_LIMITPRIV, limitpriv));
1529 zonecfg_set_limitpriv(zone_dochandle_t handle, char *limitpriv)
1531 return (setrootattr(handle, DTD_ATTR_LIMITPRIV, limitpriv));
1535 zonecfg_get_bootargs(zone_dochandle_t handle, char *bargs, size_t bargssize)
1537 return (getrootattr(handle, DTD_ATTR_BOOTARGS, bargs, bargssize));
1541 zonecfg_set_bootargs(zone_dochandle_t handle, char *bargs)
1543 return (setrootattr(handle, DTD_ATTR_BOOTARGS, bargs));
1547 zonecfg_get_sched_class(zone_dochandle_t handle, char *sched, size_t schedsize)
1549 return (getrootattr(handle, DTD_ATTR_SCHED, sched, schedsize));
1553 zonecfg_set_sched(zone_dochandle_t handle, char *sched)
1555 return (setrootattr(handle, DTD_ATTR_SCHED, sched));
1570 zonecfg_refresh_index_file(zone_dochandle_t handle)
1581 if ((err = zonecfg_get_name(handle, name, sizeof (name))) != Z_OK)
1585 if ((err = zonecfg_get_zonepath(handle, zonepath,
1591 if (is_renaming(handle)) {
1593 (void) strlcpy(ze.zone_name, handle->zone_dh_delete_name,
1596 } else if (is_new(handle)) {
1657 zonecfg_save_impl(zone_dochandle_t handle, char *filename)
1684 valid = xmlValidateDocument(&cvp, handle->zone_dh_doc);
1687 if (xmlSaveFormatFile(tmpfile, handle->zone_dh_doc, 1) <= 0)
1697 if (!is_new(handle) && !is_renaming(handle)) {
1731 if (is_snapshot(handle))
1735 if ((err = zonecfg_refresh_index_file(handle)) != Z_OK) {
1747 assert(is_new(handle) || is_renaming(handle));
1764 cleanup_res(zone_dochandle_t handle, xmlNodePtr res)
1777 err = can_set_prop(handle, dtd_to_rt(res->name),
1796 zonecfg_cleanup_config(zone_dochandle_t handle)
1801 if ((err = getroot(handle, &root)) != Z_OK)
1805 if ((err = cleanup_res(handle, root)) != Z_OK)
1811 if (can_add_res(handle, dtd_to_rt(res->name)) != Z_OK) {
1818 if ((err = cleanup_res(handle, res)) != Z_OK)
1829 zonecfg_save(zone_dochandle_t handle)
1835 if (zonecfg_check_handle(handle) != Z_OK)
1838 if (handle->zone_dh_snapshot)
1841 if ((err = zonecfg_get_name(handle, zname, sizeof (zname))) != Z_OK)
1847 addcomment(handle, "\n DO NOT EDIT THIS "
1854 (void) zonecfg_authorize_users(handle, zname);
1855 err = zonecfg_save_impl(handle, path);
1857 stripcomments(handle);
1862 handle->zone_dh_newzone = B_FALSE;
1864 if (is_renaming(handle)) {
1865 if (config_file_path(handle->zone_dh_delete_name, delpath))
1867 handle->zone_dh_delete_name[0] = '\0';
1874 zonecfg_verify_save(zone_dochandle_t handle, char *filename)
1880 if (zonecfg_check_handle(handle) != Z_OK)
1891 valid = xmlValidateDocument(&cvp, handle->zone_dh_doc);
1894 if (xmlSaveFormatFile(filename, handle->zone_dh_doc, 1) <= 0)
1901 zonecfg_detach_save(zone_dochandle_t handle, uint_t flags)
1910 if (zonecfg_check_handle(handle) != Z_OK)
1916 if ((err = zonecfg_get_name(handle, zname, sizeof (zname)))
1929 if ((err = operation_prep(handle)) != Z_OK)
1932 addcomment(handle, "\n DO NOT EDIT THIS FILE. "
1943 valid = xmlValidateDocument(&cvp, handle->zone_dh_doc);
1946 if (xmlSaveFormatFile(migpath, handle->zone_dh_doc, 1) <= 0)
1952 stripcomments(handle);
1954 handle->zone_dh_newzone = B_FALSE;
1960 zonecfg_rm_detached(zone_dochandle_t handle, boolean_t forced)
1967 if (zonecfg_check_handle(handle) != Z_OK)
1970 if (zonecfg_get_name(handle, zname, sizeof (zname)) != Z_OK)
2022 zone_dochandle_t handle;
2026 if ((handle = zonecfg_init_handle()) == NULL) {
2030 handle->zone_dh_newzone = B_TRUE;
2031 handle->zone_dh_snapshot = B_TRUE;
2033 if ((error = zonecfg_get_handle(zonename, handle)) != Z_OK)
2035 if ((error = operation_prep(handle)) != Z_OK)
2037 error = zonecfg_get_zonepath(handle, zonepath, sizeof (zonepath));
2053 if ((error = zonecfg_set_zonepath(handle, rpath)) != Z_OK)
2071 addcomment(handle, "\n DO NOT EDIT THIS FILE. "
2074 error = zonecfg_save_impl(handle, path);
2076 stripcomments(handle);
2079 zonecfg_fini_handle(handle);
2084 zonecfg_get_iptype(zone_dochandle_t handle, zone_iptype_t *iptypep)
2089 err = getrootattr(handle, DTD_ATTR_IPTYPE, property, sizeof (property));
2118 zonecfg_set_iptype(zone_dochandle_t handle, zone_iptype_t iptype)
2120 return (setrootattr(handle, DTD_ATTR_IPTYPE,
2125 newprop(zone_dochandle_t handle, xmlNodePtr node, const xmlChar *attrname,
2136 err = can_set_prop(handle, dtd_to_rt(node->name), (char *)attrname,
2149 if (get_brand_handle(handle, &bh) != Z_OK)
2177 newres(zone_dochandle_t handle, xmlNodePtr cur, xmlNodePtr *newnode,
2182 if ((err = can_add_res(handle, dtd_to_rt(dtd))) != Z_OK)
2191 zonecfg_add_filesystem_core(zone_dochandle_t handle, struct zone_fstab *tabptr)
2193 xmlNodePtr newnode, cur = handle->zone_dh_cur, options_node;
2197 if ((err = newres(handle, cur, &newnode, DTD_ELEM_FS)) != Z_OK)
2199 if ((err = newprop(handle, newnode, DTD_ATTR_SPECIAL,
2202 if (tabptr->zone_fs_raw[0] != '\0' && (err = newprop(handle, newnode,
2205 if ((err = newprop(handle, newnode, DTD_ATTR_DIR,
2208 if ((err = newprop(handle, newnode, DTD_ATTR_TYPE,
2216 if ((err = newprop(handle, options_node, DTD_ATTR_NAME,
2225 zonecfg_add_filesystem(zone_dochandle_t handle, struct zone_fstab *tabptr)
2232 if ((err = operation_prep(handle)) != Z_OK)
2235 if ((err = zonecfg_add_filesystem_core(handle, tabptr)) != Z_OK)
2304 match_prop(zone_dochandle_t handle, xmlNodePtr cur, const xmlChar *attr,
2310 if (fetch_alloc_prop(handle, cur, attr, &gotten_prop) != Z_OK)
2319 zonecfg_delete_filesystem_core(zone_dochandle_t handle,
2322 xmlNodePtr cur = handle->zone_dh_cur;
2328 dir_match = match_prop(handle, cur, DTD_ATTR_DIR,
2330 spec_match = match_prop(handle, cur, DTD_ATTR_SPECIAL,
2332 raw_match = match_prop(handle, cur, DTD_ATTR_RAW,
2334 type_match = match_prop(handle, cur, DTD_ATTR_TYPE,
2346 zonecfg_delete_filesystem(zone_dochandle_t handle, struct zone_fstab *tabptr)
2353 if ((err = operation_prep(handle)) != Z_OK)
2356 if ((err = zonecfg_delete_filesystem_core(handle, tabptr)) != Z_OK)
2364 zone_dochandle_t handle,
2373 if ((err = operation_prep(handle)) != Z_OK)
2376 if ((err = zonecfg_delete_filesystem_core(handle, oldtabptr)) != Z_OK)
2379 if ((err = zonecfg_add_filesystem_core(handle, newtabptr)) != Z_OK)
2387 zone_dochandle_t handle,
2399 if ((err = operation_prep(handle)) != Z_OK)
2408 cur = handle->zone_dh_cur;
2414 if ((fetchprop(handle, cur, DTD_ATTR_DIR, dirname,
2424 if ((fetchprop(handle, cur, DTD_ATTR_SPECIAL, special,
2443 if ((fetchprop(handle, cur, DTD_ATTR_RAW, raw,
2461 if ((fetchprop(handle, cur, DTD_ATTR_TYPE, type,
2485 if ((err = fetchprop(handle, cur, DTD_ATTR_DIR, tabptr->zone_fs_dir,
2489 if ((err = fetchprop(handle, cur, DTD_ATTR_SPECIAL,
2494 if ((err = fetchprop(handle, cur, DTD_ATTR_RAW, tabptr->zone_fs_raw,
2498 if ((err = fetchprop(handle, cur, DTD_ATTR_TYPE, tabptr->zone_fs_type,
2506 if ((fetchprop(handle, options, DTD_ATTR_NAME, options_str,
2623 zonecfg_lookup_linkname(zone_dochandle_t handle, const char *linkname)
2629 if ((err = operation_prep(handle)) != Z_OK)
2631 cur = handle->zone_dh_cur;
2634 if ((fetchprop(handle, cur, DTD_ATTR_PHYSICAL,
2640 if ((fetchprop(handle, cur, DTD_ATTR_LINKNAME,
2652 * to which 'handle' refers. 'tabptr' must have an interface, an address, a
2666 zonecfg_lookup_net(zone_dochandle_t handle, struct zone_nettab *tabptr)
2701 if ((err = operation_prep(handle)) != Z_OK)
2704 if ((err = zonecfg_get_iptype(handle, &iptype)) != Z_OK)
2711 cur = handle->zone_dh_cur;
2721 if (physspec != 0 && (fetchprop(handle, cur, DTD_ATTR_PHYSICAL,
2726 (fetchprop(handle, cur, DTD_ATTR_ADDRESS, address,
2732 (fetchprop(handle, cur, DTD_ATTR_ALLOWED_ADDRESS,
2737 if (defrouterspec != 0 && (fetchprop(handle, cur,
2756 if ((err = fetchprop(handle, cur, DTD_ATTR_PHYSICAL,
2762 (err = fetchprop(handle, cur, DTD_ATTR_ADDRESS,
2768 (err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_ADDRESS,
2773 if ((err = fetchprop(handle, cur, DTD_ATTR_CONFIGURE_ALLOWED_ADDRESS,
2778 if ((err = fetchprop(handle, cur, DTD_ATTR_DEFROUTER,
2787 zonecfg_add_net_core(zone_dochandle_t handle, struct zone_nettab *tabptr)
2789 xmlNodePtr newnode, cur = handle->zone_dh_cur;
2792 if ((err = newres(handle, cur, &newnode, DTD_ELEM_NET)) != Z_OK)
2794 if ((err = newprop(handle, newnode, DTD_ATTR_PHYSICAL,
2802 (err = newprop(handle, newnode, DTD_ATTR_ADDRESS,
2806 err = newprop(handle, newnode, DTD_ATTR_ALLOWED_ADDRESS,
2813 if ((err = newprop(handle, newnode,
2822 err = can_set_prop(handle, dtd_to_rt(DTD_ELEM_NET),
2833 if ((err = newprop(handle, newnode,
2843 ((err = newprop(handle, newnode, DTD_ATTR_DEFROUTER,
2851 zonecfg_add_net(zone_dochandle_t handle, struct zone_nettab *tabptr)
2858 if ((err = operation_prep(handle)) != Z_OK)
2861 if ((err = zonecfg_add_net_core(handle, tabptr)) != Z_OK)
2868 zonecfg_delete_net_core(zone_dochandle_t handle, struct zone_nettab *tabptr)
2870 xmlNodePtr cur = handle->zone_dh_cur;
2877 addr_match = match_prop(handle, cur, DTD_ATTR_ADDRESS,
2879 allowed_addr_match = match_prop(handle, cur,
2882 phys_match = match_prop(handle, cur, DTD_ATTR_PHYSICAL,
2895 zonecfg_delete_net(zone_dochandle_t handle, struct zone_nettab *tabptr)
2902 if ((err = operation_prep(handle)) != Z_OK)
2905 if ((err = zonecfg_delete_net_core(handle, tabptr)) != Z_OK)
2912 zonecfg_modify_net(zone_dochandle_t handle, struct zone_nettab *oldtabptr,
2920 if ((err = operation_prep(handle)) != Z_OK)
2923 if ((err = zonecfg_delete_net_core(handle, oldtabptr)) != Z_OK)
2926 if ((err = zonecfg_add_net_core(handle, newtabptr)) != Z_OK)
2933 if (tabptr->pname[0] != '\0' && (fetchprop(handle, cur, dtdattr, \
2939 zonecfg_lookup_anet(zone_dochandle_t handle, struct zone_anettab *tabptr)
2974 if ((err = operation_prep(handle)) != Z_OK)
2982 cur = handle->zone_dh_cur;
3053 if ((err = fetchprop(handle, cur, DTD_ATTR_LINKNAME,
3058 if ((err = fetchprop(handle, cur, DTD_ATTR_LOWER_LINK,
3063 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_ADDRESS,
3068 if ((err = fetchprop(handle, cur, DTD_ATTR_CONFIGURE_ALLOWED_ADDRESS,
3073 if ((err = fetchprop(handle, cur, DTD_ATTR_DEFROUTER,
3078 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_DHCP_CIDS,
3083 if ((err = fetchprop(handle, cur, DTD_ATTR_LINK_PROTECTION,
3088 if ((err = fetchprop(handle, cur, DTD_ATTR_AUTO_MAC_ADDRESS,
3093 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_ADDRESS,
3098 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_PREFIX,
3103 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_SLOT,
3108 if ((err = fetchprop(handle, cur, DTD_ATTR_VLAN_ID,
3113 if ((err = fetchprop(handle, cur, DTD_ATTR_PRIORITY,
3118 if ((err = fetchprop(handle, cur, DTD_ATTR_RXRINGS,
3123 if ((err = fetchprop(handle, cur, DTD_ATTR_TXRINGS,
3128 if ((err = fetchprop(handle, cur, DTD_ATTR_MTU,
3133 if ((err = fetchprop(handle, cur, DTD_ATTR_MAXBW,
3138 if ((err = fetchprop(handle, cur, DTD_ATTR_RXFANOUT,
3143 if ((err = fetchprop(handle, cur, DTD_ATTR_VSITYPEID,
3148 if ((err = fetchprop(handle, cur, DTD_ATTR_VSIVERS,
3153 if ((err = fetchprop(handle, cur, DTD_ATTR_VSIMGRID,
3158 if ((err = fetchprop(handle, cur, DTD_ATTR_ETSBWLCL,
3163 if ((err = fetchprop(handle, cur, DTD_ATTR_COS,
3168 if ((err = fetchprop(handle, cur, DTD_ATTR_PKEY,
3173 if ((err = fetchprop(handle, cur, DTD_ATTR_LINKMODE,
3182 zonecfg_add_anet_core(zone_dochandle_t handle, struct zone_anettab *tabptr)
3184 xmlNodePtr newnode, cur = handle->zone_dh_cur;
3187 if ((err = newres(handle, cur, &newnode, DTD_ELEM_ANET)) != Z_OK)
3191 if ((err = newprop(handle, newnode, DTD_ATTR_LOWER_LINK,
3197 (err = newprop(handle, newnode, DTD_ATTR_LINKNAME,
3201 err = newprop(handle, newnode, DTD_ATTR_ALLOWED_ADDRESS,
3208 if ((err = newprop(handle, newnode,
3217 err = can_set_prop(handle, dtd_to_rt(DTD_ELEM_NET),
3228 if ((err = newprop(handle, newnode,
3238 ((err = newprop(handle, newnode, DTD_ATTR_DEFROUTER,
3242 ((err = newprop(handle, newnode, DTD_ATTR_ALLOWED_DHCP_CIDS,
3246 ((err = newprop(handle, newnode, DTD_ATTR_LINK_PROTECTION,
3250 ((err = newprop(handle, newnode, DTD_ATTR_AUTO_MAC_ADDRESS,
3254 ((err = newprop(handle, newnode, DTD_ATTR_MAC_ADDRESS,
3258 ((err = newprop(handle, newnode, DTD_ATTR_MAC_PREFIX,
3262 ((err = newprop(handle, newnode, DTD_ATTR_MAC_SLOT,
3266 ((err = newprop(handle, newnode, DTD_ATTR_VLAN_ID,
3270 ((err = newprop(handle, newnode, DTD_ATTR_PRIORITY,
3274 ((err = newprop(handle, newnode, DTD_ATTR_RXRINGS,
3278 ((err = newprop(handle, newnode, DTD_ATTR_TXRINGS,
3282 ((err = newprop(handle, newnode, DTD_ATTR_MTU,
3286 ((err = newprop(handle, newnode, DTD_ATTR_MAXBW,
3290 ((err = newprop(handle, newnode, DTD_ATTR_RXFANOUT,
3295 ((err = newprop(handle, newnode, DTD_ATTR_VSITYPEID,
3300 ((err = newprop(handle, newnode, DTD_ATTR_VSIVERS,
3305 ((err = newprop(handle, newnode, DTD_ATTR_VSIMGRID,
3310 ((err = newprop(handle, newnode, DTD_ATTR_ETSBWLCL,
3315 ((err = newprop(handle, newnode, DTD_ATTR_COS,
3320 ((err = newprop(handle, newnode, DTD_ATTR_PKEY,
3325 ((err = newprop(handle, newnode, DTD_ATTR_LINKMODE,
3333 zonecfg_add_anet(zone_dochandle_t handle, struct zone_anettab *tabptr)
3340 if ((err = operation_prep(handle)) != Z_OK)
3343 if ((err = zonecfg_add_anet_core(handle, tabptr)) != Z_OK)
3350 zonecfg_delete_anet_core(zone_dochandle_t handle, struct zone_anettab *tabptr)
3352 xmlNodePtr cur = handle->zone_dh_cur;
3362 if (match_prop(handle, cur, DTD_ATTR_LINKNAME,
3373 zonecfg_delete_anet(zone_dochandle_t handle, struct zone_anettab *tabptr)
3380 if ((err = operation_prep(handle)) != Z_OK)
3383 if ((err = zonecfg_delete_anet_core(handle, tabptr)) != Z_OK)
3390 zonecfg_modify_anet(zone_dochandle_t handle,
3398 if ((err = operation_prep(handle)) != Z_OK)
3401 if ((err = zonecfg_delete_anet_core(handle, oldtabptr)) != Z_OK)
3404 if ((err = zonecfg_add_anet_core(handle, newtabptr)) != Z_OK)
3450 zonecfg_get_fs_allowed(zone_dochandle_t handle, char *bufp, size_t buflen)
3454 if ((err = getrootattr(handle, DTD_ATTR_FS_ALLOWED,
3463 zonecfg_set_fs_allowed(zone_dochandle_t handle, const char *bufp)
3468 return (setrootattr(handle, DTD_ATTR_FS_ALLOWED, bufp));
3525 zonecfg_get_hostid(zone_dochandle_t handle, char *bufp, size_t buflen)
3529 if ((err = getrootattr(handle, DTD_ATTR_HOSTID, bufp, buflen)) != Z_OK)
3543 zonecfg_set_hostid(zone_dochandle_t handle, const char *hostidp)
3552 return (setrootattr(handle, DTD_ATTR_HOSTID, hostidp));
3557 zonecfg_lookup_dev(zone_dochandle_t handle, struct zone_devtab *tabptr)
3566 if ((err = operation_prep(handle)) != Z_OK)
3569 cur = handle->zone_dh_cur;
3576 (fetchprop(handle, cur, DTD_ATTR_MATCH, val,
3594 (fetchprop(handle, cur, DTD_ATTR_ALLOW_PARTITION, val,
3612 (fetchprop(handle, cur, DTD_ATTR_ALLOW_RAW_IO, val,
3634 if ((err = fetchprop(handle, cur, DTD_ATTR_MATCH,
3638 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOW_PARTITION,
3642 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOW_RAW_IO,
3650 zonecfg_add_dev_core(zone_dochandle_t handle, struct zone_devtab *tabptr)
3652 xmlNodePtr newnode, cur = handle->zone_dh_cur;
3655 if ((err = newres(handle, cur, &newnode, DTD_ELEM_DEVICE)) != Z_OK)
3657 if ((err = newprop(handle, newnode, DTD_ATTR_MATCH,
3661 if ((err = newprop(handle, newnode, DTD_ATTR_ALLOW_PARTITION,
3667 if ((err = newprop(handle, newnode, DTD_ATTR_ALLOW_RAW_IO,
3676 zonecfg_add_dev(zone_dochandle_t handle, struct zone_devtab *tabptr)
3683 if ((err = operation_prep(handle)) != Z_OK)
3686 if ((err = zonecfg_add_dev_core(handle, tabptr)) != Z_OK)
3693 zonecfg_delete_dev_core(zone_dochandle_t handle, struct zone_devtab *tabptr)
3695 xmlNodePtr cur = handle->zone_dh_cur;
3704 match_match = match_prop(handle, cur, DTD_ATTR_MATCH,
3706 partition_match = match_prop(handle, cur,
3708 raw_io_match = match_prop(handle, cur, DTD_ATTR_ALLOW_RAW_IO,
3721 zonecfg_delete_dev(zone_dochandle_t handle, struct zone_devtab *tabptr)
3728 if ((err = operation_prep(handle)) != Z_OK)
3731 if ((err = zonecfg_delete_dev_core(handle, tabptr)) != Z_OK)
3739 zone_dochandle_t handle,
3748 if ((err = operation_prep(handle)) != Z_OK)
3751 if ((err = zonecfg_delete_dev_core(handle, oldtabptr)) != Z_OK)
3754 if ((err = zonecfg_add_dev_core(handle, newtabptr)) != Z_OK)
3761 zonecfg_add_auth_core(zone_dochandle_t handle, struct zone_admintab *tabptr,
3764 xmlNodePtr newnode, cur = handle->zone_dh_cur;
3767 if ((err = newres(handle, cur, &newnode, DTD_ELEM_ADMIN)) != Z_OK)
3769 if ((err = newprop(handle, newnode, DTD_ATTR_USER,
3772 err = newprop(handle, newnode, DTD_ATTR_AUTHS,
3778 handle, tabptr->zone_admin_user, zonename, B_FALSE)) != Z_OK)
3784 zonecfg_add_admin(zone_dochandle_t handle, struct zone_admintab *tabptr,
3792 if ((err = operation_prep(handle)) != Z_OK)
3795 if ((err = zonecfg_add_auth_core(handle, tabptr, zonename)) != Z_OK)
3801 zonecfg_delete_auth_core(zone_dochandle_t handle, struct zone_admintab *tabptr,
3804 xmlNodePtr cur = handle->zone_dh_cur;
3811 auth_match = match_prop(handle, cur, DTD_ATTR_USER,
3815 handle, tabptr->zone_admin_user,
3827 zonecfg_delete_admin(zone_dochandle_t handle, struct zone_admintab *tabptr,
3835 if ((err = operation_prep(handle)) != Z_OK)
3838 if ((err = zonecfg_delete_auth_core(handle, tabptr, zonename)) != Z_OK)
3845 zonecfg_modify_admin(zone_dochandle_t handle, struct zone_admintab *oldtabptr,
3853 if ((err = operation_prep(handle)) != Z_OK)
3856 if ((err = zonecfg_delete_auth_core(handle, oldtabptr, zonename))
3860 if ((err = zonecfg_add_auth_core(handle, newtabptr, zonename)) != Z_OK)
3867 zonecfg_lookup_admin(zone_dochandle_t handle, struct zone_admintab *tabptr)
3876 if ((err = operation_prep(handle)) != Z_OK)
3879 cur = handle->zone_dh_cur;
3885 if ((fetchprop(handle, cur, DTD_ATTR_USER, user,
3900 if ((err = fetchprop(handle, cur, DTD_ATTR_USER,
3905 if ((err = fetchprop(handle, cur, DTD_ATTR_AUTHS,
3971 zonecfg_lookup_attr(zone_dochandle_t handle, struct zone_attrtab *tabptr)
3980 if ((err = operation_prep(handle)) != Z_OK)
3983 cur = handle->zone_dh_cur;
3989 if ((fetchprop(handle, cur, DTD_ATTR_NAME, name,
3999 if ((fetchprop(handle, cur, DTD_ATTR_TYPE, type,
4017 if ((fetchprop(handle, cur, DTD_ATTR_VALUE, value,
4041 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME, tabptr->zone_attr_name,
4045 if ((err = fetchprop(handle, cur, DTD_ATTR_TYPE, tabptr->zone_attr_type,
4049 if ((err = fetchprop(handle, cur, DTD_ATTR_VALUE,
4058 zonecfg_add_attr_core(zone_dochandle_t handle, struct zone_attrtab *tabptr)
4060 xmlNodePtr newnode, cur = handle->zone_dh_cur;
4063 if ((err = newres(handle, cur, &newnode, DTD_ELEM_ATTR)) != Z_OK)
4065 if ((err = newprop(handle, newnode, DTD_ATTR_NAME,
4068 if ((err = newprop(handle, newnode, DTD_ATTR_TYPE,
4071 if ((err = newprop(handle, newnode, DTD_ATTR_VALUE,
4078 zonecfg_add_attr(zone_dochandle_t handle, struct zone_attrtab *tabptr)
4085 if ((err = operation_prep(handle)) != Z_OK)
4088 if ((err = zonecfg_add_attr_core(handle, tabptr)) != Z_OK)
4095 zonecfg_delete_attr_core(zone_dochandle_t handle, struct zone_attrtab *tabptr)
4097 xmlNodePtr cur = handle->zone_dh_cur;
4104 name_match = match_prop(handle, cur, DTD_ATTR_NAME,
4106 type_match = match_prop(handle, cur, DTD_ATTR_TYPE,
4108 value_match = match_prop(handle, cur, DTD_ATTR_VALUE,
4121 zonecfg_delete_attr(zone_dochandle_t handle, struct zone_attrtab *tabptr)
4128 if ((err = operation_prep(handle)) != Z_OK)
4131 if ((err = zonecfg_delete_attr_core(handle, tabptr)) != Z_OK)
4139 zone_dochandle_t handle,
4148 if ((err = operation_prep(handle)) != Z_OK)
4151 if ((err = zonecfg_delete_attr_core(handle, oldtabptr)) != Z_OK)
4154 if ((err = zonecfg_add_attr_core(handle, newtabptr)) != Z_OK)
4246 zonecfg_lookup_rctl(zone_dochandle_t handle, struct zone_rctltab *tabptr)
4256 if ((err = operation_prep(handle)) != Z_OK)
4259 cur = handle->zone_dh_cur;
4263 if ((fetchprop(handle, cur, DTD_ATTR_NAME, savedname,
4273 if ((fetchprop(handle, val, DTD_ATTR_PRIV,
4278 if ((fetchprop(handle, val, DTD_ATTR_LIMIT,
4283 if ((fetchprop(handle, val, DTD_ATTR_ACTION,
4299 zonecfg_add_rctl_core(zone_dochandle_t handle, struct zone_rctltab *tabptr)
4301 xmlNodePtr newnode, cur = handle->zone_dh_cur, valnode;
4305 if ((err = newres(handle, cur, &newnode, DTD_ELEM_RCTL)) != Z_OK)
4307 err = newprop(handle, newnode, DTD_ATTR_NAME, tabptr->zone_rctl_name);
4315 err = newprop(handle, valnode, DTD_ATTR_PRIV,
4319 err = newprop(handle, valnode, DTD_ATTR_LIMIT,
4323 err = newprop(handle, valnode, DTD_ATTR_ACTION,
4332 zonecfg_add_rctl(zone_dochandle_t handle, struct zone_rctltab *tabptr)
4339 if ((err = operation_prep(handle)) != Z_OK)
4342 if ((err = zonecfg_add_rctl_core(handle, tabptr)) != Z_OK)
4349 zonecfg_delete_rctl_core(zone_dochandle_t handle, struct zone_rctltab *tabptr)
4351 xmlNodePtr cur = handle->zone_dh_cur;
4357 if (match_prop(handle, cur, DTD_ATTR_NAME,
4368 zonecfg_delete_rctl(zone_dochandle_t handle, struct zone_rctltab *tabptr)
4375 if ((err = operation_prep(handle)) != Z_OK)
4378 if ((err = zonecfg_delete_rctl_core(handle, tabptr)) != Z_OK)
4386 zone_dochandle_t handle,
4395 if ((err = operation_prep(handle)) != Z_OK)
4398 if ((err = zonecfg_delete_rctl_core(handle, oldtabptr)) != Z_OK)
4401 if ((err = zonecfg_add_rctl_core(handle, newtabptr)) != Z_OK)
4485 return (dgettext(TEXT_DOMAIN, "Bad handle"));
4607 zonecfg_setent(zone_dochandle_t handle)
4612 if (handle == NULL)
4615 if ((err = operation_prep(handle)) != Z_OK) {
4616 handle->zone_dh_cur = NULL;
4619 cur = handle->zone_dh_cur;
4621 handle->zone_dh_cur = cur;
4626 zonecfg_endent(zone_dochandle_t handle)
4628 if (handle == NULL)
4631 handle->zone_dh_cur = handle->zone_dh_top;
4754 zonecfg_apply_rctls(char *zone_name, zone_dochandle_t handle)
4762 if ((err = zonecfg_setrctlent(handle)) != Z_OK)
4766 (void) zonecfg_endrctlent(handle);
4771 (void) zonecfg_endrctlent(handle);
4776 while (zonecfg_getrctlent(handle, &rctl) == Z_OK) {
4810 (void) zonecfg_endrctlent(handle);
4816 zonecfg_num_resources(zone_dochandle_t handle, const char *rsrc)
4825 if (zonecfg_setent(handle) != Z_OK)
4828 for (cur = handle->zone_dh_cur; cur != NULL; cur = cur->next)
4832 (void) zonecfg_endent(handle);
4838 zonecfg_del_all_resources(zone_dochandle_t handle, const char *rsrc)
4847 if ((err = zonecfg_setent(handle)) != Z_OK)
4850 cur = handle->zone_dh_cur;
4865 (void) zonecfg_endent(handle);
5303 zonecfg_bind_tmp_pool(zone_dochandle_t handle, zoneid_t zoneid, char *pool_err,
5316 err = zonecfg_lookup_pset(handle, &pset_tab);
5372 zonecfg_bind_pool(zone_dochandle_t handle, zoneid_t zoneid, char *pool_err,
5384 error = zonecfg_get_pool(handle, poolname, sizeof (poolname));
5436 zonecfg_get_poolname(zone_dochandle_t handle, char *zone, char *pool,
5442 err = zonecfg_lookup_pset(handle, &pset_tab);
5453 return (zonecfg_get_pool(handle, pool, poolsize));
5493 zonecfg_warn_poold(zone_dochandle_t handle)
5499 err = zonecfg_lookup_pset(handle, &pset_tab);
5582 zonecfg_get_dflt_sched_class(zone_dochandle_t handle, char *class, int clsize)
5586 if (zonecfg_get_pool(handle, poolname, sizeof (poolname)) == Z_OK) {
5599 zonecfg_setfsent(zone_dochandle_t handle)
5601 return (zonecfg_setent(handle));
5605 find_elem_node(zone_dochandle_t handle, const xmlChar *elem)
5615 if (get_brand_handle(handle, &bh) != Z_OK)
5625 if ((cur = handle->zone_dh_cur) != NULL) {
5635 zonecfg_getfsent(zone_dochandle_t handle, struct zone_fstab *tabptr)
5641 if (handle == NULL)
5644 cur = find_elem_node(handle, DTD_ELEM_FS);
5646 handle->zone_dh_cur = handle->zone_dh_top;
5650 if ((err = fetchprop(handle, cur, DTD_ATTR_SPECIAL,
5653 handle->zone_dh_cur = handle->zone_dh_top;
5657 if ((err = fetchprop(handle, cur, DTD_ATTR_RAW, tabptr->zone_fs_raw,
5659 handle->zone_dh_cur = handle->zone_dh_top;
5663 if ((err = fetchprop(handle, cur, DTD_ATTR_DIR, tabptr->zone_fs_dir,
5665 handle->zone_dh_cur = handle->zone_dh_top;
5669 if ((err = fetchprop(handle, cur, DTD_ATTR_TYPE, tabptr->zone_fs_type,
5671 handle->zone_dh_cur = handle->zone_dh_top;
5679 if (fetchprop(handle, options, DTD_ATTR_NAME, options_str,
5686 handle->zone_dh_cur = cur->next;
5691 zonecfg_endfsent(zone_dochandle_t handle)
5693 return (zonecfg_endent(handle));
5697 zonecfg_setnetent(zone_dochandle_t handle)
5699 return (zonecfg_setent(handle));
5703 zonecfg_getnetent(zone_dochandle_t handle, struct zone_nettab *tabptr)
5708 if (handle == NULL)
5711 cur = find_elem_node(handle, DTD_ELEM_NET);
5713 handle->zone_dh_cur = handle->zone_dh_top;
5717 if ((err = fetchprop(handle, cur, DTD_ATTR_ADDRESS,
5720 handle->zone_dh_cur = handle->zone_dh_top;
5724 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_ADDRESS,
5727 handle->zone_dh_cur = handle->zone_dh_top;
5731 if ((err = fetchprop(handle, cur, DTD_ATTR_CONFIGURE_ALLOWED_ADDRESS,
5745 if ((err = fetchprop(handle, cur, DTD_ATTR_PHYSICAL,
5748 handle->zone_dh_cur = handle->zone_dh_top;
5752 if ((err = fetchprop(handle, cur, DTD_ATTR_DEFROUTER,
5755 handle->zone_dh_cur = handle->zone_dh_top;
5759 handle->zone_dh_cur = cur->next;
5764 zonecfg_endnetent(zone_dochandle_t handle)
5766 return (zonecfg_endent(handle));
5770 zonecfg_setanetent(zone_dochandle_t handle)
5772 return (zonecfg_setent(handle));
5776 zonecfg_getanetent(zone_dochandle_t handle, struct zone_anettab *tabptr)
5781 if (handle == NULL)
5784 cur = find_elem_node(handle, DTD_ELEM_ANET);
5786 handle->zone_dh_cur = handle->zone_dh_top;
5790 if ((err = fetchprop(handle, cur, DTD_ATTR_LINKNAME,
5793 handle->zone_dh_cur = handle->zone_dh_top;
5797 if ((err = fetchprop(handle, cur, DTD_ATTR_LOWER_LINK,
5800 handle->zone_dh_cur = handle->zone_dh_top;
5804 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_ADDRESS,
5807 handle->zone_dh_cur = handle->zone_dh_top;
5811 if ((err = fetchprop(handle, cur, DTD_ATTR_CONFIGURE_ALLOWED_ADDRESS,
5825 if ((err = fetchprop(handle, cur, DTD_ATTR_DEFROUTER,
5828 handle->zone_dh_cur = handle->zone_dh_top;
5832 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOWED_DHCP_CIDS,
5835 handle->zone_dh_cur = handle->zone_dh_top;
5839 if ((err = fetchprop(handle, cur, DTD_ATTR_LINK_PROTECTION,
5842 handle->zone_dh_cur = handle->zone_dh_top;
5846 if ((err = fetchprop(handle, cur, DTD_ATTR_AUTO_MAC_ADDRESS,
5849 handle->zone_dh_cur = handle->zone_dh_top;
5853 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_ADDRESS,
5856 handle->zone_dh_cur = handle->zone_dh_top;
5860 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_PREFIX,
5863 handle->zone_dh_cur = handle->zone_dh_top;
5867 if ((err = fetchprop(handle, cur, DTD_ATTR_MAC_SLOT,
5870 handle->zone_dh_cur = handle->zone_dh_top;
5874 if ((err = fetchprop(handle, cur, DTD_ATTR_VLAN_ID,
5877 handle->zone_dh_cur = handle->zone_dh_top;
5881 if ((err = fetchprop(handle, cur, DTD_ATTR_PRIORITY,
5884 handle->zone_dh_cur = handle->zone_dh_top;
5888 if ((err = fetchprop(handle, cur, DTD_ATTR_RXRINGS,
5891 handle->zone_dh_cur = handle->zone_dh_top;
5895 if ((err = fetchprop(handle, cur, DTD_ATTR_TXRINGS,
5898 handle->zone_dh_cur = handle->zone_dh_top;
5902 if ((err = fetchprop(handle, cur, DTD_ATTR_MTU,
5905 handle->zone_dh_cur = handle->zone_dh_top;
5909 if ((err = fetchprop(handle, cur, DTD_ATTR_MAXBW,
5912 handle->zone_dh_cur = handle->zone_dh_top;
5916 if ((err = fetchprop(handle, cur, DTD_ATTR_RXFANOUT,
5919 handle->zone_dh_cur = handle->zone_dh_top;
5923 if ((err = fetchprop(handle, cur, DTD_ATTR_VSITYPEID,
5926 handle->zone_dh_cur = handle->zone_dh_top;
5930 if ((err = fetchprop(handle, cur, DTD_ATTR_VSIVERS,
5933 handle->zone_dh_cur = handle->zone_dh_top;
5937 if ((err = fetchprop(handle, cur, DTD_ATTR_VSIMGRID,
5940 handle->zone_dh_cur = handle->zone_dh_top;
5944 if ((err = fetchprop(handle, cur, DTD_ATTR_ETSBWLCL,
5947 handle->zone_dh_cur = handle->zone_dh_top;
5951 if ((err = fetchprop(handle, cur, DTD_ATTR_COS,
5954 handle->zone_dh_cur = handle->zone_dh_top;
5958 if ((err = fetchprop(handle, cur, DTD_ATTR_PKEY,
5961 handle->zone_dh_cur = handle->zone_dh_top;
5965 if ((err = fetchprop(handle, cur, DTD_ATTR_LINKMODE,
5968 handle->zone_dh_cur = handle->zone_dh_top;
5972 handle->zone_dh_cur = cur->next;
5978 zonecfg_endanetent(zone_dochandle_t handle)
5980 return (zonecfg_endent(handle));
5984 zonecfg_setdevent(zone_dochandle_t handle)
5986 return (zonecfg_setent(handle));
5990 zonecfg_getdevent(zone_dochandle_t handle, struct zone_devtab *tabptr)
5995 if (handle == NULL)
5998 cur = find_elem_node(handle, DTD_ELEM_DEVICE);
6000 handle->zone_dh_cur = handle->zone_dh_top;
6004 if ((err = fetchprop(handle, cur, DTD_ATTR_MATCH,
6007 handle->zone_dh_cur = handle->zone_dh_top;
6010 if ((err = fetchprop(handle, cur, DTD_ATTR_ALLOW_PARTITION,
6013 handle->zone_dh_cur = handle->zone_dh_top;
6016 if ((err = fetchprop(handle, cur,
6019 handle->zone_dh_cur = handle->zone_dh_top;
6023 handle->zone_dh_cur = cur->next;
6028 zonecfg_enddevent(zone_dochandle_t handle)
6030 return (zonecfg_endent(handle));
6034 zonecfg_setrctlent(zone_dochandle_t handle)
6036 return (zonecfg_setent(handle));
6040 zonecfg_getrctlent(zone_dochandle_t handle, struct zone_rctltab *tabptr)
6046 if (handle == NULL)
6049 cur = find_elem_node(handle, DTD_ELEM_RCTL);
6051 handle->zone_dh_cur = handle->zone_dh_top;
6055 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME, tabptr->zone_rctl_name,
6057 handle->zone_dh_cur = handle->zone_dh_top;
6067 if (fetchprop(handle, val, DTD_ATTR_PRIV,
6071 if (fetchprop(handle, val, DTD_ATTR_LIMIT,
6075 if (fetchprop(handle, val, DTD_ATTR_ACTION,
6083 handle->zone_dh_cur = cur->next;
6088 zonecfg_endrctlent(zone_dochandle_t handle)
6090 return (zonecfg_endent(handle));
6094 zonecfg_setattrent(zone_dochandle_t handle)
6096 return (zonecfg_setent(handle));
6100 zonecfg_getattrent(zone_dochandle_t handle, struct zone_attrtab *tabptr)
6105 if (handle == NULL)
6108 cur = find_elem_node(handle, DTD_ELEM_ATTR);
6110 handle->zone_dh_cur = handle->zone_dh_top;
6114 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME, tabptr->zone_attr_name,
6116 handle->zone_dh_cur = handle->zone_dh_top;
6120 if ((err = fetchprop(handle, cur, DTD_ATTR_TYPE, tabptr->zone_attr_type,
6122 handle->zone_dh_cur = handle->zone_dh_top;
6126 if ((err = fetchprop(handle, cur, DTD_ATTR_VALUE,
6129 handle->zone_dh_cur = handle->zone_dh_top;
6133 handle->zone_dh_cur = cur->next;
6138 zonecfg_endattrent(zone_dochandle_t handle)
6140 return (zonecfg_endent(handle));
6144 zonecfg_setadminent(zone_dochandle_t handle)
6146 return (zonecfg_setent(handle));
6150 zonecfg_getadminent(zone_dochandle_t handle, struct zone_admintab *tabptr)
6155 if (handle == NULL)
6158 cur = find_elem_node(handle, DTD_ELEM_ADMIN);
6160 handle->zone_dh_cur = handle->zone_dh_top;
6164 if ((err = fetchprop(handle, cur, DTD_ATTR_USER,
6167 handle->zone_dh_cur = handle->zone_dh_top;
6172 if ((err = fetchprop(handle, cur, DTD_ATTR_AUTHS,
6175 handle->zone_dh_cur = handle->zone_dh_top;
6179 handle->zone_dh_cur = cur->next;
6184 zonecfg_endadminent(zone_dochandle_t handle)
6186 return (zonecfg_endent(handle));
6320 priv_lists_create(zone_dochandle_t handle, char *brand, priv_lists_t **plpp,
6326 /* handle or brand must be set, but never both */
6327 assert((handle != NULL) || (brand != NULL));
6328 assert((handle == NULL) || (brand == NULL));
6330 if (handle == NULL) {
6334 if (get_brand_handle(handle, &bh) != Z_OK)
6413 zone_dochandle_t handle;
6428 if ((handle = zonecfg_init_handle()) == NULL)
6430 ret = zonecfg_get_handle(ZONE_SYS_DEFAULT_TMPL, handle);
6437 ret = zonecfg_get_handle(ZONE_OLD_SYS_DEFAULT_TMPL, handle);
6440 zonecfg_fini_handle(handle);
6443 ret = i_zonecfg_get_brand(handle, brand, brandsize);
6444 zonecfg_fini_handle(handle);
6600 zonecfg_get_privset(zone_dochandle_t handle, priv_set_t *privs,
6614 if ((err = zonecfg_get_limitpriv(handle, &limitpriv)) != Z_OK)
6617 if ((err = zonecfg_get_iptype(handle, &iptype)) != Z_OK)
6629 if ((err = priv_lists_create(handle, NULL, &plp, curr_iptype)) != Z_OK)
6659 zone_dochandle_t handle;
6702 if ((handle = zonecfg_init_handle()) == NULL)
6709 if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
6710 if ((err = zonecfg_get_handle(zone_name, handle)) != Z_OK) {
6711 zonecfg_fini_handle(handle);
6715 err = zonecfg_get_zonepath(handle, zonepath, rp_sz);
6716 zonecfg_fini_handle(handle);
6739 zone_dochandle_t handle;
6770 if ((handle = zonecfg_init_handle()) == NULL)
6773 err = zonecfg_get_handle((char *)zone_name, handle);
6775 err = zonecfg_get_brand(handle, brandname, rp_sz);
6777 zonecfg_fini_handle(handle);
7527 zonecfg_notify_unbind(void *handle)
7532 (void) sysevent_evc_unbind(((struct znotify *)handle)->zn_eventchan);
7537 ret = pthread_mutex_trylock(&((struct znotify *)handle)->zn_mutex);
7542 (void) pthread_mutex_unlock(&((struct znotify *)handle)->zn_mutex);
7543 (void) pthread_mutex_destroy(&((struct znotify *)handle)->zn_mutex);
7544 (void) pthread_cond_destroy(&((struct znotify *)handle)->zn_cond);
7545 (void) pthread_mutex_destroy(&((struct znotify *)handle)->zn_bigmutex);
7547 free(handle);
7551 zonecfg_add_ds_core(zone_dochandle_t handle, struct zone_dstab *tabptr)
7553 xmlNodePtr newnode, cur = handle->zone_dh_cur;
7556 if ((err = newres(handle, cur, &newnode, DTD_ELEM_DATASET)) != Z_OK)
7558 if ((err = newprop(handle, newnode, DTD_ATTR_NAME,
7561 if ((err = newprop(handle, newnode, DTD_ATTR_ALIAS,
7568 zonecfg_add_ds(zone_dochandle_t handle, struct zone_dstab *tabptr)
7575 if ((err = operation_prep(handle)) != Z_OK)
7578 if ((err = zonecfg_add_ds_core(handle, tabptr)) != Z_OK)
7585 zonecfg_delete_ds_core(zone_dochandle_t handle, struct zone_dstab *tabptr)
7587 xmlNodePtr cur = handle->zone_dh_cur;
7593 if (match_prop(handle, cur, DTD_ATTR_NAME,
7604 zonecfg_delete_ds(zone_dochandle_t handle, struct zone_dstab *tabptr)
7611 if ((err = operation_prep(handle)) != Z_OK)
7614 if ((err = zonecfg_delete_ds_core(handle, tabptr)) != Z_OK)
7622 zone_dochandle_t handle,
7631 if ((err = operation_prep(handle)) != Z_OK)
7634 if ((err = zonecfg_delete_ds_core(handle, oldtabptr)) != Z_OK)
7637 if ((err = zonecfg_add_ds_core(handle, newtabptr)) != Z_OK)
7644 zonecfg_lookup_ds(zone_dochandle_t handle, struct zone_dstab *tabptr)
7653 if ((err = operation_prep(handle)) != Z_OK)
7656 cur = handle->zone_dh_cur;
7662 if ((fetchprop(handle, cur, DTD_ATTR_NAME, name,
7672 if ((fetchprop(handle, cur, DTD_ATTR_ALIAS, name,
7687 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME,
7691 if ((err = fetchprop(handle, cur, DTD_ATTR_ALIAS,
7700 zonecfg_setdsent(zone_dochandle_t handle)
7702 return (zonecfg_setent(handle));
7706 zonecfg_getdsent(zone_dochandle_t handle, struct zone_dstab *tabptr)
7711 if (handle == NULL)
7714 cur = find_elem_node(handle, DTD_ELEM_DATASET);
7716 handle->zone_dh_cur = handle->zone_dh_top;
7720 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME,
7723 handle->zone_dh_cur = handle->zone_dh_top;
7727 if (fetchprop(handle, cur, DTD_ATTR_ALIAS, tabptr->zone_dataset_alias,
7732 handle->zone_dh_cur = cur->next;
7737 zonecfg_enddsent(zone_dochandle_t handle)
7739 return (zonecfg_endent(handle));
7759 zonecfg_get_aliased_rctl(zone_dochandle_t handle, const char *name,
7777 if ((err = operation_prep(handle)) != Z_OK)
7780 cur = handle->zone_dh_cur;
7784 if ((fetchprop(handle, cur, DTD_ATTR_NAME, savedname,
7806 if ((fetchprop(handle, val, DTD_ATTR_PRIV,
7810 if ((fetchprop(handle, val, DTD_ATTR_LIMIT,
7814 if ((fetchprop(handle, val, DTD_ATTR_ACTION,
7838 zonecfg_rm_aliased_rctl(zone_dochandle_t handle, char *name)
7850 if (zonecfg_get_aliased_rctl(handle, name, &val) != Z_OK)
7863 return (zonecfg_delete_rctl(handle, &rctltab));
7867 zonecfg_aliased_rctl_ok(zone_dochandle_t handle, char *name)
7871 switch (zonecfg_get_aliased_rctl(handle, name, &tmp_val)) {
7882 zonecfg_set_aliased_rctl(zone_dochandle_t handle, char *name, uint64_t val)
7890 if (!zonecfg_aliased_rctl_ok(handle, name))
7901 (void) zonecfg_rm_aliased_rctl(handle, name);
7925 return (zonecfg_add_rctl(handle, &rctltab));
7929 delete_tmp_pool(zone_dochandle_t handle)
7932 xmlNodePtr cur = handle->zone_dh_cur;
7934 if ((err = operation_prep(handle)) != Z_OK)
7949 modify_tmp_pool(zone_dochandle_t handle, char *pool_importance)
7952 xmlNodePtr cur = handle->zone_dh_cur;
7955 err = delete_tmp_pool(handle);
7960 if ((err = operation_prep(handle)) != Z_OK)
7964 if ((err = newprop(handle, newnode, DTD_ATTR_IMPORTANCE,
7973 add_pset_core(zone_dochandle_t handle, struct zone_psettab *tabptr)
7975 xmlNodePtr newnode, cur = handle->zone_dh_cur;
7979 if ((err = newprop(handle, newnode, DTD_ATTR_NCPU_MIN,
7982 if ((err = newprop(handle, newnode, DTD_ATTR_NCPU_MAX,
7986 if ((err = modify_tmp_pool(handle, tabptr->zone_importance)) != Z_OK)
7993 zonecfg_add_pset(zone_dochandle_t handle, struct zone_psettab *tabptr)
8000 if ((err = operation_prep(handle)) != Z_OK)
8003 if ((err = add_pset_core(handle, tabptr)) != Z_OK)
8010 zonecfg_delete_pset(zone_dochandle_t handle)
8014 xmlNodePtr cur = handle->zone_dh_cur;
8016 if ((err = operation_prep(handle)) != Z_OK)
8032 err = delete_tmp_pool(handle);
8040 zonecfg_modify_pset(zone_dochandle_t handle, struct zone_psettab *tabptr)
8047 if ((err = zonecfg_delete_pset(handle)) != Z_OK)
8050 if ((err = add_pset_core(handle, tabptr)) != Z_OK)
8057 zonecfg_lookup_pset(zone_dochandle_t handle, struct zone_psettab *tabptr)
8066 if ((err = operation_prep(handle)) != Z_OK)
8072 cur = handle->zone_dh_cur;
8075 if ((err = fetchprop(handle, cur, DTD_ATTR_NCPU_MIN,
8078 handle->zone_dh_cur = handle->zone_dh_top;
8082 if ((err = fetchprop(handle, cur, DTD_ATTR_NCPU_MAX,
8085 handle->zone_dh_cur = handle->zone_dh_top;
8092 if ((err = fetchprop(handle, cur, DTD_ATTR_IMPORTANCE,
8095 handle->zone_dh_cur = handle->zone_dh_top;
8105 zonecfg_getpsetent(zone_dochandle_t handle, struct zone_psettab *tabptr)
8109 if ((err = zonecfg_setent(handle)) != Z_OK)
8112 err = zonecfg_lookup_pset(handle, tabptr);
8114 (void) zonecfg_endent(handle);
8120 add_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
8122 xmlNodePtr newnode, cur = handle->zone_dh_cur;
8125 if ((err = newres(handle, cur, &newnode, DTD_ELEM_MCAP)) != Z_OK)
8127 if ((err = newprop(handle, newnode, DTD_ATTR_PHYSCAP,
8135 zonecfg_delete_mcap(zone_dochandle_t handle)
8138 xmlNodePtr cur = handle->zone_dh_cur;
8140 if ((err = operation_prep(handle)) != Z_OK)
8155 zonecfg_modify_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
8162 err = zonecfg_delete_mcap(handle);
8167 if ((err = add_mcap(handle, tabptr)) != Z_OK)
8174 zonecfg_lookup_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
8182 if ((err = operation_prep(handle)) != Z_OK)
8185 cur = handle->zone_dh_cur;
8189 if ((err = fetchprop(handle, cur, DTD_ATTR_PHYSCAP,
8192 handle->zone_dh_cur = handle->zone_dh_top;
8203 getmcapent_core(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
8208 if (handle == NULL)
8211 cur = find_elem_node(handle, DTD_ELEM_MCAP);
8213 handle->zone_dh_cur = handle->zone_dh_top;
8217 if ((err = fetchprop(handle, cur, DTD_ATTR_PHYSCAP,
8220 handle->zone_dh_cur = handle->zone_dh_top;
8224 handle->zone_dh_cur = cur->next;
8229 zonecfg_getmcapent(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
8233 if ((err = zonecfg_setent(handle)) != Z_OK)
8236 err = getmcapent_core(handle, tabptr);
8238 (void) zonecfg_endent(handle);
8825 zonecfg_delete_admins(zone_dochandle_t handle, char *zonename)
8831 if ((err = zonecfg_setadminent(handle)) != Z_OK) {
8834 while (zonecfg_getadminent(handle, &admintab) == Z_OK) {
8835 err = zonecfg_delete_admin(handle, &admintab,
8838 (void) zonecfg_endadminent(handle);
8843 if ((err = zonecfg_setadminent(handle)) != Z_OK) {
8847 (void) zonecfg_endadminent(handle);
8891 zonecfg_update_userauths(zone_dochandle_t handle, char *zonename)
8933 if ((err = zonecfg_delete_admins(handle, zonename)) == Z_OK) {
8977 err = zonecfg_add_admin(handle,
9080 * element of the handle strcture.
9083 zonecfg_authorize_user_impl(zone_dochandle_t handle, char *user,
9134 if (is_renaming(handle))
9135 delete_name = handle->zone_dh_delete_name;
9175 (void) zonecfg_remove_userauths(handle, user, "", B_FALSE);
9232 zonecfg_authorize_users(zone_dochandle_t handle, char *zonename)
9239 if ((err = operation_prep(handle)) != Z_OK)
9242 cur = handle->zone_dh_cur;
9246 if (fetchprop(handle, cur, DTD_ATTR_USER, user,
9249 if (fetchprop(handle, cur, DTD_ATTR_AUTHS, auths,
9252 if (zonecfg_authorize_user_impl(handle, user, auths, zonename)
9256 (void) zonecfg_remove_userauths(handle, "", "", B_TRUE);
9262 zonecfg_deauthorize_user(zone_dochandle_t handle, char *user, char *zonename)
9264 return (zonecfg_authorize_user_impl(handle, user, "", zonename));
9268 zonecfg_deauthorize_users(zone_dochandle_t handle, char *zonename)
9274 if ((err = operation_prep(handle)) != Z_OK)
9277 cur = handle->zone_dh_cur;
9281 if (fetchprop(handle, cur, DTD_ATTR_USER, user,
9284 if ((err = zonecfg_deauthorize_user(handle, user,
9292 zonecfg_insert_userauths(zone_dochandle_t handle, char *user, char *zonename)
9296 prev = &handle->zone_dh_userauths;
9323 zonecfg_remove_userauths(zone_dochandle_t handle, char *user, char *zonename,
9328 prev = &handle->zone_dh_userauths;
9340 (void) zonecfg_deauthorize_user(handle,
9574 zonecfg_fetch_rootzpool_storage(zone_dochandle_t handle, xmlNodePtr cur,
9583 if ((err = fetchprop(handle, src, DTD_ATTR_URI,
9595 zonecfg_fetch_zpool_storage(zone_dochandle_t handle, xmlNodePtr cur,
9604 if ((err = fetchprop(handle, src, DTD_ATTR_URI,
9616 zonecfg_add_storage_node(zone_dochandle_t handle, xmlNodePtr newnode,
9622 if ((err = newres(handle, newnode, &storagenode, DTD_ELEM_STORAGE)))
9625 return (newprop(handle, storagenode, DTD_ATTR_URI,
9630 zonecfg_lookup_rootzpool(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9638 if ((err = operation_prep(handle)) != Z_OK)
9644 cur = handle->zone_dh_cur;
9656 zonecfg_fetch_rootzpool_storage(handle, cur, &temp_rzptab)
9686 if ((err = zonecfg_fetch_rootzpool_storage(handle, cur,
9690 if (fetchprop(handle, cur, DTD_ATTR_INSTALL_SIZE,
9699 zonecfg_lookup_zpool(zone_dochandle_t handle, zone_zptab_t *tabptr)
9708 if ((err = operation_prep(handle)) != Z_OK)
9715 cur = handle->zone_dh_cur;
9728 zonecfg_fetch_zpool_storage(handle, cur,
9741 (fetchprop(handle, cur, DTD_ATTR_NAME, name, sizeof (name))
9764 if ((err = zonecfg_fetch_zpool_storage(handle, cur, tabptr)) != Z_OK)
9766 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME, tabptr->zone_zp_name,
9770 if (fetchprop(handle, cur, DTD_ATTR_INSTALL_SIZE,
9784 zonecfg_delete_rootzpool_core(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9786 xmlNodePtr cur = handle->zone_dh_cur;
9800 zonecfg_delete_rootzpool(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9806 if ((err = operation_prep(handle)) != Z_OK)
9808 return (zonecfg_delete_rootzpool_core(handle, tabptr));
9817 zonecfg_delete_zpool_core(zone_dochandle_t handle, zone_zptab_t *tabptr)
9819 xmlNodePtr cur = handle->zone_dh_cur;
9824 if (match_prop(handle, cur, DTD_ATTR_NAME,
9835 zonecfg_delete_zpool(zone_dochandle_t handle, zone_zptab_t *tabptr)
9841 if ((err = operation_prep(handle)) != Z_OK)
9843 return (zonecfg_delete_zpool_core(handle, tabptr));
9847 zonecfg_setrzpent(zone_dochandle_t handle)
9849 return (zonecfg_setent(handle));
9853 zonecfg_getrzpent(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9858 if ((tabptr == NULL) || (handle == NULL))
9861 cur = find_elem_node(handle, DTD_ELEM_ROOTZPOOL);
9863 handle->zone_dh_cur = handle->zone_dh_top;
9867 if ((err = zonecfg_fetch_rootzpool_storage(handle,
9869 handle->zone_dh_cur = handle->zone_dh_top;
9873 if (fetchprop(handle, cur, DTD_ATTR_INSTALL_SIZE,
9878 handle->zone_dh_cur = cur->next;
9883 zonecfg_endrzpent(zone_dochandle_t handle)
9885 return (zonecfg_endent(handle));
9889 zonecfg_setzpent(zone_dochandle_t handle)
9891 return (zonecfg_setent(handle));
9895 zonecfg_getzpent(zone_dochandle_t handle, zone_zptab_t *tabptr)
9900 if ((tabptr == NULL) || (handle == NULL))
9903 cur = find_elem_node(handle, DTD_ELEM_ZPOOL);
9905 handle->zone_dh_cur = handle->zone_dh_top;
9909 if ((err = zonecfg_fetch_zpool_storage(handle, cur, tabptr)) != Z_OK) {
9910 handle->zone_dh_cur = handle->zone_dh_top;
9913 if ((err = fetchprop(handle, cur, DTD_ATTR_NAME, tabptr->zone_zp_name,
9915 handle->zone_dh_cur = handle->zone_dh_top;
9919 if (fetchprop(handle, cur, DTD_ATTR_INSTALL_SIZE,
9924 handle->zone_dh_cur = cur->next;
9929 zonecfg_endzpent(zone_dochandle_t handle)
9931 return (zonecfg_endent(handle));
9935 zonecfg_add_rootzpool_core(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9938 xmlNodePtr cur = handle->zone_dh_cur;
9942 if ((err = newres(handle, cur, &newnode,
9946 if ((err = newprop(handle, newnode, DTD_ATTR_INSTALL_SIZE,
9951 if ((err = zonecfg_add_storage_node(handle,
9959 zonecfg_add_rootzpool(zone_dochandle_t handle, zone_rzptab_t *tabptr)
9965 if ((err = operation_prep(handle)) != Z_OK)
9967 return (zonecfg_add_rootzpool_core(handle, tabptr));
9971 zonecfg_add_zpool_core(zone_dochandle_t handle, zone_zptab_t *tabptr)
9974 xmlNodePtr cur = handle->zone_dh_cur;
9978 if ((err = newres(handle, cur, &newnode, DTD_ELEM_ZPOOL)) != Z_OK)
9981 if ((err = newprop(handle, newnode, DTD_ATTR_INSTALL_SIZE,
9984 if ((err = newprop(handle, newnode, DTD_ATTR_NAME,
9989 if ((err = zonecfg_add_storage_node(handle,
9997 zonecfg_add_zpool(zone_dochandle_t handle, zone_zptab_t *tabptr)
10003 if ((err = operation_prep(handle)) != Z_OK)
10005 return (zonecfg_add_zpool_core(handle, tabptr));
10009 zonecfg_modify_rootzpool(zone_dochandle_t handle, zone_rzptab_t *oldtabptr,
10016 if ((err = operation_prep(handle)) != Z_OK)
10018 if ((err = zonecfg_delete_rootzpool_core(handle, oldtabptr)) != Z_OK)
10020 if ((err = zonecfg_add_rootzpool_core(handle, newtabptr)) != Z_OK)
10026 zonecfg_modify_zpool(zone_dochandle_t handle, zone_zptab_t *oldtabptr,
10033 if ((err = operation_prep(handle)) != Z_OK)
10035 if ((err = zonecfg_delete_zpool_core(handle, oldtabptr)) != Z_OK)
10037 if ((err = zonecfg_add_zpool_core(handle, newtabptr)) != Z_OK)
10136 verify_mac_profile(zone_dochandle_t handle, char *prof)
10147 if (get_brand_handle(handle, &bh) != Z_OK)
10221 zonecfg_get_mac_lists(zone_dochandle_t handle, zone_maclist_t *ml)
10233 if ((err = zonecfg_get_mac_profile(handle, prof, sizeof (prof))) != 0)
10239 if (get_brand_handle(handle, &bh) != Z_OK)
10254 n = zonecfg_num_resources(handle, "fs");
10282 if ((err = zonecfg_setfsent(handle)) != Z_OK) {
10287 while (zonecfg_getfsent(handle, &fstab) == Z_OK) {
10293 (void) zonecfg_endfsent(handle);
10375 zonecfg_set_mac_profile(zone_dochandle_t handle, char *profile)
10379 if ((ret = verify_mac_profile(handle, profile)) != Z_OK) {
10380 (void) setrootattr(handle, DTD_ATTR_MAC_PROFILE, NULL);
10384 return (setrootattr(handle, DTD_ATTR_MAC_PROFILE, profile));
10388 zonecfg_get_mac_profile(zone_dochandle_t handle, char *prof, size_t profsz)
10390 return (getrootattr(handle, DTD_ATTR_MAC_PROFILE, prof, profsz));
10398 zonecfg_iter_resource(zone_dochandle_t handle,
10404 if ((ret = getroot(handle, &root)) != Z_OK)
10426 zonecfg_iter_property(zone_dochandle_t handle,
10434 if ((ret = getroot(handle, &root)) != Z_OK)