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