zfeature_common.h revision a6f561b4aee75d0d028e7b36b151c8ed8a86bc76
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License (the "License").
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You may not use this file except in compliance with the License.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * or http://www.opensolaris.org/os/licensing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2012 by Delphix. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef _ZFEATURE_COMMON_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _ZFEATURE_COMMON_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <sys/fs/zfs.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <sys/inttypes.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <sys/types.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifdef __cplusplus
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern "C" {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct zfeature_info;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct zfeature_info {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char *fi_uname; /* User-facing feature name */
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz const char *fi_guid; /* On-disk feature identifier */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char *fi_desc; /* Feature description */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz boolean_t fi_mos; /* Is the feature necessary to read the MOS? */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin struct zfeature_info **fi_depends; /* array; null terminated */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin} zfeature_info_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainztypedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ZFS_FEATURE_DEBUG
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinenum spa_feature {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SPA_FEATURE_ASYNC_DESTROY,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SPA_FEATURE_EMPTY_BPOBJ,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SPA_FEATURE_LZ4_COMPRESS,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SPA_FEATURES
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz} spa_feature_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern zfeature_info_t spa_feature_table[SPA_FEATURES];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern boolean_t zfeature_is_valid_guid(const char *);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainzextern boolean_t zfeature_is_supported(const char *);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int zfeature_lookup_guid(const char *, zfeature_info_t **res);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int zfeature_lookup_name(const char *, zfeature_info_t **res);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern void zpool_feature_init(void);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifdef __cplusplus
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* _ZFEATURE_COMMON_H */
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner