xref: /illumos-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h (revision b1b8ab34de515a5e83206da22c3d7e563241b021)
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, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 /*
20  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
21  * Use is subject to license terms.
22  */
23 
24 #ifndef	_SYS_FS_ZFS_H
25 #define	_SYS_FS_ZFS_H
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * On-disk version number.
31  */
32 #define	ZFS_VERSION_1			1ULL
33 #define	ZFS_VERSION_2			2ULL
34 #define	ZFS_VERSION_3			3ULL
35 #define	ZFS_VERSION_4			4ULL
36 #define	ZFS_VERSION_5			5ULL
37 #define	ZFS_VERSION_6			6ULL
38 #define	ZFS_VERSION			ZFS_VERSION_6
39 
40 /*
41  * The following are configuration names used in the nvlist describing a pool's
42  * configuration.
43  */
44 #define	ZPOOL_CONFIG_VERSION		"version"
45 #define	ZPOOL_CONFIG_POOL_NAME		"name"
46 #define	ZPOOL_CONFIG_POOL_STATE		"state"
47 #define	ZPOOL_CONFIG_POOL_TXG		"txg"
48 #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
49 #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
50 #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
51 #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
52 #define	ZPOOL_CONFIG_TYPE		"type"
53 #define	ZPOOL_CONFIG_CHILDREN		"children"
54 #define	ZPOOL_CONFIG_ID			"id"
55 #define	ZPOOL_CONFIG_GUID		"guid"
56 #define	ZPOOL_CONFIG_PATH		"path"
57 #define	ZPOOL_CONFIG_DEVID		"devid"
58 #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
59 #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
60 #define	ZPOOL_CONFIG_ASHIFT		"ashift"
61 #define	ZPOOL_CONFIG_ASIZE		"asize"
62 #define	ZPOOL_CONFIG_DTL		"DTL"
63 #define	ZPOOL_CONFIG_STATS		"stats"
64 #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
65 #define	ZPOOL_CONFIG_OFFLINE		"offline"
66 #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
67 #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
68 #define	ZPOOL_CONFIG_SPARES		"spares"
69 #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
70 #define	ZPOOL_CONFIG_NPARITY		"nparity"
71 
72 #define	VDEV_TYPE_ROOT			"root"
73 #define	VDEV_TYPE_MIRROR		"mirror"
74 #define	VDEV_TYPE_REPLACING		"replacing"
75 #define	VDEV_TYPE_RAIDZ			"raidz"
76 #define	VDEV_TYPE_DISK			"disk"
77 #define	VDEV_TYPE_FILE			"file"
78 #define	VDEV_TYPE_MISSING		"missing"
79 #define	VDEV_TYPE_SPARE			"spare"
80 
81 /*
82  * pool state.  The following states are written to disk as part of the normal
83  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
84  * software abstractions used at various levels to communicate pool state.
85  */
86 typedef enum pool_state {
87 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
88 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
89 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
90 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
91 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
92 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
93 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
94 } pool_state_t;
95 
96 #endif	/* _SYS_FS_ZFS_H */
97