Lines Matching defs:hdl
66 namespace_clear(libzfs_handle_t *hdl)
68 if (hdl->libzfs_ns_avl) {
72 while ((cn = uu_avl_teardown(hdl->libzfs_ns_avl,
79 uu_avl_destroy(hdl->libzfs_ns_avl);
80 hdl->libzfs_ns_avl = NULL;
83 if (hdl->libzfs_ns_avlpool) {
84 uu_avl_pool_destroy(hdl->libzfs_ns_avlpool);
85 hdl->libzfs_ns_avlpool = NULL;
93 namespace_reload(libzfs_handle_t *hdl)
101 if (hdl->libzfs_ns_gen == 0) {
107 if ((hdl->libzfs_ns_avlpool = uu_avl_pool_create("config_pool",
111 return (no_memory(hdl));
113 if ((hdl->libzfs_ns_avl = uu_avl_create(hdl->libzfs_ns_avlpool,
115 return (no_memory(hdl));
118 if (zcmd_alloc_dst_nvlist(hdl, &zc, 0) != 0)
122 zc.zc_cookie = hdl->libzfs_ns_gen;
123 if (ioctl(hdl->libzfs_fd, ZFS_IOC_POOL_CONFIGS, &zc) != 0) {
133 if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
141 return (zpool_standard_error(hdl, errno,
146 hdl->libzfs_ns_gen = zc.zc_cookie;
151 if (zcmd_read_dst_nvlist(hdl, &zc, &config) != 0) {
162 while ((cn = uu_avl_teardown(hdl->libzfs_ns_avl, &cookie)) != NULL) {
173 if ((cn = zfs_alloc(hdl, sizeof (config_node_t))) == NULL) {
178 if ((cn->cn_name = zfs_strdup(hdl,
190 return (no_memory(hdl));
192 verify(uu_avl_find(hdl->libzfs_ns_avl, cn, NULL, &where)
195 uu_avl_insert(hdl->libzfs_ns_avl, cn, where);
226 libzfs_handle_t *hdl = zhp->zpool_hdl;
234 if (zcmd_alloc_dst_nvlist(hdl, &zc, zhp->zpool_config_size) != 0)
248 if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
261 if (zcmd_read_dst_nvlist(hdl, &zc, &config) != 0) {
302 zpool_iter(libzfs_handle_t *hdl, zpool_iter_f func, void *data)
314 if (!hdl->libzfs_pool_iter && namespace_reload(hdl) != 0)
317 hdl->libzfs_pool_iter++;
318 for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
319 cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
321 if (zpool_open_quiet(hdl, cn->cn_name, &zhp) != 0) {
322 hdl->libzfs_pool_iter--;
330 hdl->libzfs_pool_iter--;
334 hdl->libzfs_pool_iter--;
344 zfs_iter_root(libzfs_handle_t *hdl, zfs_iter_f func, void *data)
350 if (namespace_reload(hdl) != 0)
353 for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
354 cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
356 if ((zhp = make_dataset_handle(hdl, cn->cn_name)) == NULL)