Deleted Added
sdiff udiff text old ( 168404 ) new ( 168926 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 60 unchanged lines hidden (view full) ---

69 else
70 return (0);
71}
72
73void
74namespace_clear(libzfs_handle_t *hdl)
75{
76 if (hdl->libzfs_ns_avl) {
77 config_node_t *cn;
78 void *cookie = NULL;
79
80 while ((cn = uu_avl_teardown(hdl->libzfs_ns_avl,
81 &cookie)) != NULL) {
82 nvlist_free(cn->cn_config);
83 free(cn->cn_name);
84 free(cn);
85 }
86
87 uu_avl_destroy(hdl->libzfs_ns_avl);
88 hdl->libzfs_ns_avl = NULL;
89 }
90
91 if (hdl->libzfs_ns_avlpool) {
92 uu_avl_pool_destroy(hdl->libzfs_ns_avlpool);
93 hdl->libzfs_ns_avlpool = NULL;
94 }

--- 4 unchanged lines hidden (view full) ---

99 */
100static int
101namespace_reload(libzfs_handle_t *hdl)
102{
103 nvlist_t *config;
104 config_node_t *cn;
105 nvpair_t *elem;
106 zfs_cmd_t zc = { 0 };
107 void *cookie;
108
109 if (hdl->libzfs_ns_gen == 0) {
110 /*
111 * This is the first time we've accessed the configuration
112 * cache. Initialize the AVL tree and then fall through to the
113 * common code.
114 */
115 if ((hdl->libzfs_ns_avlpool = uu_avl_pool_create("config_pool",

--- 45 unchanged lines hidden (view full) ---

161 return (-1);
162 }
163
164 zcmd_free_nvlists(&zc);
165
166 /*
167 * Clear out any existing configuration information.
168 */
169 cookie = NULL;
170 while ((cn = uu_avl_teardown(hdl->libzfs_ns_avl, &cookie)) != NULL) {
171 nvlist_free(cn->cn_config);
172 free(cn->cn_name);
173 free(cn);
174 }
175
176 elem = NULL;
177 while ((elem = nvlist_next_nvpair(config, elem)) != NULL) {
178 nvlist_t *child;
179 uu_avl_index_t where;
180
181 if ((cn = zfs_alloc(hdl, sizeof (config_node_t))) == NULL) {
182 nvlist_free(config);
183 return (-1);

--- 19 unchanged lines hidden (view full) ---

203 uu_avl_insert(hdl->libzfs_ns_avl, cn, where);
204 }
205
206 nvlist_free(config);
207 return (0);
208}
209
210/*
211 * Retrieve the configuration for the given pool. The configuration is a nvlist
212 * describing the vdevs, as well as the statistics associated with each one.
213 */
214nvlist_t *
215zpool_get_config(zpool_handle_t *zhp, nvlist_t **oldconfig)
216{
217 if (oldconfig)
218 *oldconfig = zhp->zpool_old_config;
219 return (zhp->zpool_config);

--- 141 unchanged lines hidden ---