zfeature_common.h revision 236884
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/*
23236884Smm * Copyright (c) 2012 by Delphix. All rights reserved.
24236884Smm */
25236884Smm
26236884Smm#ifndef _ZFEATURE_COMMON_H
27236884Smm#define	_ZFEATURE_COMMON_H
28236884Smm
29236884Smm#include <sys/fs/zfs.h>
30236884Smm#include <sys/types.h>
31236884Smm
32236884Smm#ifdef	__cplusplus
33236884Smmextern "C" {
34236884Smm#endif
35236884Smm
36236884Smmstruct zfeature_info;
37236884Smm
38236884Smmtypedef struct zfeature_info {
39236884Smm	const char *fi_uname;	/* User-facing feature name */
40236884Smm	const char *fi_guid;	/* On-disk feature identifier */
41236884Smm	const char *fi_desc;	/* Feature description */
42236884Smm	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
43236884Smm	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
44236884Smm	struct zfeature_info **fi_depends; /* array; null terminated */
45236884Smm} zfeature_info_t;
46236884Smm
47236884Smmtypedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
48236884Smm
49236884Smm#define	ZFS_FEATURE_DEBUG
50236884Smm
51236884Smmstatic enum spa_feature {
52236884Smm	SPA_FEATURE_ASYNC_DESTROY,
53236884Smm	SPA_FEATURES
54236884Smm} spa_feature_t;
55236884Smm
56236884Smmextern zfeature_info_t spa_feature_table[SPA_FEATURES];
57236884Smm
58236884Smmextern boolean_t zfeature_is_valid_guid(const char *);
59236884Smm
60236884Smmextern boolean_t zfeature_is_supported(const char *);
61236884Smmextern int zfeature_lookup_guid(const char *, zfeature_info_t **res);
62236884Smmextern int zfeature_lookup_name(const char *, zfeature_info_t **res);
63236884Smm
64236884Smmextern void zpool_feature_init(void);
65236884Smm
66236884Smm#ifdef	__cplusplus
67236884Smm}
68236884Smm#endif
69236884Smm
70236884Smm#endif	/* _ZFEATURE_COMMON_H */
71