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/*
23262093Savg * Copyright (c) 2013 by Delphix. All rights reserved.
24246586Sdelphij * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25255750Sdelphij * 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
40263390Sdelphijtypedef enum spa_feature {
41263390Sdelphij	SPA_FEATURE_NONE = -1,
42263390Sdelphij	SPA_FEATURE_ASYNC_DESTROY,
43263390Sdelphij	SPA_FEATURE_EMPTY_BPOBJ,
44263390Sdelphij	SPA_FEATURE_LZ4_COMPRESS,
45263390Sdelphij	SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
46263390Sdelphij	SPA_FEATURE_SPACEMAP_HISTOGRAM,
47263397Sdelphij	SPA_FEATURE_ENABLED_TXG,
48263397Sdelphij	SPA_FEATURE_HOLE_BIRTH,
49263390Sdelphij	SPA_FEATURE_EXTENSIBLE_DATASET,
50268649Sdelphij	SPA_FEATURE_EMBEDDED_DATA,
51263407Sdelphij	SPA_FEATURE_BOOKMARKS,
52265744Sdelphij	SPA_FEATURE_FS_SS_LIMIT,
53263390Sdelphij	SPA_FEATURES
54263390Sdelphij} spa_feature_t;
55263390Sdelphij
56263397Sdelphij#define	SPA_FEATURE_DISABLED	(-1ULL)
57263397Sdelphij
58236884Smmtypedef struct zfeature_info {
59263390Sdelphij	spa_feature_t fi_feature;
60236884Smm	const char *fi_uname;	/* User-facing feature name */
61236884Smm	const char *fi_guid;	/* On-disk feature identifier */
62236884Smm	const char *fi_desc;	/* Feature description */
63236884Smm	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
64236884Smm	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
65263397Sdelphij	/* Activate this feature at the same time it is enabled */
66263397Sdelphij	boolean_t fi_activate_on_enable;
67263390Sdelphij	/* array of dependencies, terminated by SPA_FEATURE_NONE */
68263390Sdelphij	const spa_feature_t *fi_depends;
69236884Smm} zfeature_info_t;
70236884Smm
71268649Sdelphijtypedef int (zfeature_func_t)(zfeature_info_t *, void *);
72236884Smm
73236884Smm#define	ZFS_FEATURE_DEBUG
74236884Smm
75236884Smmextern zfeature_info_t spa_feature_table[SPA_FEATURES];
76236884Smm
77236884Smmextern boolean_t zfeature_is_valid_guid(const char *);
78236884Smm
79236884Smmextern boolean_t zfeature_is_supported(const char *);
80268649Sdelphijextern int zfeature_lookup_name(const char *, spa_feature_t *);
81268649Sdelphijextern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t);
82236884Smm
83236884Smmextern void zpool_feature_init(void);
84236884Smm
85236884Smm#ifdef	__cplusplus
86236884Smm}
87236884Smm#endif
88236884Smm
89236884Smm#endif	/* _ZFEATURE_COMMON_H */
90