xref: /titanic_51/usr/src/common/zfs/zfeature_common.h (revision a6f561b4aee75d0d028e7b36b151c8ed8a86bc76)
153089ab7Seschrock /*
253089ab7Seschrock  * CDDL HEADER START
353089ab7Seschrock  *
453089ab7Seschrock  * The contents of this file are subject to the terms of the
553089ab7Seschrock  * Common Development and Distribution License (the "License").
653089ab7Seschrock  * You may not use this file except in compliance with the License.
753089ab7Seschrock  *
853089ab7Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
953089ab7Seschrock  * or http://www.opensolaris.org/os/licensing.
1053089ab7Seschrock  * See the License for the specific language governing permissions
1153089ab7Seschrock  * and limitations under the License.
1253089ab7Seschrock  *
1353089ab7Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
1453089ab7Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1553089ab7Seschrock  * If applicable, add the following below this CDDL HEADER, with the
1653089ab7Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
1753089ab7Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
1853089ab7Seschrock  *
1953089ab7Seschrock  * CDDL HEADER END
2053089ab7Seschrock  */
2153089ab7Seschrock 
2253089ab7Seschrock /*
2353089ab7Seschrock  * Copyright (c) 2012 by Delphix. All rights reserved.
24*a6f561b4SSašo Kiselkov  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2553089ab7Seschrock  */
2653089ab7Seschrock 
2753089ab7Seschrock #ifndef _ZFEATURE_COMMON_H
2853089ab7Seschrock #define	_ZFEATURE_COMMON_H
2953089ab7Seschrock 
3053089ab7Seschrock #include <sys/fs/zfs.h>
3153089ab7Seschrock #include <sys/inttypes.h>
3253089ab7Seschrock #include <sys/types.h>
3353089ab7Seschrock 
3453089ab7Seschrock #ifdef	__cplusplus
3553089ab7Seschrock extern "C" {
3653089ab7Seschrock #endif
3753089ab7Seschrock 
3853089ab7Seschrock struct zfeature_info;
3953089ab7Seschrock 
4053089ab7Seschrock typedef struct zfeature_info {
4153089ab7Seschrock 	const char *fi_uname;	/* User-facing feature name */
4253089ab7Seschrock 	const char *fi_guid;	/* On-disk feature identifier */
4353089ab7Seschrock 	const char *fi_desc;	/* Feature description */
4453089ab7Seschrock 	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
4553089ab7Seschrock 	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
4653089ab7Seschrock 	struct zfeature_info **fi_depends; /* array; null terminated */
4753089ab7Seschrock } zfeature_info_t;
4853089ab7Seschrock 
4953089ab7Seschrock typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
5053089ab7Seschrock 
5153089ab7Seschrock #define	ZFS_FEATURE_DEBUG
5253089ab7Seschrock 
5353089ab7Seschrock enum spa_feature {
5453089ab7Seschrock 	SPA_FEATURE_ASYNC_DESTROY,
55f1745736SMatthew Ahrens 	SPA_FEATURE_EMPTY_BPOBJ,
56*a6f561b4SSašo Kiselkov 	SPA_FEATURE_LZ4_COMPRESS,
5753089ab7Seschrock 	SPA_FEATURES
5853089ab7Seschrock } spa_feature_t;
5953089ab7Seschrock 
6053089ab7Seschrock extern zfeature_info_t spa_feature_table[SPA_FEATURES];
6153089ab7Seschrock 
6253089ab7Seschrock extern boolean_t zfeature_is_valid_guid(const char *);
6353089ab7Seschrock 
6453089ab7Seschrock extern boolean_t zfeature_is_supported(const char *);
6553089ab7Seschrock extern int zfeature_lookup_guid(const char *, zfeature_info_t **res);
6653089ab7Seschrock extern int zfeature_lookup_name(const char *, zfeature_info_t **res);
6753089ab7Seschrock 
6853089ab7Seschrock extern void zpool_feature_init(void);
6953089ab7Seschrock 
7053089ab7Seschrock #ifdef	__cplusplus
7153089ab7Seschrock }
7253089ab7Seschrock #endif
7353089ab7Seschrock 
7453089ab7Seschrock #endif	/* _ZFEATURE_COMMON_H */
75