zfeature_common.h revision e4c795beb33bf59dd4ad2e3f88f493111484b890
116d8656Alexander Pyhalov/*
216d8656Alexander Pyhalov * CDDL HEADER START
316d8656Alexander Pyhalov *
416d8656Alexander Pyhalov * The contents of this file are subject to the terms of the
516d8656Alexander Pyhalov * Common Development and Distribution License (the "License").
616d8656Alexander Pyhalov * You may not use this file except in compliance with the License.
716d8656Alexander Pyhalov *
816d8656Alexander Pyhalov * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
916d8656Alexander Pyhalov * or http://www.opensolaris.org/os/licensing.
1016d8656Alexander Pyhalov * See the License for the specific language governing permissions
1116d8656Alexander Pyhalov * and limitations under the License.
1216d8656Alexander Pyhalov *
1316d8656Alexander Pyhalov * When distributing Covered Code, include this CDDL HEADER in each
1416d8656Alexander Pyhalov * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1516d8656Alexander Pyhalov * If applicable, add the following below this CDDL HEADER, with the
1616d8656Alexander Pyhalov * fields enclosed by brackets "[]" replaced with your own identifying
1716d8656Alexander Pyhalov * information: Portions Copyright [yyyy] [name of copyright owner]
1816d8656Alexander Pyhalov *
1916d8656Alexander Pyhalov * CDDL HEADER END
2016d8656Alexander Pyhalov */
2116d8656Alexander Pyhalov
2216d8656Alexander Pyhalov/*
2316d8656Alexander Pyhalov * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
2416d8656Alexander Pyhalov * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2516d8656Alexander Pyhalov * Copyright (c) 2013, Joyent, Inc. All rights reserved.
2616d8656Alexander Pyhalov * Copyright (c) 2014 Integros [integros.com]
2716d8656Alexander Pyhalov * Copyright (c) 2017, Intel Corporation.
2816d8656Alexander Pyhalov */
2916d8656Alexander Pyhalov
3016d8656Alexander Pyhalov#ifndef _ZFEATURE_COMMON_H
3116d8656Alexander Pyhalov#define	_ZFEATURE_COMMON_H
3216d8656Alexander Pyhalov
3316d8656Alexander Pyhalov#include <sys/fs/zfs.h>
3416d8656Alexander Pyhalov#include <sys/inttypes.h>
3516d8656Alexander Pyhalov#include <sys/types.h>
3616d8656Alexander Pyhalov
3716d8656Alexander Pyhalov#ifdef	__cplusplus
3816d8656Alexander Pyhalovextern "C" {
3916d8656Alexander Pyhalov#endif
4016d8656Alexander Pyhalov
4116d8656Alexander Pyhalovstruct zfeature_info;
4216d8656Alexander Pyhalov
4316d8656Alexander Pyhalovtypedef enum spa_feature {
4416d8656Alexander Pyhalov	SPA_FEATURE_NONE = -1,
4516d8656Alexander Pyhalov	SPA_FEATURE_ASYNC_DESTROY,
4616d8656Alexander Pyhalov	SPA_FEATURE_EMPTY_BPOBJ,
4716d8656Alexander Pyhalov	SPA_FEATURE_LZ4_COMPRESS,
4816d8656Alexander Pyhalov	SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
4916d8656Alexander Pyhalov	SPA_FEATURE_SPACEMAP_HISTOGRAM,
5016d8656Alexander Pyhalov	SPA_FEATURE_ENABLED_TXG,
5116d8656Alexander Pyhalov	SPA_FEATURE_HOLE_BIRTH,
5216d8656Alexander Pyhalov	SPA_FEATURE_EXTENSIBLE_DATASET,
5316d8656Alexander Pyhalov	SPA_FEATURE_EMBEDDED_DATA,
5416d8656Alexander Pyhalov	SPA_FEATURE_BOOKMARKS,
5516d8656Alexander Pyhalov	SPA_FEATURE_FS_SS_LIMIT,
5616d8656Alexander Pyhalov	SPA_FEATURE_LARGE_BLOCKS,
5716d8656Alexander Pyhalov	SPA_FEATURE_LARGE_DNODE,
5816d8656Alexander Pyhalov	SPA_FEATURE_SHA512,
5916d8656Alexander Pyhalov	SPA_FEATURE_SKEIN,
6016d8656Alexander Pyhalov	SPA_FEATURE_EDONR,
6116d8656Alexander Pyhalov	SPA_FEATURE_DEVICE_REMOVAL,
6216d8656Alexander Pyhalov	SPA_FEATURE_OBSOLETE_COUNTS,
6316d8656Alexander Pyhalov	SPA_FEATURE_POOL_CHECKPOINT,
6416d8656Alexander Pyhalov	SPA_FEATURE_SPACEMAP_V2,
6516d8656Alexander Pyhalov	SPA_FEATURE_ALLOCATION_CLASSES,
6616d8656Alexander Pyhalov	SPA_FEATURE_RESILVER_DEFER,
6716d8656Alexander Pyhalov	SPA_FEATURES
6816d8656Alexander Pyhalov} spa_feature_t;
6916d8656Alexander Pyhalov
7016d8656Alexander Pyhalov#define	SPA_FEATURE_DISABLED	(-1ULL)
7116d8656Alexander Pyhalov
7216d8656Alexander Pyhalovtypedef enum zfeature_flags {
7316d8656Alexander Pyhalov	/* Can open pool readonly even if this feature is not supported. */
7416d8656Alexander Pyhalov	ZFEATURE_FLAG_READONLY_COMPAT =		(1 << 0),
7516d8656Alexander Pyhalov	/* Is this feature necessary to read the MOS? */
7616d8656Alexander Pyhalov	ZFEATURE_FLAG_MOS =			(1 << 1),
7716d8656Alexander Pyhalov	/* Activate this feature at the same time it is enabled. */
7816d8656Alexander Pyhalov	ZFEATURE_FLAG_ACTIVATE_ON_ENABLE =	(1 << 2),
7916d8656Alexander Pyhalov	/* Each dataset has a field set if it has ever used this feature. */
8016d8656Alexander Pyhalov	ZFEATURE_FLAG_PER_DATASET =		(1 << 3)
8116d8656Alexander Pyhalov} zfeature_flags_t;
8216d8656Alexander Pyhalov
8316d8656Alexander Pyhalovtypedef struct zfeature_info {
8416d8656Alexander Pyhalov	spa_feature_t fi_feature;
8516d8656Alexander Pyhalov	const char *fi_uname;	/* User-facing feature name */
8616d8656Alexander Pyhalov	const char *fi_guid;	/* On-disk feature identifier */
8716d8656Alexander Pyhalov	const char *fi_desc;	/* Feature description */
8816d8656Alexander Pyhalov	zfeature_flags_t fi_flags;
8916d8656Alexander Pyhalov	/* array of dependencies, terminated by SPA_FEATURE_NONE */
9016d8656Alexander Pyhalov	const spa_feature_t *fi_depends;
9116d8656Alexander Pyhalov} zfeature_info_t;
9216d8656Alexander Pyhalov
9316d8656Alexander Pyhalovtypedef int (zfeature_func_t)(zfeature_info_t *, void *);
9416d8656Alexander Pyhalov
9516d8656Alexander Pyhalov#define	ZFS_FEATURE_DEBUG
9616d8656Alexander Pyhalov
9716d8656Alexander Pyhalovextern zfeature_info_t spa_feature_table[SPA_FEATURES];
9816d8656Alexander Pyhalov
9916d8656Alexander Pyhalovextern boolean_t zfeature_is_valid_guid(const char *);
10016d8656Alexander Pyhalov
10116d8656Alexander Pyhalovextern boolean_t zfeature_is_supported(const char *);
10216d8656Alexander Pyhalovextern int zfeature_lookup_name(const char *, spa_feature_t *);
10316d8656Alexander Pyhalovextern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t);
10416d8656Alexander Pyhalov
10516d8656Alexander Pyhalovextern void zpool_feature_init(void);
10616d8656Alexander Pyhalov
10716d8656Alexander Pyhalov#ifdef	__cplusplus
10816d8656Alexander Pyhalov}
10916d8656Alexander Pyhalov#endif
11016d8656Alexander Pyhalov
11116d8656Alexander Pyhalov#endif	/* _ZFEATURE_COMMON_H */
11216d8656Alexander Pyhalov