153089abeschrock/* 253089abeschrock * CDDL HEADER START 353089abeschrock * 453089abeschrock * The contents of this file are subject to the terms of the 553089abeschrock * Common Development and Distribution License (the "License"). 653089abeschrock * You may not use this file except in compliance with the License. 753089abeschrock * 853089abeschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 953089abeschrock * or http://www.opensolaris.org/os/licensing. 1053089abeschrock * See the License for the specific language governing permissions 1153089abeschrock * and limitations under the License. 1253089abeschrock * 1353089abeschrock * When distributing Covered Code, include this CDDL HEADER in each 1453089abeschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1553089abeschrock * If applicable, add the following below this CDDL HEADER, with the 1653089abeschrock * fields enclosed by brackets "[]" replaced with your own identifying 1753089abeschrock * information: Portions Copyright [yyyy] [name of copyright owner] 1853089abeschrock * 1953089abeschrock * CDDL HEADER END 2053089abeschrock */ 2153089abeschrock 2253089abeschrock/* 238671400Serapheim Dimitropoulos * Copyright (c) 2011, 2017 by Delphix. All rights reserved. 24a6f561bSašo Kiselkov * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 25810e43bBill Pijewski * Copyright (c) 2013, Joyent, Inc. All rights reserved. 26c3d26abMatthew Ahrens * Copyright (c) 2014 Integros [integros.com] 27663207aDon Brady * Copyright (c) 2017, Intel Corporation. 2853089abeschrock */ 2953089abeschrock 3053089abeschrock#ifndef _ZFEATURE_COMMON_H 3153089abeschrock#define _ZFEATURE_COMMON_H 3253089abeschrock 3353089abeschrock#include <sys/fs/zfs.h> 3453089abeschrock#include <sys/inttypes.h> 3553089abeschrock#include <sys/types.h> 3653089abeschrock 3753089abeschrock#ifdef __cplusplus 3853089abeschrockextern "C" { 3953089abeschrock#endif 4053089abeschrock 4153089abeschrockstruct zfeature_info; 4253089abeschrock 432acef22Matthew Ahrenstypedef enum spa_feature { 442acef22Matthew Ahrens SPA_FEATURE_NONE = -1, 452acef22Matthew Ahrens SPA_FEATURE_ASYNC_DESTROY, 462acef22Matthew Ahrens SPA_FEATURE_EMPTY_BPOBJ, 472acef22Matthew Ahrens SPA_FEATURE_LZ4_COMPRESS, 482acef22Matthew Ahrens SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, 492acef22Matthew Ahrens SPA_FEATURE_SPACEMAP_HISTOGRAM, 5043466aaMax Grossman SPA_FEATURE_ENABLED_TXG, 5143466aaMax Grossman SPA_FEATURE_HOLE_BIRTH, 522acef22Matthew Ahrens SPA_FEATURE_EXTENSIBLE_DATASET, 535d7b4d4Matthew Ahrens SPA_FEATURE_EMBEDDED_DATA, 5478f1710Matthew Ahrens SPA_FEATURE_BOOKMARKS, 55a2afb61Jerry Jelinek SPA_FEATURE_FS_SS_LIMIT, 56b515258Matthew Ahrens SPA_FEATURE_LARGE_BLOCKS, 5754811daToomas Soome SPA_FEATURE_LARGE_DNODE, 5845818eeMatthew Ahrens SPA_FEATURE_SHA512, 5945818eeMatthew Ahrens SPA_FEATURE_SKEIN, 6045818eeMatthew Ahrens SPA_FEATURE_EDONR, 615cabbc6Prashanth Sreenivasa SPA_FEATURE_DEVICE_REMOVAL, 625cabbc6Prashanth Sreenivasa SPA_FEATURE_OBSOLETE_COUNTS, 638671400Serapheim Dimitropoulos SPA_FEATURE_POOL_CHECKPOINT, 6417f1128Serapheim Dimitropoulos SPA_FEATURE_SPACEMAP_V2, 65663207aDon Brady SPA_FEATURE_ALLOCATION_CLASSES, 66e4c795bTom Caputi SPA_FEATURE_RESILVER_DEFER, 67eb63303Tom Caputi SPA_FEATURE_ENCRYPTION, 68eb63303Tom Caputi SPA_FEATURE_BOOKMARK_V2, 69f67950bNasf-Fan SPA_FEATURE_USEROBJ_ACCOUNTING, 70f67950bNasf-Fan SPA_FEATURE_PROJECT_QUOTA, 71814dcd4Serapheim Dimitropoulos SPA_FEATURE_LOG_SPACEMAP, 722acef22Matthew Ahrens SPA_FEATURES 732acef22Matthew Ahrens} spa_feature_t; 742acef22Matthew Ahrens 7543466aaMax Grossman#define SPA_FEATURE_DISABLED (-1ULL) 7643466aaMax Grossman 77ca0cc39Matthew Ahrenstypedef enum zfeature_flags { 78ca0cc39Matthew Ahrens /* Can open pool readonly even if this feature is not supported. */ 79ca0cc39Matthew Ahrens ZFEATURE_FLAG_READONLY_COMPAT = (1 << 0), 80ca0cc39Matthew Ahrens /* Is this feature necessary to read the MOS? */ 81ca0cc39Matthew Ahrens ZFEATURE_FLAG_MOS = (1 << 1), 82ca0cc39Matthew Ahrens /* Activate this feature at the same time it is enabled. */ 83ca0cc39Matthew Ahrens ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2), 84ca0cc39Matthew Ahrens /* Each dataset has a field set if it has ever used this feature. */ 85ca0cc39Matthew Ahrens ZFEATURE_FLAG_PER_DATASET = (1 << 3) 86ca0cc39Matthew Ahrens} zfeature_flags_t; 87ca0cc39Matthew Ahrens 8853089abeschrocktypedef struct zfeature_info { 892acef22Matthew Ahrens spa_feature_t fi_feature; 9053089abeschrock const char *fi_uname; /* User-facing feature name */ 9153089abeschrock const char *fi_guid; /* On-disk feature identifier */ 9253089abeschrock const char *fi_desc; /* Feature description */ 93ca0cc39Matthew Ahrens zfeature_flags_t fi_flags; 942acef22Matthew Ahrens /* array of dependencies, terminated by SPA_FEATURE_NONE */ 952acef22Matthew Ahrens const spa_feature_t *fi_depends; 9653089abeschrock} zfeature_info_t; 9753089abeschrock 985d7b4d4Matthew Ahrenstypedef int (zfeature_func_t)(zfeature_info_t *, void *); 9953089abeschrock 10053089abeschrock#define ZFS_FEATURE_DEBUG 10153089abeschrock 10253089abeschrockextern zfeature_info_t spa_feature_table[SPA_FEATURES]; 10353089abeschrock 10453089abeschrockextern boolean_t zfeature_is_valid_guid(const char *); 10553089abeschrock 10653089abeschrockextern boolean_t zfeature_is_supported(const char *); 1075d7b4d4Matthew Ahrensextern int zfeature_lookup_name(const char *, spa_feature_t *); 1085d7b4d4Matthew Ahrensextern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); 10953089abeschrock 11053089abeschrockextern void zpool_feature_init(void); 11153089abeschrock 11253089abeschrock#ifdef __cplusplus 11353089abeschrock} 11453089abeschrock#endif 11553089abeschrock 11653089abeschrock#endif /* _ZFEATURE_COMMON_H */ 117