Path: blob/main/sys/contrib/openzfs/include/zfeature_common.h
48254 views
// SPDX-License-Identifier: CDDL-1.01/*2* CDDL HEADER START3*4* The contents of this file are subject to the terms of the5* Common Development and Distribution License (the "License").6* You may not use this file except in compliance with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or https://opensource.org/licenses/CDDL-1.0.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* Copyright (c) 2011, 2018 by Delphix. All rights reserved.24* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.25* Copyright (c) 2013, Joyent, Inc. All rights reserved.26* Copyright (c) 2017, Intel Corporation.27* Copyright (c) 2024, Klara, Inc.28*/2930#ifndef _ZFEATURE_COMMON_H31#define _ZFEATURE_COMMON_H extern __attribute__((visibility("default")))3233#include <sys/fs/zfs.h>34#include <sys/inttypes.h>35#include <sys/types.h>3637#ifdef __cplusplus38extern "C" {39#endif4041struct zfeature_info;4243typedef enum spa_feature {44SPA_FEATURE_NONE = -1,45SPA_FEATURE_ASYNC_DESTROY,46SPA_FEATURE_EMPTY_BPOBJ,47SPA_FEATURE_LZ4_COMPRESS,48SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,49SPA_FEATURE_SPACEMAP_HISTOGRAM,50SPA_FEATURE_ENABLED_TXG,51SPA_FEATURE_HOLE_BIRTH,52SPA_FEATURE_EXTENSIBLE_DATASET,53SPA_FEATURE_EMBEDDED_DATA,54SPA_FEATURE_BOOKMARKS,55SPA_FEATURE_FS_SS_LIMIT,56SPA_FEATURE_LARGE_BLOCKS,57SPA_FEATURE_LARGE_DNODE,58SPA_FEATURE_SHA512,59SPA_FEATURE_SKEIN,60SPA_FEATURE_EDONR,61SPA_FEATURE_USEROBJ_ACCOUNTING,62SPA_FEATURE_ENCRYPTION,63SPA_FEATURE_PROJECT_QUOTA,64SPA_FEATURE_DEVICE_REMOVAL,65SPA_FEATURE_OBSOLETE_COUNTS,66SPA_FEATURE_POOL_CHECKPOINT,67SPA_FEATURE_SPACEMAP_V2,68SPA_FEATURE_ALLOCATION_CLASSES,69SPA_FEATURE_RESILVER_DEFER,70SPA_FEATURE_BOOKMARK_V2,71SPA_FEATURE_REDACTION_BOOKMARKS,72SPA_FEATURE_REDACTED_DATASETS,73SPA_FEATURE_BOOKMARK_WRITTEN,74SPA_FEATURE_LOG_SPACEMAP,75SPA_FEATURE_LIVELIST,76SPA_FEATURE_DEVICE_REBUILD,77SPA_FEATURE_ZSTD_COMPRESS,78SPA_FEATURE_DRAID,79SPA_FEATURE_ZILSAXATTR,80SPA_FEATURE_HEAD_ERRLOG,81SPA_FEATURE_BLAKE3,82SPA_FEATURE_BLOCK_CLONING,83SPA_FEATURE_AVZ_V2,84SPA_FEATURE_REDACTION_LIST_SPILL,85SPA_FEATURE_RAIDZ_EXPANSION,86SPA_FEATURE_FAST_DEDUP,87SPA_FEATURE_LONGNAME,88SPA_FEATURE_LARGE_MICROZAP,89SPA_FEATURE_DYNAMIC_GANG_HEADER,90SPA_FEATURE_BLOCK_CLONING_ENDIAN,91SPA_FEATURE_PHYSICAL_REWRITE,92SPA_FEATURES93} spa_feature_t;9495#define SPA_FEATURE_DISABLED (-1ULL)9697typedef enum zfeature_flags {98/* Can open pool readonly even if this feature is not supported. */99ZFEATURE_FLAG_READONLY_COMPAT = (1 << 0),100/*101* Is this feature necessary to load the pool? i.e. do we need this102* feature to read the full feature list out of the MOS?103*/104ZFEATURE_FLAG_MOS = (1 << 1),105/* Activate this feature at the same time it is enabled. */106ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2),107/* Each dataset has a field set if it has ever used this feature. */108ZFEATURE_FLAG_PER_DATASET = (1 << 3),109/*110* This feature isn't enabled by zpool upgrade; it must be explicitly111* listed to be enabled. It will also be applied if listed in an112* explicitly provided compatibility list. This flag can be removed113* from a given feature once support is sufficiently widespread, or114* worries about backwards compatibility are no longer relevant.115*/116ZFEATURE_FLAG_NO_UPGRADE = (1 << 4)117} zfeature_flags_t;118119typedef enum zfeature_type {120ZFEATURE_TYPE_BOOLEAN,121ZFEATURE_TYPE_UINT64_ARRAY,122ZFEATURE_NUM_TYPES123} zfeature_type_t;124125typedef struct zfeature_info {126spa_feature_t fi_feature;127const char *fi_uname; /* User-facing feature name */128const char *fi_guid; /* On-disk feature identifier */129const char *fi_desc; /* Feature description */130zfeature_flags_t fi_flags;131boolean_t fi_zfs_mod_supported; /* supported by running zfs module */132zfeature_type_t fi_type; /* Only relevant for PER_DATASET features */133/* array of dependencies, terminated by SPA_FEATURE_NONE */134const spa_feature_t *fi_depends;135} zfeature_info_t;136137typedef int (zfeature_func_t)(zfeature_info_t *, void *);138139#define ZFS_FEATURE_DEBUG140141_ZFEATURE_COMMON_H zfeature_info_t spa_feature_table[SPA_FEATURES];142_ZFEATURE_COMMON_H boolean_t zfeature_checks_disable;143144_ZFEATURE_COMMON_H boolean_t zfeature_is_valid_guid(const char *);145146_ZFEATURE_COMMON_H boolean_t zfeature_is_supported(const char *);147_ZFEATURE_COMMON_H int zfeature_lookup_guid(const char *, spa_feature_t *);148_ZFEATURE_COMMON_H int zfeature_lookup_name(const char *, spa_feature_t *);149_ZFEATURE_COMMON_H boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t);150151_ZFEATURE_COMMON_H void zpool_feature_init(void);152153#ifdef __cplusplus154}155#endif156157#endif /* _ZFEATURE_COMMON_H */158159160