1236884Smm/* 2236884Smm * CDDL HEADER START 3236884Smm * 4236884Smm * The contents of this file are subject to the terms of the 5236884Smm * Common Development and Distribution License (the "License"). 6236884Smm * You may not use this file except in compliance with the License. 7236884Smm * 8236884Smm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9236884Smm * or http://www.opensolaris.org/os/licensing. 10236884Smm * See the License for the specific language governing permissions 11236884Smm * and limitations under the License. 12236884Smm * 13236884Smm * When distributing Covered Code, include this CDDL HEADER in each 14236884Smm * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15236884Smm * If applicable, add the following below this CDDL HEADER, with the 16236884Smm * fields enclosed by brackets "[]" replaced with your own identifying 17236884Smm * information: Portions Copyright [yyyy] [name of copyright owner] 18236884Smm * 19236884Smm * CDDL HEADER END 20236884Smm */ 21236884Smm 22236884Smm/* 23332547Smav * Copyright (c) 2011, 2017 by Delphix. All rights reserved. 24246586Sdelphij * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 25255750Sdelphij * Copyright (c) 2013, Joyent, Inc. All rights reserved. 26296519Smav * Copyright (c) 2014 Integros [integros.com] 27236884Smm */ 28236884Smm 29236884Smm#ifndef _ZFEATURE_COMMON_H 30236884Smm#define _ZFEATURE_COMMON_H 31236884Smm 32236884Smm#include <sys/fs/zfs.h> 33236884Smm#include <sys/types.h> 34236884Smm 35236884Smm#ifdef __cplusplus 36236884Smmextern "C" { 37236884Smm#endif 38236884Smm 39236884Smmstruct zfeature_info; 40236884Smm 41259813Sdelphijtypedef enum spa_feature { 42259813Sdelphij SPA_FEATURE_NONE = -1, 43259813Sdelphij SPA_FEATURE_ASYNC_DESTROY, 44259813Sdelphij SPA_FEATURE_EMPTY_BPOBJ, 45259813Sdelphij SPA_FEATURE_LZ4_COMPRESS, 46259813Sdelphij SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, 47259813Sdelphij SPA_FEATURE_SPACEMAP_HISTOGRAM, 48260150Sdelphij SPA_FEATURE_ENABLED_TXG, 49260150Sdelphij SPA_FEATURE_HOLE_BIRTH, 50259813Sdelphij SPA_FEATURE_EXTENSIBLE_DATASET, 51268075Sdelphij SPA_FEATURE_EMBEDDED_DATA, 52260183Sdelphij SPA_FEATURE_BOOKMARKS, 53264835Sdelphij SPA_FEATURE_FS_SS_LIMIT, 54274337Sdelphij SPA_FEATURE_LARGE_BLOCKS, 55289422Smav SPA_FEATURE_SHA512, 56289422Smav SPA_FEATURE_SKEIN, 57301010Sallanjude#ifdef illumos 58289422Smav SPA_FEATURE_EDONR, 59289422Smav#endif 60332525Smav SPA_FEATURE_DEVICE_REMOVAL, 61332525Smav SPA_FEATURE_OBSOLETE_COUNTS, 62332547Smav SPA_FEATURE_POOL_CHECKPOINT, 63339104Smav SPA_FEATURE_SPACEMAP_V2, 64259813Sdelphij SPA_FEATURES 65259813Sdelphij} spa_feature_t; 66259813Sdelphij 67260150Sdelphij#define SPA_FEATURE_DISABLED (-1ULL) 68260150Sdelphij 69286708Smavtypedef enum zfeature_flags { 70286708Smav /* Can open pool readonly even if this feature is not supported. */ 71286708Smav ZFEATURE_FLAG_READONLY_COMPAT = (1 << 0), 72286708Smav /* Is this feature necessary to read the MOS? */ 73286708Smav ZFEATURE_FLAG_MOS = (1 << 1), 74286708Smav /* Activate this feature at the same time it is enabled. */ 75286708Smav ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2), 76286708Smav /* Each dataset has a field set if it has ever used this feature. */ 77286708Smav ZFEATURE_FLAG_PER_DATASET = (1 << 3) 78286708Smav} zfeature_flags_t; 79286708Smav 80236884Smmtypedef struct zfeature_info { 81259813Sdelphij spa_feature_t fi_feature; 82236884Smm const char *fi_uname; /* User-facing feature name */ 83236884Smm const char *fi_guid; /* On-disk feature identifier */ 84236884Smm const char *fi_desc; /* Feature description */ 85286708Smav zfeature_flags_t fi_flags; 86259813Sdelphij /* array of dependencies, terminated by SPA_FEATURE_NONE */ 87259813Sdelphij const spa_feature_t *fi_depends; 88236884Smm} zfeature_info_t; 89236884Smm 90268075Sdelphijtypedef int (zfeature_func_t)(zfeature_info_t *, void *); 91236884Smm 92236884Smm#define ZFS_FEATURE_DEBUG 93236884Smm 94236884Smmextern zfeature_info_t spa_feature_table[SPA_FEATURES]; 95236884Smm 96236884Smmextern boolean_t zfeature_is_valid_guid(const char *); 97236884Smm 98236884Smmextern boolean_t zfeature_is_supported(const char *); 99268075Sdelphijextern int zfeature_lookup_name(const char *, spa_feature_t *); 100268075Sdelphijextern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); 101236884Smm 102236884Smmextern void zpool_feature_init(void); 103236884Smm 104236884Smm#ifdef __cplusplus 105236884Smm} 106236884Smm#endif 107236884Smm 108236884Smm#endif /* _ZFEATURE_COMMON_H */ 109