1b1b8ab3lling/*
2b1b8ab3lling *  GRUB  --  GRand Unified Bootloader
3b1b8ab3lling *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
4b1b8ab3lling *
5b1b8ab3lling *  This program is free software; you can redistribute it and/or modify
6b1b8ab3lling *  it under the terms of the GNU General Public License as published by
7b1b8ab3lling *  the Free Software Foundation; either version 2 of the License, or
8b1b8ab3lling *  (at your option) any later version.
9b1b8ab3lling *
10b1b8ab3lling *  This program is distributed in the hope that it will be useful,
11b1b8ab3lling *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12b1b8ab3lling *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13b1b8ab3lling *  GNU General Public License for more details.
14b1b8ab3lling *
15b1b8ab3lling *  You should have received a copy of the GNU General Public License
16b1b8ab3lling *  along with this program; if not, write to the Free Software
17b1b8ab3lling *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18b1b8ab3lling */
19ad135b5Christopher Siden
20b1b8ab3lling/*
213f9d6adLin Ling * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
22ad135b5Christopher Siden * Copyright (c) 2012 by Delphix. All rights reserved.
23b1b8ab3lling */
24b1b8ab3lling
25b1b8ab3lling#ifndef	_SYS_FS_ZFS_H
26b1b8ab3lling#define	_SYS_FS_ZFS_H
27b1b8ab3lling
28b1b8ab3lling/*
29b1b8ab3lling * On-disk version number.
30b1b8ab3lling */
31ad135b5Christopher Siden#define	SPA_VERSION_INITIAL		1ULL
32ad135b5Christopher Siden#define	SPA_VERSION_BEFORE_FEATURES	28ULL
33ad135b5Christopher Siden#define	SPA_VERSION			5000ULL
34ad135b5Christopher Siden#define	SPA_VERSION_FEATURES		5000ULL
35ad135b5Christopher Siden
36ad135b5Christopher Siden#define	SPA_VERSION_IS_SUPPORTED(v) \
37ad135b5Christopher Siden	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
38ad135b5Christopher Siden	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
39b1b8ab3lling
40b1b8ab3lling/*
41b1b8ab3lling * The following are configuration names used in the nvlist describing a pool's
42b1b8ab3lling * configuration.
43b1b8ab3lling */
44b1b8ab3lling#define	ZPOOL_CONFIG_VERSION		"version"
45b1b8ab3lling#define	ZPOOL_CONFIG_POOL_NAME		"name"
46b1b8ab3lling#define	ZPOOL_CONFIG_POOL_STATE		"state"
47b1b8ab3lling#define	ZPOOL_CONFIG_POOL_TXG		"txg"
48b1b8ab3lling#define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
49b1b8ab3lling#define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
50b1b8ab3lling#define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
51b1b8ab3lling#define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
52b1b8ab3lling#define	ZPOOL_CONFIG_TYPE		"type"
53b1b8ab3lling#define	ZPOOL_CONFIG_CHILDREN		"children"
54b1b8ab3lling#define	ZPOOL_CONFIG_ID			"id"
55b1b8ab3lling#define	ZPOOL_CONFIG_GUID		"guid"
56b1b8ab3lling#define	ZPOOL_CONFIG_PATH		"path"
57b1b8ab3lling#define	ZPOOL_CONFIG_DEVID		"devid"
58b1b8ab3lling#define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
59b1b8ab3lling#define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
60b1b8ab3lling#define	ZPOOL_CONFIG_ASHIFT		"ashift"
61b1b8ab3lling#define	ZPOOL_CONFIG_ASIZE		"asize"
62b1b8ab3lling#define	ZPOOL_CONFIG_DTL		"DTL"
63b1b8ab3lling#define	ZPOOL_CONFIG_STATS		"stats"
64b1b8ab3lling#define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
65b1b8ab3lling#define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
66b1b8ab3lling#define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
67b1b8ab3lling#define	ZPOOL_CONFIG_SPARES		"spares"
68b1b8ab3lling#define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
69b1b8ab3lling#define	ZPOOL_CONFIG_NPARITY		"nparity"
70e7cbe64gw#define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
71fa94a07brendan#define	ZPOOL_CONFIG_L2CACHE		"l2cache"
7288ecc94George Wilson#define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
7388ecc94George Wilson#define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
7488ecc94George Wilson#define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
759eb19f4George Wilson#define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
769eb19f4George Wilson#define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
779eb19f4George Wilson#define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
78ad135b5Christopher Siden#define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
79e7cbe64gw/*
80e7cbe64gw * The persistent vdev state is stored as separate values rather than a single
81e7cbe64gw * 'vdev_state' entry.  This is because a device can be in multiple states, such
82e7cbe64gw * as offline and degraded.
83e7cbe64gw */
84e7cbe64gw#define	ZPOOL_CONFIG_OFFLINE		"offline"
85e7cbe64gw#define	ZPOOL_CONFIG_FAULTED		"faulted"
86e7cbe64gw#define	ZPOOL_CONFIG_DEGRADED		"degraded"
87e7cbe64gw#define	ZPOOL_CONFIG_REMOVED		"removed"
88b1b8ab3lling
89b1b8ab3lling#define	VDEV_TYPE_ROOT			"root"
90b1b8ab3lling#define	VDEV_TYPE_MIRROR		"mirror"
91b1b8ab3lling#define	VDEV_TYPE_REPLACING		"replacing"
92b1b8ab3lling#define	VDEV_TYPE_RAIDZ			"raidz"
93b1b8ab3lling#define	VDEV_TYPE_DISK			"disk"
94b1b8ab3lling#define	VDEV_TYPE_FILE			"file"
95b1b8ab3lling#define	VDEV_TYPE_MISSING		"missing"
9688ecc94George Wilson#define	VDEV_TYPE_HOLE			"hole"
97b1b8ab3lling#define	VDEV_TYPE_SPARE			"spare"
98fa94a07brendan#define	VDEV_TYPE_L2CACHE		"l2cache"
99b1b8ab3lling
100b1b8ab3lling/*
101b1b8ab3lling * pool state.  The following states are written to disk as part of the normal
102fa94a07brendan * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
103fa94a07brendan * states are software abstractions used at various levels to communicate pool
104fa94a07brendan * state.
105b1b8ab3lling */
106b1b8ab3llingtypedef enum pool_state {
107b1b8ab3lling	POOL_STATE_ACTIVE = 0,		/* In active use		*/
108b1b8ab3lling	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
109b1b8ab3lling	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
110b1b8ab3lling	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
111fa94a07brendan	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
112b1b8ab3lling	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
113b1b8ab3lling	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
114b1b8ab3lling	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
115b1b8ab3lling} pool_state_t;
116b1b8ab3lling
117b1b8ab3lling#endif	/* _SYS_FS_ZFS_H */
118