Files
mirror_zfs/include/zfeature_common.h
T

159 lines
4.9 KiB
C
Raw Normal View History

2025-01-04 11:04:27 +11:00
// SPDX-License-Identifier: CDDL-1.0
2012-12-13 15:24:15 -08:00
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2022-07-11 23:16:13 +02:00
* or https://opensource.org/licenses/CDDL-1.0.
2012-12-13 15:24:15 -08:00
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
2018-10-16 11:15:04 -07:00
* Copyright (c) 2011, 2018 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
2018-09-05 19:33:36 -06:00
* Copyright (c) 2017, Intel Corporation.
2024-10-03 13:47:11 +10:00
* Copyright (c) 2024, Klara, Inc.
2012-12-13 15:24:15 -08:00
*/
#ifndef _ZFEATURE_COMMON_H
2021-05-15 11:53:14 +02:00
#define _ZFEATURE_COMMON_H extern __attribute__((visibility("default")))
2012-12-13 15:24:15 -08:00
#include <sys/fs/zfs.h>
#include <sys/inttypes.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct zfeature_info;
2013-10-08 09:13:05 -08:00
typedef enum spa_feature {
SPA_FEATURE_NONE = -1,
SPA_FEATURE_ASYNC_DESTROY,
SPA_FEATURE_EMPTY_BPOBJ,
SPA_FEATURE_LZ4_COMPRESS,
SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
2013-10-08 09:13:05 -08:00
SPA_FEATURE_SPACEMAP_HISTOGRAM,
2013-12-09 10:37:51 -08:00
SPA_FEATURE_ENABLED_TXG,
SPA_FEATURE_HOLE_BIRTH,
2013-10-08 09:13:05 -08:00
SPA_FEATURE_EXTENSIBLE_DATASET,
2014-06-05 13:19:08 -08:00
SPA_FEATURE_EMBEDDED_DATA,
2013-12-11 14:33:41 -08:00
SPA_FEATURE_BOOKMARKS,
SPA_FEATURE_FS_SS_LIMIT,
2014-11-03 12:15:08 -08:00
SPA_FEATURE_LARGE_BLOCKS,
2016-03-16 18:25:34 -07:00
SPA_FEATURE_LARGE_DNODE,
SPA_FEATURE_SHA512,
SPA_FEATURE_SKEIN,
SPA_FEATURE_EDONR,
SPA_FEATURE_USEROBJ_ACCOUNTING,
2017-08-14 13:36:48 -04:00
SPA_FEATURE_ENCRYPTION,
2018-02-14 06:54:54 +08:00
SPA_FEATURE_PROJECT_QUOTA,
SPA_FEATURE_DEVICE_REMOVAL,
SPA_FEATURE_OBSOLETE_COUNTS,
2016-12-16 14:11:29 -08:00
SPA_FEATURE_POOL_CHECKPOINT,
2017-08-04 09:30:49 -07:00
SPA_FEATURE_SPACEMAP_V2,
2018-09-05 19:33:36 -06:00
SPA_FEATURE_ALLOCATION_CLASSES,
SPA_FEATURE_RESILVER_DEFER,
2019-02-04 14:15:01 -05:00
SPA_FEATURE_BOOKMARK_V2,
2019-06-19 09:48:13 -07:00
SPA_FEATURE_REDACTION_BOOKMARKS,
SPA_FEATURE_REDACTED_DATASETS,
SPA_FEATURE_BOOKMARK_WRITTEN,
2019-07-16 10:11:49 -07:00
SPA_FEATURE_LOG_SPACEMAP,
2019-07-26 10:54:14 -07:00
SPA_FEATURE_LIVELIST,
2020-07-03 11:05:50 -07:00
SPA_FEATURE_DEVICE_REBUILD,
2020-08-18 19:10:17 +02:00
SPA_FEATURE_ZSTD_COMPRESS,
2020-11-13 13:51:51 -08:00
SPA_FEATURE_DRAID,
2022-02-23 02:36:43 +05:30
SPA_FEATURE_ZILSAXATTR,
SPA_FEATURE_HEAD_ERRLOG,
SPA_FEATURE_BLAKE3,
2023-03-10 20:59:53 +01:00
SPA_FEATURE_BLOCK_CLONING,
2023-04-20 09:07:56 -08:00
SPA_FEATURE_AVZ_V2,
SPA_FEATURE_REDACTION_LIST_SPILL,
2023-11-08 11:19:41 -07:00
SPA_FEATURE_RAIDZ_EXPANSION,
SPA_FEATURE_FAST_DEDUP,
SPA_FEATURE_LONGNAME,
2024-10-03 13:47:11 +10:00
SPA_FEATURE_LARGE_MICROZAP,
2025-01-23 16:26:09 -08:00
SPA_FEATURE_DYNAMIC_GANG_HEADER,
2025-07-30 12:42:47 -04:00
SPA_FEATURE_BLOCK_CLONING_ENDIAN,
2025-07-23 15:51:00 -04:00
SPA_FEATURE_PHYSICAL_REWRITE,
2013-10-08 09:13:05 -08:00
SPA_FEATURES
} spa_feature_t;
2013-12-09 10:37:51 -08:00
#define SPA_FEATURE_DISABLED (-1ULL)
typedef enum zfeature_flags {
/* Can open pool readonly even if this feature is not supported. */
ZFEATURE_FLAG_READONLY_COMPAT = (1 << 0),
2018-10-16 11:15:04 -07:00
/*
* Is this feature necessary to load the pool? i.e. do we need this
* feature to read the full feature list out of the MOS?
*/
ZFEATURE_FLAG_MOS = (1 << 1),
/* Activate this feature at the same time it is enabled. */
ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2),
/* Each dataset has a field set if it has ever used this feature. */
2025-07-03 11:03:30 -07:00
ZFEATURE_FLAG_PER_DATASET = (1 << 3),
/*
* This feature isn't enabled by zpool upgrade; it must be explicitly
* listed to be enabled. It will also be applied if listed in an
* explicitly provided compatibility list. This flag can be removed
* from a given feature once support is sufficiently widespread, or
* worries about backwards compatibility are no longer relevant.
*/
ZFEATURE_FLAG_NO_UPGRADE = (1 << 4)
} zfeature_flags_t;
2018-10-16 11:15:04 -07:00
typedef enum zfeature_type {
ZFEATURE_TYPE_BOOLEAN,
ZFEATURE_TYPE_UINT64_ARRAY,
ZFEATURE_NUM_TYPES
} zfeature_type_t;
2012-12-13 15:24:15 -08:00
typedef struct zfeature_info {
2013-10-08 09:13:05 -08:00
spa_feature_t fi_feature;
2012-12-13 15:24:15 -08:00
const char *fi_uname; /* User-facing feature name */
const char *fi_guid; /* On-disk feature identifier */
const char *fi_desc; /* Feature description */
zfeature_flags_t fi_flags;
boolean_t fi_zfs_mod_supported; /* supported by running zfs module */
2018-10-16 11:15:04 -07:00
zfeature_type_t fi_type; /* Only relevant for PER_DATASET features */
2013-10-08 09:13:05 -08:00
/* array of dependencies, terminated by SPA_FEATURE_NONE */
const spa_feature_t *fi_depends;
2012-12-13 15:24:15 -08:00
} zfeature_info_t;
2014-06-05 13:19:08 -08:00
typedef int (zfeature_func_t)(zfeature_info_t *, void *);
2012-12-13 15:24:15 -08:00
#define ZFS_FEATURE_DEBUG
2021-05-15 11:53:14 +02:00
_ZFEATURE_COMMON_H zfeature_info_t spa_feature_table[SPA_FEATURES];
_ZFEATURE_COMMON_H boolean_t zfeature_checks_disable;
2012-12-13 15:24:15 -08:00
2021-05-15 11:53:14 +02:00
_ZFEATURE_COMMON_H boolean_t zfeature_is_valid_guid(const char *);
2012-12-13 15:24:15 -08:00
2021-05-15 11:53:14 +02:00
_ZFEATURE_COMMON_H boolean_t zfeature_is_supported(const char *);
_ZFEATURE_COMMON_H int zfeature_lookup_guid(const char *, spa_feature_t *);
_ZFEATURE_COMMON_H int zfeature_lookup_name(const char *, spa_feature_t *);
_ZFEATURE_COMMON_H boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t);
2012-12-13 15:24:15 -08:00
2021-05-15 11:53:14 +02:00
_ZFEATURE_COMMON_H void zpool_feature_init(void);
2012-12-13 15:24:15 -08:00
#ifdef __cplusplus
}
#endif
#endif /* _ZFEATURE_COMMON_H */