xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision b1b8ab34)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5441d80aaSlling  * Common Development and Distribution License (the "License").
6441d80aaSlling  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
2239c23413Seschrock  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens #ifndef	_SYS_FS_ZFS_H
27fa9e4066Sahrens #define	_SYS_FS_ZFS_H
28fa9e4066Sahrens 
29fa9e4066Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
30fa9e4066Sahrens 
31fa9e4066Sahrens #include <sys/types.h>
32fa9e4066Sahrens 
33fa9e4066Sahrens #ifdef	__cplusplus
34fa9e4066Sahrens extern "C" {
35fa9e4066Sahrens #endif
36fa9e4066Sahrens 
37fa9e4066Sahrens /*
38fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
39fa9e4066Sahrens  */
40fa9e4066Sahrens 
41fa9e4066Sahrens /*
42fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
43fa9e4066Sahrens  * combined into masks that can be passed to various functions.
44fa9e4066Sahrens  */
45fa9e4066Sahrens typedef enum {
46fa9e4066Sahrens 	ZFS_TYPE_FILESYSTEM	= 0x1,
47fa9e4066Sahrens 	ZFS_TYPE_SNAPSHOT	= 0x2,
48*b1b8ab34Slling 	ZFS_TYPE_VOLUME		= 0x4,
49*b1b8ab34Slling 	ZFS_TYPE_POOL		= 0x8
50fa9e4066Sahrens } zfs_type_t;
51fa9e4066Sahrens 
52fa9e4066Sahrens #define	ZFS_TYPE_ANY	\
53fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
54fa9e4066Sahrens 
55fa9e4066Sahrens /*
5666e2aaccSgw  * Properties are identified by these constants and must be added to the
5766e2aaccSgw  * end of this list to ensure that external conumsers are not affected
5866e2aaccSgw  * by the change. The property list also determines how 'zfs get' will
5966e2aaccSgw  * display them.  If you make any changes to this list, be sure to update
6066e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
61fa9e4066Sahrens  */
62fa9e4066Sahrens typedef enum {
6366e2aaccSgw 	ZFS_PROP_CONT = -2,
64fa9e4066Sahrens 	ZFS_PROP_INVAL = -1,
65fa9e4066Sahrens 	ZFS_PROP_TYPE,
66fa9e4066Sahrens 	ZFS_PROP_CREATION,
67fa9e4066Sahrens 	ZFS_PROP_USED,
68fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
69fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
70fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
71fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
72fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
73fa9e4066Sahrens 	ZFS_PROP_QUOTA,
74fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
75fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
76fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
77fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
78fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
79fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
80fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
81fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
82fa9e4066Sahrens 	ZFS_PROP_ATIME,
83fa9e4066Sahrens 	ZFS_PROP_DEVICES,
84fa9e4066Sahrens 	ZFS_PROP_EXEC,
85fa9e4066Sahrens 	ZFS_PROP_SETUID,
86fa9e4066Sahrens 	ZFS_PROP_READONLY,
87fa9e4066Sahrens 	ZFS_PROP_ZONED,
88fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
89fa9e4066Sahrens 	ZFS_PROP_ACLMODE,
90fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
9166e2aaccSgw 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
9266e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
93e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
9466e2aaccSgw 	ZFS_PROP_SHAREISCSI,
9566e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
967b55fa8eSck 	ZFS_PROP_XATTR,
97d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
98*b1b8ab34Slling 	ZFS_PROP_COPIES,
99*b1b8ab34Slling 	ZFS_PROP_BOOTFS
100fa9e4066Sahrens } zfs_prop_t;
101fa9e4066Sahrens 
102*b1b8ab34Slling typedef zfs_prop_t zpool_prop_t;
103*b1b8ab34Slling 
1047f7322feSeschrock #define	ZFS_PROP_VALUE		"value"
1057f7322feSeschrock #define	ZFS_PROP_SOURCE		"source"
1067f7322feSeschrock 
107*b1b8ab34Slling typedef enum {
108*b1b8ab34Slling 	ZFS_SRC_NONE = 0x1,
109*b1b8ab34Slling 	ZFS_SRC_DEFAULT = 0x2,
110*b1b8ab34Slling 	ZFS_SRC_TEMPORARY = 0x4,
111*b1b8ab34Slling 	ZFS_SRC_LOCAL = 0x8,
112*b1b8ab34Slling 	ZFS_SRC_INHERITED = 0x10
113*b1b8ab34Slling } zfs_source_t;
114*b1b8ab34Slling 
115*b1b8ab34Slling #define	ZFS_SRC_ALL	0x1f
116*b1b8ab34Slling 
117fa9e4066Sahrens /*
118fa9e4066Sahrens  * The following functions are shared between libzfs and the kernel.
119fa9e4066Sahrens  */
120fa9e4066Sahrens zfs_prop_t zfs_name_to_prop(const char *);
121*b1b8ab34Slling zpool_prop_t zpool_name_to_prop(const char *);
122e9dbad6fSeschrock boolean_t zfs_prop_user(const char *);
123fa9e4066Sahrens int zfs_prop_readonly(zfs_prop_t);
1247f7322feSeschrock const char *zfs_prop_default_string(zfs_prop_t);
125e9dbad6fSeschrock const char *zfs_prop_to_name(zfs_prop_t);
126*b1b8ab34Slling const char *zpool_prop_to_name(zfs_prop_t);
127fa9e4066Sahrens uint64_t zfs_prop_default_numeric(zfs_prop_t);
128e9dbad6fSeschrock int zfs_prop_inheritable(zfs_prop_t);
129acd76fe5Seschrock int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
130acd76fe5Seschrock int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
13199653d4eSeschrock 
13266e2aaccSgw /*
13366e2aaccSgw  * Property Iterator
13466e2aaccSgw  */
13566e2aaccSgw typedef zfs_prop_t (*zfs_prop_f)(zfs_prop_t, void *);
136*b1b8ab34Slling typedef zfs_prop_f zpool_prop_f;
13766e2aaccSgw extern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t);
138*b1b8ab34Slling extern zpool_prop_t zpool_prop_iter(zpool_prop_f, void *, boolean_t);
13966e2aaccSgw 
140eaca9bbdSeschrock /*
14199653d4eSeschrock  * On-disk version number.
142eaca9bbdSeschrock  */
14344cd46caSbillm #define	ZFS_VERSION_1			1ULL
14444cd46caSbillm #define	ZFS_VERSION_2			2ULL
14599653d4eSeschrock #define	ZFS_VERSION_3			3ULL
146d7306b64Sek #define	ZFS_VERSION_4			4ULL
147c9431fa1Sahl #define	ZFS_VERSION_5			5ULL
148*b1b8ab34Slling #define	ZFS_VERSION_6			6ULL
149*b1b8ab34Slling /*
150*b1b8ab34Slling  * When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk
151*b1b8ab34Slling  * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
152*b1b8ab34Slling  * and do the appropriate changes.
153*b1b8ab34Slling  */
154*b1b8ab34Slling #define	ZFS_VERSION			ZFS_VERSION_6
155*b1b8ab34Slling #define	ZFS_VERSION_STRING		"6"
15644cd46caSbillm 
15744cd46caSbillm /*
15844cd46caSbillm  * Symbolic names for the changes that caused a ZFS_VERSION switch.
15944cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
16044cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
16144cd46caSbillm  * were multiple changes to on-disk structures during that version.
16244cd46caSbillm  *
16344cd46caSbillm  * NOTE: When checking the current ZFS_VERSION in your code, be sure
16444cd46caSbillm  *       to use spa_version() since it reports the version of the
16544cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
16644cd46caSbillm  *       be dangerous in some cases.
16744cd46caSbillm  */
16844cd46caSbillm #define	ZFS_VERSION_INITIAL		ZFS_VERSION_1
16944cd46caSbillm #define	ZFS_VERSION_DITTO_BLOCKS	ZFS_VERSION_2
17099653d4eSeschrock #define	ZFS_VERSION_SPARES		ZFS_VERSION_3
17199653d4eSeschrock #define	ZFS_VERSION_RAID6		ZFS_VERSION_3
17299653d4eSeschrock #define	ZFS_VERSION_BPLIST_ACCOUNT	ZFS_VERSION_3
17399653d4eSeschrock #define	ZFS_VERSION_RAIDZ_DEFLATE	ZFS_VERSION_3
17499653d4eSeschrock #define	ZFS_VERSION_DNODE_BYTES		ZFS_VERSION_3
175d7306b64Sek #define	ZFS_VERSION_ZPOOL_HISTORY	ZFS_VERSION_4
176c9431fa1Sahl #define	ZFS_VERSION_GZIP_COMPRESSION	ZFS_VERSION_5
177*b1b8ab34Slling #define	ZFS_VERSION_BOOTFS		ZFS_VERSION_6
178eaca9bbdSeschrock 
179fa9e4066Sahrens /*
180fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
181fa9e4066Sahrens  * configuration.
182fa9e4066Sahrens  */
183fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
184fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
185fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
186fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
187fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
188fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
189fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
190fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
191fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
192fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
193fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
194fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
195fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
196fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
197fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
198fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
199fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
200fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
201fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
202fa9e4066Sahrens #define	ZPOOL_CONFIG_STATS		"stats"
203afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
204441d80aaSlling #define	ZPOOL_CONFIG_OFFLINE		"offline"
205ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
206ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
20799653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
20899653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
20999653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
210fa9e4066Sahrens 
211fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
212fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
213fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
214fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
215fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
216fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
217fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
21899653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
219fa9e4066Sahrens 
220fa9e4066Sahrens /*
221fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
222fa9e4066Sahrens  */
223fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
224fa9e4066Sahrens 
225fa9e4066Sahrens /*
226fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
227fa9e4066Sahrens  * userland.
228fa9e4066Sahrens  */
229fa9e4066Sahrens #define	ZPOOL_CACHE_DIR		"/etc/zfs"
230fa9e4066Sahrens #define	ZPOOL_CACHE_FILE	"zpool.cache"
231fa9e4066Sahrens #define	ZPOOL_CACHE_TMP		".zpool.cache"
232fa9e4066Sahrens 
233fa9e4066Sahrens #define	ZPOOL_CACHE		ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
234fa9e4066Sahrens 
235fa9e4066Sahrens /*
236fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
237fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
238fa9e4066Sahrens  */
239fa9e4066Sahrens typedef enum vdev_state {
240fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
241fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
242fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
243fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
244fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
245fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
246fa9e4066Sahrens } vdev_state_t;
247fa9e4066Sahrens 
248fa9e4066Sahrens /*
249fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
250fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
251fa9e4066Sahrens  */
252fa9e4066Sahrens typedef enum vdev_aux {
253fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
254fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
255fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
256fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
257fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
258fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
259eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
260eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
26199653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
26299653d4eSeschrock 	VDEV_AUX_SPARED		/* hot spare used in another pool	*/
263fa9e4066Sahrens } vdev_aux_t;
264fa9e4066Sahrens 
265fa9e4066Sahrens /*
26646a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
26799653d4eSeschrock  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
26846a2abf2Seschrock  * software abstractions used at various levels to communicate pool state.
269fa9e4066Sahrens  */
270fa9e4066Sahrens typedef enum pool_state {
271fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
272fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
273fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
27499653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
275fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
27646a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
27746a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
278fa9e4066Sahrens } pool_state_t;
279fa9e4066Sahrens 
280fa9e4066Sahrens /*
281fa9e4066Sahrens  * Scrub types.
282fa9e4066Sahrens  */
283fa9e4066Sahrens typedef enum pool_scrub_type {
284fa9e4066Sahrens 	POOL_SCRUB_NONE,
285fa9e4066Sahrens 	POOL_SCRUB_RESILVER,
286fa9e4066Sahrens 	POOL_SCRUB_EVERYTHING,
287fa9e4066Sahrens 	POOL_SCRUB_TYPES
288fa9e4066Sahrens } pool_scrub_type_t;
289fa9e4066Sahrens 
290fa9e4066Sahrens /*
291fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
292fa9e4066Sahrens  */
293fa9e4066Sahrens typedef enum zio_type {
294fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
295fa9e4066Sahrens 	ZIO_TYPE_READ,
296fa9e4066Sahrens 	ZIO_TYPE_WRITE,
297fa9e4066Sahrens 	ZIO_TYPE_FREE,
298fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
299fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
300fa9e4066Sahrens 	ZIO_TYPES
301fa9e4066Sahrens } zio_type_t;
302fa9e4066Sahrens 
303fa9e4066Sahrens /*
304fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
305fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
306fa9e4066Sahrens  */
307fa9e4066Sahrens typedef struct vdev_stat {
308fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
309fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
310fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
311fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
312fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
31399653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
3142a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
315fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
316fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
317fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
318fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
319fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
320fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
321fa9e4066Sahrens 	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
322fa9e4066Sahrens 	uint64_t	vs_scrub_complete;	/* completed?		*/
323fa9e4066Sahrens 	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
324fa9e4066Sahrens 	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
325fa9e4066Sahrens 	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
326fa9e4066Sahrens 	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
327fa9e4066Sahrens 	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
328fa9e4066Sahrens } vdev_stat_t;
329fa9e4066Sahrens 
330fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
331fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
332fa9e4066Sahrens 
333fa9e4066Sahrens /*
334fa9e4066Sahrens  * zvol paths.  Irritatingly, the devfsadm interfaces want all these
335fa9e4066Sahrens  * paths without the /dev prefix, but for some things, we want the
336fa9e4066Sahrens  * /dev prefix.  Below are the names without /dev.
337fa9e4066Sahrens  */
338fa9e4066Sahrens #define	ZVOL_DEV_DIR	"zvol/dsk"
339fa9e4066Sahrens #define	ZVOL_RDEV_DIR	"zvol/rdsk"
340fa9e4066Sahrens 
341fa9e4066Sahrens /*
342fa9e4066Sahrens  * And here are the things we need with /dev, etc. in front of them.
343fa9e4066Sahrens  */
344fa9e4066Sahrens #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zvol@0:"
345fa9e4066Sahrens #define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR
346fa9e4066Sahrens 
347fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
348fa9e4066Sahrens 
349fa9e4066Sahrens /*
350fa9e4066Sahrens  * /dev/zfs ioctl numbers.
351fa9e4066Sahrens  */
352fa9e4066Sahrens #define	ZFS_IOC		('Z' << 8)
353fa9e4066Sahrens 
354fa9e4066Sahrens typedef enum zfs_ioc {
355fa9e4066Sahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC,
356fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
357fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
358fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
359fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
360fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
361fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
362fa9e4066Sahrens 	ZFS_IOC_POOL_SCRUB,
363fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
364eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
36506eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
36606eeb2adSek 	ZFS_IOC_POOL_LOG_HISTORY,
367fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
368fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
369fa9e4066Sahrens 	ZFS_IOC_VDEV_ONLINE,
370fa9e4066Sahrens 	ZFS_IOC_VDEV_OFFLINE,
371fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
372fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
373c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
374fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
375fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
376fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
377fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
378fa9e4066Sahrens 	ZFS_IOC_CREATE_MINOR,
379fa9e4066Sahrens 	ZFS_IOC_REMOVE_MINOR,
380fa9e4066Sahrens 	ZFS_IOC_CREATE,
381fa9e4066Sahrens 	ZFS_IOC_DESTROY,
382fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
383fa9e4066Sahrens 	ZFS_IOC_RENAME,
384fa9e4066Sahrens 	ZFS_IOC_RECVBACKUP,
385ea8dc4b6Seschrock 	ZFS_IOC_SENDBACKUP,
386ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
387ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
388ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
389ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
390ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
3911d452cf5Sahrens 	ZFS_IOC_PROMOTE,
3921d452cf5Sahrens 	ZFS_IOC_DESTROY_SNAPS,
39355434c77Sek 	ZFS_IOC_SNAPSHOT,
39455434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
395*b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
396*b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
397*b1b8ab34Slling 	ZFS_IOC_POOL_GET_PROPS
398fa9e4066Sahrens } zfs_ioc_t;
399fa9e4066Sahrens 
400ea8dc4b6Seschrock /*
401ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
402ea8dc4b6Seschrock  */
403ea8dc4b6Seschrock typedef enum {
404ea8dc4b6Seschrock 	SPA_LOAD_NONE,		/* no load in progress */
405ea8dc4b6Seschrock 	SPA_LOAD_OPEN,		/* normal open */
406ea8dc4b6Seschrock 	SPA_LOAD_IMPORT,	/* import in progress */
407ea8dc4b6Seschrock 	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
408ea8dc4b6Seschrock } spa_load_state_t;
409ea8dc4b6Seschrock 
410e9dbad6fSeschrock /*
411e9dbad6fSeschrock  * Bookmark name values.
412e9dbad6fSeschrock  */
41355434c77Sek #define	ZPOOL_ERR_LIST		"error list"
414e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
415e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
416e9dbad6fSeschrock 
41706eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
41806eeb2adSek 
41906eeb2adSek /*
42006eeb2adSek  * The following are names used in the nvlist describing
42106eeb2adSek  * the pool's history log.
42206eeb2adSek  */
42306eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
42406eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
42506eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
42606eeb2adSek 
427fa9e4066Sahrens #ifdef	__cplusplus
428fa9e4066Sahrens }
429fa9e4066Sahrens #endif
430fa9e4066Sahrens 
431fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
432