Home | History | Annotate | Line # | Download | only in sys
      1  1.1  chs /*
      2  1.1  chs  * CDDL HEADER START
      3  1.1  chs  *
      4  1.1  chs  * The contents of this file are subject to the terms of the
      5  1.1  chs  * Common Development and Distribution License (the "License").
      6  1.1  chs  * You may not use this file except in compliance with the License.
      7  1.1  chs  *
      8  1.1  chs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  1.1  chs  * or http://www.opensolaris.org/os/licensing.
     10  1.1  chs  * See the License for the specific language governing permissions
     11  1.1  chs  * and limitations under the License.
     12  1.1  chs  *
     13  1.1  chs  * When distributing Covered Code, include this CDDL HEADER in each
     14  1.1  chs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  1.1  chs  * If applicable, add the following below this CDDL HEADER, with the
     16  1.1  chs  * fields enclosed by brackets "[]" replaced with your own identifying
     17  1.1  chs  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  1.1  chs  *
     19  1.1  chs  * CDDL HEADER END
     20  1.1  chs  */
     21  1.1  chs 
     22  1.1  chs /*
     23  1.1  chs  * Copyright (c) 2013 by Delphix. All rights reserved.
     24  1.1  chs  */
     25  1.1  chs 
     26  1.1  chs #ifndef _SYS_ZFEATURE_H
     27  1.1  chs #define	_SYS_ZFEATURE_H
     28  1.1  chs 
     29  1.1  chs #include <sys/nvpair.h>
     30  1.1  chs #include <sys/txg.h>
     31  1.1  chs #include "zfeature_common.h"
     32  1.1  chs 
     33  1.1  chs #ifdef	__cplusplus
     34  1.1  chs extern "C" {
     35  1.1  chs #endif
     36  1.1  chs 
     37  1.1  chs #define	VALID_FEATURE_FID(fid)	((fid) >= 0 && (fid) < SPA_FEATURES)
     38  1.1  chs #define	VALID_FEATURE_OR_NONE(fid)	((fid) == SPA_FEATURE_NONE ||	\
     39  1.1  chs     VALID_FEATURE_FID(fid))
     40  1.1  chs 
     41  1.1  chs struct spa;
     42  1.1  chs struct dmu_tx;
     43  1.1  chs struct objset;
     44  1.1  chs 
     45  1.1  chs extern void spa_feature_create_zap_objects(struct spa *, struct dmu_tx *);
     46  1.1  chs extern void spa_feature_enable(struct spa *, spa_feature_t,
     47  1.1  chs     struct dmu_tx *);
     48  1.1  chs extern void spa_feature_incr(struct spa *, spa_feature_t, struct dmu_tx *);
     49  1.1  chs extern void spa_feature_decr(struct spa *, spa_feature_t, struct dmu_tx *);
     50  1.1  chs extern boolean_t spa_feature_is_enabled(struct spa *, spa_feature_t);
     51  1.1  chs extern boolean_t spa_feature_is_active(struct spa *, spa_feature_t);
     52  1.1  chs extern boolean_t spa_feature_enabled_txg(spa_t *spa, spa_feature_t fid,
     53  1.1  chs     uint64_t *txg);
     54  1.1  chs extern uint64_t spa_feature_refcount(spa_t *, spa_feature_t, uint64_t);
     55  1.1  chs extern boolean_t spa_features_check(spa_t *, boolean_t, nvlist_t *, nvlist_t *);
     56  1.1  chs 
     57  1.1  chs /*
     58  1.1  chs  * These functions are only exported for zhack and zdb; normal callers should
     59  1.1  chs  * use the above interfaces.
     60  1.1  chs  */
     61  1.1  chs extern int feature_get_refcount(struct spa *, zfeature_info_t *, uint64_t *);
     62  1.1  chs extern int feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature,
     63  1.1  chs     uint64_t *res);
     64  1.1  chs extern void feature_enable_sync(struct spa *, zfeature_info_t *,
     65  1.1  chs     struct dmu_tx *);
     66  1.1  chs extern void feature_sync(struct spa *, zfeature_info_t *, uint64_t,
     67  1.1  chs     struct dmu_tx *);
     68  1.1  chs 
     69  1.1  chs #ifdef	__cplusplus
     70  1.1  chs }
     71  1.1  chs #endif
     72  1.1  chs 
     73  1.1  chs #endif /* _SYS_ZFEATURE_H */
     74