xref: /titanic_51/usr/src/common/zfs/zfeature_common.h (revision 53089ab7c84db6fb76c16ca50076c147cda11757)
1*53089ab7Seschrock /*
2*53089ab7Seschrock  * CDDL HEADER START
3*53089ab7Seschrock  *
4*53089ab7Seschrock  * The contents of this file are subject to the terms of the
5*53089ab7Seschrock  * Common Development and Distribution License (the "License").
6*53089ab7Seschrock  * You may not use this file except in compliance with the License.
7*53089ab7Seschrock  *
8*53089ab7Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*53089ab7Seschrock  * or http://www.opensolaris.org/os/licensing.
10*53089ab7Seschrock  * See the License for the specific language governing permissions
11*53089ab7Seschrock  * and limitations under the License.
12*53089ab7Seschrock  *
13*53089ab7Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
14*53089ab7Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*53089ab7Seschrock  * If applicable, add the following below this CDDL HEADER, with the
16*53089ab7Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
17*53089ab7Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
18*53089ab7Seschrock  *
19*53089ab7Seschrock  * CDDL HEADER END
20*53089ab7Seschrock  */
21*53089ab7Seschrock 
22*53089ab7Seschrock /*
23*53089ab7Seschrock  * Copyright (c) 2012 by Delphix. All rights reserved.
24*53089ab7Seschrock  */
25*53089ab7Seschrock 
26*53089ab7Seschrock #ifndef _ZFEATURE_COMMON_H
27*53089ab7Seschrock #define	_ZFEATURE_COMMON_H
28*53089ab7Seschrock 
29*53089ab7Seschrock #include <sys/fs/zfs.h>
30*53089ab7Seschrock #include <sys/inttypes.h>
31*53089ab7Seschrock #include <sys/types.h>
32*53089ab7Seschrock 
33*53089ab7Seschrock #ifdef	__cplusplus
34*53089ab7Seschrock extern "C" {
35*53089ab7Seschrock #endif
36*53089ab7Seschrock 
37*53089ab7Seschrock struct zfeature_info;
38*53089ab7Seschrock 
39*53089ab7Seschrock typedef struct zfeature_info {
40*53089ab7Seschrock 	const char *fi_uname;	/* User-facing feature name */
41*53089ab7Seschrock 	const char *fi_guid;	/* On-disk feature identifier */
42*53089ab7Seschrock 	const char *fi_desc;	/* Feature description */
43*53089ab7Seschrock 	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
44*53089ab7Seschrock 	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
45*53089ab7Seschrock 	struct zfeature_info **fi_depends; /* array; null terminated */
46*53089ab7Seschrock } zfeature_info_t;
47*53089ab7Seschrock 
48*53089ab7Seschrock typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
49*53089ab7Seschrock 
50*53089ab7Seschrock #define	ZFS_FEATURE_DEBUG
51*53089ab7Seschrock 
52*53089ab7Seschrock enum spa_feature {
53*53089ab7Seschrock 	SPA_FEATURE_ASYNC_DESTROY,
54*53089ab7Seschrock 	SPA_FEATURES
55*53089ab7Seschrock } spa_feature_t;
56*53089ab7Seschrock 
57*53089ab7Seschrock extern zfeature_info_t spa_feature_table[SPA_FEATURES];
58*53089ab7Seschrock 
59*53089ab7Seschrock extern boolean_t zfeature_is_valid_guid(const char *);
60*53089ab7Seschrock 
61*53089ab7Seschrock extern boolean_t zfeature_is_supported(const char *);
62*53089ab7Seschrock extern int zfeature_lookup_guid(const char *, zfeature_info_t **res);
63*53089ab7Seschrock extern int zfeature_lookup_name(const char *, zfeature_info_t **res);
64*53089ab7Seschrock 
65*53089ab7Seschrock extern void zpool_feature_init(void);
66*53089ab7Seschrock 
67*53089ab7Seschrock #ifdef	__cplusplus
68*53089ab7Seschrock }
69*53089ab7Seschrock #endif
70*53089ab7Seschrock 
71*53089ab7Seschrock #endif	/* _ZFEATURE_COMMON_H */
72