zfs.h revision 441d80aa4f613b6298fc8bd3151f4be02dbf84fc
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 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * Copyright 2006 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
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/types.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
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,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_TYPE_VOLUME = 0x4
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_type_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_TYPE_ANY \
fa9e4066f08beec538e775443c5be79dd423fcabahrens (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Properties are identified by these constants. They are arranged in order of
fa9e4066f08beec538e775443c5be79dd423fcabahrens * how they should be displayed by 'zfs get'. If you make any changes to this
fa9e4066f08beec538e775443c5be79dd423fcabahrens * list, be sure to update the property table in usr/src/common/zfs/zfs_prop.c.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef enum {
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_INVAL = -1,
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,
fa9e4066f08beec538e775443c5be79dd423fcabahrens /*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The following properties are not exposed to the user, but are
fa9e4066f08beec538e775443c5be79dd423fcabahrens * accessible by libzfs clients.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_CREATETXG,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_PROP_NAME,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_NPROP_ALL
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_prop_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_NPROP_VISIBLE ZFS_PROP_CREATETXG
fa9e4066f08beec538e775443c5be79dd423fcabahrens
7f7322febbcfe774b7270abc3b191c094bfcc517eschrock#define ZFS_PROP_VALUE "value"
7f7322febbcfe774b7270abc3b191c094bfcc517eschrock#define ZFS_PROP_SOURCE "source"
7f7322febbcfe774b7270abc3b191c094bfcc517eschrock
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The following functions are shared between libzfs and the kernel.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_prop_t zfs_name_to_prop(const char *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint zfs_prop_readonly(zfs_prop_t);
7f7322febbcfe774b7270abc3b191c094bfcc517eschrockconst char *zfs_prop_default_string(zfs_prop_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrensuint64_t zfs_prop_default_numeric(zfs_prop_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
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_POOL_HEALTH "pool_health"
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"
441d80aa4f613b6298fc8bd3151f4be02dbf84fclling#define ZPOOL_CONFIG_OFFLINE "offline"
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"
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 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CACHE_DIR "/etc/zfs"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CACHE_FILE "zpool.cache"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CACHE_TMP ".zpool.cache"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
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 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_STATE_HEALTHY /* Presumed good */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} vdev_state_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
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 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens VDEV_AUX_BAD_LABEL /* the label is OK but invalid */
fa9e4066f08beec538e775443c5be79dd423fcabahrens} vdev_aux_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * pool state. The following states are written to disk as part of the normal
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED. The remaining states are
46a2abf27af40eda17a3f97e79eda1aef4e3c3c8eschrock * software abstractions used at various levels to communicate 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 */
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 */
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
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_DRIVER "zfs"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZFS_DEV "/dev/zfs"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
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 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZVOL_DEV_DIR "zvol/dsk"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZVOL_RDEV_DIR "zvol/rdsk"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * And here are the things we need with /dev, etc. in front of them.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZVOL_PSEUDO_DEV "/devices/pseudo/zvol@0:"
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define ZVOL_FULL_DEV_DIR "/dev/" ZVOL_DEV_DIR
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_GUID,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_STATS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_TRYIMPORT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_SCRUB,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_POOL_FREEZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_ADD,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_REMOVE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_ONLINE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_OFFLINE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_ATTACH,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_VDEV_DETACH,
c67d9675bbc8392fe45f3a7dfbda1ad4daa1eb07eschrock ZFS_IOC_VDEV_SETPATH,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_OBJSET_STATS,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_DATASET_LIST_NEXT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SNAPSHOT_LIST_NEXT,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_PROP,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_QUOTA,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_RESERVATION,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_VOLSIZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SET_VOLBLOCKSIZE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_CREATE_MINOR,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_REMOVE_MINOR,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_CREATE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_DESTROY,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_ROLLBACK,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_RENAME,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_RECVBACKUP,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_IOC_SENDBACKUP
fa9e4066f08beec538e775443c5be79dd423fcabahrens} zfs_ioc_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_FS_ZFS_H */