1236884Smm/*
2236884Smm * CDDL HEADER START
3236884Smm *
4236884Smm * The contents of this file are subject to the terms of the
5236884Smm * Common Development and Distribution License (the "License").
6236884Smm * You may not use this file except in compliance with the License.
7236884Smm *
8236884Smm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9236884Smm * or http://www.opensolaris.org/os/licensing.
10236884Smm * See the License for the specific language governing permissions
11236884Smm * and limitations under the License.
12236884Smm *
13236884Smm * When distributing Covered Code, include this CDDL HEADER in each
14236884Smm * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15236884Smm * If applicable, add the following below this CDDL HEADER, with the
16236884Smm * fields enclosed by brackets "[]" replaced with your own identifying
17236884Smm * information: Portions Copyright [yyyy] [name of copyright owner]
18236884Smm *
19236884Smm * CDDL HEADER END
20236884Smm */
21236884Smm
22236884Smm/*
23262094Savg * Copyright (c) 2013 by Delphix. All rights reserved.
24247309Sdelphij * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25262089Savg * Copyright (c) 2013, Joyent, Inc. All rights reserved.
26236884Smm */
27236884Smm
28236884Smm#ifndef _ZFEATURE_COMMON_H
29236884Smm#define	_ZFEATURE_COMMON_H
30236884Smm
31236884Smm#include <sys/fs/zfs.h>
32236884Smm#include <sys/types.h>
33236884Smm
34236884Smm#ifdef	__cplusplus
35236884Smmextern "C" {
36236884Smm#endif
37236884Smm
38236884Smmstruct zfeature_info;
39236884Smm
40263391Sdelphijtypedef enum spa_feature {
41263391Sdelphij	SPA_FEATURE_NONE = -1,
42263391Sdelphij	SPA_FEATURE_ASYNC_DESTROY,
43263391Sdelphij	SPA_FEATURE_EMPTY_BPOBJ,
44263391Sdelphij	SPA_FEATURE_LZ4_COMPRESS,
45263391Sdelphij	SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
46263391Sdelphij	SPA_FEATURE_SPACEMAP_HISTOGRAM,
47263398Sdelphij	SPA_FEATURE_ENABLED_TXG,
48263398Sdelphij	SPA_FEATURE_HOLE_BIRTH,
49263391Sdelphij	SPA_FEATURE_EXTENSIBLE_DATASET,
50263410Sdelphij	SPA_FEATURE_BOOKMARKS,
51265754Sdelphij	SPA_FEATURE_FS_SS_LIMIT,
52263391Sdelphij	SPA_FEATURES
53263391Sdelphij} spa_feature_t;
54263391Sdelphij
55263398Sdelphij#define	SPA_FEATURE_DISABLED	(-1ULL)
56263398Sdelphij
57236884Smmtypedef struct zfeature_info {
58263391Sdelphij	spa_feature_t fi_feature;
59236884Smm	const char *fi_uname;	/* User-facing feature name */
60236884Smm	const char *fi_guid;	/* On-disk feature identifier */
61236884Smm	const char *fi_desc;	/* Feature description */
62236884Smm	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
63236884Smm	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
64263398Sdelphij	/* Activate this feature at the same time it is enabled */
65263398Sdelphij	boolean_t fi_activate_on_enable;
66263391Sdelphij	/* array of dependencies, terminated by SPA_FEATURE_NONE */
67263391Sdelphij	const spa_feature_t *fi_depends;
68236884Smm} zfeature_info_t;
69236884Smm
70236884Smmtypedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
71236884Smm
72236884Smm#define	ZFS_FEATURE_DEBUG
73236884Smm
74236884Smmextern zfeature_info_t spa_feature_table[SPA_FEATURES];
75236884Smm
76236884Smmextern boolean_t zfeature_is_valid_guid(const char *);
77236884Smm
78236884Smmextern boolean_t zfeature_is_supported(const char *);
79263391Sdelphijextern int zfeature_lookup_name(const char *name, spa_feature_t *res);
80263398Sdelphijextern boolean_t zfeature_depends_on(spa_feature_t fid, spa_feature_t check);
81236884Smm
82236884Smmextern void zpool_feature_init(void);
83236884Smm
84236884Smm#ifdef	__cplusplus
85236884Smm}
86236884Smm#endif
87236884Smm
88236884Smm#endif	/* _ZFEATURE_COMMON_H */
89