Lines Matching defs:table

226 	avl_node_t zpd_link;		/* property table linkage */
338 zprop_lookup_impl(avl_tree_t *table, nvlist_t *default_sublists,
353 found = avl_find(table, &zpd, &index);
362 found = avl_find(table, &zpd, &index);
448 found = avl_find(table, &zpd, &index);
458 found = avl_find(table, &zpd, &index);
486 err = zprop_lookup_impl(table, default_sublists, buf, spec,
504 zprop_lookup_node_impl(zprop_table_t *table, const char *name,
515 while ((pair = nvlist_next_nvpair(table->zpt_default_sublists,
540 (void) no_memory(table->zpt_libzfs);
549 err = zprop_lookup_impl(&table->zpt_props, table->zpt_default_sublists,
552 (void) no_memory(table->zpt_libzfs); /* abort */
570 zprop_lookup_node(zprop_table_t *table, const char *name, zprop_spec_t spec,
573 int err = zprop_lookup_node_impl(table, name, spec, xpp);
602 err = zprop_lookup_node_impl(table, buf,
613 zprop_lookup_spec(zprop_table_t *table, const char *name, zprop_spec_t spec,
619 err = zprop_lookup_node(table, name, spec, &found);
660 zprop_iter_impl(zprop_table_t *table, const char *sublist,
667 /* walk the entire table */
668 for (zpd = avl_first(&table->zpt_props); zpd != NULL;
669 zpd = AVL_NEXT(&table->zpt_props, zpd)) {
681 rc = zprop_lookup_node(table, sublist, ZPROP_SUBLIST, &zpd);
703 zprop_id_lookup(zprop_table_t *table, int id)
705 if (id < 0 || id >= table->zpt_prop_seq)
708 return (table->zpt_array[id]);
712 zprop_id_to_name(zprop_table_t *table, int id)
716 zpd = zprop_id_lookup(table, id);
721 zprop_name_to_id(zprop_table_t *table, const char *name)
725 if (zprop_lookup_spec(table, name, ZPROP_PROPERTY, &zpd) != 0)
732 zprop_append(zprop_table_t *table, const zpropdef_t *zpd)
734 int n = table->zpt_array_slots;
736 int builtin = zc_get_numprops(table->zpt_type);
739 table->zpt_array_slots = (n += builtin);
740 table->zpt_array = zfs_realloc(table->zpt_libzfs,
741 table->zpt_array,
746 table->zpt_array[i] = zpd;
792 zprop_load_one(zprop_table_t *table, const char *propname, const char *owner,
804 int id = table->zpt_prop_seq++;
811 pnode = zfs_alloc(table->zpt_libzfs, sizeof (zpropdef_node_t));
812 name = zfs_alloc(table->zpt_libzfs, n + 1);
821 pd->pd_colname = zfs_strdup(table->zpt_libzfs, colname);
823 pnode->zpd_d.zpd_deleg = zfs_strdup(table->zpt_libzfs,
831 char **values = zfs_alloc(table->zpt_libzfs,
841 values[v] = zfs_strdup(table->zpt_libzfs,
850 pnode->zpd_d.zpd_owner = zfs_strdup(table->zpt_libzfs, owner);
859 anode = zfs_alloc(table->zpt_libzfs,
862 aname = zfs_alloc(table->zpt_libzfs,
873 /* add the property alias to the table */
874 found = avl_find(&table->zpt_props, anode, &index);
882 avl_insert(&table->zpt_props, anode, index);
893 /* add the property entry to the table */
894 found = avl_find(&table->zpt_props, pnode, &index);
901 avl_insert(&table->zpt_props, pnode, index);
902 zprop_append(table, &pnode->zpd_d);
905 name = zfs_strdup(table->zpt_libzfs, propname);
929 found = avl_find(&table->zpt_props, &zpd, &index);
934 snode = zfs_alloc(table->zpt_libzfs,
936 sname = zfs_alloc(table->zpt_libzfs, (cp - name) + 1);
938 sublist_avl = zfs_alloc(table->zpt_libzfs,
947 table->zpt_sublist_seq++;
951 avl_insert(&table->zpt_props, snode, index);
985 load_zfs_properties(zprop_table_t *table)
993 VERIFY3U(0, ==, zprop_load_one(table, pd->pd_name,
997 ASSERT(table->zpt_prop_seq == ZFS_NUM_PROPS);
1001 load_zpool_properties(zprop_table_t *table)
1009 VERIFY3U(0, ==, zprop_load_one(table, pd->pd_name,
1013 ASSERT(table->zpt_prop_seq == ZPOOL_NUM_PROPS);
1019 zprop_desc_alloc(zprop_table_t *table, const char *owner, nvpair_t *xprop,
1027 pd = zfs_alloc(table->zpt_libzfs, sizeof (zprop_desc_t));
1041 pd->pd_values = zfs_strdup(table->zpt_libzfs,
1055 pd->pd_strdefault = zfs_strdup(table->zpt_libzfs, strdefault);
1063 load_xprops(zprop_table_t *table, const char *owner, nvlist_t *xprops,
1073 err = zprop_desc_alloc(table, owner, pair, types, &pd);
1077 err = zprop_load_one(table, propname, owner, pair, pd);
1094 unload_zprops(zprop_table_t *table, const char *owner)
1099 while ((node = avl_destroy_nodes(&table->zpt_props, &cookie)) != NULL)
1105 zprop_add_default_sublist(zprop_table_t *table, const char *owner,
1114 if (table->zpt_default_sublists == NULL) {
1115 if ((err = nvlist_alloc(&table->zpt_default_sublists,
1120 if ((err = nvlist_add_boolean(table->zpt_default_sublists, name)) != 0)
1127 zprop_remove_default_sublist(zprop_table_t *table, const char *name)
1129 (void) nvlist_remove_all(table->zpt_default_sublists, name);
1133 load_default_sublists(zprop_table_t *table, const char *owner,
1142 err = zprop_add_default_sublist(table, owner, name);
1162 zprop_table_init(zprop_table_t *table, zfs_type_t type)
1164 avl_create(&table->zpt_props, zpropdef_node_cmp,
1167 table->zpt_type = type;
1168 table->zpt_default_sublists = NULL;
1169 table->zpt_prop_seq = 0;
1170 table->zpt_sublist_seq = 1; /* sublist id 0 is 'all' */
1171 table->zpt_array_slots = zc_get_numprops(type);
1172 table->zpt_array = zfs_alloc(table->zpt_libzfs,
1173 sizeof (zpropdef_t *) * table->zpt_array_slots);
1174 table->zpt_loaded = B_FALSE;
1176 (void) load_zpool_properties(table);
1178 (void) load_zfs_properties(table);
1183 zprop_table_fini(zprop_table_t *table)
1185 unload_zprops(table, NULL);
1186 avl_destroy(&table->zpt_props);
1187 nvlist_free(table->zpt_default_sublists);
1188 table->zpt_default_sublists = NULL;
1189 free(table->zpt_array);
1190 table->zpt_array = NULL;
1191 table->zpt_array_slots = 0;
1192 table->zpt_loaded = B_FALSE;
1217 zprop_table_t *table = zprop_get_table(hdl, type);
1224 if (table->zpt_loaded)
1243 err = load_xprops(table, owner, props, type);
1245 unload_zprops(table, owner);
1249 err = load_default_sublists(table, owner, default_sublists);
1256 zprop_table_t *table;
1258 table = &hdl->libzfs_props;
1259 table->zpt_loaded = B_TRUE;
1260 table = &hdl->libzfs_poolprops;
1261 table->zpt_loaded = B_TRUE;
1267 zprop_table_t *table = &hdl->libzfs_props;
1269 return (zprop_add_default_sublist(table, NULL, name));
1275 zprop_table_t *table = &hdl->libzfs_props;
1277 zprop_remove_default_sublist(table, name);
1299 zprop_table_t *table = zprop_get_table(hdl, type);
1300 return (zprop_iter_impl(table, sublist, descend_sublists, func, arg));
1307 zprop_table_t *table = zprop_get_table(hdl, type);
1308 return (zprop_lookup_spec(table, name, spec, xpp));
1314 zprop_table_t *table = zprop_get_table(hdl, type);
1319 count = table->zpt_prop_seq;
1322 count = (table->zpt_sublist_seq - 1);
1325 count = ((table->zpt_sublist_seq - 1) + table->zpt_prop_seq);
1331 count = (table->zpt_prop_seq - zc_get_numprops(type));