Deleted Added
full compact
zfeature.c (236884) zfeature.c (243674)
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

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

168
169/*
170 * Checks that the features active in the specified object are supported by
171 * this software. Adds each unsupported feature (name -> description) to
172 * the supplied nvlist.
173 */
174boolean_t
175feature_is_supported(objset_t *os, uint64_t obj, uint64_t desc_obj,
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

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

168
169/*
170 * Checks that the features active in the specified object are supported by
171 * this software. Adds each unsupported feature (name -> description) to
172 * the supplied nvlist.
173 */
174boolean_t
175feature_is_supported(objset_t *os, uint64_t obj, uint64_t desc_obj,
176 nvlist_t *unsup_feat)
176 nvlist_t *unsup_feat, nvlist_t *enabled_feat)
177{
178 boolean_t supported;
179 zap_cursor_t zc;
180 zap_attribute_t za;
181
182 supported = B_TRUE;
183 for (zap_cursor_init(&zc, os, obj);
184 zap_cursor_retrieve(&zc, &za) == 0;
185 zap_cursor_advance(&zc)) {
186 ASSERT(za.za_integer_length == sizeof (uint64_t) &&
187 za.za_num_integers == 1);
188
177{
178 boolean_t supported;
179 zap_cursor_t zc;
180 zap_attribute_t za;
181
182 supported = B_TRUE;
183 for (zap_cursor_init(&zc, os, obj);
184 zap_cursor_retrieve(&zc, &za) == 0;
185 zap_cursor_advance(&zc)) {
186 ASSERT(za.za_integer_length == sizeof (uint64_t) &&
187 za.za_num_integers == 1);
188
189 if (NULL != enabled_feat) {
190 fnvlist_add_uint64(enabled_feat, za.za_name,
191 za.za_first_integer);
192 }
193
189 if (za.za_first_integer != 0 &&
190 !zfeature_is_supported(za.za_name)) {
191 supported = B_FALSE;
192
194 if (za.za_first_integer != 0 &&
195 !zfeature_is_supported(za.za_name)) {
196 supported = B_FALSE;
197
193 if (unsup_feat != NULL) {
198 if (NULL != unsup_feat) {
194 char *desc = "";
195 char buf[MAXPATHLEN];
196
197 if (zap_lookup(os, desc_obj, za.za_name,
198 1, sizeof (buf), buf) == 0)
199 desc = buf;
200
201 VERIFY(nvlist_add_string(unsup_feat, za.za_name,

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

211static int
212feature_get_refcount(objset_t *os, uint64_t read_obj, uint64_t write_obj,
213 zfeature_info_t *feature, uint64_t *res)
214{
215 int err;
216 uint64_t refcount;
217 uint64_t zapobj = feature->fi_can_readonly ? write_obj : read_obj;
218
199 char *desc = "";
200 char buf[MAXPATHLEN];
201
202 if (zap_lookup(os, desc_obj, za.za_name,
203 1, sizeof (buf), buf) == 0)
204 desc = buf;
205
206 VERIFY(nvlist_add_string(unsup_feat, za.za_name,

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

216static int
217feature_get_refcount(objset_t *os, uint64_t read_obj, uint64_t write_obj,
218 zfeature_info_t *feature, uint64_t *res)
219{
220 int err;
221 uint64_t refcount;
222 uint64_t zapobj = feature->fi_can_readonly ? write_obj : read_obj;
223
219 ASSERT(0 != zapobj);
224 /*
225 * If the pool is currently being created, the feature objects may not
226 * have been allocated yet. Act as though all features are disabled.
227 */
228 if (zapobj == 0)
229 return (ENOTSUP);
220
221 err = zap_lookup(os, zapobj, feature->fi_guid, sizeof (uint64_t), 1,
222 &refcount);
223 if (err != 0) {
224 if (err == ENOENT)
225 return (ENOTSUP);
226 else
227 return (err);

--- 187 unchanged lines hidden ---
230
231 err = zap_lookup(os, zapobj, feature->fi_guid, sizeof (uint64_t), 1,
232 &refcount);
233 if (err != 0) {
234 if (err == ENOENT)
235 return (ENOTSUP);
236 else
237 return (err);

--- 187 unchanged lines hidden ---