usr/src/uts/common/sys/fs/zfs.h
author gw25295
Wed, 24 Oct 2007 20:00:39 -0700
changeset 5329 33cb98223b2d
parent 5147 5e950ccc9585
child 5331 3047ad28a67b
permissions -rw-r--r--
PSARC 2007/567 zpool failmode property 6322646 ZFS should gracefully handle all devices failing (when writing) 6413847 vdev label write failure should be handled more gracefully 6417772 need nicer message on write failure 6417779 ZFS: I/O failure (write on ...) -- need to reallocate writes 6467927 Node gets into a panic loop when devices are fenced off 6565042 ZFS should gracefully handle all devices failing (when reading) 6596239 Stop issuing IOs to a vdev that is going to be removed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1485
e971e58d18f6 6322005 support for persistent offline
lling
parents: 1356
diff changeset
     5
 * Common Development and Distribution License (the "License").
e971e58d18f6 6322005 support for persistent offline
lling
parents: 1356
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
3377
a2fa338530c1 6393525 vdev_reopen() should verify that it's still the same device
eschrock
parents: 3234
diff changeset
    22
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#ifndef	_SYS_FS_ZFS_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_FS_ZFS_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#pragma ident	"%Z%%M%	%I%	%E% SMI"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
 * Types and constants shared between userland and the kernel.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    39
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    40
 * Each dataset can be one of the following types.  These constants can be
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
 * combined into masks that can be passed to various functions.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    43
typedef enum {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
	ZFS_TYPE_FILESYSTEM	= 0x1,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
	ZFS_TYPE_SNAPSHOT	= 0x2,
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
    46
	ZFS_TYPE_VOLUME		= 0x4,
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
    47
	ZFS_TYPE_POOL		= 0x8
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    48
} zfs_type_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    49
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    50
#define	ZFS_TYPE_DATASET	\
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
/*
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    54
 * Dataset properties are identified by these constants and must be added to
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    55
 * the end of this list to ensure that external consumers are not affected
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    56
 * by the change. If you make any changes to this list, be sure to update
3654
9c6042b08979 6483718 need a stable interface to get all native properties
gw25295
parents: 3444
diff changeset
    57
 * the property table in usr/src/common/zfs/zfs_prop.c.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
typedef enum {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
	ZFS_PROP_TYPE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
	ZFS_PROP_CREATION,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
	ZFS_PROP_USED,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
	ZFS_PROP_AVAILABLE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    64
	ZFS_PROP_REFERENCED,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    65
	ZFS_PROP_COMPRESSRATIO,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    66
	ZFS_PROP_MOUNTED,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
	ZFS_PROP_ORIGIN,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
	ZFS_PROP_QUOTA,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
	ZFS_PROP_RESERVATION,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
	ZFS_PROP_VOLSIZE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
	ZFS_PROP_VOLBLOCKSIZE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
	ZFS_PROP_RECORDSIZE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    73
	ZFS_PROP_MOUNTPOINT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    74
	ZFS_PROP_SHARENFS,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    75
	ZFS_PROP_CHECKSUM,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    76
	ZFS_PROP_COMPRESSION,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    77
	ZFS_PROP_ATIME,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    78
	ZFS_PROP_DEVICES,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    79
	ZFS_PROP_EXEC,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    80
	ZFS_PROP_SETUID,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    81
	ZFS_PROP_READONLY,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    82
	ZFS_PROP_ZONED,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    83
	ZFS_PROP_SNAPDIR,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    84
	ZFS_PROP_ACLMODE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    85
	ZFS_PROP_ACLINHERIT,
3654
9c6042b08979 6483718 need a stable interface to get all native properties
gw25295
parents: 3444
diff changeset
    86
	ZFS_PROP_CREATETXG,		/* not exposed to the user */
9c6042b08979 6483718 need a stable interface to get all native properties
gw25295
parents: 3444
diff changeset
    87
	ZFS_PROP_NAME,			/* not exposed to the user */
2676
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
    88
	ZFS_PROP_CANMOUNT,
