author | gw25295 |
Wed, 24 Oct 2007 20:00:39 -0700 | |
changeset 5329 | 33cb98223b2d |
parent 5147 | 5e950ccc9585 |
child 5331 | 3047ad28a67b |
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 |
#ifdef __cplusplus |
|
32 |
extern "C" { |
|
33 |
#endif |
|
34 |
||
35 |
/* |
|
36 |
* Types and constants shared between userland and the kernel. |
|
37 |
*/ |
|
38 |
||
39 |
/* |
|
40 |
* Each dataset can be one of the following types. These constants can be |
|
41 |
* combined into masks that can be passed to various functions. |
|
42 |
*/ |
|
43 |
typedef enum { |
|
44 |
ZFS_TYPE_FILESYSTEM = 0x1, |
|
45 |
ZFS_TYPE_SNAPSHOT = 0x2, |
|
3912 | 46 |
ZFS_TYPE_VOLUME = 0x4, |
47 |
ZFS_TYPE_POOL = 0x8 |
|
789 | 48 |
} zfs_type_t; |
49 |
||
5094 | 50 |
#define ZFS_TYPE_DATASET \ |
789 | 51 |
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) |
52 |
||
53 |
/* |
|
5094 | 54 |
* Dataset properties are identified by these constants and must be added to |
55 |
* the end of this list to ensure that external consumers are not affected |
|
56 |
* by the change. If you make any changes to this list, be sure to update |
|
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
57 |
* the property table in usr/src/common/zfs/zfs_prop.c. |
789 | 58 |
*/ |
59 |
typedef enum { |
|
60 |
ZFS_PROP_TYPE, |
|
61 |
ZFS_PROP_CREATION, |
|
62 |
ZFS_PROP_USED, |
|
63 |
ZFS_PROP_AVAILABLE, |
|
64 |
ZFS_PROP_REFERENCED, |
|
65 |
ZFS_PROP_COMPRESSRATIO, |
|
66 |
ZFS_PROP_MOUNTED, |
|
67 |
ZFS_PROP_ORIGIN, |
|
68 |
ZFS_PROP_QUOTA, |
|
69 |
ZFS_PROP_RESERVATION, |
|
70 |
ZFS_PROP_VOLSIZE, |
|
71 |
ZFS_PROP_VOLBLOCKSIZE, |
|
72 |
ZFS_PROP_RECORDSIZE, |
|
73 |
ZFS_PROP_MOUNTPOINT, |
|
74 |
ZFS_PROP_SHARENFS, |
|
75 |
ZFS_PROP_CHECKSUM, |
|
76 |
ZFS_PROP_COMPRESSION, |
|
77 |
ZFS_PROP_ATIME, |
|
78 |
ZFS_PROP_DEVICES, |
|
79 |
ZFS_PROP_EXEC, |
|
80 |
ZFS_PROP_SETUID, |
|
81 |
ZFS_PROP_READONLY, |
|
82 |
ZFS_PROP_ZONED, |
|
83 |
ZFS_PROP_SNAPDIR, |
|
84 |
ZFS_PROP_ACLMODE, |
|
85 |
ZFS_PROP_ACLINHERIT, |
|
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
86 |
ZFS_PROP_CREATETXG, /* not exposed to the user */ |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
87 |
ZFS_PROP_NAME, /* not exposed to the user */ |
2676 | 88 |
ZFS_PROP_CANMOUNT, |
3654
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
89 |
ZFS_PROP_SHAREISCSI, |
9c6042b08979
6483718 need a stable interface to get all native properties
gw25295
parents:
3444
diff
changeset
|
90 |
ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ |
3234 | 91 |
ZFS_PROP_XATTR, |
3835 | 92 |
ZFS_PROP_NUMCLONES, /* not exposed to the user */ |
3912 | 93 |
ZFS_PROP_COPIES, |
4577 | 94 |
ZFS_PROP_VERSION, |
4787 | 95 |
ZFS_NUM_PROPS |
789 | 96 |
} zfs_prop_t; |
97 |
||
5094 | 98 |
/* |
99 |
* Pool properties are identified by these constants and must be added to the |
|
100 |
* end of this list to ensure that external conumsers are not affected |
|
101 |
* by the change. If you make any changes to this list, be sure to update |
|
102 |
* the property table in usr/src/common/zfs/zpool_prop.c. |
|
103 |
*/ |
|
104 |
typedef enum { |
|
105 |
ZPOOL_PROP_NAME, |
|
106 |
ZPOOL_PROP_SIZE, |
|
107 |
ZPOOL_PROP_USED, |
|
108 |
ZPOOL_PROP_AVAILABLE, |
|
109 |
ZPOOL_PROP_CAPACITY, |
|
110 |
ZPOOL_PROP_ALTROOT, |
|
111 |
ZPOOL_PROP_HEALTH, |
|
112 |
ZPOOL_PROP_GUID, |
|
113 |
ZPOOL_PROP_VERSION, |
|
114 |
ZPOOL_PROP_BOOTFS, |
|
115 |
ZPOOL_PROP_DELEGATION, |
|
116 |
ZPOOL_PROP_AUTOREPLACE, |
|
117 |
ZPOOL_PROP_TEMPORARY, |
|
5329 | 118 |
ZPOOL_PROP_FAILUREMODE, |
5094 | 119 |
ZPOOL_NUM_PROPS |
120 |
} zpool_prop_t; |
|
3912 | 121 |
|
5094 | 122 |
#define ZPROP_CONT -2 |
123 |
#define ZPROP_INVAL -1 |
|
4451 | 124 |
|
5094 | 125 |
#define ZPROP_VALUE "value" |
126 |
#define ZPROP_SOURCE "source" |
|
1356
e021b5e4aa0e
6377671 zfs mount -a shouldn't bother checking snapshots
eschrock
parents:
1354
diff
changeset
|
127 |
|
3912 | 128 |
typedef enum { |
5094 | 129 |
ZPROP_SRC_NONE = 0x1, |
130 |
ZPROP_SRC_DEFAULT = 0x2, |
|
131 |
ZPROP_SRC_TEMPORARY = 0x4, |
|
132 |
ZPROP_SRC_LOCAL = 0x8, |
|
133 |
ZPROP_SRC_INHERITED = 0x10 |
|
134 |
} zprop_source_t; |
|
135 |
||
136 |
#define ZPROP_SRC_ALL 0x1f |
|
137 |
||
138 |
typedef int (*zprop_func)(int, void *); |
|
3912 | 139 |
|
5094 | 140 |
/* |
141 |
* Dataset property functions shared between libzfs and kernel. |
|
142 |
*/ |
|
143 |
const char *zfs_prop_default_string(zfs_prop_t); |
|
144 |
uint64_t zfs_prop_default_numeric(zfs_prop_t); |
|
145 |
boolean_t zfs_prop_readonly(zfs_prop_t); |
|
146 |
boolean_t zfs_prop_inheritable(zfs_prop_t); |
|
147 |
const char *zfs_prop_to_name(zfs_prop_t); |
|
148 |
zfs_prop_t zfs_name_to_prop(const char *); |
|
149 |
boolean_t zfs_prop_user(const char *); |
|
150 |
int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); |
|
151 |
int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); |
|
3912 | 152 |
|
5094 | 153 |
/* |
154 |
* Pool property functions shared between libzfs and kernel. |
|
155 |
*/ |
|
156 |
zpool_prop_t zpool_name_to_prop(const char *); |
|
157 |
const char *zpool_prop_to_name(zpool_prop_t); |
|
158 |
const char *zpool_prop_default_string(zpool_prop_t); |
|
159 |
uint64_t zpool_prop_default_numeric(zpool_prop_t); |
|
160 |
boolean_t zpool_prop_readonly(zpool_prop_t); |
|
161 |
int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); |
|
162 |
int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); |
|
163 |
||
164 |
/* |
|
165 |
* Definitions for the Delegation. |
|
166 |
*/ |
|
4543 | 167 |
typedef enum { |
168 |
ZFS_DELEG_WHO_UNKNOWN = 0, |
|
169 |
ZFS_DELEG_USER = 'u', |
|
170 |
ZFS_DELEG_USER_SETS = 'U', |
|
171 |
ZFS_DELEG_GROUP = 'g', |
|
172 |
ZFS_DELEG_GROUP_SETS = 'G', |
|
173 |
ZFS_DELEG_EVERYONE = 'e', |
|
174 |
ZFS_DELEG_EVERYONE_SETS = 'E', |
|
175 |
ZFS_DELEG_CREATE = 'c', |
|
176 |
ZFS_DELEG_CREATE_SETS = 'C', |
|
177 |
ZFS_DELEG_NAMED_SET = 's', |
|
178 |
ZFS_DELEG_NAMED_SET_SETS = 'S' |
|
179 |
} zfs_deleg_who_type_t; |
|
180 |
||
181 |
typedef enum { |
|
182 |
ZFS_DELEG_NONE = 0, |
|
183 |
ZFS_DELEG_PERM_LOCAL = 1, |
|
184 |
ZFS_DELEG_PERM_DESCENDENT = 2, |
|
185 |
ZFS_DELEG_PERM_LOCALDESCENDENT = 3, |
|
186 |
ZFS_DELEG_PERM_CREATE = 4 |
|
187 |
} zfs_deleg_inherit_t; |
|
188 |
||
189 |
#define ZFS_DELEG_PERM_UID "uid" |
|
190 |
#define ZFS_DELEG_PERM_GID "gid" |
|
191 |
#define ZFS_DELEG_PERM_GROUPS "groups" |
|
192 |
||
789 | 193 |
/* |
2082 | 194 |
* On-disk version number. |
1760 | 195 |
*/ |
4577 | 196 |
#define SPA_VERSION_1 1ULL |
197 |
#define SPA_VERSION_2 2ULL |
|
198 |
#define SPA_VERSION_3 3ULL |
|
199 |
#define SPA_VERSION_4 4ULL |
|
200 |
#define SPA_VERSION_5 5ULL |
|
201 |
#define SPA_VERSION_6 6ULL |
|
202 |
#define SPA_VERSION_7 7ULL |
|
203 |
#define SPA_VERSION_8 8ULL |
|
3912 | 204 |
/* |
4577 | 205 |
* When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk |
3912 | 206 |
* format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, |
207 |
* and do the appropriate changes. |
|
208 |
*/ |
|
4577 | 209 |
#define SPA_VERSION SPA_VERSION_8 |
210 |
#define SPA_VERSION_STRING "8" |
|
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
211 |
|
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
212 |
/* |
4577 | 213 |
* Symbolic names for the changes that caused a SPA_VERSION switch. |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
214 |
* 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
|
215 |
* 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
|
216 |
* 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
|
217 |
* |
4577 | 218 |
* NOTE: When checking the current SPA_VERSION in your code, be sure |
1775
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
219 |
* 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
|
220 |
* 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
|
221 |
* be dangerous in some cases. |
e51e26b432c0
6410698 ZFS metadata needs to be more highly replicated (ditto blocks)
billm
parents:
1760
diff
changeset
|
222 |
*/ |
4577 | 223 |
#define SPA_VERSION_INITIAL SPA_VERSION_1 |
224 |
#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 |
|
225 |
#define SPA_VERSION_SPARES SPA_VERSION_3 |
|
226 |
#define SPA_VERSION_RAID6 SPA_VERSION_3 |
|
227 |
#define SPA_VERSION_BPLIST_ACCOUNT SPA_VERSION_3 |
|
228 |
#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 |
|
229 |
#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 |
|
230 |
#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 |
|
231 |
#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 |
|
232 |
#define SPA_VERSION_BOOTFS SPA_VERSION_6 |
|
5094 | 233 |
#define SPA_VERSION_SLOGS SPA_VERSION_7 |
234 |
#define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 |
|
4577 | 235 |
|
236 |
/* |
|
237 |
* ZPL version - rev'd whenever an incompatible on-disk format change |
|
238 |
* occurs. This is independent of SPA/DMU/ZAP versioning. You must |
|
239 |
* also update the version_table[] and help message in zfs_prop.c. |
|
240 |
* |
|
241 |
* When changing, be sure to teach GRUB how to read the new format! |
|
242 |
* See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*} |
|
243 |
*/ |
|
244 |
#define ZPL_VERSION_1 1ULL |
|
245 |
#define ZPL_VERSION_2 2ULL |
|
246 |
#define ZPL_VERSION ZPL_VERSION_2 |
|
247 |
#define ZPL_VERSION_STRING "2" |
|
248 |
||
249 |
#define ZPL_VERSION_INITIAL ZPL_VERSION_1 |
|
250 |
#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2 |
|
1760 | 251 |
|
252 |
/* |
|
789 | 253 |
* The following are configuration names used in the nvlist describing a pool's |
254 |
* configuration. |
|
255 |
*/ |
|
256 |
#define ZPOOL_CONFIG_VERSION "version" |
|
257 |
#define ZPOOL_CONFIG_POOL_NAME "name" |
|
258 |
#define ZPOOL_CONFIG_POOL_STATE "state" |
|
259 |
#define ZPOOL_CONFIG_POOL_TXG "txg" |
|
260 |
#define ZPOOL_CONFIG_POOL_GUID "pool_guid" |
|
261 |
#define ZPOOL_CONFIG_CREATE_TXG "create_txg" |
|
262 |
#define ZPOOL_CONFIG_TOP_GUID "top_guid" |
|
263 |
#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" |
|
264 |
#define ZPOOL_CONFIG_TYPE "type" |
|
265 |
#define ZPOOL_CONFIG_CHILDREN "children" |
|
266 |
#define ZPOOL_CONFIG_ID "id" |
|
267 |
#define ZPOOL_CONFIG_GUID "guid" |
|
268 |
#define ZPOOL_CONFIG_PATH "path" |
|
269 |
#define ZPOOL_CONFIG_DEVID "devid" |
|
270 |
#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" |
|
271 |
#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" |
|
272 |
#define ZPOOL_CONFIG_ASHIFT "ashift" |
|
273 |
#define ZPOOL_CONFIG_ASIZE "asize" |
|
274 |
#define ZPOOL_CONFIG_DTL "DTL" |
|
275 |
#define ZPOOL_CONFIG_STATS "stats" |
|
1171 | 276 |
#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" |
1544 | 277 |
#define ZPOOL_CONFIG_ERRCOUNT "error_count" |
278 |
#define ZPOOL_CONFIG_NOT_PRESENT "not_present" |
|
2082 | 279 |
#define ZPOOL_CONFIG_SPARES "spares" |
280 |
#define ZPOOL_CONFIG_IS_SPARE "is_spare" |
|
281 |
#define ZPOOL_CONFIG_NPARITY "nparity" |
|
3975
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
282 |
#define ZPOOL_CONFIG_HOSTID "hostid" |
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
283 |
#define ZPOOL_CONFIG_HOSTNAME "hostname" |
6674f5d79069
6282725 hostname/hostid should be stored in the label
ek110237
parents:
3912
diff
changeset
|
284 |
#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ |
4451 | 285 |
#define ZPOOL_CONFIG_UNSPARE "unspare" |
286 |
#define ZPOOL_CONFIG_PHYS_PATH "phys_path" |
|
4527 | 287 |
#define ZPOOL_CONFIG_IS_LOG "is_log" |
4451 | 288 |
/* |
289 |
* The persistent vdev state is stored as separate values rather than a single |
|
290 |
* 'vdev_state' entry. This is because a device can be in multiple states, such |
|
291 |
* as offline and degraded. |
|
292 |
*/ |
|
293 |
#define ZPOOL_CONFIG_OFFLINE "offline" |
|
294 |
#define ZPOOL_CONFIG_FAULTED "faulted" |
|
295 |
#define ZPOOL_CONFIG_DEGRADED "degraded" |
|
296 |
#define ZPOOL_CONFIG_REMOVED "removed" |
|
789 | 297 |
|
298 |
#define VDEV_TYPE_ROOT "root" |
|
299 |
#define VDEV_TYPE_MIRROR "mirror" |
|
300 |
#define VDEV_TYPE_REPLACING "replacing" |
|
301 |
#define VDEV_TYPE_RAIDZ "raidz" |
|
302 |
#define VDEV_TYPE_DISK "disk" |
|
303 |
#define VDEV_TYPE_FILE "file" |
|
304 |
#define VDEV_TYPE_MISSING "missing" |
|
2082 | 305 |
#define VDEV_TYPE_SPARE "spare" |
4527 | 306 |
#define VDEV_TYPE_LOG "log" |
789 | 307 |
|
308 |
/* |
|
309 |
* This is needed in userland to report the minimum necessary device size. |
|
310 |
*/ |
|
311 |
#define SPA_MINDEVSIZE (64ULL << 20) |
|
312 |
||
313 |
/* |
|
314 |
* The location of the pool configuration repository, shared between kernel and |
|
315 |
* userland. |
|
316 |
*/ |
|
317 |
#define ZPOOL_CACHE_DIR "/etc/zfs" |
|
318 |
#define ZPOOL_CACHE_FILE "zpool.cache" |
|
319 |
#define ZPOOL_CACHE_TMP ".zpool.cache" |
|
320 |
||
321 |
#define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE |
|
322 |
||
323 |
/* |
|
324 |
* vdev states are ordered from least to most healthy. |
|
325 |
* A vdev that's CANT_OPEN or below is considered unusable. |
|
326 |
*/ |
|
327 |
typedef enum vdev_state { |
|
328 |
VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ |
|
329 |
VDEV_STATE_CLOSED, /* Not currently open */ |
|
330 |
VDEV_STATE_OFFLINE, /* Not allowed to open */ |
|
4451 | 331 |
VDEV_STATE_REMOVED, /* Explicitly removed from system */ |
789 | 332 |
VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ |
4451 | 333 |
VDEV_STATE_FAULTED, /* External request to fault device */ |
789 | 334 |
VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ |
335 |
VDEV_STATE_HEALTHY /* Presumed good */ |
|
336 |
} vdev_state_t; |
|
337 |
||
4451 | 338 |
#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY |
339 |
||
789 | 340 |
/* |
341 |
* vdev aux states. When a vdev is in the CANT_OPEN state, the aux field |
|
342 |
* of the vdev stats structure uses these constants to distinguish why. |
|
343 |
*/ |
|
344 |
typedef enum vdev_aux { |
|
345 |
VDEV_AUX_NONE, /* no error */ |
|
346 |
VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ |
|
347 |
VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ |
|
348 |
VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ |
|
349 |
VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ |
|
350 |
VDEV_AUX_TOO_SMALL, /* vdev size is too small */ |
|
1760 | 351 |
VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ |
352 |
VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ |
|
2082 | 353 |
VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ |
4451 | 354 |
VDEV_AUX_SPARED, /* hot spare used in another pool */ |
355 |
VDEV_AUX_ERR_EXCEEDED /* too many errors */ |
|
789 | 356 |
} vdev_aux_t; |
357 |
||
358 |
/* |
|
1352
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
359 |
* pool state. The following states are written to disk as part of the normal |
2082 | 360 |
* 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
|
361 |
* software abstractions used at various levels to communicate pool state. |
789 | 362 |
*/ |
363 |
typedef enum pool_state { |
|
364 |
POOL_STATE_ACTIVE = 0, /* In active use */ |
|
365 |
POOL_STATE_EXPORTED, /* Explicitly exported */ |
|
366 |
POOL_STATE_DESTROYED, /* Explicitly destroyed */ |
|
2082 | 367 |
POOL_STATE_SPARE, /* Reserved for hot spare use */ |
789 | 368 |
POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ |
5329 | 369 |
POOL_STATE_IO_FAILURE, /* Internal pool state */ |
1352
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
370 |
POOL_STATE_UNAVAIL, /* Internal libzfs state */ |
b7039548de2f
6343802 zpool(1M) should make better use of libdiskmgt
eschrock
parents:
1175
diff
changeset
|
371 |
POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ |
789 | 372 |
} pool_state_t; |
373 |
||
374 |
/* |
|
375 |
* Scrub types. |
|
376 |
*/ |
|
377 |
typedef enum pool_scrub_type { |
|
378 |
POOL_SCRUB_NONE, |
|
379 |
POOL_SCRUB_RESILVER, |
|
380 |
POOL_SCRUB_EVERYTHING, |
|
381 |
POOL_SCRUB_TYPES |
|
382 |
} pool_scrub_type_t; |
|
383 |
||
384 |
/* |
|
385 |
* ZIO types. Needed to interpret vdev statistics below. |
|
386 |
*/ |
|
387 |
typedef enum zio_type { |
|
388 |
ZIO_TYPE_NULL = 0, |
|
389 |
ZIO_TYPE_READ, |
|
390 |
ZIO_TYPE_WRITE, |
|
391 |
ZIO_TYPE_FREE, |
|
392 |
ZIO_TYPE_CLAIM, |
|
393 |
ZIO_TYPE_IOCTL, |
|
394 |
ZIO_TYPES |
|
395 |
} zio_type_t; |
|
396 |
||
397 |
/* |
|
398 |
* Vdev statistics. Note: all fields should be 64-bit because this |
|
399 |
* is passed between kernel and userland as an nvlist uint64 array. |
|
400 |
*/ |
|
401 |
typedef struct vdev_stat { |
|
402 |
hrtime_t vs_timestamp; /* time since vdev load */ |
|
403 |
uint64_t vs_state; /* vdev state */ |
|
404 |
uint64_t vs_aux; /* see vdev_aux_t */ |
|
405 |
uint64_t vs_alloc; /* space allocated */ |
|
406 |
uint64_t vs_space; /* total capacity */ |
|
2082 | 407 |
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
|
408 |
uint64_t vs_rsize; /* replaceable dev size */ |
789 | 409 |
uint64_t vs_ops[ZIO_TYPES]; /* operation count */ |
410 |
uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ |
|
411 |
uint64_t vs_read_errors; /* read errors */ |
|
412 |
uint64_t vs_write_errors; /* write errors */ |
|
413 |
uint64_t vs_checksum_errors; /* checksum errors */ |
|
414 |
uint64_t vs_self_healed; /* self-healed bytes */ |
|
415 |
uint64_t vs_scrub_type; /* pool_scrub_type_t */ |
|
416 |
uint64_t vs_scrub_complete; /* completed? */ |
|
417 |
uint64_t vs_scrub_examined; /* bytes examined; top */ |
|
418 |
uint64_t vs_scrub_repaired; /* bytes repaired; leaf */ |
|
419 |
uint64_t vs_scrub_errors; /* errors during scrub */ |
|
420 |
uint64_t vs_scrub_start; /* UTC scrub start time */ |
|
421 |
uint64_t vs_scrub_end; /* UTC scrub end time */ |
|
422 |
} vdev_stat_t; |
|
423 |
||
424 |
#define ZFS_DRIVER "zfs" |
|
425 |
#define ZFS_DEV "/dev/zfs" |
|
426 |
||
427 |
/* |
|
428 |
* zvol paths. Irritatingly, the devfsadm interfaces want all these |
|
429 |
* paths without the /dev prefix, but for some things, we want the |
|
430 |
* /dev prefix. Below are the names without /dev. |
|
431 |
*/ |
|
432 |
#define ZVOL_DEV_DIR "zvol/dsk" |
|
433 |
#define ZVOL_RDEV_DIR "zvol/rdsk" |
|
434 |
||
435 |
/* |
|
436 |
* And here are the things we need with /dev, etc. in front of them. |
|
437 |
*/ |
|
438 |
#define ZVOL_PSEUDO_DEV "/devices/pseudo/zvol@0:" |
|
439 |
#define ZVOL_FULL_DEV_DIR "/dev/" ZVOL_DEV_DIR |
|
440 |
||
441 |
#define ZVOL_PROP_NAME "name" |
|
442 |
||
443 |
/* |
|
444 |
* /dev/zfs ioctl numbers. |
|
445 |
*/ |
|
446 |
#define ZFS_IOC ('Z' << 8) |
|
447 |
||
448 |
typedef enum zfs_ioc { |
|
449 |
ZFS_IOC_POOL_CREATE = ZFS_IOC, |
|
450 |
ZFS_IOC_POOL_DESTROY, |
|
451 |
ZFS_IOC_POOL_IMPORT, |
|
452 |
ZFS_IOC_POOL_EXPORT, |
|
453 |
ZFS_IOC_POOL_CONFIGS, |
|
454 |
ZFS_IOC_POOL_STATS, |
|
455 |
ZFS_IOC_POOL_TRYIMPORT, |
|
456 |
ZFS_IOC_POOL_SCRUB, |
|
457 |
ZFS_IOC_POOL_FREEZE, |
|
1760 | 458 |
ZFS_IOC_POOL_UPGRADE, |
2926 | 459 |
ZFS_IOC_POOL_GET_HISTORY, |
789 | 460 |
ZFS_IOC_VDEV_ADD, |
461 |
ZFS_IOC_VDEV_REMOVE, |
|
4451 | 462 |
ZFS_IOC_VDEV_SET_STATE, |
789 | 463 |
ZFS_IOC_VDEV_ATTACH, |
464 |
ZFS_IOC_VDEV_DETACH, |
|
1354
81359ee1ee63
6362672 import gets confused about overlapping slices
eschrock
parents:
1352
diff
changeset
|
465 |
ZFS_IOC_VDEV_SETPATH, |
789 | 466 |
ZFS_IOC_OBJSET_STATS, |
5147
5e950ccc9585
6596190 "zfs list" is slow due to version property
rm160521
parents:
5094
diff
changeset
|
467 |
ZFS_IOC_OBJSET_VERSION, |
789 | 468 |
ZFS_IOC_DATASET_LIST_NEXT, |
469 |
ZFS_IOC_SNAPSHOT_LIST_NEXT, |
|
470 |
ZFS_IOC_SET_PROP, |
|
471 |
ZFS_IOC_CREATE_MINOR, |
|
472 |
ZFS_IOC_REMOVE_MINOR, |
|
473 |
ZFS_IOC_CREATE, |
|
474 |
ZFS_IOC_DESTROY, |
|
475 |
ZFS_IOC_ROLLBACK, |
|
476 |
ZFS_IOC_RENAME, |
|
477 |
ZFS_IOC_RECVBACKUP, |
|
1544 | 478 |
ZFS_IOC_SENDBACKUP, |
479 |
ZFS_IOC_INJECT_FAULT, |
|
480 |
ZFS_IOC_CLEAR_FAULT, |
|
481 |
ZFS_IOC_INJECT_LIST_NEXT, |
|
482 |
ZFS_IOC_ERROR_LOG, |
|
483 |
ZFS_IOC_CLEAR, |
|
2199 | 484 |
ZFS_IOC_PROMOTE, |
485 |
ZFS_IOC_DESTROY_SNAPS, |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
486 |
ZFS_IOC_SNAPSHOT, |
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
487 |
ZFS_IOC_DSOBJ_TO_DSNAME, |
3912 | 488 |
ZFS_IOC_OBJ_TO_PATH, |
489 |
ZFS_IOC_POOL_SET_PROPS, |
|
4543 | 490 |
ZFS_IOC_POOL_GET_PROPS, |
491 |
ZFS_IOC_SET_FSACL, |
|
492 |
ZFS_IOC_GET_FSACL, |
|
493 |
ZFS_IOC_ISCSI_PERM_CHECK, |
|
4849
3a61e0a9a953
6536043 arc_byteswap_func_t and dmu_byteswap_func_t are redundant
ahrens
parents:
4787
diff
changeset
|
494 |
ZFS_IOC_SHARE, |
3a61e0a9a953
6536043 arc_byteswap_func_t and dmu_byteswap_func_t are redundant
ahrens
parents:
4787
diff
changeset
|
495 |
ZFS_IOC_INHERIT_PROP |
789 | 496 |
} zfs_ioc_t; |
497 |
||
1544 | 498 |
/* |
499 |
* Internal SPA load state. Used by FMA diagnosis engine. |
|
500 |
*/ |
|
501 |
typedef enum { |
|
502 |
SPA_LOAD_NONE, /* no load in progress */ |
|
503 |
SPA_LOAD_OPEN, /* normal open */ |
|
504 |
SPA_LOAD_IMPORT, /* import in progress */ |
|
505 |
SPA_LOAD_TRYIMPORT /* tryimport in progress */ |
|
506 |
} spa_load_state_t; |
|
507 |
||
2676 | 508 |
/* |
509 |
* Bookmark name values. |
|
510 |
*/ |
|
3444
dc160a70a50d
6410433 'zpool status -v' would be more useful with filenames
ek110237
parents:
3377
diff
changeset
|
511 |
#define ZPOOL_ERR_LIST "error list" |
2676 | 512 |
#define ZPOOL_ERR_DATASET "dataset" |
513 |
#define ZPOOL_ERR_OBJECT "object" |
|
514 |
||
2926 | 515 |
#define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) |
516 |
||
517 |
/* |
|
518 |
* The following are names used in the nvlist describing |
|
519 |
* the pool's history log. |
|
520 |
*/ |
|
521 |
#define ZPOOL_HIST_RECORD "history record" |
|
522 |
#define ZPOOL_HIST_TIME "history time" |
|
523 |
#define ZPOOL_HIST_CMD "history command" |
|
4543 | 524 |
#define ZPOOL_HIST_WHO "history who" |
525 |
#define ZPOOL_HIST_ZONE "history zone" |
|
526 |
#define ZPOOL_HIST_HOST "history hostname" |
|
527 |
#define ZPOOL_HIST_TXG "history txg" |
|
528 |
#define ZPOOL_HIST_INT_EVENT "history internal event" |
|
529 |
#define ZPOOL_HIST_INT_STR "history internal str" |
|
2926 | 530 |
|
4451 | 531 |
/* |
532 |
* Flags for ZFS_IOC_VDEV_SET_STATE |
|
533 |
*/ |
|
534 |
#define ZFS_ONLINE_CHECKREMOVE 0x1 |
|
535 |
#define ZFS_ONLINE_UNSPARE 0x2 |
|
536 |
#define ZFS_ONLINE_FORCEFAULT 0x4 |
|
537 |
#define ZFS_OFFLINE_TEMPORARY 0x1 |
|
538 |
||
539 |
/* |
|
540 |
* Sysevent payload members. ZFS will generate the following sysevents with the |
|
541 |
* given payloads: |
|
542 |
* |
|
543 |
* ESC_ZFS_RESILVER_START |
|
544 |
* ESC_ZFS_RESILVER_END |
|
545 |
* ESC_ZFS_POOL_DESTROY |
|
546 |
* |
|
547 |
* ZFS_EV_POOL_NAME DATA_TYPE_STRING |
|
548 |
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64 |
|
549 |
* |
|
550 |
* ESC_ZFS_VDEV_REMOVE |
|
551 |
* ESC_ZFS_VDEV_CLEAR |
|
552 |
* ESC_ZFS_VDEV_CHECK |
|
553 |
* |
|
554 |
* ZFS_EV_POOL_NAME DATA_TYPE_STRING |
|
555 |
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64 |
|
556 |
* ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) |
|
557 |
* ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 |
|
558 |
*/ |
|
559 |
#define ZFS_EV_POOL_NAME "pool_name" |
|
560 |
#define ZFS_EV_POOL_GUID "pool_guid" |
|
561 |
#define ZFS_EV_VDEV_PATH "vdev_path" |
|
562 |
#define ZFS_EV_VDEV_GUID "vdev_guid" |
|
563 |
||
4543 | 564 |
typedef enum history_internal_events { |
565 |
LOG_NO_EVENT = 0, |
|
566 |
LOG_POOL_CREATE, |
|
567 |
LOG_POOL_VDEV_ADD, |
|
568 |
LOG_POOL_REMOVE, |
|
569 |
LOG_POOL_DESTROY, |
|
570 |
LOG_POOL_EXPORT, |
|
571 |
LOG_POOL_IMPORT, |
|
572 |
LOG_POOL_VDEV_ATTACH, |
|
573 |
LOG_POOL_VDEV_REPLACE, |
|
574 |
LOG_POOL_VDEV_DETACH, |
|
575 |
LOG_POOL_VDEV_ONLINE, |
|
576 |
LOG_POOL_VDEV_OFFLINE, |
|
577 |
LOG_POOL_UPGRADE, |
|
578 |
LOG_POOL_CLEAR, |
|
579 |
LOG_POOL_SCRUB, |
|
580 |
LOG_POOL_PROPSET, |
|
581 |
LOG_DS_CREATE, |
|
582 |
LOG_DS_CLONE, |
|
583 |
LOG_DS_DESTROY, |
|
584 |
LOG_DS_DESTROY_BEGIN, |
|
585 |
LOG_DS_INHERIT, |
|
586 |
LOG_DS_PROPSET, |
|
587 |
LOG_DS_QUOTA, |
|
588 |
LOG_DS_PERM_UPDATE, |
|
589 |
LOG_DS_PERM_REMOVE, |
|
590 |
LOG_DS_PERM_WHO_REMOVE, |
|
591 |
LOG_DS_PROMOTE, |
|
592 |
LOG_DS_RECEIVE, |
|
593 |
LOG_DS_RENAME, |
|
594 |
LOG_DS_RESERVATION, |
|
595 |
LOG_DS_REPLAY_INC_SYNC, |
|
596 |
LOG_DS_REPLAY_FULL_SYNC, |
|
597 |
LOG_DS_ROLLBACK, |
|
598 |
LOG_DS_SNAPSHOT, |
|
4577 | 599 |
LOG_DS_UPGRADE, |
4543 | 600 |
LOG_END |
601 |
} history_internal_events_t; |
|
602 |
||
789 | 603 |
#ifdef __cplusplus |
604 |
} |
|
605 |
#endif |
|
606 |
||
607 |
#endif /* _SYS_FS_ZFS_H */ |