zfs.h revision 8f18d1fadf6a0c20fac9ff7259a5368faa3c3bfb
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
441d80aa4f613b6298fc8bd3151f4be02dbf84fclling * Common Development and Distribution License (the "License").
441d80aa4f613b6298fc8bd3151f4be02dbf84fclling * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
f94275ce205810a201404c5f35f4cc96057022b1Adam Leventhal
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifndef _SYS_FS_ZFS_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define _SYS_FS_ZFS_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby#include <sys/time.h>
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Types and constants shared between userland and the kernel.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Each dataset can be one of the following types. These constants can be
fa9e4066f08beec538e775443c5be79dd423fcabahrens * combined into masks that can be passed to various functions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum {
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_TYPE_FILESYSTEM = 0x1,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_TYPE_SNAPSHOT = 0x2,
b1b8ab34de515a5e83206da22c3d7e563241b021lling ZFS_TYPE_VOLUME = 0x4,
b1b8ab34de515a5e83206da22c3d7e563241b021lling ZFS_TYPE_POOL = 0x8
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_type_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZFS_TYPE_DATASET \
fa9e4066f08beec538e775443c5be79dd423fcabahrens (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
fa9e4066f08beec538e775443c5be79dd423fcabahrens
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor#define ZAP_MAXNAMELEN 256
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor#define ZAP_MAXVALUELEN (1024 * 8)
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor#define ZAP_OLDMAXVALUELEN 1024
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
990b4856d0eaada6f8140335733a1b1771ed2746lling * Dataset properties are identified by these constants and must be added to
990b4856d0eaada6f8140335733a1b1771ed2746lling * the end of this list to ensure that external consumers are not affected
990b4856d0eaada6f8140335733a1b1771ed2746lling * by the change. If you make any changes to this list, be sure to update
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * the property table in usr/src/common/zfs/zfs_prop.c.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum {
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_TYPE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_CREATION,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_USED,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_AVAILABLE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_REFERENCED,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_COMPRESSRATIO,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_MOUNTED,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_ORIGIN,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_QUOTA,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_RESERVATION,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_VOLSIZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_VOLBLOCKSIZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_RECORDSIZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_MOUNTPOINT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_SHARENFS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_CHECKSUM,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_COMPRESSION,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_ATIME,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_DEVICES,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_EXEC,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_SETUID,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_READONLY,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_ZONED,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_SNAPDIR,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_ACLMODE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_ACLINHERIT,
66e2aacc02a4625d105fb249ad16c27e79604ff2gw ZFS_PROP_CREATETXG, /* not exposed to the user */
66e2aacc02a4625d105fb249ad16c27e79604ff2gw ZFS_PROP_NAME, /* not exposed to the user */
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock ZFS_PROP_CANMOUNT,
66e2aacc02a4625d105fb249ad16c27e79604ff2gw ZFS_PROP_SHAREISCSI,
66e2aacc02a4625d105fb249ad16c27e79604ff2gw ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */
7b55fa8ea6046becb3b72f8886a503979c322084ck ZFS_PROP_XATTR,
d0ad202d2eff2cc0c70ee550686a703ddda7106cahrens ZFS_PROP_NUMCLONES, /* not exposed to the user */
b1b8ab34de515a5e83206da22c3d7e563241b021lling ZFS_PROP_COPIES,
e7437265dc2a4920c197ed4337665539d358b22cahrens ZFS_PROP_VERSION,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_UTF8ONLY,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_NORMALIZE,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_CASE,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_VSCAN,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_NBMAND,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_PROP_SHARESMB,
a9799022bd90b13722204e80112efaa5bf573099ck ZFS_PROP_REFQUOTA,
a9799022bd90b13722204e80112efaa5bf573099ck ZFS_PROP_REFRESERVATION,
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrock ZFS_PROP_GUID,
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek ZFS_PROP_PRIMARYCACHE,
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek ZFS_PROP_SECONDARYCACHE,
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens ZFS_PROP_USEDSNAP,
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens ZFS_PROP_USEDDS,
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens ZFS_PROP_USEDCHILD,
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens ZFS_PROP_USEDREFRESERV,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_PROP_USERACCOUNTING, /* not exposed to the user */
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_PROP_DEFER_DESTROY,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_PROP_USERREFS,
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrin ZFS_PROP_LOGBIAS,
1d7132005da8d75994a6ad204e6ec05ef5ffaa4bEric Schrock ZFS_PROP_UNIQUE, /* not exposed to the user */
1d7132005da8d75994a6ad204e6ec05ef5ffaa4bEric Schrock ZFS_PROP_OBJSETID, /* not exposed to the user */
91ebeef555ce7f899b6270a3c2df47b51f7ad59aahrens ZFS_NUM_PROPS
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_prop_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrenstypedef enum {
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_PROP_USERUSED,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_PROP_USERQUOTA,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_PROP_GROUPUSED,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_PROP_GROUPQUOTA,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_NUM_USERQUOTA_PROPS
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens} zfs_userquota_prop_t;
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensextern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens
990b4856d0eaada6f8140335733a1b1771ed2746lling/*
990b4856d0eaada6f8140335733a1b1771ed2746lling * Pool properties are identified by these constants and must be added to the
b87f3af36bb994656da117319f5129ddfd05ed21perrin * end of this list to ensure that external consumers are not affected
990b4856d0eaada6f8140335733a1b1771ed2746lling * by the change. If you make any changes to this list, be sure to update
990b4856d0eaada6f8140335733a1b1771ed2746lling * the property table in usr/src/common/zfs/zpool_prop.c.
990b4856d0eaada6f8140335733a1b1771ed2746lling */
990b4856d0eaada6f8140335733a1b1771ed2746llingtypedef enum {
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_NAME,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_SIZE,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_USED,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_AVAILABLE,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_CAPACITY,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_ALTROOT,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_HEALTH,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_GUID,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_VERSION,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_BOOTFS,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_DELEGATION,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_PROP_AUTOREPLACE,
2f8aaab38e6371ad39ed90a1211ba8921acbb4d5eschrock ZPOOL_PROP_CACHEFILE,
0a4e9518a44f226be6d39383330b5b1792d2f184gw ZPOOL_PROP_FAILUREMODE,
d5b5bb256c576fe5ef26e0795bd40abe77f93246Rich Morris ZPOOL_PROP_LISTSNAPS,
573ca77e53dd31dcaebef023e7eb41969e6896c1George Wilson ZPOOL_PROP_AUTOEXPAND,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPOOL_NUM_PROPS
990b4856d0eaada6f8140335733a1b1771ed2746lling} zpool_prop_t;
b1b8ab34de515a5e83206da22c3d7e563241b021lling
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZPROP_CONT -2
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZPROP_INVAL -1
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZPROP_VALUE "value"
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZPROP_SOURCE "source"
7f7322febbcfe774b7270abc3b191c094bfcc517eschrock
b1b8ab34de515a5e83206da22c3d7e563241b021llingtypedef enum {
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPROP_SRC_NONE = 0x1,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPROP_SRC_DEFAULT = 0x2,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPROP_SRC_TEMPORARY = 0x4,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPROP_SRC_LOCAL = 0x8,
990b4856d0eaada6f8140335733a1b1771ed2746lling ZPROP_SRC_INHERITED = 0x10
990b4856d0eaada6f8140335733a1b1771ed2746lling} zprop_source_t;
990b4856d0eaada6f8140335733a1b1771ed2746lling
990b4856d0eaada6f8140335733a1b1771ed2746lling#define ZPROP_SRC_ALL 0x1f
990b4856d0eaada6f8140335733a1b1771ed2746lling
990b4856d0eaada6f8140335733a1b1771ed2746llingtypedef int (*zprop_func)(int, void *);
990b4856d0eaada6f8140335733a1b1771ed2746lling
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh/*
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh * Properties to be set on the root file system of a new pool
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh * are stuffed into their own nvlist, which is then included in
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh * the properties nvlist with the pool properties.
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh */
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh#define ZPOOL_ROOTFS_PROPS "root-props-nvl"
0a48a24e663a04e34e2ed4e55390ad96f178dbeatimh
990b4856d0eaada6f8140335733a1b1771ed2746lling/*
990b4856d0eaada6f8140335733a1b1771ed2746lling * Dataset property functions shared between libzfs and kernel.
990b4856d0eaada6f8140335733a1b1771ed2746lling */
990b4856d0eaada6f8140335733a1b1771ed2746llingconst char *zfs_prop_default_string(zfs_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llinguint64_t zfs_prop_default_numeric(zfs_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingboolean_t zfs_prop_readonly(zfs_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingboolean_t zfs_prop_inheritable(zfs_prop_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwboolean_t zfs_prop_setonce(zfs_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingconst char *zfs_prop_to_name(zfs_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingzfs_prop_t zfs_name_to_prop(const char *);
990b4856d0eaada6f8140335733a1b1771ed2746llingboolean_t zfs_prop_user(const char *);
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrensboolean_t zfs_prop_userquota(const char *name);
990b4856d0eaada6f8140335733a1b1771ed2746llingint zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
990b4856d0eaada6f8140335733a1b1771ed2746llingint zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
4853e976fadf3d55239638b6a1fee20681fde314gwboolean_t zfs_prop_valid_for_type(int, zfs_type_t);
b1b8ab34de515a5e83206da22c3d7e563241b021lling
990b4856d0eaada6f8140335733a1b1771ed2746lling/*
990b4856d0eaada6f8140335733a1b1771ed2746lling * Pool property functions shared between libzfs and kernel.
990b4856d0eaada6f8140335733a1b1771ed2746lling */
990b4856d0eaada6f8140335733a1b1771ed2746llingzpool_prop_t zpool_name_to_prop(const char *);
990b4856d0eaada6f8140335733a1b1771ed2746llingconst char *zpool_prop_to_name(zpool_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingconst char *zpool_prop_default_string(zpool_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llinguint64_t zpool_prop_default_numeric(zpool_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingboolean_t zpool_prop_readonly(zpool_prop_t);
990b4856d0eaada6f8140335733a1b1771ed2746llingint zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
990b4856d0eaada6f8140335733a1b1771ed2746llingint zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
b1b8ab34de515a5e83206da22c3d7e563241b021lling
990b4856d0eaada6f8140335733a1b1771ed2746lling/*
990b4856d0eaada6f8140335733a1b1771ed2746lling * Definitions for the Delegation.
990b4856d0eaada6f8140335733a1b1771ed2746lling */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarkstypedef enum {
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_WHO_UNKNOWN = 0,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_USER = 'u',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_USER_SETS = 'U',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_GROUP = 'g',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_GROUP_SETS = 'G',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_EVERYONE = 'e',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_EVERYONE_SETS = 'E',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_CREATE = 'c',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_CREATE_SETS = 'C',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_NAMED_SET = 's',
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_NAMED_SET_SETS = 'S'
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks} zfs_deleg_who_type_t;
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarkstypedef enum {
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_NONE = 0,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_PERM_LOCAL = 1,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_PERM_DESCENDENT = 2,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_DELEG_PERM_CREATE = 4
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks} zfs_deleg_inherit_t;
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_PERM_UID "uid"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_PERM_GID "gid"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZFS_DELEG_PERM_GROUPS "groups"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright#define ZFS_SMB_ACL_SRC "src"
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright#define ZFS_SMB_ACL_TARGET "target"
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright
a227b7f4f323ad89c40a86c430a5e891504a8e8bhstypedef enum {
a227b7f4f323ad89c40a86c430a5e891504a8e8bhs ZFS_CANMOUNT_OFF = 0,
a227b7f4f323ad89c40a86c430a5e891504a8e8bhs ZFS_CANMOUNT_ON = 1,
a227b7f4f323ad89c40a86c430a5e891504a8e8bhs ZFS_CANMOUNT_NOAUTO = 2
a227b7f4f323ad89c40a86c430a5e891504a8e8bhs} zfs_canmount_type_t;
a227b7f4f323ad89c40a86c430a5e891504a8e8bhs
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrintypedef enum {
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrin ZFS_LOGBIAS_LATENCY = 0,
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrin ZFS_LOGBIAS_THROUGHPUT = 1
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrin} zfs_logbias_op_t;
e09fa4dacfb671e707d50a55ae9b5cc191e1b8cbNeil Perrin
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef enum zfs_share_op {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_SHARE_NFS = 0,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_UNSHARE_NFS = 1,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_SHARE_SMB = 2,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_UNSHARE_SMB = 3
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw} zfs_share_op_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wrighttypedef enum zfs_smb_acl_op {
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright ZFS_SMB_ACL_ADD,
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright ZFS_SMB_ACL_REMOVE,
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright ZFS_SMB_ACL_RENAME,
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright ZFS_SMB_ACL_PURGE
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright} zfs_smb_acl_op_t;
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bektypedef enum zfs_cache_type {
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek ZFS_CACHE_NONE = 0,
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek ZFS_CACHE_METADATA = 1,
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek ZFS_CACHE_ALL = 2
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek} zfs_cache_type_t;
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek
3baa08fc5b6bea08a475b0cfe3ad161d74c5864bek
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock/*
99653d4ee642c6528e88224f12409a5f23060994eschrock * On-disk version number.
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock */
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_1 1ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_2 2ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_3 3ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_4 4ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_5 5ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_6 6ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_7 7ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_8 8ULL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define SPA_VERSION_9 9ULL
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan#define SPA_VERSION_10 10ULL
088f389458728c464569a5506b58070254fa4f7dahrens#define SPA_VERSION_11 11ULL
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrens#define SPA_VERSION_12 12ULL
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens#define SPA_VERSION_13 13ULL
d0f3f37e7f24f68fdbd85386c60e576883622762Mark Shellenbaum#define SPA_VERSION_14 14ULL
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define SPA_VERSION_15 15ULL
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor#define SPA_VERSION_16 16ULL
f94275ce205810a201404c5f35f4cc96057022b1Adam Leventhal#define SPA_VERSION_17 17ULL
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby#define SPA_VERSION_18 18ULL
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define SPA_VERSION_19 19ULL
b1b8ab34de515a5e83206da22c3d7e563241b021lling/*
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens * and do the appropriate changes. Also bump the version number in
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens * usr/src/grub/capability.
b1b8ab34de515a5e83206da22c3d7e563241b021lling */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define SPA_VERSION SPA_VERSION_19
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define SPA_VERSION_STRING "19"
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm/*
e7437265dc2a4920c197ed4337665539d358b22cahrens * Symbolic names for the changes that caused a SPA_VERSION switch.
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * Used in the code when checking for presence or absence of a feature.
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * Feel free to define multiple symbolic names for each version if there
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * were multiple changes to on-disk structures during that version.
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm *
e7437265dc2a4920c197ed4337665539d358b22cahrens * NOTE: When checking the current SPA_VERSION in your code, be sure
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * to use spa_version() since it reports the version of the
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * last synced uberblock. Checking the in-flight version can
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * be dangerous in some cases.
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm */
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_INITIAL SPA_VERSION_1
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_SPARES SPA_VERSION_3
f94275ce205810a201404c5f35f4cc96057022b1Adam Leventhal#define SPA_VERSION_RAIDZ2 SPA_VERSION_3
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_BPLIST_ACCOUNT SPA_VERSION_3
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
e7437265dc2a4920c197ed4337665539d358b22cahrens#define SPA_VERSION_BOOTFS SPA_VERSION_6
990b4856d0eaada6f8140335733a1b1771ed2746lling#define SPA_VERSION_SLOGS SPA_VERSION_7
990b4856d0eaada6f8140335733a1b1771ed2746lling#define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define SPA_VERSION_FUID SPA_VERSION_9
a9799022bd90b13722204e80112efaa5bf573099ck#define SPA_VERSION_REFRESERVATION SPA_VERSION_9
a9799022bd90b13722204e80112efaa5bf573099ck#define SPA_VERSION_REFQUOTA SPA_VERSION_9
a9799022bd90b13722204e80112efaa5bf573099ck#define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan#define SPA_VERSION_L2CACHE SPA_VERSION_10
088f389458728c464569a5506b58070254fa4f7dahrens#define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
088f389458728c464569a5506b58070254fa4f7dahrens#define SPA_VERSION_ORIGIN SPA_VERSION_11
088f389458728c464569a5506b58070254fa4f7dahrens#define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrens#define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
74e7dc986c89efca1f2e4451c7a572e05e4a6e4fMatthew Ahrens#define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
d0f3f37e7f24f68fdbd85386c60e576883622762Mark Shellenbaum#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define SPA_VERSION_USERSPACE SPA_VERSION_15
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor#define SPA_VERSION_STMF_PROP SPA_VERSION_16
f94275ce205810a201404c5f35f4cc96057022b1Adam Leventhal#define SPA_VERSION_RAIDZ3 SPA_VERSION_17
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby#define SPA_VERSION_USERREFS SPA_VERSION_18
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define SPA_VERSION_HOLES SPA_VERSION_19
e7437265dc2a4920c197ed4337665539d358b22cahrens
e7437265dc2a4920c197ed4337665539d358b22cahrens/*
e7437265dc2a4920c197ed4337665539d358b22cahrens * ZPL version - rev'd whenever an incompatible on-disk format change
e7437265dc2a4920c197ed4337665539d358b22cahrens * occurs. This is independent of SPA/DMU/ZAP versioning. You must
e7437265dc2a4920c197ed4337665539d358b22cahrens * also update the version_table[] and help message in zfs_prop.c.
e7437265dc2a4920c197ed4337665539d358b22cahrens *
e7437265dc2a4920c197ed4337665539d358b22cahrens * When changing, be sure to teach GRUB how to read the new format!
478ed9ada0b6efe1318150a700986aa47e6a926dEric Taylor * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
e7437265dc2a4920c197ed4337665539d358b22cahrens */
e7437265dc2a4920c197ed4337665539d358b22cahrens#define ZPL_VERSION_1 1ULL
e7437265dc2a4920c197ed4337665539d358b22cahrens#define ZPL_VERSION_2 2ULL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define ZPL_VERSION_3 3ULL
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define ZPL_VERSION_4 4ULL
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define ZPL_VERSION ZPL_VERSION_4
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define ZPL_VERSION_STRING "4"
e7437265dc2a4920c197ed4337665539d358b22cahrens
e7437265dc2a4920c197ed4337665539d358b22cahrens#define ZPL_VERSION_INITIAL ZPL_VERSION_1
e7437265dc2a4920c197ed4337665539d358b22cahrens#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define ZPL_VERSION_FUID ZPL_VERSION_3
de8267e0f723ed2c38ea9def92d465f69a300f56timh#define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define ZPL_VERSION_SYSATTR ZPL_VERSION_3
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens#define ZPL_VERSION_USERSPACE ZPL_VERSION_4
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The following are configuration names used in the nvlist describing a pool's
fa9e4066f08beec538e775443c5be79dd423fcabahrens * configuration.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_VERSION "version"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_POOL_NAME "name"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_POOL_STATE "state"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_POOL_TXG "txg"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_POOL_GUID "pool_guid"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_CREATE_TXG "create_txg"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_TOP_GUID "top_guid"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_TYPE "type"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_CHILDREN "children"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_ID "id"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_GUID "guid"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_PATH "path"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_DEVID "devid"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_ASHIFT "ashift"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_ASIZE "asize"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_DTL "DTL"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CONFIG_STATS "stats"
afefbcddfd8caf5f3b2da510d9439471ab225040eschrock#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#define ZPOOL_CONFIG_ERRCOUNT "error_count"
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#define ZPOOL_CONFIG_NOT_PRESENT "not_present"
99653d4ee642c6528e88224f12409a5f23060994eschrock#define ZPOOL_CONFIG_SPARES "spares"
99653d4ee642c6528e88224f12409a5f23060994eschrock#define ZPOOL_CONFIG_IS_SPARE "is_spare"
99653d4ee642c6528e88224f12409a5f23060994eschrock#define ZPOOL_CONFIG_NPARITY "nparity"
95173954d2b811ceb583a9012c3b16e1d0dd6438ek#define ZPOOL_CONFIG_HOSTID "hostid"
95173954d2b811ceb583a9012c3b16e1d0dd6438ek#define ZPOOL_CONFIG_HOSTNAME "hostname"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_UNSPARE "unspare"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_PHYS_PATH "phys_path"
8654d0253136055bd4cc2423d87378e8a37f2eb5perrin#define ZPOOL_CONFIG_IS_LOG "is_log"
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan#define ZPOOL_CONFIG_L2CACHE "l2cache"
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define ZPOOL_CONFIG_IS_HOLE "is_hole"
e14bb3258d05c1b1077e2db7cf77088924e56919Jeff Bonwick#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock/*
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * The persistent vdev state is stored as separate values rather than a single
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * 'vdev_state' entry. This is because a device can be in multiple states, such
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * as offline and degraded.
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_OFFLINE "offline"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_FAULTED "faulted"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_DEGRADED "degraded"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZPOOL_CONFIG_REMOVED "removed"
6809eb4e2a4a94bcc76229c7b5108b96134537b6Eric Schrock#define ZPOOL_CONFIG_FRU "fru"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_ROOT "root"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_MIRROR "mirror"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_REPLACING "replacing"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_RAIDZ "raidz"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_DISK "disk"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_FILE "file"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define VDEV_TYPE_MISSING "missing"
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson#define VDEV_TYPE_HOLE "hole"
99653d4ee642c6528e88224f12409a5f23060994eschrock#define VDEV_TYPE_SPARE "spare"
8654d0253136055bd4cc2423d87378e8a37f2eb5perrin#define VDEV_TYPE_LOG "log"
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan#define VDEV_TYPE_L2CACHE "l2cache"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This is needed in userland to report the minimum necessary device size.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define SPA_MINDEVSIZE (64ULL << 20)
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The location of the pool configuration repository, shared between kernel and
fa9e4066f08beec538e775443c5be79dd423fcabahrens * userland.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
c5904d138f3bdf0762dbf452a43d5a5c387ea6a8eschrock#define ZPOOL_CACHE "/etc/zfs/zpool.cache"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * vdev states are ordered from least to most healthy.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * A vdev that's CANT_OPEN or below is considered unusable.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum vdev_state {
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_CLOSED, /* Not currently open */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_OFFLINE, /* Not allowed to open */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock VDEV_STATE_REMOVED, /* Explicitly removed from system */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock VDEV_STATE_FAULTED, /* External request to fault device */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_HEALTHY /* Presumed good */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} vdev_state_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
fa9e4066f08beec538e775443c5be79dd423fcabahrens * of the vdev stats structure uses these constants to distinguish why.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum vdev_aux {
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_NONE, /* no error */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_TOO_SMALL, /* vdev size is too small */
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
99653d4ee642c6528e88224f12409a5f23060994eschrock VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock VDEV_AUX_SPARED, /* hot spare used in another pool */
32b87932f3ef0887d873b7f6d2d1943799b2afc0ek VDEV_AUX_ERR_EXCEEDED, /* too many errors */
b87f3af36bb994656da117319f5129ddfd05ed21perrin VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
b87f3af36bb994656da117319f5129ddfd05ed21perrin VDEV_AUX_BAD_LOG /* cannot read log chain(s) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} vdev_aux_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * pool state. The following states are written to disk as part of the normal
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan * states are software abstractions used at various levels to communicate
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan * pool state.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum pool_state {
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_STATE_ACTIVE = 0, /* In active use */
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_STATE_EXPORTED, /* Explicitly exported */
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_STATE_DESTROYED, /* Explicitly destroyed */
99653d4ee642c6528e88224f12409a5f23060994eschrock POOL_STATE_SPARE, /* Reserved for hot spare use */
fa94a07fd0519b8abfd871ad8fe60e6bebe1e2bbbrendan POOL_STATE_L2CACHE, /* Level 2 ARC device */
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock POOL_STATE_UNAVAIL, /* Internal libzfs state */
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} pool_state_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Scrub types.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum pool_scrub_type {
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_SCRUB_NONE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_SCRUB_RESILVER,
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_SCRUB_EVERYTHING,
fa9e4066f08beec538e775443c5be79dd423fcabahrens POOL_SCRUB_TYPES
fa9e4066f08beec538e775443c5be79dd423fcabahrens} pool_scrub_type_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ZIO types. Needed to interpret vdev statistics below.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum zio_type {
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_NULL = 0,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_READ,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_WRITE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_FREE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_CLAIM,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPE_IOCTL,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZIO_TYPES
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zio_type_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Vdev statistics. Note: all fields should be 64-bit because this
fa9e4066f08beec538e775443c5be79dd423fcabahrens * is passed between kernel and userland as an nvlist uint64 array.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct vdev_stat {
fa9e4066f08beec538e775443c5be79dd423fcabahrens hrtime_t vs_timestamp; /* time since vdev load */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_state; /* vdev state */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_aux; /* see vdev_aux_t */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_alloc; /* space allocated */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_space; /* total capacity */
99653d4ee642c6528e88224f12409a5f23060994eschrock uint64_t vs_dspace; /* deflated capacity */
2a79c5fee1dab68e30266ba4356cf60b871aabcflling uint64_t vs_rsize; /* replaceable dev size */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_ops[ZIO_TYPES]; /* operation count */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_read_errors; /* read errors */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_write_errors; /* write errors */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_checksum_errors; /* checksum errors */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_self_healed; /* self-healed bytes */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_type; /* pool_scrub_type_t */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_complete; /* completed? */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_examined; /* bytes examined; top */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_repaired; /* bytes repaired; leaf */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_errors; /* errors during scrub */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_start; /* UTC scrub start time */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_end; /* UTC scrub end time */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} vdev_stat_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw#define ZVOL_DRIVER "zvol"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_DRIVER "zfs"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_DEV "/dev/zfs"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor/* general zvol path */
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor#define ZVOL_DIR "/dev/zvol"
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor/* expansion */
573ca77e53dd31dcaebef023e7eb41969e6896c1George Wilson#define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:"
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor/* for dump and swap */
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor#define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/"
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor#define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZVOL_PROP_NAME "name"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * /dev/zfs ioctl numbers.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_IOC ('Z' << 8)
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum zfs_ioc {
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_CREATE = ZFS_IOC,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_DESTROY,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_IMPORT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_EXPORT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_CONFIGS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_STATS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_TRYIMPORT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_SCRUB,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_FREEZE,
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock ZFS_IOC_POOL_UPGRADE,
06eeb2ad640ce72d394ac521094bed7681044408ek ZFS_IOC_POOL_GET_HISTORY,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_ADD,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_REMOVE,
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock ZFS_IOC_VDEV_SET_STATE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_ATTACH,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_DETACH,
c67d9675bbc8392fe45f3a7dfbda1ad4daa1eb07eschrock ZFS_IOC_VDEV_SETPATH,
6809eb4e2a4a94bcc76229c7b5108b96134537b6Eric Schrock ZFS_IOC_VDEV_SETFRU,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_OBJSET_STATS,
de8267e0f723ed2c38ea9def92d465f69a300f56timh ZFS_IOC_OBJSET_ZPLPROPS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_DATASET_LIST_NEXT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SNAPSHOT_LIST_NEXT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_PROP,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_CREATE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_DESTROY,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_ROLLBACK,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_RENAME,
3cb34c601f3ef3016f638574f5982e80c3735c71ahrens ZFS_IOC_RECV,
3cb34c601f3ef3016f638574f5982e80c3735c71ahrens ZFS_IOC_SEND,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ZFS_IOC_INJECT_FAULT,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ZFS_IOC_CLEAR_FAULT,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ZFS_IOC_INJECT_LIST_NEXT,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ZFS_IOC_ERROR_LOG,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock ZFS_IOC_CLEAR,
1d452cf5123cb6ac0a013a4dbd4dcceeb0da314dahrens ZFS_IOC_PROMOTE,
1d452cf5123cb6ac0a013a4dbd4dcceeb0da314dahrens ZFS_IOC_DESTROY_SNAPS,
55434c770c89aa1b84474f2559a106803511aba0ek ZFS_IOC_SNAPSHOT,
55434c770c89aa1b84474f2559a106803511aba0ek ZFS_IOC_DSOBJ_TO_DSNAME,
b1b8ab34de515a5e83206da22c3d7e563241b021lling ZFS_IOC_OBJ_TO_PATH,
b1b8ab34de515a5e83206da22c3d7e563241b021lling ZFS_IOC_POOL_SET_PROPS,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_IOC_POOL_GET_PROPS,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_IOC_SET_FSACL,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_IOC_GET_FSACL,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks ZFS_IOC_ISCSI_PERM_CHECK,
e45ce728996d8e573eecb27f555fb86aaff0cafdahrens ZFS_IOC_SHARE,
743a77ed89085d3c232c4a2f65ab4e19576839e2Alan Wright ZFS_IOC_INHERIT_PROP,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_IOC_SMB_ACL,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_IOC_USERSPACE_ONE,
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens ZFS_IOC_USERSPACE_MANY,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_IOC_USERSPACE_UPGRADE,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_IOC_HOLD,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_IOC_RELEASE,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby ZFS_IOC_GET_HOLDS
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_ioc_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock/*
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Internal SPA load state. Used by FMA diagnosis engine.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrocktypedef enum {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock SPA_LOAD_NONE, /* no load in progress */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock SPA_LOAD_OPEN, /* normal open */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock SPA_LOAD_IMPORT, /* import in progress */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock SPA_LOAD_TRYIMPORT /* tryimport in progress */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock} spa_load_state_t;
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock/*
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock * Bookmark name values.
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock */
55434c770c89aa1b84474f2559a106803511aba0ek#define ZPOOL_ERR_LIST "error list"
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock#define ZPOOL_ERR_DATASET "dataset"
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock#define ZPOOL_ERR_OBJECT "object"
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock
06eeb2ad640ce72d394ac521094bed7681044408ek#define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
06eeb2ad640ce72d394ac521094bed7681044408ek
06eeb2ad640ce72d394ac521094bed7681044408ek/*
06eeb2ad640ce72d394ac521094bed7681044408ek * The following are names used in the nvlist describing
06eeb2ad640ce72d394ac521094bed7681044408ek * the pool's history log.
06eeb2ad640ce72d394ac521094bed7681044408ek */
06eeb2ad640ce72d394ac521094bed7681044408ek#define ZPOOL_HIST_RECORD "history record"
06eeb2ad640ce72d394ac521094bed7681044408ek#define ZPOOL_HIST_TIME "history time"
06eeb2ad640ce72d394ac521094bed7681044408ek#define ZPOOL_HIST_CMD "history command"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_WHO "history who"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_ZONE "history zone"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_HOST "history hostname"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_TXG "history txg"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_INT_EVENT "history internal event"
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#define ZPOOL_HIST_INT_STR "history internal str"
06eeb2ad640ce72d394ac521094bed7681044408ek
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock/*
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * Flags for ZFS_IOC_VDEV_SET_STATE
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_ONLINE_CHECKREMOVE 0x1
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_ONLINE_UNSPARE 0x2
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_ONLINE_FORCEFAULT 0x4
573ca77e53dd31dcaebef023e7eb41969e6896c1George Wilson#define ZFS_ONLINE_EXPAND 0x8
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_OFFLINE_TEMPORARY 0x1
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock/*
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * Sysevent payload members. ZFS will generate the following sysevents with the
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * given payloads:
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock *
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_RESILVER_START
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_RESILVER_END
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_POOL_DESTROY
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock *
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock *
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_VDEV_REMOVE
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_VDEV_CLEAR
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ESC_ZFS_VDEV_CHECK
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock *
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock */
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_EV_POOL_NAME "pool_name"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_EV_POOL_GUID "pool_guid"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_EV_VDEV_PATH "vdev_path"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock#define ZFS_EV_VDEV_GUID "vdev_guid"
3d7072f8bd27709dba14f6fe336f149d25d9e207eschrock
088f389458728c464569a5506b58070254fa4f7dahrens/*
088f389458728c464569a5506b58070254fa4f7dahrens * Note: This is encoded on-disk, so new events must be added to the
088f389458728c464569a5506b58070254fa4f7dahrens * end, and unused events can not be removed. Be sure to edit
8f18d1fadf6a0c20fac9ff7259a5368faa3c3bfbGeorge Wilson * libzfs_pool.c: hist_event_table[].
088f389458728c464569a5506b58070254fa4f7dahrens */
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarkstypedef enum history_internal_events {
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_NO_EVENT = 0,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_CREATE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_ADD,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_REMOVE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_DESTROY,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_EXPORT,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_IMPORT,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_ATTACH,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_REPLACE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_DETACH,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_ONLINE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_VDEV_OFFLINE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_UPGRADE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_CLEAR,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_SCRUB,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_POOL_PROPSET,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_CREATE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_CLONE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_DESTROY,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_DESTROY_BEGIN,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_INHERIT,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_PROPSET,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_QUOTA,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_PERM_UPDATE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_PERM_REMOVE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_PERM_WHO_REMOVE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_PROMOTE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_RECEIVE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_RENAME,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_RESERVATION,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_REPLAY_INC_SYNC,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_REPLAY_FULL_SYNC,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_ROLLBACK,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_DS_SNAPSHOT,
e7437265dc2a4920c197ed4337665539d358b22cahrens LOG_DS_UPGRADE,
a9799022bd90b13722204e80112efaa5bf573099ck LOG_DS_REFQUOTA,
a9799022bd90b13722204e80112efaa5bf573099ck LOG_DS_REFRESERV,
088f389458728c464569a5506b58070254fa4f7dahrens LOG_POOL_SCRUB_DONE,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby LOG_DS_USER_HOLD,
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby LOG_DS_USER_RELEASE,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks LOG_END
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks} history_internal_events_t;
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_FS_ZFS_H */