3654
9c6042b08979 6483718 need a stable interface to get all native properties
gw25295
parents: 3444
diff changeset
    89
	ZFS_PROP_SHAREISCSI,
9c6042b08979 6483718 need a stable interface to get all native properties
gw25295
parents: 3444
diff changeset
    90
	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
3234
28b36f7bbd7e PSARC/2006/638 noxattr ZFS property
ck153898
parents: 3126
diff changeset
    91
	ZFS_PROP_XATTR,
3835
063f0749804a PSARC/2007/121 zfs set copies
ahrens
parents: 3741
diff changeset
    92
	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
    93
	ZFS_PROP_COPIES,
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
    94
	ZFS_PROP_VERSION,
4787
602d3f97842c 6393351 unique_* could be improved
ahrens
parents: 4597
diff changeset
    95
	ZFS_NUM_PROPS
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    96
} zfs_prop_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    97
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    98
/*
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
    99
 * Pool properties are identified by these constants and must be added to the
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   100
 * end of this list to ensure that external conumsers are not affected
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   101
 * by the change. If you make any changes to this list, be sure to update
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   102
 * the property table in usr/src/common/zfs/zpool_prop.c.
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   103
 */
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   104
typedef enum {
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   105
	ZPOOL_PROP_NAME,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   106
	ZPOOL_PROP_SIZE,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   107
	ZPOOL_PROP_USED,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   108
	ZPOOL_PROP_AVAILABLE,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   109
	ZPOOL_PROP_CAPACITY,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   110
	ZPOOL_PROP_ALTROOT,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   111
	ZPOOL_PROP_HEALTH,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   112
	ZPOOL_PROP_GUID,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   113
	ZPOOL_PROP_VERSION,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   114
	ZPOOL_PROP_BOOTFS,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   115
	ZPOOL_PROP_DELEGATION,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   116
	ZPOOL_PROP_AUTOREPLACE,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   117
	ZPOOL_PROP_TEMPORARY,
5329
33cb98223b2d PSARC 2007/567 zpool failmode property
gw25295
parents: 5147
diff changeset
   118
	ZPOOL_PROP_FAILUREMODE,
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   119
	ZPOOL_NUM_PROPS
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   120
} zpool_prop_t;
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   121
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   122
#define	ZPROP_CONT		-2
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   123
#define	ZPROP_INVAL		-1
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   124
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   125
#define	ZPROP_VALUE		"value"
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   126
#define	ZPROP_SOURCE		"source"
1356
e021b5e4aa0e 6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents: 1354
diff changeset
   127
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   128
typedef enum {
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   129
	ZPROP_SRC_NONE = 0x1,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   130
	ZPROP_SRC_DEFAULT = 0x2,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   131
	ZPROP_SRC_TEMPORARY = 0x4,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   132
	ZPROP_SRC_LOCAL = 0x8,
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   133
	ZPROP_SRC_INHERITED = 0x10
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   134
} zprop_source_t;
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   135
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   136
#define	ZPROP_SRC_ALL	0x1f
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   137
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   138
typedef int (*zprop_func)(int, void *);
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   139
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   140
/*
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   141
 * Dataset property functions shared between libzfs and kernel.
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   142
 */
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   143
const char *zfs_prop_default_string(zfs_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   144
uint64_t zfs_prop_default_numeric(zfs_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   145
boolean_t zfs_prop_readonly(zfs_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   146
boolean_t zfs_prop_inheritable(zfs_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   147
const char *zfs_prop_to_name(zfs_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   148
zfs_prop_t zfs_name_to_prop(const char *);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   149
boolean_t zfs_prop_user(const char *);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   150
int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   151
int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   152
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   153
/*
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   154
 * Pool property functions shared between libzfs and kernel.
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   155
 */
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   156
zpool_prop_t zpool_name_to_prop(const char *);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   157
const char *zpool_prop_to_name(zpool_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   158
const char *zpool_prop_default_string(zpool_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   159
uint64_t zpool_prop_default_numeric(zpool_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   160
boolean_t zpool_prop_readonly(zpool_prop_t);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   161
int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   162
int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   163
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   164
/*
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   165
 * Definitions for the Delegation.
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   166
 */
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   167
typedef enum {
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   168
	ZFS_DELEG_WHO_UNKNOWN = 0,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   169
	ZFS_DELEG_USER = 'u',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   170
	ZFS_DELEG_USER_SETS = 'U',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   171
	ZFS_DELEG_GROUP = 'g',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   172
	ZFS_DELEG_GROUP_SETS = 'G',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   173
	ZFS_DELEG_EVERYONE = 'e',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   174
	ZFS_DELEG_EVERYONE_SETS = 'E',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   175
	ZFS_DELEG_CREATE = 'c',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   176
	ZFS_DELEG_CREATE_SETS = 'C',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   177
	ZFS_DELEG_NAMED_SET = 's',
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   178
	ZFS_DELEG_NAMED_SET_SETS = 'S'
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   179
} zfs_deleg_who_type_t;
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   180
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   181
typedef enum {
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   182
	ZFS_DELEG_NONE = 0,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   183
	ZFS_DELEG_PERM_LOCAL = 1,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   184
	ZFS_DELEG_PERM_DESCENDENT = 2,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   185
	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   186
	ZFS_DELEG_PERM_CREATE = 4
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   187
} zfs_deleg_inherit_t;
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   188
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   189
#define	ZFS_DELEG_PERM_UID	"uid"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   190
#define	ZFS_DELEG_PERM_GID	"gid"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   191
#define	ZFS_DELEG_PERM_GROUPS	"groups"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   192
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   193
/*
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   194
 * On-disk version number.
1760
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   195
 */
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   196
#define	SPA_VERSION_1			1ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   197
#define	SPA_VERSION_2			2ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   198
#define	SPA_VERSION_3			3ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   199
#define	SPA_VERSION_4			4ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   200
#define	SPA_VERSION_5			5ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   201
#define	SPA_VERSION_6			6ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   202
#define	SPA_VERSION_7			7ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   203
#define	SPA_VERSION_8			8ULL
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   204
/*
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   205
 * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   206
 * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   207
 * and do the appropriate changes.
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   208
 */
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   209
#define	SPA_VERSION			SPA_VERSION_8
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   210
#define	SPA_VERSION_STRING		"8"
1775
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   211
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   212
/*
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   213
 * Symbolic names for the changes that caused a SPA_VERSION switch.
1775
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   214
 * Used in the code when checking for presence or absence of a feature.
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   215
 * Feel free to define multiple symbolic names for each version if there
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   216
 * were multiple changes to on-disk structures during that version.
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   217
 *
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   218
 * NOTE: When checking the current SPA_VERSION in your code, be sure
1775
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   219
 *       to use spa_version() since it reports the version of the
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   220
 *       last synced uberblock.  Checking the in-flight version can
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   221
 *       be dangerous in some cases.
e51e26b432c0 6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents: 1760
diff changeset
   222
 */
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   223
#define	SPA_VERSION_INITIAL		SPA_VERSION_1
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   224
#define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   225
#define	SPA_VERSION_SPARES		SPA_VERSION_3
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   226
#define	SPA_VERSION_RAID6		SPA_VERSION_3
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   227
#define	SPA_VERSION_BPLIST_ACCOUNT	SPA_VERSION_3
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   228
#define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   229
#define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   230
#define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   231
#define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   232
#define	SPA_VERSION_BOOTFS		SPA_VERSION_6
5094
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   233
#define	SPA_VERSION_SLOGS		SPA_VERSION_7
71a3e95fb9e2 PSARC 2007/342 Enhanced ZFS Pool Properties
lling
parents: 4849
diff changeset
   234
#define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   235
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   236
/*
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   237
 * ZPL version - rev'd whenever an incompatible on-disk format change
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   238
 * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   239
 * also update the version_table[] and help message in zfs_prop.c.
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   240
 *
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   241
 * When changing, be sure to teach GRUB how to read the new format!
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   242
 * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   243
 */
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   244
#define	ZPL_VERSION_1			1ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   245
#define	ZPL_VERSION_2			2ULL
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   246
#define	ZPL_VERSION			ZPL_VERSION_2
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   247
#define	ZPL_VERSION_STRING		"2"
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   248
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   249
#define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   250
#define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
1760
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   251
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   252
/*
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   253
 * The following are configuration names used in the nvlist describing a pool's
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   254
 * configuration.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   255
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   256
#define	ZPOOL_CONFIG_VERSION		"version"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   257
#define	ZPOOL_CONFIG_POOL_NAME		"name"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   258
#define	ZPOOL_CONFIG_POOL_STATE		"state"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   259
#define	ZPOOL_CONFIG_POOL_TXG		"txg"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   260
#define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   261
#define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   262
#define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   263
#define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   264
#define	ZPOOL_CONFIG_TYPE		"type"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   265
#define	ZPOOL_CONFIG_CHILDREN		"children"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   266
#define	ZPOOL_CONFIG_ID			"id"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   267
#define	ZPOOL_CONFIG_GUID		"guid"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   268
#define	ZPOOL_CONFIG_PATH		"path"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   269
#define	ZPOOL_CONFIG_DEVID		"devid"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   270
#define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   271
#define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   272
#define	ZPOOL_CONFIG_ASHIFT		"ashift"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   273
#define	ZPOOL_CONFIG_ASIZE		"asize"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   274
#define	ZPOOL_CONFIG_DTL		"DTL"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   275
#define	ZPOOL_CONFIG_STATS		"stats"
1171
b501e9f31cab 6344272 re-think how whole disks are stored
eschrock
parents: 789
diff changeset
   276
#define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   277
#define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   278
#define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   279
#define	ZPOOL_CONFIG_SPARES		"spares"
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   280
#define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   281
#define	ZPOOL_CONFIG_NPARITY		"nparity"
3975
6674f5d79069 6282725 hostname/hostid should be stored in the label
ek110237
parents: 3912
diff changeset
   282
#define	ZPOOL_CONFIG_HOSTID		"hostid"
6674f5d79069 6282725 hostname/hostid should be stored in the label
ek110237
parents: 3912
diff changeset
   283
#define	ZPOOL_CONFIG_HOSTNAME		"hostname"
6674f5d79069 6282725 hostname/hostid should be stored in the label
ek110237
parents: 3912
diff changeset
   284
#define	ZPOOL_CONFIG_TIMESTAMP		"timestamp" /* not stored on disk */
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   285
#define	ZPOOL_CONFIG_UNSPARE		"unspare"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   286
#define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
4527
5d5b6ba91b17 PSARC 2007/171 ZFS Separate Intent Log
perrin
parents: 4451
diff changeset
   287
#define	ZPOOL_CONFIG_IS_LOG		"is_log"
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   288
/*
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   289
 * The persistent vdev state is stored as separate values rather than a single
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   290
 * 'vdev_state' entry.  This is because a device can be in multiple states, such
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   291
 * as offline and degraded.
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   292
 */
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   293
#define	ZPOOL_CONFIG_OFFLINE		"offline"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   294
#define	ZPOOL_CONFIG_FAULTED		"faulted"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   295
#define	ZPOOL_CONFIG_DEGRADED		"degraded"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   296
#define	ZPOOL_CONFIG_REMOVED		"removed"
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   297
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   298
#define	VDEV_TYPE_ROOT			"root"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   299
#define	VDEV_TYPE_MIRROR		"mirror"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   300
#define	VDEV_TYPE_REPLACING		"replacing"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   301
#define	VDEV_TYPE_RAIDZ			"raidz"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   302
#define	VDEV_TYPE_DISK			"disk"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   303
#define	VDEV_TYPE_FILE			"file"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   304
#define	VDEV_TYPE_MISSING		"missing"
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   305
#define	VDEV_TYPE_SPARE			"spare"
4527
5d5b6ba91b17 PSARC 2007/171 ZFS Separate Intent Log
perrin
parents: 4451
diff changeset
   306
#define	VDEV_TYPE_LOG			"log"
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   307
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   308
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   309
 * This is needed in userland to report the minimum necessary device size.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   310
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   311
#define	SPA_MINDEVSIZE		(64ULL << 20)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   312
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   313
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   314
 * The location of the pool configuration repository, shared between kernel and
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   315
 * userland.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   316
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   317
#define	ZPOOL_CACHE_DIR		"/etc/zfs"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   318
#define	ZPOOL_CACHE_FILE	"zpool.cache"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   319
#define	ZPOOL_CACHE_TMP		".zpool.cache"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   320
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   321
#define	ZPOOL_CACHE		ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   322
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   323
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   324
 * vdev states are ordered from least to most healthy.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   325
 * A vdev that's CANT_OPEN or below is considered unusable.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   326
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   327
typedef enum vdev_state {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   328
	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   329
	VDEV_STATE_CLOSED,	/* Not currently open			*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   330
	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   331
	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   332
	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   333
	VDEV_STATE_FAULTED,	/* External request to fault device	*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   334
	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   335
	VDEV_STATE_HEALTHY	/* Presumed good			*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   336
} vdev_state_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   337
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   338
#define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   339
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   340
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   341
 * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   342
 * of the vdev stats structure uses these constants to distinguish why.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   343
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   344
typedef enum vdev_aux {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   345
	VDEV_AUX_NONE,		/* no error				*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   346
	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   347
	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   348
	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   349
	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   350
	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
1760
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   351
	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   352
	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   353
	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   354
	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   355
	VDEV_AUX_ERR_EXCEEDED	/* too many errors			*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   356
} vdev_aux_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   357
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   358
/*
1352
b7039548de2f 6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents: 1175
diff changeset
   359
 * pool state.  The following states are written to disk as part of the normal
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   360
 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
1352
b7039548de2f 6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents: 1175
diff changeset
   361
 * software abstractions used at various levels to communicate pool state.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   362
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   363
typedef enum pool_state {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   364
	POOL_STATE_ACTIVE = 0,		/* In active use		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   365
	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   366
	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   367
	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   368
	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
5329
33cb98223b2d PSARC 2007/567 zpool failmode property
gw25295
parents: 5147
diff changeset
   369
	POOL_STATE_IO_FAILURE,		/* Internal pool state		*/
1352
b7039548de2f 6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents: 1175
diff changeset
   370
	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
b7039548de2f 6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents: 1175
diff changeset
   371
	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   372
} pool_state_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   373
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   374
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   375
 * Scrub types.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   376
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   377
typedef enum pool_scrub_type {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   378
	POOL_SCRUB_NONE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   379
	POOL_SCRUB_RESILVER,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   380
	POOL_SCRUB_EVERYTHING,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   381
	POOL_SCRUB_TYPES
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   382
} pool_scrub_type_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   383
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   384
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   385
 * ZIO types.  Needed to interpret vdev statistics below.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   386
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   387
typedef enum zio_type {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   388
	ZIO_TYPE_NULL = 0,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   389
	ZIO_TYPE_READ,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   390
	ZIO_TYPE_WRITE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   391
	ZIO_TYPE_FREE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   392
	ZIO_TYPE_CLAIM,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   393
	ZIO_TYPE_IOCTL,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   394
	ZIO_TYPES
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   395
} zio_type_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   396
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   397
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   398
 * Vdev statistics.  Note: all fields should be 64-bit because this
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   399
 * is passed between kernel and userland as an nvlist uint64 array.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   400
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   401
typedef struct vdev_stat {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   402
	hrtime_t	vs_timestamp;		/* time since vdev load	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   403
	uint64_t	vs_state;		/* vdev state		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   404
	uint64_t	vs_aux;			/* see vdev_aux_t	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   405
	uint64_t	vs_alloc;		/* space allocated	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   406
	uint64_t	vs_space;		/* total capacity	*/
2082
76b439ec3ac1 PSARC 2006/223 ZFS Hot Spares
eschrock
parents: 1775
diff changeset
   407
	uint64_t	vs_dspace;		/* deflated capacity	*/
1175
759d20c7e57b 6366265 attach/replace should allow a new device size at least the min of all devs in a mirror/raidz
lling
parents: 1171
diff changeset
   408
	uint64_t	vs_rsize;		/* replaceable dev size */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   409
	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   410
	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   411
	uint64_t	vs_read_errors;		/* read errors		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   412
	uint64_t	vs_write_errors;	/* write errors		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   413
	uint64_t	vs_checksum_errors;	/* checksum errors	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   414
	uint64_t	vs_self_healed;		/* self-healed bytes	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   415
	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   416
	uint64_t	vs_scrub_complete;	/* completed?		*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   417
	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   418
	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   419
	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   420
	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   421
	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   422
} vdev_stat_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   423
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   424
#define	ZFS_DRIVER	"zfs"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   425
#define	ZFS_DEV		"/dev/zfs"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   426
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   427
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   428
 * zvol paths.  Irritatingly, the devfsadm interfaces want all these
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   429
 * paths without the /dev prefix, but for some things, we want the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   430
 * /dev prefix.  Below are the names without /dev.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   431
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   432
#define	ZVOL_DEV_DIR	"zvol/dsk"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   433
#define	ZVOL_RDEV_DIR	"zvol/rdsk"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   434
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   435
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   436
 * And here are the things we need with /dev, etc. in front of them.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   437
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   438
#define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zvol@0:"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   439
#define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   440
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   441
#define	ZVOL_PROP_NAME		"name"
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   442
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   443
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   444
 * /dev/zfs ioctl numbers.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   445
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   446
#define	ZFS_IOC		('Z' << 8)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   447
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   448
typedef enum zfs_ioc {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   449
	ZFS_IOC_POOL_CREATE = ZFS_IOC,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   450
	ZFS_IOC_POOL_DESTROY,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   451
	ZFS_IOC_POOL_IMPORT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   452
	ZFS_IOC_POOL_EXPORT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   453
	ZFS_IOC_POOL_CONFIGS,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   454
	ZFS_IOC_POOL_STATS,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   455
	ZFS_IOC_POOL_TRYIMPORT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   456
	ZFS_IOC_POOL_SCRUB,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   457
	ZFS_IOC_POOL_FREEZE,
1760
e1ad2821c30d PSARC 2006/206 zpool upgrade
eschrock
parents: 1544
diff changeset
   458
	ZFS_IOC_POOL_UPGRADE,
2926
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   459
	ZFS_IOC_POOL_GET_HISTORY,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   460
	ZFS_IOC_VDEV_ADD,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   461
	ZFS_IOC_VDEV_REMOVE,
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   462
	ZFS_IOC_VDEV_SET_STATE,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   463
	ZFS_IOC_VDEV_ATTACH,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   464
	ZFS_IOC_VDEV_DETACH,
1354
81359ee1ee63 6362672 import gets confused about overlapping slices
eschrock
parents: 1352
diff changeset
   465
	ZFS_IOC_VDEV_SETPATH,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   466
	ZFS_IOC_OBJSET_STATS,
5147
5e950ccc9585 6596190 "zfs list" is slow due to version property
rm160521
parents: 5094
diff changeset
   467
	ZFS_IOC_OBJSET_VERSION,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   468
	ZFS_IOC_DATASET_LIST_NEXT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   469
	ZFS_IOC_SNAPSHOT_LIST_NEXT,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   470
	ZFS_IOC_SET_PROP,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   471
	ZFS_IOC_CREATE_MINOR,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   472
	ZFS_IOC_REMOVE_MINOR,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   473
	ZFS_IOC_CREATE,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   474
	ZFS_IOC_DESTROY,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   475
	ZFS_IOC_ROLLBACK,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   476
	ZFS_IOC_RENAME,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   477
	ZFS_IOC_RECVBACKUP,
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   478
	ZFS_IOC_SENDBACKUP,
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   479
	ZFS_IOC_INJECT_FAULT,
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   480
	ZFS_IOC_CLEAR_FAULT,
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   481
	ZFS_IOC_INJECT_LIST_NEXT,
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   482
	ZFS_IOC_ERROR_LOG,
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   483
	ZFS_IOC_CLEAR,
2199
712a788c2dfd PSARC 2006/388 snapshot -r
ahrens
parents: 2082
diff changeset
   484
	ZFS_IOC_PROMOTE,
712a788c2dfd PSARC 2006/388 snapshot -r
ahrens
parents: 2082
diff changeset
   485
	ZFS_IOC_DESTROY_SNAPS,
3444
dc160a70a50d 6410433 'zpool status -v' would be more useful with filenames
ek110237
parents: 3377
diff changeset
   486
	ZFS_IOC_SNAPSHOT,
dc160a70a50d 6410433 'zpool status -v' would be more useful with filenames
ek110237
parents: 3377
diff changeset
   487
	ZFS_IOC_DSOBJ_TO_DSNAME,
3912
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   488
	ZFS_IOC_OBJ_TO_PATH,
f6891a60bd72 PSARC 2007/083 ZFS bootable datasets
lling
parents: 3886
diff changeset
   489
	ZFS_IOC_POOL_SET_PROPS,
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   490
	ZFS_IOC_POOL_GET_PROPS,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   491
	ZFS_IOC_SET_FSACL,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   492
	ZFS_IOC_GET_FSACL,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   493
	ZFS_IOC_ISCSI_PERM_CHECK,
4849
3a61e0a9a953 6536043 arc_byteswap_func_t and dmu_byteswap_func_t are redundant
ahrens
parents: 4787
diff changeset
   494
	ZFS_IOC_SHARE,
3a61e0a9a953 6536043 arc_byteswap_func_t and dmu_byteswap_func_t are redundant
ahrens
parents: 4787
diff changeset
   495
	ZFS_IOC_INHERIT_PROP
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   496
} zfs_ioc_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   497
1544
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   498
/*
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   499
 * Internal SPA load state.  Used by FMA diagnosis engine.
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   500
 */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   501
typedef enum {
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   502
	SPA_LOAD_NONE,		/* no load in progress */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   503
	SPA_LOAD_OPEN,		/* normal open */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   504
	SPA_LOAD_IMPORT,	/* import in progress */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   505
	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   506
} spa_load_state_t;
938876158511 PSARC 2006/077 zpool clear
eschrock
parents: 1485
diff changeset
   507
2676
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   508
/*
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   509
 * Bookmark name values.
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   510
 */
3444
dc160a70a50d 6410433 'zpool status -v' would be more useful with filenames
ek110237
parents: 3377
diff changeset
   511
#define	ZPOOL_ERR_LIST		"error list"
2676
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   512
#define	ZPOOL_ERR_DATASET	"dataset"
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   513
#define	ZPOOL_ERR_OBJECT	"object"
5cee47eddab6 PSARC 2006/486 ZFS canmount property
eschrock
parents: 2199
diff changeset
   514
2926
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   515
#define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   516
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   517
/*
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   518
 * The following are names used in the nvlist describing
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   519
 * the pool's history log.
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   520
 */
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   521
#define	ZPOOL_HIST_RECORD	"history record"
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   522
#define	ZPOOL_HIST_TIME		"history time"
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   523
#define	ZPOOL_HIST_CMD		"history command"
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   524
#define	ZPOOL_HIST_WHO		"history who"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   525
#define	ZPOOL_HIST_ZONE		"history zone"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   526
#define	ZPOOL_HIST_HOST		"history hostname"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   527
#define	ZPOOL_HIST_TXG		"history txg"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   528
#define	ZPOOL_HIST_INT_EVENT	"history internal event"
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   529
#define	ZPOOL_HIST_INT_STR	"history internal str"
2926
acfcfefbc60d PSARC 2006/288 zpool history
ek110237
parents: 2717
diff changeset
   530
4451
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   531
/*
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   532
 * Flags for ZFS_IOC_VDEV_SET_STATE
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   533
 */
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   534
#define	ZFS_ONLINE_CHECKREMOVE	0x1
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   535
#define	ZFS_ONLINE_UNSPARE	0x2
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   536
#define	ZFS_ONLINE_FORCEFAULT	0x4
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   537
#define	ZFS_OFFLINE_TEMPORARY	0x1
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   538
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   539
/*
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   540
 * Sysevent payload members.  ZFS will generate the following sysevents with the
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   541
 * given payloads:
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   542
 *
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   543
 *	ESC_ZFS_RESILVER_START
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   544
 *	ESC_ZFS_RESILVER_END
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   545
 *	ESC_ZFS_POOL_DESTROY
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   546
 *
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   547
 *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   548
 *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   549
 *
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   550
 *	ESC_ZFS_VDEV_REMOVE
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   551
 *	ESC_ZFS_VDEV_CLEAR
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   552
 *	ESC_ZFS_VDEV_CHECK
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   553
 *
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   554
 *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   555
 *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   556
 *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   557
 *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   558
 */
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   559
#define	ZFS_EV_POOL_NAME	"pool_name"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   560
#define	ZFS_EV_POOL_GUID	"pool_guid"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   561
#define	ZFS_EV_VDEV_PATH	"vdev_path"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   562
#define	ZFS_EV_VDEV_GUID	"vdev_guid"
24fbf2d7a5d7 PSARC 2007/197 ZFS hotplug
eschrock
parents: 3975
diff changeset
   563
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   564
typedef enum history_internal_events {
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   565
	LOG_NO_EVENT = 0,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   566
	LOG_POOL_CREATE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   567
	LOG_POOL_VDEV_ADD,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   568
	LOG_POOL_REMOVE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   569
	LOG_POOL_DESTROY,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   570
	LOG_POOL_EXPORT,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   571
	LOG_POOL_IMPORT,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   572
	LOG_POOL_VDEV_ATTACH,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   573
	LOG_POOL_VDEV_REPLACE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   574
	LOG_POOL_VDEV_DETACH,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   575
	LOG_POOL_VDEV_ONLINE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   576
	LOG_POOL_VDEV_OFFLINE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   577
	LOG_POOL_UPGRADE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   578
	LOG_POOL_CLEAR,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   579
	LOG_POOL_SCRUB,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   580
	LOG_POOL_PROPSET,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   581
	LOG_DS_CREATE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   582
	LOG_DS_CLONE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   583
	LOG_DS_DESTROY,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   584
	LOG_DS_DESTROY_BEGIN,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   585
	LOG_DS_INHERIT,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   586
	LOG_DS_PROPSET,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   587
	LOG_DS_QUOTA,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   588
	LOG_DS_PERM_UPDATE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   589
	LOG_DS_PERM_REMOVE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   590
	LOG_DS_PERM_WHO_REMOVE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   591
	LOG_DS_PROMOTE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   592
	LOG_DS_RECEIVE,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   593
	LOG_DS_RENAME,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   594
	LOG_DS_RESERVATION,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   595
	LOG_DS_REPLAY_INC_SYNC,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   596
	LOG_DS_REPLAY_FULL_SYNC,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   597
	LOG_DS_ROLLBACK,
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   598
	LOG_DS_SNAPSHOT,
4577
ed36b0e652bc PSARC/2007/328 zfs upgrade
ahrens
parents: 4543
diff changeset
   599
	LOG_DS_UPGRADE,
4543
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   600
	LOG_END
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   601
} history_internal_events_t;
12bb2876a62e PSARC/2006/465 ZFS Delegated Administration
marks
parents: 4527
diff changeset
   602
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   603
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   604
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   605
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   606
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   607
#endif	/* _SYS_FS_ZFS_H */