zfs.h revision c9431fa1e59a88c2f0abf611f25b97af964449e5
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
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 * CDDL HEADER END
39c23413b8df94a95f67b34cfd4a4dfc3fd0b48deschrock * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Types and constants shared between userland and the kernel.
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.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum {
fa9e4066f08beec538e775443c5be79dd423fcabahrens (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * Properties are identified by these constants and must be added to the
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * end of this list to ensure that external conumsers are not affected
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * by the change. The property list also determines how 'zfs get' will
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * display them. If you make any changes to this list, be sure to update
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * the property table in usr/src/common/zfs/zfs_prop.c.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum {
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The following functions are shared between libzfs and the kernel.
acd76fe5a01cfab51c34c67df884b68562a97f3feschrockint zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
acd76fe5a01cfab51c34c67df884b68562a97f3feschrockint zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
66e2aacc02a4625d105fb249ad16c27e79604ff2gw * Property Iterator
66e2aacc02a4625d105fb249ad16c27e79604ff2gwextern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t);
99653d4ee642c6528e88224f12409a5f23060994eschrock * On-disk version number.
44cd46cadd9aab751dae6a4023c1cb5bf316d274billm * Symbolic names for the changes that caused a ZFS_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 * NOTE: When checking the current ZFS_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.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The following are configuration names used in the nvlist describing a pool's
fa9e4066f08beec538e775443c5be79dd423fcabahrens * configuration.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This is needed in userland to report the minimum necessary device size.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The location of the pool configuration repository, shared between kernel and
fa9e4066f08beec538e775443c5be79dd423fcabahrens * userland.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * vdev states are ordered from least to most healthy.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * A vdev that's CANT_OPEN or below is considered unusable.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum vdev_state {
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
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.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum vdev_aux {
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 */
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 */
99653d4ee642c6528e88224f12409a5f23060994eschrock VDEV_AUX_SPARED /* hot spare used in another pool */
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * pool state. The following states are written to disk as part of the normal
99653d4ee642c6528e88224f12409a5f23060994eschrock * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE. The remaining states are
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * software abstractions used at various levels to communicate pool state.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum pool_state {
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Scrub types.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ZIO types. Needed to interpret vdev statistics below.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum zio_type {
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Vdev statistics. Note: all fields should be 64-bit because this
fa9e4066f08beec538e775443c5be79dd423fcabahrens * is passed between kernel and userland as an nvlist uint64 array.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct vdev_stat {
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_examined; /* bytes examined; top */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t vs_scrub_repaired; /* bytes repaired; leaf */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zvol paths. Irritatingly, the devfsadm interfaces want all these
fa9e4066f08beec538e775443c5be79dd423fcabahrens * paths without the /dev prefix, but for some things, we want the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * /dev prefix. Below are the names without /dev.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * And here are the things we need with /dev, etc. in front of them.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * /dev/zfs ioctl numbers.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum zfs_ioc {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Internal SPA load state. Used by FMA diagnosis engine.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrocktypedef enum {
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock * Bookmark name values.
06eeb2ad640ce72d394ac521094bed7681044408ek * The following are names used in the nvlist describing
06eeb2ad640ce72d394ac521094bed7681044408ek * the pool's history log.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_FS_ZFS_H */