zfeature_common.h revision b515258426fed6c7311fd3f1dea697cfbd4085c6
1e71ca95Gerald Jelinek/*
2e71ca95Gerald Jelinek * CDDL HEADER START
3e71ca95Gerald Jelinek *
4e71ca95Gerald Jelinek * The contents of this file are subject to the terms of the
5e71ca95Gerald Jelinek * Common Development and Distribution License (the "License").
6e71ca95Gerald Jelinek * You may not use this file except in compliance with the License.
7e71ca95Gerald Jelinek *
8e71ca95Gerald Jelinek * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e71ca95Gerald Jelinek * or http://www.opensolaris.org/os/licensing.
10e71ca95Gerald Jelinek * See the License for the specific language governing permissions
11e71ca95Gerald Jelinek * and limitations under the License.
12e71ca95Gerald Jelinek *
13e71ca95Gerald Jelinek * When distributing Covered Code, include this CDDL HEADER in each
14e71ca95Gerald Jelinek * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e71ca95Gerald Jelinek * If applicable, add the following below this CDDL HEADER, with the
16e71ca95Gerald Jelinek * fields enclosed by brackets "[]" replaced with your own identifying
17e71ca95Gerald Jelinek * information: Portions Copyright [yyyy] [name of copyright owner]
18e71ca95Gerald Jelinek *
19e71ca95Gerald Jelinek * CDDL HEADER END
20e71ca95Gerald Jelinek */
21e71ca95Gerald Jelinek
22e71ca95Gerald Jelinek/*
2380e2ca8<gerald.jelinek@sun.com> * Copyright (c) 2013 by Delphix. All rights reserved.
24e71ca95Gerald Jelinek * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25e71ca95Gerald Jelinek * Copyright (c) 2013, Joyent, Inc. All rights reserved.
26e71ca95Gerald Jelinek */
27e71ca95Gerald Jelinek
28e71ca95Gerald Jelinek#ifndef _ZFEATURE_COMMON_H
29e71ca95Gerald Jelinek#define	_ZFEATURE_COMMON_H
30e71ca95Gerald Jelinek
31e71ca95Gerald Jelinek#include <sys/fs/zfs.h>
32e71ca95Gerald Jelinek#include <sys/inttypes.h>
33e71ca95Gerald Jelinek#include <sys/types.h>
34e71ca95Gerald Jelinek
35e71ca95Gerald Jelinek#ifdef	__cplusplus
36e71ca95Gerald Jelinekextern "C" {
37e71ca95Gerald Jelinek#endif
38e71ca95Gerald Jelinek
39e71ca95Gerald Jelinekstruct zfeature_info;
40e71ca95Gerald Jelinek
41e71ca95Gerald Jelinektypedef enum spa_feature {
4280e2ca8<gerald.jelinek@sun.com>	SPA_FEATURE_NONE = -1,
43e71ca95Gerald Jelinek	SPA_FEATURE_ASYNC_DESTROY,
44e71ca95Gerald Jelinek	SPA_FEATURE_EMPTY_BPOBJ,
45e71ca95Gerald Jelinek	SPA_FEATURE_LZ4_COMPRESS,
46e71ca95Gerald Jelinek	SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
47e71ca95Gerald Jelinek	SPA_FEATURE_SPACEMAP_HISTOGRAM,
48e71ca95Gerald Jelinek	SPA_FEATURE_ENABLED_TXG,
49e71ca95Gerald Jelinek	SPA_FEATURE_HOLE_BIRTH,
50e71ca95Gerald Jelinek	SPA_FEATURE_EXTENSIBLE_DATASET,
51e71ca95Gerald Jelinek	SPA_FEATURE_EMBEDDED_DATA,
52e71ca95Gerald Jelinek	SPA_FEATURE_BOOKMARKS,
53e71ca95Gerald Jelinek	SPA_FEATURE_FS_SS_LIMIT,
54e71ca95Gerald Jelinek	SPA_FEATURE_LARGE_BLOCKS,
55e71ca95Gerald Jelinek	SPA_FEATURES
56e71ca95Gerald Jelinek} spa_feature_t;
57e71ca95Gerald Jelinek
58e71ca95Gerald Jelinek#define	SPA_FEATURE_DISABLED	(-1ULL)
59e71ca95Gerald Jelinek
60e71ca95Gerald Jelinektypedef struct zfeature_info {
61e71ca95Gerald Jelinek	spa_feature_t fi_feature;
62e71ca95Gerald Jelinek	const char *fi_uname;	/* User-facing feature name */
63e71ca95Gerald Jelinek	const char *fi_guid;	/* On-disk feature identifier */
64e71ca95Gerald Jelinek	const char *fi_desc;	/* Feature description */
65e71ca95Gerald Jelinek	boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
66e71ca95Gerald Jelinek	boolean_t fi_mos;	/* Is the feature necessary to read the MOS? */
67e71ca95Gerald Jelinek	/* Activate this feature at the same time it is enabled */
6880e2ca8<gerald.jelinek@sun.com>	boolean_t fi_activate_on_enable;
69e71ca95Gerald Jelinek	/* array of dependencies, terminated by SPA_FEATURE_NONE */
70e71ca95Gerald Jelinek	const spa_feature_t *fi_depends;
71e71ca95Gerald Jelinek} zfeature_info_t;
72e71ca95Gerald Jelinek
73typedef int (zfeature_func_t)(zfeature_info_t *, void *);
74
75#define	ZFS_FEATURE_DEBUG
76
77extern zfeature_info_t spa_feature_table[SPA_FEATURES];
78
79extern boolean_t zfeature_is_valid_guid(const char *);
80
81extern boolean_t zfeature_is_supported(const char *);
82extern int zfeature_lookup_name(const char *, spa_feature_t *);
83extern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t);
84
85extern void zpool_feature_init(void);
86
87#ifdef	__cplusplus
88}
89#endif
90
91#endif	/* _ZFEATURE_COMMON_H */
92