author | perrin |
Fri, 22 Jun 2007 20:02:13 -0700 | |
changeset 4527 | 5d5b6ba91b17 |
parent 4451 | 24fbf2d7a5d7 |
child 4543 | 12bb2876a62e |
permissions | -rw-r--r-- |
789 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
1485 | 5 |
* Common Development and Distribution License (the "License"). |
6 |
* You may not use this file except in compliance with the License. |
|
789 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
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 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#ifndef _SYS_FS_ZFS_H |
|
27 |
#define _SYS_FS_ZFS_H |
|
28 |
||
29 |
#pragma ident "%Z%%M% %I% %E% SMI" |
|
30 |
||
31 |
#include <sys/types.h> |
|
32 |
||
33 |
#ifdef __cplusplus |
|
34 |
extern "C" { |
|
35 |
#endif |
|
36 |
||
37 |
/* |
|
38 |
* Types and constants shared between userland and the kernel. |
|
39 |
*/ |
|
40 |
||
41 |
/* |
|
42 |
* Each dataset can be one of the following types. These constants can be |
|
43 |
* combined into masks that can be passed to various functions. |
|
44 |
*/ |
|
45 |
typedef enum { |
|
46 |
ZFS_TYPE_FILESYSTEM = 0x1, |
|
47 |
ZFS_TYPE_SNAPSHOT = 0x2, |
|
3912 | 48 |
ZFS_TYPE_VOLUME = 0x4, |
49 |
ZFS_TYPE_POOL = 0x8 |
|
789 | 50 |
} zfs_type_t; |
51 |
||
52 |
#define ZFS_TYPE_ANY \ |
|
53 |
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) |
|
54 |
||
55 |
/* |
|
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
56 |
* Properties are identified by these constants and must be added to the |
4451 | 57 |
* end of this list to ensure that external consumers are not affected |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
58 |
* by the change. The property list also determines how 'zfs get' will |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
59 |
* display them. If you make any changes to this list, be sure to update |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
60 |
* the property table in usr/src/common/zfs/zfs_prop.c. |
789 | 61 |
*/ |
62 |
typedef enum { |
|
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
63 |
ZFS_PROP_CONT = -2, |
789 | 64 |
ZFS_PROP_INVAL = -1, |
65 |
ZFS_PROP_TYPE, |
|
66 |
ZFS_PROP_CREATION, |
|
67 |
ZFS_PROP_USED, |
|
68 |
ZFS_PROP_AVAILABLE, |
|
69 |
ZFS_PROP_REFERENCED, |
|
70 |
ZFS_PROP_COMPRESSRATIO, |
|
71 |
ZFS_PROP_MOUNTED, |
|
72 |
ZFS_PROP_ORIGIN, |
|
73 |
ZFS_PROP_QUOTA, |
|
74 |
ZFS_PROP_RESERVATION, |
|
75 |
ZFS_PROP_VOLSIZE, |
|
76 |
ZFS_PROP_VOLBLOCKSIZE, |
|
77 |
ZFS_PROP_RECORDSIZE, |
|
78 |
ZFS_PROP_MOUNTPOINT, |
|
79 |
ZFS_PROP_SHARENFS, |
|
80 |
ZFS_PROP_CHECKSUM, |
|
81 |
ZFS_PROP_COMPRESSION, |
|
82 |
ZFS_PROP_ATIME, |
|
83 |
ZFS_PROP_DEVICES, |
|
84 |
ZFS_PROP_EXEC, |
|
85 |
ZFS_PROP_SETUID, |
|
86 |
ZFS_PROP_READONLY, |
|
87 |
ZFS_PROP_ZONED, |
|
88 |
ZFS_PROP_SNAPDIR, |
|
89 |
ZFS_PROP_ACLMODE, |
|
90 |
ZFS_PROP_ACLINHERIT, |
|
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
91 |
ZFS_PROP_CREATETXG, /* not exposed to the user */ |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
92 |
ZFS_PROP_NAME, /* not exposed to the user */ |
2676 | 93 |
ZFS_PROP_CANMOUNT, |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
94 |
ZFS_PROP_SHAREISCSI, |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
95 |
ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ |
3234 | 96 |
ZFS_PROP_XATTR, |
3835 | 97 |
ZFS_PROP_NUMCLONES, /* not exposed to the user */ |
3912 | 98 |
ZFS_PROP_COPIES, |
4451 | 99 |
ZPOOL_PROP_BOOTFS, |
100 |
ZPOOL_PROP_AUTOREPLACE, |
|
101 |
ZPOOL_PROP_NAME |
|
789 | 102 |
} zfs_prop_t; |
103 |
||
3912 | 104 |
typedef zfs_prop_t zpool_prop_t; |
105 |
||
4451 | 106 |
#define ZPOOL_PROP_CONT ZFS_PROP_CONT |
107 |
#define ZPOOL_PROP_INVAL ZFS_PROP_INVAL |
|
108 |
||
1356
e021b5e4aa0e
6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents:
1354
diff
changeset
|
109 |
#define ZFS_PROP_VALUE "value" |
e021b5e4aa0e
6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents:
1354
diff
changeset
|
110 |
#define ZFS_PROP_SOURCE "source" |
e021b5e4aa0e
6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents:
1354
diff
changeset
|
111 |
|
3912 | 112 |
typedef enum { |
113 |
ZFS_SRC_NONE = 0x1, |
|
114 |
ZFS_SRC_DEFAULT = 0x2, |
|
115 |
ZFS_SRC_TEMPORARY = 0x4, |
|
116 |
ZFS_SRC_LOCAL = 0x8, |
|
117 |
ZFS_SRC_INHERITED = 0x10 |
|
118 |
} zfs_source_t; |
|
119 |
||
120 |
#define ZFS_SRC_ALL 0x1f |
|
121 |
||
789 | 122 |
/* |
123 |
* The following functions are shared between libzfs and the kernel. |
|
124 |
*/ |
|
125 |
zfs_prop_t zfs_name_to_prop(const char *); |
|
3912 | 126 |
zpool_prop_t zpool_name_to_prop(const char *); |
2676 | 127 |
boolean_t zfs_prop_user(const char *); |
789 | 128 |
int zfs_prop_readonly(zfs_prop_t); |
1356
e021b5e4aa0e
6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents:
1354
diff
changeset
|
129 |
const char *zfs_prop_default_string(zfs_prop_t); |
2676 | 130 |
const char *zfs_prop_to_name(zfs_prop_t); |
4451 | 131 |
const char *zpool_prop_to_name(zpool_prop_t); |
789 | 132 |
uint64_t zfs_prop_default_numeric(zfs_prop_t); |
2676 | 133 |
int zfs_prop_inheritable(zfs_prop_t); |
2717
ed589a32259d
6469385 zfs_set_prop_nvlist range checking is busted
eschrock
parents:
2676
diff
changeset
|
134 |
int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); |
ed589a32259d
6469385 zfs_set_prop_nvlist range checking is busted
eschrock
parents:
2676
diff
changeset
|
135 |
int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); |
4451 | 136 |
uint64_t zpool_prop_default_numeric(zpool_prop_t); |
2082 | 137 |
|
789 | 138 |
/* |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
139 |
* Property Iterator |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
140 |
*/ |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
141 |
typedef zfs_prop_t (*zfs_prop_f)(zfs_prop_t, void *); |
4451 | 142 |
typedef zpool_prop_t (*zpool_prop_f)(zpool_prop_t, void *); |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
143 |
extern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t); |
3912 | 144 |
extern zpool_prop_t zpool_prop_iter(zpool_prop_f, void *, boolean_t); |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
145 |
|
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
146 |
/* |
2082 | 147 |
* On-disk version number. |
1760 | 148 |
*/ |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
149 |
#define ZFS_VERSION_1 1ULL |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
150 |
#define ZFS_VERSION_2 2ULL |
2082 | 151 |
#define ZFS_VERSION_3 3ULL |
3863
d56571426115
6529406 zpool history needs to bump the on-disk version
ek110237
parents:
3835
diff
changeset
|
152 |
#define ZFS_VERSION_4 4ULL |
3886
3291401d66a6
6536602 add zlib compression support and upgrade to version 1.2.3
ahl
parents:
3863
diff
changeset
|
153 |
#define ZFS_VERSION_5 5ULL |
3912 | 154 |
#define ZFS_VERSION_6 6ULL |
4527 | 155 |
#define ZFS_VERSION_7 7ULL |
3912 | 156 |
/* |
157 |
* When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk |
|
158 |
* format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, |
|
159 |
* and do the appropriate changes. |
|
160 |
*/ |
|
4527 | 161 |
#define ZFS_VERSION ZFS_VERSION_7 |
162 |
#define ZFS_VERSION_STRING "7" |
|
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
163 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
164 |
/* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
165 |
* Symbolic names for the changes that caused a ZFS_VERSION switch. |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
166 |
* 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
|
167 |
* 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
|
168 |
* 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
|
169 |
* |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
170 |
* NOTE: When checking the current ZFS_VERSION in your code, be sure |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
171 |
* 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
|
172 |
* 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
|
173 |
* be dangerous in some cases. |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
174 |
*/ |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
175 |
#define ZFS_VERSION_INITIAL ZFS_VERSION_1 |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
176 |
#define ZFS_VERSION_DITTO_BLOCKS ZFS_VERSION_2 |
2082 | 177 |
#define ZFS_VERSION_SPARES ZFS_VERSION_3 |
178 |
#define ZFS_VERSION_RAID6 ZFS_VERSION_3 |
|
179 |
#define ZFS_VERSION_BPLIST_ACCOUNT ZFS_VERSION_3 |
|
180 |
#define ZFS_VERSION_RAIDZ_DEFLATE ZFS_VERSION_3 |
|
181 |
#define ZFS_VERSION_DNODE_BYTES ZFS_VERSION_3 |
|
3863
d56571426115
6529406 zpool history needs to bump the on-disk version
ek110237
parents:
3835
diff
changeset
|
182 |
#define ZFS_VERSION_ZPOOL_HISTORY ZFS_VERSION_4 |
3886
3291401d66a6
6536602 add zlib compression support and upgrade to version 1.2.3
ahl
parents:
3863
diff
changeset
|
183 |
#define ZFS_VERSION_GZIP_COMPRESSION ZFS_VERSION_5 |
3912 | 184 |
#define ZFS_VERSION_BOOTFS ZFS_VERSION_6 |
4527 | 185 |
#define ZFS_VERSION_SLOGS ZFS_VERSION_7 |
1760 | 186 |
|
187 |
/* |
|
789 | 188 |
* The following are configuration names used in the nvlist describing a pool's |
189 |
* configuration. |
|
190 |
*/ |
|
191 |
#define ZPOOL_CONFIG_VERSION "version" |
|
192 |
#define ZPOOL_CONFIG_POOL_NAME "name" |
|
193 |
#define ZPOOL_CONFIG_POOL_STATE "state" |
|
194 |
#define ZPOOL_CONFIG_POOL_TXG "txg" |
|
195 |
#define ZPOOL_CONFIG_POOL_GUID "pool_guid" |
|
196 |
#define ZPOOL_CONFIG_CREATE_TXG "create_txg" |
|
197 |
#define ZPOOL_CONFIG_TOP_GUID "top_guid" |
|
198 |
#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" |
|
199 |
#define ZPOOL_CONFIG_TYPE "type" |
|
200 |
#define ZPOOL_CONFIG_CHILDREN "children" |
|
201 |
#define ZPOOL_CONFIG_ID "id" |
|
202 |
#define ZPOOL_CONFIG_GUID "guid" |
|
203 |
#define ZPOOL_CONFIG_PATH "path" |
|
204 |
#define ZPOOL_CONFIG_DEVID "devid" |
|
205 |
#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" |
|
206 |
#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" |
|
207 |
#define ZPOOL_CONFIG_ASHIFT "ashift" |
|
208 |
#define ZPOOL_CONFIG_ASIZE "asize" |
|
209 |
#define ZPOOL_CONFIG_DTL "DTL" |
|
210 |
#define ZPOOL_CONFIG_STATS "stats" |
|
1171 | 211 |
#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" |
1544 | 212 |
#define ZPOOL_CONFIG_ERRCOUNT "error_count" |
213 |
#define ZPOOL_CONFIG_NOT_PRESENT "not_present" |
|
2082 | 214 |
#define ZPOOL_CONFIG_SPARES "spares" |
215 |
#define ZPOOL_CONFIG_IS_SPARE "is_spare" |
|
216 |
#define ZPOOL_CONFIG_NPARITY "nparity" |
|
3975
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
217 |
#define ZPOOL_CONFIG_HOSTID "hostid" |
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
218 |
#define ZPOOL_CONFIG_HOSTNAME "hostname" |
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
219 |
#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ |
4451 | 220 |
#define ZPOOL_CONFIG_UNSPARE "unspare" |
221 |
#define ZPOOL_CONFIG_PHYS_PATH "phys_path" |
|
4527 | 222 |
#define ZPOOL_CONFIG_IS_LOG "is_log" |
4451 | 223 |
/* |
224 |
* The persistent vdev state is stored as separate values rather than a single |
|
225 |
* 'vdev_state' entry. This is because a device can be in multiple states, such |
|
226 |
* as offline and degraded. |
|
227 |
*/ |
|
228 |
#define ZPOOL_CONFIG_OFFLINE "offline" |
|
229 |
#define ZPOOL_CONFIG_FAULTED "faulted" |
|
230 |
#define ZPOOL_CONFIG_DEGRADED "degraded" |
|
231 |
#define ZPOOL_CONFIG_REMOVED "removed" |
|
789 | 232 |
|
233 |
#define VDEV_TYPE_ROOT "root" |
|
234 |
#define VDEV_TYPE_MIRROR "mirror" |
|
235 |
#define VDEV_TYPE_REPLACING "replacing" |
|
236 |
#define VDEV_TYPE_RAIDZ "raidz" |
|
237 |
#define VDEV_TYPE_DISK "disk" |
|
238 |
#define VDEV_TYPE_FILE "file" |
|
239 |
#define VDEV_TYPE_MISSING "missing" |
|
2082 | 240 |
#define VDEV_TYPE_SPARE "spare" |
4527 | 241 |
#define VDEV_TYPE_LOG "log" |
789 | 242 |
|
243 |
/* |
|
244 |
* This is needed in userland to report the minimum necessary device size. |
|
245 |
*/ |
|
246 |
#define SPA_MINDEVSIZE (64ULL << 20) |
|
247 |
||
248 |
/* |
|
249 |
* The location of the pool configuration repository, shared between kernel and |
|
250 |
* userland. |
|
251 |
*/ |
|
252 |
#define ZPOOL_CACHE_DIR "/etc/zfs" |
|
253 |
#define ZPOOL_CACHE_FILE "zpool.cache" |
|
254 |
#define ZPOOL_CACHE_TMP ".zpool.cache" |
|
255 |
||
256 |
#define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE |
|
257 |
||
258 |
/* |
|
259 |
* vdev states are ordered from least to most healthy. |
|
260 |
* A vdev that's CANT_OPEN or below is considered unusable. |
|
261 |
*/ |
|
262 |
typedef enum vdev_state { |
|
263 |
VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ |
|
264 |
VDEV_STATE_CLOSED, /* Not currently open */ |
|
265 |
VDEV_STATE_OFFLINE, /* Not allowed to open */ |
|
4451 | 266 |
VDEV_STATE_REMOVED, /* Explicitly removed from system */ |
789 | 267 |
VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ |
4451 | 268 |
VDEV_STATE_FAULTED, /* External request to fault device */ |
789 | 269 |
VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ |
270 |
VDEV_STATE_HEALTHY /* Presumed good */ |
|
271 |
} vdev_state_t; |
|
272 |
||
4451 | 273 |
#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY |
274 |
||
789 | 275 |
/* |
276 |
* vdev aux states. When a vdev is in the CANT_OPEN state, the aux field |
|
277 |
* of the vdev stats structure uses these constants to distinguish why. |
|
278 |
*/ |
|
279 |
typedef enum vdev_aux { |
|
280 |
VDEV_AUX_NONE, /* no error */ |
|
281 |
VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ |
|
282 |
VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ |
|
283 |
VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ |
|
284 |
VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ |
|
285 |
VDEV_AUX_TOO_SMALL, /* vdev size is too small */ |
|
1760 | 286 |
VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ |
287 |
VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ |
|
2082 | 288 |
VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ |
4451 | 289 |
VDEV_AUX_SPARED, /* hot spare used in another pool */ |
290 |
VDEV_AUX_ERR_EXCEEDED /* too many errors */ |
|
789 | 291 |
} vdev_aux_t; |
292 |
||
293 |
/* |
|
1352
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
294 |
* pool state. The following states are written to disk as part of the normal |
2082 | 295 |
* 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
|
296 |
* software abstractions used at various levels to communicate pool state. |
789 | 297 |
*/ |
298 |
typedef enum pool_state { |
|
299 |
POOL_STATE_ACTIVE = 0, /* In active use */ |
|
300 |
POOL_STATE_EXPORTED, /* Explicitly exported */ |
|
301 |
POOL_STATE_DESTROYED, /* Explicitly destroyed */ |
|
2082 | 302 |
POOL_STATE_SPARE, /* Reserved for hot spare use */ |
789 | 303 |
POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ |
1352
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
304 |
POOL_STATE_UNAVAIL, /* Internal libzfs state */ |
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
305 |
POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ |
789 | 306 |
} pool_state_t; |
307 |
||
308 |
/* |
|
309 |
* Scrub types. |
|
310 |
*/ |
|
311 |
typedef enum pool_scrub_type { |
|
312 |
POOL_SCRUB_NONE, |
|
313 |
POOL_SCRUB_RESILVER, |
|
314 |
POOL_SCRUB_EVERYTHING, |
|
315 |
POOL_SCRUB_TYPES |
|
316 |
} pool_scrub_type_t; |
|
317 |
||
318 |
/* |
|
319 |
* ZIO types. Needed to interpret vdev statistics below. |
|
320 |
*/ |
|
321 |
typedef enum zio_type { |
|
322 |
ZIO_TYPE_NULL = 0, |
|
323 |
ZIO_TYPE_READ, |
|
324 |
ZIO_TYPE_WRITE, |
|
325 |
ZIO_TYPE_FREE, |
|
326 |
ZIO_TYPE_CLAIM, |
|
327 |
ZIO_TYPE_IOCTL, |
|
328 |
ZIO_TYPES |
|
329 |
} zio_type_t; |
|
330 |
||
331 |
/* |
|
332 |
* Vdev statistics. Note: all fields should be 64-bit because this |
|
333 |
* is passed between kernel and userland as an nvlist uint64 array. |
|
334 |
*/ |
|
335 |
typedef struct vdev_stat { |
|
336 |
hrtime_t vs_timestamp; /* time since vdev load */ |
|
337 |
uint64_t vs_state; /* vdev state */ |
|
338 |
uint64_t vs_aux; /* see vdev_aux_t */ |
|
339 |
uint64_t vs_alloc; /* space allocated */ |
|
340 |
uint64_t vs_space; /* total capacity */ |
|
2082 | 341 |
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
|
342 |
uint64_t vs_rsize; /* replaceable dev size */ |
789 | 343 |
uint64_t vs_ops[ZIO_TYPES]; /* operation count */ |
344 |
uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ |
|
345 |
uint64_t vs_read_errors; /* read errors */ |
|
346 |
uint64_t vs_write_errors; /* write errors */ |
|
347 |
uint64_t vs_checksum_errors; /* checksum errors */ |
|
348 |
uint64_t vs_self_healed; /* self-healed bytes */ |
|
349 |
uint64_t vs_scrub_type; /* pool_scrub_type_t */ |
|
350 |
uint64_t vs_scrub_complete; /* completed? */ |
|
351 |
uint64_t vs_scrub_examined; /* bytes examined; top */ |
|
352 |
uint64_t vs_scrub_repaired; /* bytes repaired; leaf */ |
|
353 |
uint64_t vs_scrub_errors; /* errors during scrub */ |
|
354 |
uint64_t vs_scrub_start; /* UTC scrub start time */ |
|
355 |
uint64_t vs_scrub_end; /* UTC scrub end time */ |
|
356 |
} vdev_stat_t; |
|
357 |
||
358 |
#define ZFS_DRIVER "zfs" |
|
359 |
#define ZFS_DEV "/dev/zfs" |
|
360 |
||
361 |
/* |
|
362 |
* zvol paths. Irritatingly, the devfsadm interfaces want all these |
|
363 |
* paths without the /dev prefix, but for some things, we want the |
|
364 |
* /dev prefix. Below are the names without /dev. |
|
365 |
*/ |
|
366 |
#define ZVOL_DEV_DIR "zvol/dsk" |
|
367 |
#define ZVOL_RDEV_DIR "zvol/rdsk" |
|
368 |
||
369 |
/* |
|
370 |
* And here are the things we need with /dev, etc. in front of them. |
|
371 |
*/ |
|
372 |
#define ZVOL_PSEUDO_DEV "/devices/pseudo/zvol@0:" |
|
373 |
#define ZVOL_FULL_DEV_DIR "/dev/" ZVOL_DEV_DIR |
|
374 |
||
375 |
#define ZVOL_PROP_NAME "name" |
|
376 |
||
377 |
/* |
|
378 |
* /dev/zfs ioctl numbers. |
|
379 |
*/ |
|
380 |
#define ZFS_IOC ('Z' << 8) |
|
381 |
||
382 |
typedef enum zfs_ioc { |
|
383 |
ZFS_IOC_POOL_CREATE = ZFS_IOC, |
|
384 |
ZFS_IOC_POOL_DESTROY, |
|
385 |
ZFS_IOC_POOL_IMPORT, |
|
386 |
ZFS_IOC_POOL_EXPORT, |
|
387 |
ZFS_IOC_POOL_CONFIGS, |
|
388 |
ZFS_IOC_POOL_STATS, |
|
389 |
ZFS_IOC_POOL_TRYIMPORT, |
|
390 |
ZFS_IOC_POOL_SCRUB, |
|
391 |
ZFS_IOC_POOL_FREEZE, |
|
1760 | 392 |
ZFS_IOC_POOL_UPGRADE, |
2926 | 393 |
ZFS_IOC_POOL_GET_HISTORY, |
394 |
ZFS_IOC_POOL_LOG_HISTORY, |
|
789 | 395 |
ZFS_IOC_VDEV_ADD, |
396 |
ZFS_IOC_VDEV_REMOVE, |
|
4451 | 397 |
ZFS_IOC_VDEV_SET_STATE, |
789 | 398 |
ZFS_IOC_VDEV_ATTACH, |
399 |
ZFS_IOC_VDEV_DETACH, |
|
1354
81359ee1ee63
6362672 import gets confused about overlapping slices
eschrock
parents:
1352
diff
changeset
|
400 |
ZFS_IOC_VDEV_SETPATH, |
789 | 401 |
ZFS_IOC_OBJSET_STATS, |
402 |
ZFS_IOC_DATASET_LIST_NEXT, |
|
403 |
ZFS_IOC_SNAPSHOT_LIST_NEXT, |
|
404 |
ZFS_IOC_SET_PROP, |
|
405 |
ZFS_IOC_CREATE_MINOR, |
|
406 |
ZFS_IOC_REMOVE_MINOR, |
|
407 |
ZFS_IOC_CREATE, |
|
408 |
ZFS_IOC_DESTROY, |
|
409 |
ZFS_IOC_ROLLBACK, |
|
410 |
ZFS_IOC_RENAME, |
|
411 |
ZFS_IOC_RECVBACKUP, |
|
1544 | 412 |
ZFS_IOC_SENDBACKUP, |
413 |
ZFS_IOC_INJECT_FAULT, |
|
414 |
ZFS_IOC_CLEAR_FAULT, |
|
415 |
ZFS_IOC_INJECT_LIST_NEXT, |
|
416 |
ZFS_IOC_ERROR_LOG, |
|
417 |
ZFS_IOC_CLEAR, |
|
2199 | 418 |
ZFS_IOC_PROMOTE, |
419 |
ZFS_IOC_DESTROY_SNAPS, |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
420 |
ZFS_IOC_SNAPSHOT, |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
421 |
ZFS_IOC_DSOBJ_TO_DSNAME, |
3912 | 422 |
ZFS_IOC_OBJ_TO_PATH, |
423 |
ZFS_IOC_POOL_SET_PROPS, |
|
424 |
ZFS_IOC_POOL_GET_PROPS |
|
789 | 425 |
} zfs_ioc_t; |
426 |
||
1544 | 427 |
/* |
428 |
* Internal SPA load state. Used by FMA diagnosis engine. |
|
429 |
*/ |
|
430 |
typedef enum { |
|
431 |
SPA_LOAD_NONE, /* no load in progress */ |
|
432 |
SPA_LOAD_OPEN, /* normal open */ |
|
433 |
SPA_LOAD_IMPORT, /* import in progress */ |
|
434 |
SPA_LOAD_TRYIMPORT /* tryimport in progress */ |
|
435 |
} spa_load_state_t; |
|
436 |
||
2676 | 437 |
/* |
438 |
* Bookmark name values. |
|
439 |
*/ |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
440 |
#define ZPOOL_ERR_LIST "error list" |
2676 | 441 |
#define ZPOOL_ERR_DATASET "dataset" |
442 |
#define ZPOOL_ERR_OBJECT "object" |
|
443 |
||
2926 | 444 |
#define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) |
445 |
||
446 |
/* |
|
447 |
* The following are names used in the nvlist describing |
|
448 |
* the pool's history log. |
|
449 |
*/ |
|
450 |
#define ZPOOL_HIST_RECORD "history record" |
|
451 |
#define ZPOOL_HIST_TIME "history time" |
|
452 |
#define ZPOOL_HIST_CMD "history command" |
|
453 |
||
4451 | 454 |
/* |
455 |
* Flags for ZFS_IOC_VDEV_SET_STATE |
|
456 |
*/ |
|
457 |
#define ZFS_ONLINE_CHECKREMOVE 0x1 |
|
458 |
#define ZFS_ONLINE_UNSPARE 0x2 |
|
459 |
#define ZFS_ONLINE_FORCEFAULT 0x4 |
|
460 |
#define ZFS_OFFLINE_TEMPORARY 0x1 |
|
461 |
||
462 |
/* |
|
463 |
* Sysevent payload members. ZFS will generate the following sysevents with the |
|
464 |
* given payloads: |
|
465 |
* |
|
466 |
* ESC_ZFS_RESILVER_START |
|
467 |
* ESC_ZFS_RESILVER_END |
|
468 |
* ESC_ZFS_POOL_DESTROY |
|
469 |
* |
|
470 |
* ZFS_EV_POOL_NAME DATA_TYPE_STRING |
|
471 |
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64 |
|
472 |
* |
|
473 |
* ESC_ZFS_VDEV_REMOVE |
|
474 |
* ESC_ZFS_VDEV_CLEAR |
|
475 |
* ESC_ZFS_VDEV_CHECK |
|
476 |
* |
|
477 |
* ZFS_EV_POOL_NAME DATA_TYPE_STRING |
|
478 |
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64 |
|
479 |
* ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) |
|
480 |
* ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 |
|
481 |
*/ |
|
482 |
#define ZFS_EV_POOL_NAME "pool_name" |
|
483 |
#define ZFS_EV_POOL_GUID "pool_guid" |
|
484 |
#define ZFS_EV_VDEV_PATH "vdev_path" |
|
485 |
#define ZFS_EV_VDEV_GUID "vdev_guid" |
|
486 |
||
789 | 487 |
#ifdef __cplusplus |
488 |
} |
|
489 |
#endif |
|
490 |
||
491 |
#endif /* _SYS_FS_ZFS_H */ |