]>
Commit | Line | Data |
---|---|---|
34dc7c2f BB |
1 | /* |
2 | * CDDL HEADER START | |
3 | * | |
4 | * The contents of this file are subject to the terms of the | |
5 | * Common Development and Distribution License (the "License"). | |
6 | * You may not use this file except in compliance with the License. | |
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 | */ | |
45d1cae3 | 21 | |
34dc7c2f | 22 | /* |
428870ff | 23 | * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
5b72a38d | 24 | * Copyright (c) 2011, 2017 by Delphix. All rights reserved. |
3541dc6d | 25 | * Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
12fa0466 DE |
26 | * Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved. |
27 | * Copyright (c) 2014 Integros [integros.com] | |
bec1067d | 28 | * Copyright (c) 2017 Datto Inc. |
34dc7c2f BB |
29 | */ |
30 | ||
428870ff BB |
31 | /* Portions Copyright 2010 Robert Milkowski */ |
32 | ||
34dc7c2f BB |
33 | #ifndef _SYS_FS_ZFS_H |
34 | #define _SYS_FS_ZFS_H | |
35 | ||
45d1cae3 | 36 | #include <sys/time.h> |
193a37cb | 37 | #include <sys/zio_priority.h> |
45d1cae3 | 38 | |
34dc7c2f BB |
39 | #ifdef __cplusplus |
40 | extern "C" { | |
41 | #endif | |
42 | ||
43 | /* | |
44 | * Types and constants shared between userland and the kernel. | |
45 | */ | |
46 | ||
47 | /* | |
48 | * Each dataset can be one of the following types. These constants can be | |
49 | * combined into masks that can be passed to various functions. | |
50 | */ | |
51 | typedef enum { | |
da536844 MA |
52 | ZFS_TYPE_FILESYSTEM = (1 << 0), |
53 | ZFS_TYPE_SNAPSHOT = (1 << 1), | |
54 | ZFS_TYPE_VOLUME = (1 << 2), | |
55 | ZFS_TYPE_POOL = (1 << 3), | |
56 | ZFS_TYPE_BOOKMARK = (1 << 4) | |
34dc7c2f BB |
57 | } zfs_type_t; |
58 | ||
e67a7ffb GM |
59 | /* |
60 | * NB: lzc_dataset_type should be updated whenever a new objset type is added, | |
61 | * if it represents a real type of a dataset that can be created from userland. | |
62 | */ | |
6f1ffb06 MA |
63 | typedef enum dmu_objset_type { |
64 | DMU_OST_NONE, | |
65 | DMU_OST_META, | |
66 | DMU_OST_ZFS, | |
67 | DMU_OST_ZVOL, | |
68 | DMU_OST_OTHER, /* For testing only! */ | |
69 | DMU_OST_ANY, /* Be careful! */ | |
70 | DMU_OST_NUMTYPES | |
71 | } dmu_objset_type_t; | |
72 | ||
34dc7c2f BB |
73 | #define ZFS_TYPE_DATASET \ |
74 | (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) | |
75 | ||
eca7b760 IK |
76 | /* |
77 | * All of these include the terminating NUL byte. | |
78 | */ | |
9babb374 BB |
79 | #define ZAP_MAXNAMELEN 256 |
80 | #define ZAP_MAXVALUELEN (1024 * 8) | |
81 | #define ZAP_OLDMAXVALUELEN 1024 | |
eca7b760 | 82 | #define ZFS_MAX_DATASET_NAME_LEN 256 |
9babb374 | 83 | |
34dc7c2f BB |
84 | /* |
85 | * Dataset properties are identified by these constants and must be added to | |
86 | * the end of this list to ensure that external consumers are not affected | |
87 | * by the change. If you make any changes to this list, be sure to update | |
e77aa730 | 88 | * the property table in module/zcommon/zfs_prop.c. |
34dc7c2f BB |
89 | */ |
90 | typedef enum { | |
31864e3d BB |
91 | ZPROP_CONT = -2, |
92 | ZPROP_INVAL = -1, | |
648a09ad | 93 | ZFS_PROP_TYPE = 0, |
34dc7c2f BB |
94 | ZFS_PROP_CREATION, |
95 | ZFS_PROP_USED, | |
96 | ZFS_PROP_AVAILABLE, | |
97 | ZFS_PROP_REFERENCED, | |
98 | ZFS_PROP_COMPRESSRATIO, | |
99 | ZFS_PROP_MOUNTED, | |
100 | ZFS_PROP_ORIGIN, | |
101 | ZFS_PROP_QUOTA, | |
102 | ZFS_PROP_RESERVATION, | |
103 | ZFS_PROP_VOLSIZE, | |
104 | ZFS_PROP_VOLBLOCKSIZE, | |
105 | ZFS_PROP_RECORDSIZE, | |
106 | ZFS_PROP_MOUNTPOINT, | |
107 | ZFS_PROP_SHARENFS, | |
108 | ZFS_PROP_CHECKSUM, | |
109 | ZFS_PROP_COMPRESSION, | |
110 | ZFS_PROP_ATIME, | |
111 | ZFS_PROP_DEVICES, | |
112 | ZFS_PROP_EXEC, | |
113 | ZFS_PROP_SETUID, | |
114 | ZFS_PROP_READONLY, | |
115 | ZFS_PROP_ZONED, | |
116 | ZFS_PROP_SNAPDIR, | |
428870ff | 117 | ZFS_PROP_PRIVATE, /* not exposed to user, temporary */ |
34dc7c2f | 118 | ZFS_PROP_ACLINHERIT, |
305bc4b3 | 119 | ZFS_PROP_CREATETXG, |
34dc7c2f BB |
120 | ZFS_PROP_NAME, /* not exposed to the user */ |
121 | ZFS_PROP_CANMOUNT, | |
34dc7c2f BB |
122 | ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ |
123 | ZFS_PROP_XATTR, | |
124 | ZFS_PROP_NUMCLONES, /* not exposed to the user */ | |
125 | ZFS_PROP_COPIES, | |
126 | ZFS_PROP_VERSION, | |
127 | ZFS_PROP_UTF8ONLY, | |
128 | ZFS_PROP_NORMALIZE, | |
129 | ZFS_PROP_CASE, | |
130 | ZFS_PROP_VSCAN, | |
131 | ZFS_PROP_NBMAND, | |
132 | ZFS_PROP_SHARESMB, | |
133 | ZFS_PROP_REFQUOTA, | |
134 | ZFS_PROP_REFRESERVATION, | |
b128c09f BB |
135 | ZFS_PROP_GUID, |
136 | ZFS_PROP_PRIMARYCACHE, | |
137 | ZFS_PROP_SECONDARYCACHE, | |
138 | ZFS_PROP_USEDSNAP, | |
139 | ZFS_PROP_USEDDS, | |
140 | ZFS_PROP_USEDCHILD, | |
141 | ZFS_PROP_USEDREFRESERV, | |
9babb374 BB |
142 | ZFS_PROP_USERACCOUNTING, /* not exposed to the user */ |
143 | ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */ | |
45d1cae3 BB |
144 | ZFS_PROP_DEFER_DESTROY, |
145 | ZFS_PROP_USERREFS, | |
428870ff BB |
146 | ZFS_PROP_LOGBIAS, |
147 | ZFS_PROP_UNIQUE, /* not exposed to the user */ | |
148 | ZFS_PROP_OBJSETID, /* not exposed to the user */ | |
149 | ZFS_PROP_DEDUP, | |
150 | ZFS_PROP_MLSLABEL, | |
151 | ZFS_PROP_SYNC, | |
50c957f7 | 152 | ZFS_PROP_DNODESIZE, |
f5fc4aca | 153 | ZFS_PROP_REFRATIO, |
330d06f9 MA |
154 | ZFS_PROP_WRITTEN, |
155 | ZFS_PROP_CLONES, | |
24a64651 MA |
156 | ZFS_PROP_LOGICALUSED, |
157 | ZFS_PROP_LOGICALREFERENCED, | |
96c2e961 | 158 | ZFS_PROP_INCONSISTENT, /* not exposed to the user */ |
cf8738d8 | 159 | ZFS_PROP_VOLMODE, |
788eb90c JJ |
160 | ZFS_PROP_FILESYSTEM_LIMIT, |
161 | ZFS_PROP_SNAPSHOT_LIMIT, | |
162 | ZFS_PROP_FILESYSTEM_COUNT, | |
163 | ZFS_PROP_SNAPSHOT_COUNT, | |
0b4d1b58 | 164 | ZFS_PROP_SNAPDEV, |
023699cd | 165 | ZFS_PROP_ACLTYPE, |
11b9ec23 MT |
166 | ZFS_PROP_SELINUX_CONTEXT, |
167 | ZFS_PROP_SELINUX_FSCONTEXT, | |
168 | ZFS_PROP_SELINUX_DEFCONTEXT, | |
169 | ZFS_PROP_SELINUX_ROOTCONTEXT, | |
6d111134 | 170 | ZFS_PROP_RELATIME, |
faf0f58c | 171 | ZFS_PROP_REDUNDANT_METADATA, |
f67d7090 | 172 | ZFS_PROP_OVERLAY, |
1715493f | 173 | ZFS_PROP_PREV_SNAP, |
47dfff3b | 174 | ZFS_PROP_RECEIVE_RESUME_TOKEN, |
b5256303 TC |
175 | ZFS_PROP_ENCRYPTION, |
176 | ZFS_PROP_KEYLOCATION, | |
177 | ZFS_PROP_KEYFORMAT, | |
178 | ZFS_PROP_PBKDF2_SALT, | |
179 | ZFS_PROP_PBKDF2_ITERS, | |
180 | ZFS_PROP_ENCRYPTION_ROOT, | |
181 | ZFS_PROP_KEY_GUID, | |
182 | ZFS_PROP_KEYSTATUS, | |
a1d477c2 | 183 | ZFS_PROP_REMAPTXG, /* not exposed to the user */ |
34dc7c2f BB |
184 | ZFS_NUM_PROPS |
185 | } zfs_prop_t; | |
186 | ||
9babb374 BB |
187 | typedef enum { |
188 | ZFS_PROP_USERUSED, | |
189 | ZFS_PROP_USERQUOTA, | |
190 | ZFS_PROP_GROUPUSED, | |
191 | ZFS_PROP_GROUPQUOTA, | |
1de321e6 JX |
192 | ZFS_PROP_USEROBJUSED, |
193 | ZFS_PROP_USEROBJQUOTA, | |
194 | ZFS_PROP_GROUPOBJUSED, | |
195 | ZFS_PROP_GROUPOBJQUOTA, | |
9c5167d1 NF |
196 | ZFS_PROP_PROJECTUSED, |
197 | ZFS_PROP_PROJECTQUOTA, | |
198 | ZFS_PROP_PROJECTOBJUSED, | |
199 | ZFS_PROP_PROJECTOBJQUOTA, | |
9babb374 BB |
200 | ZFS_NUM_USERQUOTA_PROPS |
201 | } zfs_userquota_prop_t; | |
202 | ||
203 | extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; | |
204 | ||
34dc7c2f BB |
205 | /* |
206 | * Pool properties are identified by these constants and must be added to the | |
b128c09f | 207 | * end of this list to ensure that external consumers are not affected |
34dc7c2f | 208 | * by the change. If you make any changes to this list, be sure to update |
e77aa730 | 209 | * the property table in module/zcommon/zpool_prop.c. |
34dc7c2f BB |
210 | */ |
211 | typedef enum { | |
31864e3d | 212 | ZPOOL_PROP_INVAL = -1, |
34dc7c2f BB |
213 | ZPOOL_PROP_NAME, |
214 | ZPOOL_PROP_SIZE, | |
34dc7c2f BB |
215 | ZPOOL_PROP_CAPACITY, |
216 | ZPOOL_PROP_ALTROOT, | |
217 | ZPOOL_PROP_HEALTH, | |
218 | ZPOOL_PROP_GUID, | |
219 | ZPOOL_PROP_VERSION, | |
220 | ZPOOL_PROP_BOOTFS, | |
221 | ZPOOL_PROP_DELEGATION, | |
222 | ZPOOL_PROP_AUTOREPLACE, | |
223 | ZPOOL_PROP_CACHEFILE, | |
224 | ZPOOL_PROP_FAILUREMODE, | |
b128c09f | 225 | ZPOOL_PROP_LISTSNAPS, |
9babb374 | 226 | ZPOOL_PROP_AUTOEXPAND, |
428870ff BB |
227 | ZPOOL_PROP_DEDUPDITTO, |
228 | ZPOOL_PROP_DEDUPRATIO, | |
229 | ZPOOL_PROP_FREE, | |
230 | ZPOOL_PROP_ALLOCATED, | |
572e2857 | 231 | ZPOOL_PROP_READONLY, |
df30f566 | 232 | ZPOOL_PROP_ASHIFT, |
d96eb2b1 | 233 | ZPOOL_PROP_COMMENT, |
1bd201e7 | 234 | ZPOOL_PROP_EXPANDSZ, |
9ae529ec | 235 | ZPOOL_PROP_FREEING, |
f3a7f661 | 236 | ZPOOL_PROP_FRAGMENTATION, |
fbeddd60 | 237 | ZPOOL_PROP_LEAKED, |
f1512ee6 | 238 | ZPOOL_PROP_MAXBLOCKSIZE, |
83e9986f | 239 | ZPOOL_PROP_TNAME, |
50c957f7 | 240 | ZPOOL_PROP_MAXDNODESIZE, |
379ca9cf | 241 | ZPOOL_PROP_MULTIHOST, |
34dc7c2f BB |
242 | ZPOOL_NUM_PROPS |
243 | } zpool_prop_t; | |
244 | ||
d96eb2b1 DM |
245 | /* Small enough to not hog a whole line of printout in zpool(1M). */ |
246 | #define ZPROP_MAX_COMMENT 32 | |
247 | ||
34dc7c2f BB |
248 | #define ZPROP_VALUE "value" |
249 | #define ZPROP_SOURCE "source" | |
250 | ||
251 | typedef enum { | |
252 | ZPROP_SRC_NONE = 0x1, | |
253 | ZPROP_SRC_DEFAULT = 0x2, | |
254 | ZPROP_SRC_TEMPORARY = 0x4, | |
255 | ZPROP_SRC_LOCAL = 0x8, | |
428870ff BB |
256 | ZPROP_SRC_INHERITED = 0x10, |
257 | ZPROP_SRC_RECEIVED = 0x20 | |
34dc7c2f BB |
258 | } zprop_source_t; |
259 | ||
428870ff BB |
260 | #define ZPROP_SRC_ALL 0x3f |
261 | ||
262 | #define ZPROP_SOURCE_VAL_RECVD "$recvd" | |
263 | #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS" | |
43e52edd | 264 | |
428870ff BB |
265 | /* |
266 | * Dataset flag implemented as a special entry in the props zap object | |
267 | * indicating that the dataset has received properties on or after | |
268 | * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties | |
269 | * just as it did in earlier versions, and thereafter, local properties are | |
270 | * preserved. | |
271 | */ | |
272 | #define ZPROP_HAS_RECVD "$hasrecvd" | |
273 | ||
274 | typedef enum { | |
275 | ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */ | |
276 | ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */ | |
277 | } zprop_errflags_t; | |
34dc7c2f BB |
278 | |
279 | typedef int (*zprop_func)(int, void *); | |
280 | ||
b128c09f BB |
281 | /* |
282 | * Properties to be set on the root file system of a new pool | |
283 | * are stuffed into their own nvlist, which is then included in | |
284 | * the properties nvlist with the pool properties. | |
285 | */ | |
286 | #define ZPOOL_ROOTFS_PROPS "root-props-nvl" | |
287 | ||
d99a0153 CW |
288 | /* |
289 | * Length of 'written@' and 'written#' | |
290 | */ | |
291 | #define ZFS_WRITTEN_PROP_PREFIX_LEN 8 | |
292 | ||
34dc7c2f BB |
293 | /* |
294 | * Dataset property functions shared between libzfs and kernel. | |
295 | */ | |
296 | const char *zfs_prop_default_string(zfs_prop_t); | |
297 | uint64_t zfs_prop_default_numeric(zfs_prop_t); | |
298 | boolean_t zfs_prop_readonly(zfs_prop_t); | |
d99a0153 | 299 | boolean_t zfs_prop_visible(zfs_prop_t prop); |
34dc7c2f BB |
300 | boolean_t zfs_prop_inheritable(zfs_prop_t); |
301 | boolean_t zfs_prop_setonce(zfs_prop_t); | |
b5256303 TC |
302 | boolean_t zfs_prop_encryption_key_param(zfs_prop_t); |
303 | boolean_t zfs_prop_valid_keylocation(const char *, boolean_t); | |
34dc7c2f BB |
304 | const char *zfs_prop_to_name(zfs_prop_t); |
305 | zfs_prop_t zfs_name_to_prop(const char *); | |
306 | boolean_t zfs_prop_user(const char *); | |
428870ff | 307 | boolean_t zfs_prop_userquota(const char *); |
330d06f9 | 308 | boolean_t zfs_prop_written(const char *); |
34dc7c2f BB |
309 | int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); |
310 | int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); | |
428870ff | 311 | uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed); |
962d5242 | 312 | boolean_t zfs_prop_valid_for_type(int, zfs_type_t, boolean_t); |
34dc7c2f BB |
313 | |
314 | /* | |
315 | * Pool property functions shared between libzfs and kernel. | |
316 | */ | |
317 | zpool_prop_t zpool_name_to_prop(const char *); | |
318 | const char *zpool_prop_to_name(zpool_prop_t); | |
319 | const char *zpool_prop_default_string(zpool_prop_t); | |
320 | uint64_t zpool_prop_default_numeric(zpool_prop_t); | |
321 | boolean_t zpool_prop_readonly(zpool_prop_t); | |
9ae529ec CS |
322 | boolean_t zpool_prop_feature(const char *); |
323 | boolean_t zpool_prop_unsupported(const char *); | |
34dc7c2f BB |
324 | int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); |
325 | int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); | |
428870ff | 326 | uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); |
34dc7c2f BB |
327 | |
328 | /* | |
329 | * Definitions for the Delegation. | |
330 | */ | |
331 | typedef enum { | |
332 | ZFS_DELEG_WHO_UNKNOWN = 0, | |
333 | ZFS_DELEG_USER = 'u', | |
334 | ZFS_DELEG_USER_SETS = 'U', | |
335 | ZFS_DELEG_GROUP = 'g', | |
336 | ZFS_DELEG_GROUP_SETS = 'G', | |
337 | ZFS_DELEG_EVERYONE = 'e', | |
338 | ZFS_DELEG_EVERYONE_SETS = 'E', | |
339 | ZFS_DELEG_CREATE = 'c', | |
340 | ZFS_DELEG_CREATE_SETS = 'C', | |
341 | ZFS_DELEG_NAMED_SET = 's', | |
342 | ZFS_DELEG_NAMED_SET_SETS = 'S' | |
343 | } zfs_deleg_who_type_t; | |
344 | ||
345 | typedef enum { | |
346 | ZFS_DELEG_NONE = 0, | |
347 | ZFS_DELEG_PERM_LOCAL = 1, | |
348 | ZFS_DELEG_PERM_DESCENDENT = 2, | |
349 | ZFS_DELEG_PERM_LOCALDESCENDENT = 3, | |
350 | ZFS_DELEG_PERM_CREATE = 4 | |
351 | } zfs_deleg_inherit_t; | |
352 | ||
353 | #define ZFS_DELEG_PERM_UID "uid" | |
354 | #define ZFS_DELEG_PERM_GID "gid" | |
355 | #define ZFS_DELEG_PERM_GROUPS "groups" | |
356 | ||
428870ff BB |
357 | #define ZFS_MLSLABEL_DEFAULT "none" |
358 | ||
9babb374 BB |
359 | #define ZFS_SMB_ACL_SRC "src" |
360 | #define ZFS_SMB_ACL_TARGET "target" | |
361 | ||
34dc7c2f BB |
362 | typedef enum { |
363 | ZFS_CANMOUNT_OFF = 0, | |
364 | ZFS_CANMOUNT_ON = 1, | |
365 | ZFS_CANMOUNT_NOAUTO = 2 | |
366 | } zfs_canmount_type_t; | |
367 | ||
428870ff BB |
368 | typedef enum { |
369 | ZFS_LOGBIAS_LATENCY = 0, | |
370 | ZFS_LOGBIAS_THROUGHPUT = 1 | |
371 | } zfs_logbias_op_t; | |
372 | ||
34dc7c2f BB |
373 | typedef enum zfs_share_op { |
374 | ZFS_SHARE_NFS = 0, | |
375 | ZFS_UNSHARE_NFS = 1, | |
376 | ZFS_SHARE_SMB = 2, | |
377 | ZFS_UNSHARE_SMB = 3 | |
378 | } zfs_share_op_t; | |
379 | ||
9babb374 BB |
380 | typedef enum zfs_smb_acl_op { |
381 | ZFS_SMB_ACL_ADD, | |
382 | ZFS_SMB_ACL_REMOVE, | |
383 | ZFS_SMB_ACL_RENAME, | |
384 | ZFS_SMB_ACL_PURGE | |
385 | } zfs_smb_acl_op_t; | |
386 | ||
b128c09f BB |
387 | typedef enum zfs_cache_type { |
388 | ZFS_CACHE_NONE = 0, | |
389 | ZFS_CACHE_METADATA = 1, | |
390 | ZFS_CACHE_ALL = 2 | |
391 | } zfs_cache_type_t; | |
392 | ||
428870ff BB |
393 | typedef enum { |
394 | ZFS_SYNC_STANDARD = 0, | |
395 | ZFS_SYNC_ALWAYS = 1, | |
396 | ZFS_SYNC_DISABLED = 2 | |
397 | } zfs_sync_type_t; | |
398 | ||
82a37189 BB |
399 | typedef enum { |
400 | ZFS_XATTR_OFF = 0, | |
401 | ZFS_XATTR_DIR = 1, | |
402 | ZFS_XATTR_SA = 2 | |
403 | } zfs_xattr_type_t; | |
b128c09f | 404 | |
50c957f7 NB |
405 | typedef enum { |
406 | ZFS_DNSIZE_LEGACY = 0, | |
407 | ZFS_DNSIZE_AUTO = 1, | |
408 | ZFS_DNSIZE_1K = 1024, | |
409 | ZFS_DNSIZE_2K = 2048, | |
410 | ZFS_DNSIZE_4K = 4096, | |
411 | ZFS_DNSIZE_8K = 8192, | |
412 | ZFS_DNSIZE_16K = 16384 | |
413 | } zfs_dnsize_type_t; | |
414 | ||
faf0f58c MA |
415 | typedef enum { |
416 | ZFS_REDUNDANT_METADATA_ALL, | |
417 | ZFS_REDUNDANT_METADATA_MOST | |
418 | } zfs_redundant_metadata_type_t; | |
419 | ||
cf8738d8 | 420 | typedef enum { |
421 | ZFS_VOLMODE_DEFAULT = 0, | |
422 | ZFS_VOLMODE_GEOM = 1, | |
423 | ZFS_VOLMODE_DEV = 2, | |
424 | ZFS_VOLMODE_NONE = 3 | |
425 | } zfs_volmode_t; | |
426 | ||
b5256303 TC |
427 | typedef enum zfs_keystatus { |
428 | ZFS_KEYSTATUS_NONE = 0, | |
429 | ZFS_KEYSTATUS_UNAVAILABLE, | |
430 | ZFS_KEYSTATUS_AVAILABLE, | |
431 | } zfs_keystatus_t; | |
432 | ||
433 | typedef enum zfs_keyformat { | |
434 | ZFS_KEYFORMAT_NONE = 0, | |
435 | ZFS_KEYFORMAT_RAW, | |
436 | ZFS_KEYFORMAT_HEX, | |
437 | ZFS_KEYFORMAT_PASSPHRASE, | |
438 | ZFS_KEYFORMAT_FORMATS | |
439 | } zfs_keyformat_t; | |
440 | ||
441 | typedef enum zfs_key_location { | |
442 | ZFS_KEYLOCATION_NONE = 0, | |
443 | ZFS_KEYLOCATION_PROMPT, | |
444 | ZFS_KEYLOCATION_URI, | |
445 | ZFS_KEYLOCATION_LOCATIONS | |
446 | } zfs_keylocation_t; | |
447 | ||
448 | #define DEFAULT_PBKDF2_ITERATIONS 350000 | |
449 | #define MIN_PBKDF2_ITERATIONS 100000 | |
450 | ||
34dc7c2f BB |
451 | /* |
452 | * On-disk version number. | |
453 | */ | |
454 | #define SPA_VERSION_1 1ULL | |
455 | #define SPA_VERSION_2 2ULL | |
456 | #define SPA_VERSION_3 3ULL | |
457 | #define SPA_VERSION_4 4ULL | |
458 | #define SPA_VERSION_5 5ULL | |
459 | #define SPA_VERSION_6 6ULL | |
460 | #define SPA_VERSION_7 7ULL | |
461 | #define SPA_VERSION_8 8ULL | |
462 | #define SPA_VERSION_9 9ULL | |
463 | #define SPA_VERSION_10 10ULL | |
b128c09f BB |
464 | #define SPA_VERSION_11 11ULL |
465 | #define SPA_VERSION_12 12ULL | |
466 | #define SPA_VERSION_13 13ULL | |
467 | #define SPA_VERSION_14 14ULL | |
9babb374 BB |
468 | #define SPA_VERSION_15 15ULL |
469 | #define SPA_VERSION_16 16ULL | |
45d1cae3 BB |
470 | #define SPA_VERSION_17 17ULL |
471 | #define SPA_VERSION_18 18ULL | |
428870ff BB |
472 | #define SPA_VERSION_19 19ULL |
473 | #define SPA_VERSION_20 20ULL | |
474 | #define SPA_VERSION_21 21ULL | |
475 | #define SPA_VERSION_22 22ULL | |
476 | #define SPA_VERSION_23 23ULL | |
477 | #define SPA_VERSION_24 24ULL | |
478 | #define SPA_VERSION_25 25ULL | |
479 | #define SPA_VERSION_26 26ULL | |
572e2857 BB |
480 | #define SPA_VERSION_27 27ULL |
481 | #define SPA_VERSION_28 28ULL | |
9ae529ec | 482 | #define SPA_VERSION_5000 5000ULL |
572e2857 | 483 | |
34dc7c2f BB |
484 | /* |
485 | * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk | |
9babb374 BB |
486 | * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*}, |
487 | * and do the appropriate changes. Also bump the version number in | |
488 | * usr/src/grub/capability. | |
34dc7c2f | 489 | */ |
9ae529ec CS |
490 | #define SPA_VERSION SPA_VERSION_5000 |
491 | #define SPA_VERSION_STRING "5000" | |
34dc7c2f BB |
492 | |
493 | /* | |
494 | * Symbolic names for the changes that caused a SPA_VERSION switch. | |
495 | * Used in the code when checking for presence or absence of a feature. | |
496 | * Feel free to define multiple symbolic names for each version if there | |
497 | * were multiple changes to on-disk structures during that version. | |
498 | * | |
499 | * NOTE: When checking the current SPA_VERSION in your code, be sure | |
500 | * to use spa_version() since it reports the version of the | |
501 | * last synced uberblock. Checking the in-flight version can | |
502 | * be dangerous in some cases. | |
503 | */ | |
504 | #define SPA_VERSION_INITIAL SPA_VERSION_1 | |
505 | #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 | |
506 | #define SPA_VERSION_SPARES SPA_VERSION_3 | |
45d1cae3 | 507 | #define SPA_VERSION_RAIDZ2 SPA_VERSION_3 |
428870ff | 508 | #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3 |
34dc7c2f BB |
509 | #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 |
510 | #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 | |
511 | #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 | |
512 | #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 | |
513 | #define SPA_VERSION_BOOTFS SPA_VERSION_6 | |
514 | #define SPA_VERSION_SLOGS SPA_VERSION_7 | |
515 | #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 | |
516 | #define SPA_VERSION_FUID SPA_VERSION_9 | |
517 | #define SPA_VERSION_REFRESERVATION SPA_VERSION_9 | |
518 | #define SPA_VERSION_REFQUOTA SPA_VERSION_9 | |
519 | #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9 | |
520 | #define SPA_VERSION_L2CACHE SPA_VERSION_10 | |
b128c09f BB |
521 | #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11 |
522 | #define SPA_VERSION_ORIGIN SPA_VERSION_11 | |
523 | #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 | |
524 | #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 | |
525 | #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 | |
526 | #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 | |
9babb374 BB |
527 | #define SPA_VERSION_USERSPACE SPA_VERSION_15 |
528 | #define SPA_VERSION_STMF_PROP SPA_VERSION_16 | |
45d1cae3 BB |
529 | #define SPA_VERSION_RAIDZ3 SPA_VERSION_17 |
530 | #define SPA_VERSION_USERREFS SPA_VERSION_18 | |
428870ff BB |
531 | #define SPA_VERSION_HOLES SPA_VERSION_19 |
532 | #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20 | |
533 | #define SPA_VERSION_DEDUP SPA_VERSION_21 | |
534 | #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22 | |
535 | #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23 | |
536 | #define SPA_VERSION_SA SPA_VERSION_24 | |
537 | #define SPA_VERSION_SCAN SPA_VERSION_25 | |
538 | #define SPA_VERSION_DIR_CLONES SPA_VERSION_26 | |
539 | #define SPA_VERSION_DEADLISTS SPA_VERSION_26 | |
572e2857 BB |
540 | #define SPA_VERSION_FAST_SNAP SPA_VERSION_27 |
541 | #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28 | |
9ae529ec CS |
542 | #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28 |
543 | #define SPA_VERSION_FEATURES SPA_VERSION_5000 | |
544 | ||
545 | #define SPA_VERSION_IS_SUPPORTED(v) \ | |
546 | (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \ | |
547 | ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION)) | |
34dc7c2f BB |
548 | |
549 | /* | |
550 | * ZPL version - rev'd whenever an incompatible on-disk format change | |
551 | * occurs. This is independent of SPA/DMU/ZAP versioning. You must | |
552 | * also update the version_table[] and help message in zfs_prop.c. | |
553 | * | |
554 | * When changing, be sure to teach GRUB how to read the new format! | |
9babb374 | 555 | * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*} |
34dc7c2f BB |
556 | */ |
557 | #define ZPL_VERSION_1 1ULL | |
558 | #define ZPL_VERSION_2 2ULL | |
559 | #define ZPL_VERSION_3 3ULL | |
9babb374 | 560 | #define ZPL_VERSION_4 4ULL |
428870ff BB |
561 | #define ZPL_VERSION_5 5ULL |
562 | #define ZPL_VERSION ZPL_VERSION_5 | |
563 | #define ZPL_VERSION_STRING "5" | |
34dc7c2f BB |
564 | |
565 | #define ZPL_VERSION_INITIAL ZPL_VERSION_1 | |
566 | #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2 | |
567 | #define ZPL_VERSION_FUID ZPL_VERSION_3 | |
568 | #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3 | |
569 | #define ZPL_VERSION_SYSATTR ZPL_VERSION_3 | |
9babb374 | 570 | #define ZPL_VERSION_USERSPACE ZPL_VERSION_4 |
428870ff BB |
571 | #define ZPL_VERSION_SA ZPL_VERSION_5 |
572 | ||
573 | /* Rewind request information */ | |
574 | #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */ | |
575 | #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */ | |
576 | #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */ | |
577 | #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */ | |
578 | #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */ | |
579 | #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */ | |
580 | #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */ | |
581 | ||
582 | typedef struct zpool_rewind_policy { | |
583 | uint32_t zrp_request; /* rewind behavior requested */ | |
584 | uint64_t zrp_maxmeta; /* max acceptable meta-data errors */ | |
585 | uint64_t zrp_maxdata; /* max acceptable data errors */ | |
586 | uint64_t zrp_txg; /* specific txg to load */ | |
587 | } zpool_rewind_policy_t; | |
34dc7c2f BB |
588 | |
589 | /* | |
590 | * The following are configuration names used in the nvlist describing a pool's | |
a1d477c2 MA |
591 | * configuration. New on-disk names should be prefixed with "<reverse-DNS>:" |
592 | * (e.g. "org.open-zfs:") to avoid conflicting names being developed | |
593 | * independently. | |
34dc7c2f BB |
594 | */ |
595 | #define ZPOOL_CONFIG_VERSION "version" | |
596 | #define ZPOOL_CONFIG_POOL_NAME "name" | |
597 | #define ZPOOL_CONFIG_POOL_STATE "state" | |
598 | #define ZPOOL_CONFIG_POOL_TXG "txg" | |
599 | #define ZPOOL_CONFIG_POOL_GUID "pool_guid" | |
600 | #define ZPOOL_CONFIG_CREATE_TXG "create_txg" | |
601 | #define ZPOOL_CONFIG_TOP_GUID "top_guid" | |
602 | #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" | |
603 | #define ZPOOL_CONFIG_TYPE "type" | |
604 | #define ZPOOL_CONFIG_CHILDREN "children" | |
605 | #define ZPOOL_CONFIG_ID "id" | |
606 | #define ZPOOL_CONFIG_GUID "guid" | |
a1d477c2 MA |
607 | #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object" |
608 | #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births" | |
609 | #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev" | |
34dc7c2f BB |
610 | #define ZPOOL_CONFIG_PATH "path" |
611 | #define ZPOOL_CONFIG_DEVID "devid" | |
612 | #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" | |
613 | #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" | |
614 | #define ZPOOL_CONFIG_ASHIFT "ashift" | |
615 | #define ZPOOL_CONFIG_ASIZE "asize" | |
616 | #define ZPOOL_CONFIG_DTL "DTL" | |
428870ff | 617 | #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */ |
a1d477c2 | 618 | #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */ |
428870ff | 619 | #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */ |
a1d477c2 | 620 | #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */ |
193a37cb TH |
621 | |
622 | /* container nvlist of extended stats */ | |
623 | #define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex" | |
624 | ||
625 | /* Active queue read/write stats */ | |
626 | #define ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE "vdev_sync_r_active_queue" | |
627 | #define ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE "vdev_sync_w_active_queue" | |
628 | #define ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE "vdev_async_r_active_queue" | |
629 | #define ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE "vdev_async_w_active_queue" | |
630 | #define ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE "vdev_async_scrub_active_queue" | |
631 | ||
632 | /* Queue sizes */ | |
633 | #define ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE "vdev_sync_r_pend_queue" | |
634 | #define ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE "vdev_sync_w_pend_queue" | |
635 | #define ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE "vdev_async_r_pend_queue" | |
636 | #define ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE "vdev_async_w_pend_queue" | |
637 | #define ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE "vdev_async_scrub_pend_queue" | |
638 | ||
639 | /* Latency read/write histogram stats */ | |
640 | #define ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO "vdev_tot_r_lat_histo" | |
641 | #define ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO "vdev_tot_w_lat_histo" | |
642 | #define ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO "vdev_disk_r_lat_histo" | |
643 | #define ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO "vdev_disk_w_lat_histo" | |
644 | #define ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO "vdev_sync_r_lat_histo" | |
645 | #define ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO "vdev_sync_w_lat_histo" | |
646 | #define ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO "vdev_async_r_lat_histo" | |
647 | #define ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO "vdev_async_w_lat_histo" | |
648 | #define ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO "vdev_scrub_histo" | |
649 | ||
7e945072 TH |
650 | /* Request size histograms */ |
651 | #define ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO "vdev_sync_ind_r_histo" | |
652 | #define ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO "vdev_sync_ind_w_histo" | |
653 | #define ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO "vdev_async_ind_r_histo" | |
654 | #define ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO "vdev_async_ind_w_histo" | |
655 | #define ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO "vdev_ind_scrub_histo" | |
656 | #define ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO "vdev_sync_agg_r_histo" | |
657 | #define ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO "vdev_sync_agg_w_histo" | |
658 | #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO "vdev_async_agg_r_histo" | |
659 | #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO "vdev_async_agg_w_histo" | |
660 | #define ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO "vdev_agg_scrub_histo" | |
193a37cb | 661 | |
1bbd8770 TH |
662 | /* vdev enclosure sysfs path */ |
663 | #define ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH "vdev_enc_sysfs_path" | |
664 | ||
34dc7c2f BB |
665 | #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" |
666 | #define ZPOOL_CONFIG_ERRCOUNT "error_count" | |
667 | #define ZPOOL_CONFIG_NOT_PRESENT "not_present" | |
668 | #define ZPOOL_CONFIG_SPARES "spares" | |
669 | #define ZPOOL_CONFIG_IS_SPARE "is_spare" | |
670 | #define ZPOOL_CONFIG_NPARITY "nparity" | |
671 | #define ZPOOL_CONFIG_HOSTID "hostid" | |
672 | #define ZPOOL_CONFIG_HOSTNAME "hostname" | |
572e2857 | 673 | #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time" |
34dc7c2f BB |
674 | #define ZPOOL_CONFIG_UNSPARE "unspare" |
675 | #define ZPOOL_CONFIG_PHYS_PATH "phys_path" | |
676 | #define ZPOOL_CONFIG_IS_LOG "is_log" | |
677 | #define ZPOOL_CONFIG_L2CACHE "l2cache" | |
428870ff BB |
678 | #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array" |
679 | #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children" | |
680 | #define ZPOOL_CONFIG_IS_HOLE "is_hole" | |
681 | #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram" | |
682 | #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats" | |
683 | #define ZPOOL_CONFIG_DDT_STATS "ddt_stats" | |
684 | #define ZPOOL_CONFIG_SPLIT "splitcfg" | |
685 | #define ZPOOL_CONFIG_ORIG_GUID "orig_guid" | |
686 | #define ZPOOL_CONFIG_SPLIT_GUID "split_guid" | |
687 | #define ZPOOL_CONFIG_SPLIT_LIST "guid_list" | |
688 | #define ZPOOL_CONFIG_REMOVING "removing" | |
5d1f7fb6 | 689 | #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg" |
d96eb2b1 | 690 | #define ZPOOL_CONFIG_COMMENT "comment" |
b128c09f | 691 | #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */ |
cec3a0a1 | 692 | #define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */ |
34dc7c2f BB |
693 | #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ |
694 | #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */ | |
572e2857 BB |
695 | #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */ |
696 | #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */ | |
9ae529ec CS |
697 | #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */ |
698 | #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */ | |
b9b24bb4 | 699 | #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */ |
9ae529ec CS |
700 | #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */ |
701 | #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read" | |
702 | #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */ | |
ffe9d382 | 703 | #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */ |
e0ab3ab5 JS |
704 | #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top" |
705 | #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf" | |
706 | #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps" | |
379ca9cf OF |
707 | #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */ |
708 | #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */ | |
709 | #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */ | |
710 | #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */ | |
711 | ||
34dc7c2f BB |
712 | /* |
713 | * The persistent vdev state is stored as separate values rather than a single | |
714 | * 'vdev_state' entry. This is because a device can be in multiple states, such | |
715 | * as offline and degraded. | |
716 | */ | |
717 | #define ZPOOL_CONFIG_OFFLINE "offline" | |
718 | #define ZPOOL_CONFIG_FAULTED "faulted" | |
719 | #define ZPOOL_CONFIG_DEGRADED "degraded" | |
720 | #define ZPOOL_CONFIG_REMOVED "removed" | |
9babb374 | 721 | #define ZPOOL_CONFIG_FRU "fru" |
428870ff BB |
722 | #define ZPOOL_CONFIG_AUX_STATE "aux_state" |
723 | ||
724 | /* Rewind policy parameters */ | |
725 | #define ZPOOL_REWIND_POLICY "rewind-policy" | |
726 | #define ZPOOL_REWIND_REQUEST "rewind-request" | |
727 | #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg" | |
728 | #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh" | |
729 | #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh" | |
730 | ||
731 | /* Rewind data discovered */ | |
732 | #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts" | |
733 | #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors" | |
734 | #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind" | |
34dc7c2f BB |
735 | |
736 | #define VDEV_TYPE_ROOT "root" | |
737 | #define VDEV_TYPE_MIRROR "mirror" | |
738 | #define VDEV_TYPE_REPLACING "replacing" | |
739 | #define VDEV_TYPE_RAIDZ "raidz" | |
740 | #define VDEV_TYPE_DISK "disk" | |
741 | #define VDEV_TYPE_FILE "file" | |
742 | #define VDEV_TYPE_MISSING "missing" | |
428870ff | 743 | #define VDEV_TYPE_HOLE "hole" |
34dc7c2f BB |
744 | #define VDEV_TYPE_SPARE "spare" |
745 | #define VDEV_TYPE_LOG "log" | |
746 | #define VDEV_TYPE_L2CACHE "l2cache" | |
a1d477c2 MA |
747 | #define VDEV_TYPE_INDIRECT "indirect" |
748 | ||
749 | /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */ | |
750 | #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \ | |
751 | "com.delphix:indirect_obsolete_sm" | |
752 | #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \ | |
753 | "com.delphix:obsolete_counts_are_precise" | |
34dc7c2f BB |
754 | |
755 | /* | |
756 | * This is needed in userland to report the minimum necessary device size. | |
757 | */ | |
758 | #define SPA_MINDEVSIZE (64ULL << 20) | |
759 | ||
f3a7f661 GW |
760 | /* |
761 | * Set if the fragmentation has not yet been calculated. This can happen | |
762 | * because the space maps have not been upgraded or the histogram feature | |
763 | * is not enabled. | |
764 | */ | |
765 | #define ZFS_FRAG_INVALID UINT64_MAX | |
766 | ||
34dc7c2f BB |
767 | /* |
768 | * The location of the pool configuration repository, shared between kernel and | |
769 | * userland. | |
770 | */ | |
b128c09f | 771 | #define ZPOOL_CACHE "/etc/zfs/zpool.cache" |
34dc7c2f BB |
772 | |
773 | /* | |
774 | * vdev states are ordered from least to most healthy. | |
775 | * A vdev that's CANT_OPEN or below is considered unusable. | |
776 | */ | |
777 | typedef enum vdev_state { | |
778 | VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ | |
779 | VDEV_STATE_CLOSED, /* Not currently open */ | |
780 | VDEV_STATE_OFFLINE, /* Not allowed to open */ | |
781 | VDEV_STATE_REMOVED, /* Explicitly removed from system */ | |
782 | VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ | |
783 | VDEV_STATE_FAULTED, /* External request to fault device */ | |
784 | VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ | |
785 | VDEV_STATE_HEALTHY /* Presumed good */ | |
786 | } vdev_state_t; | |
787 | ||
788 | #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY | |
789 | ||
790 | /* | |
791 | * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field | |
792 | * of the vdev stats structure uses these constants to distinguish why. | |
793 | */ | |
794 | typedef enum vdev_aux { | |
795 | VDEV_AUX_NONE, /* no error */ | |
796 | VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ | |
797 | VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ | |
798 | VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ | |
799 | VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ | |
800 | VDEV_AUX_TOO_SMALL, /* vdev size is too small */ | |
801 | VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ | |
802 | VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ | |
803 | VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ | |
9ae529ec | 804 | VDEV_AUX_UNSUP_FEAT, /* unsupported features */ |
34dc7c2f | 805 | VDEV_AUX_SPARED, /* hot spare used in another pool */ |
b128c09f BB |
806 | VDEV_AUX_ERR_EXCEEDED, /* too many errors */ |
807 | VDEV_AUX_IO_FAILURE, /* experienced I/O failure */ | |
428870ff | 808 | VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */ |
4a283c7f | 809 | VDEV_AUX_EXTERNAL, /* external diagnosis or forced fault */ |
ff61d1a4 | 810 | VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */ |
4a283c7f | 811 | VDEV_AUX_BAD_ASHIFT, /* vdev ashift is invalid */ |
379ca9cf OF |
812 | VDEV_AUX_EXTERNAL_PERSIST, /* persistent forced fault */ |
813 | VDEV_AUX_ACTIVE, /* vdev active on a different host */ | |
34dc7c2f BB |
814 | } vdev_aux_t; |
815 | ||
816 | /* | |
817 | * pool state. The following states are written to disk as part of the normal | |
818 | * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining | |
819 | * states are software abstractions used at various levels to communicate | |
820 | * pool state. | |
821 | */ | |
822 | typedef enum pool_state { | |
823 | POOL_STATE_ACTIVE = 0, /* In active use */ | |
824 | POOL_STATE_EXPORTED, /* Explicitly exported */ | |
825 | POOL_STATE_DESTROYED, /* Explicitly destroyed */ | |
826 | POOL_STATE_SPARE, /* Reserved for hot spare use */ | |
827 | POOL_STATE_L2CACHE, /* Level 2 ARC device */ | |
828 | POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ | |
34dc7c2f BB |
829 | POOL_STATE_UNAVAIL, /* Internal libzfs state */ |
830 | POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ | |
831 | } pool_state_t; | |
832 | ||
379ca9cf OF |
833 | /* |
834 | * mmp state. The following states provide additional detail describing | |
835 | * why a pool couldn't be safely imported. | |
836 | */ | |
837 | typedef enum mmp_state { | |
838 | MMP_STATE_ACTIVE = 0, /* In active use */ | |
839 | MMP_STATE_INACTIVE, /* Inactive and safe to import */ | |
840 | MMP_STATE_NO_HOSTID /* System hostid is not set */ | |
841 | } mmp_state_t; | |
842 | ||
34dc7c2f | 843 | /* |
428870ff | 844 | * Scan Functions. |
34dc7c2f | 845 | */ |
428870ff BB |
846 | typedef enum pool_scan_func { |
847 | POOL_SCAN_NONE, | |
848 | POOL_SCAN_SCRUB, | |
849 | POOL_SCAN_RESILVER, | |
850 | POOL_SCAN_FUNCS | |
851 | } pool_scan_func_t; | |
34dc7c2f | 852 | |
0ea05c64 AP |
853 | /* |
854 | * Used to control scrub pause and resume. | |
855 | */ | |
856 | typedef enum pool_scrub_cmd { | |
857 | POOL_SCRUB_NORMAL = 0, | |
858 | POOL_SCRUB_PAUSE, | |
859 | POOL_SCRUB_FLAGS_END | |
860 | } pool_scrub_cmd_t; | |
861 | ||
862 | ||
34dc7c2f BB |
863 | /* |
864 | * ZIO types. Needed to interpret vdev statistics below. | |
865 | */ | |
866 | typedef enum zio_type { | |
867 | ZIO_TYPE_NULL = 0, | |
868 | ZIO_TYPE_READ, | |
869 | ZIO_TYPE_WRITE, | |
870 | ZIO_TYPE_FREE, | |
871 | ZIO_TYPE_CLAIM, | |
872 | ZIO_TYPE_IOCTL, | |
873 | ZIO_TYPES | |
874 | } zio_type_t; | |
875 | ||
428870ff BB |
876 | /* |
877 | * Pool statistics. Note: all fields should be 64-bit because this | |
878 | * is passed between kernel and userland as an nvlist uint64 array. | |
879 | */ | |
880 | typedef struct pool_scan_stat { | |
881 | /* values stored on disk */ | |
882 | uint64_t pss_func; /* pool_scan_func_t */ | |
883 | uint64_t pss_state; /* dsl_scan_state_t */ | |
884 | uint64_t pss_start_time; /* scan start time */ | |
885 | uint64_t pss_end_time; /* scan end time */ | |
886 | uint64_t pss_to_examine; /* total bytes to scan */ | |
d4a72f23 | 887 | uint64_t pss_examined; /* total bytes located by scanner */ |
428870ff BB |
888 | uint64_t pss_to_process; /* total bytes to process */ |
889 | uint64_t pss_processed; /* total processed bytes */ | |
890 | uint64_t pss_errors; /* scan errors */ | |
891 | ||
892 | /* values not stored on disk */ | |
d4a72f23 | 893 | uint64_t pss_pass_exam; /* examined bytes per scan pass */ |
428870ff | 894 | uint64_t pss_pass_start; /* start time of a scan pass */ |
0ea05c64 AP |
895 | uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */ |
896 | /* cumulative time scrub spent paused, needed for rate calculation */ | |
897 | uint64_t pss_pass_scrub_spent_paused; | |
d4677269 | 898 | uint64_t pss_pass_issued; /* issued bytes per scan pass */ |
d4a72f23 | 899 | uint64_t pss_issued; /* total bytes checked by scanner */ |
428870ff BB |
900 | } pool_scan_stat_t; |
901 | ||
a1d477c2 MA |
902 | typedef struct pool_removal_stat { |
903 | uint64_t prs_state; /* dsl_scan_state_t */ | |
904 | uint64_t prs_removing_vdev; | |
905 | uint64_t prs_start_time; | |
906 | uint64_t prs_end_time; | |
907 | uint64_t prs_to_copy; /* bytes that need to be copied */ | |
908 | uint64_t prs_copied; /* bytes copied so far */ | |
909 | /* | |
910 | * bytes of memory used for indirect mappings. | |
911 | * This includes all removed vdevs. | |
912 | */ | |
913 | uint64_t prs_mapping_memory; | |
914 | } pool_removal_stat_t; | |
915 | ||
428870ff BB |
916 | typedef enum dsl_scan_state { |
917 | DSS_NONE, | |
918 | DSS_SCANNING, | |
919 | DSS_FINISHED, | |
920 | DSS_CANCELED, | |
921 | DSS_NUM_STATES | |
922 | } dsl_scan_state_t; | |
923 | ||
ffe9d382 BB |
924 | /* |
925 | * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER. The ordering | |
926 | * of this enum must be maintained to ensure the errata identifiers map to | |
927 | * the correct documentation. New errata may only be appended to the list | |
928 | * and must contain corresponding documentation at the above link. | |
929 | */ | |
930 | typedef enum zpool_errata { | |
931 | ZPOOL_ERRATA_NONE, | |
4f2dcb3e RY |
932 | ZPOOL_ERRATA_ZOL_2094_SCRUB, |
933 | ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY, | |
ae76f45c | 934 | ZPOOL_ERRATA_ZOL_6845_ENCRYPTION, |
ffe9d382 | 935 | } zpool_errata_t; |
428870ff | 936 | |
34dc7c2f BB |
937 | /* |
938 | * Vdev statistics. Note: all fields should be 64-bit because this | |
939 | * is passed between kernel and userland as an nvlist uint64 array. | |
940 | */ | |
941 | typedef struct vdev_stat { | |
942 | hrtime_t vs_timestamp; /* time since vdev load */ | |
943 | uint64_t vs_state; /* vdev state */ | |
944 | uint64_t vs_aux; /* see vdev_aux_t */ | |
945 | uint64_t vs_alloc; /* space allocated */ | |
946 | uint64_t vs_space; /* total capacity */ | |
947 | uint64_t vs_dspace; /* deflated capacity */ | |
948 | uint64_t vs_rsize; /* replaceable dev size */ | |
1bd201e7 | 949 | uint64_t vs_esize; /* expandable dev size */ |
34dc7c2f BB |
950 | uint64_t vs_ops[ZIO_TYPES]; /* operation count */ |
951 | uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ | |
952 | uint64_t vs_read_errors; /* read errors */ | |
953 | uint64_t vs_write_errors; /* write errors */ | |
954 | uint64_t vs_checksum_errors; /* checksum errors */ | |
955 | uint64_t vs_self_healed; /* self-healed bytes */ | |
428870ff BB |
956 | uint64_t vs_scan_removing; /* removing? */ |
957 | uint64_t vs_scan_processed; /* scan processed bytes */ | |
f3a7f661 | 958 | uint64_t vs_fragmentation; /* device fragmentation */ |
193a37cb | 959 | |
34dc7c2f BB |
960 | } vdev_stat_t; |
961 | ||
193a37cb TH |
962 | /* |
963 | * Extended stats | |
964 | * | |
965 | * These are stats which aren't included in the original iostat output. For | |
966 | * convenience, they are grouped together in vdev_stat_ex, although each stat | |
d5884c34 | 967 | * is individually exported as an nvlist. |
193a37cb TH |
968 | */ |
969 | typedef struct vdev_stat_ex { | |
970 | /* Number of ZIOs issued to disk and waiting to finish */ | |
971 | uint64_t vsx_active_queue[ZIO_PRIORITY_NUM_QUEUEABLE]; | |
972 | ||
973 | /* Number of ZIOs pending to be issued to disk */ | |
974 | uint64_t vsx_pend_queue[ZIO_PRIORITY_NUM_QUEUEABLE]; | |
975 | ||
976 | /* | |
977 | * Below are the histograms for various latencies. Buckets are in | |
978 | * units of nanoseconds. | |
979 | */ | |
980 | ||
981 | /* | |
982 | * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in | |
983 | * before this. | |
984 | */ | |
7e945072 TH |
985 | #define VDEV_L_HISTO_BUCKETS 37 /* Latency histo buckets */ |
986 | #define VDEV_RQ_HISTO_BUCKETS 25 /* Request size histo buckets */ | |
987 | ||
193a37cb TH |
988 | |
989 | /* Amount of time in ZIO queue (ns) */ | |
990 | uint64_t vsx_queue_histo[ZIO_PRIORITY_NUM_QUEUEABLE] | |
7e945072 | 991 | [VDEV_L_HISTO_BUCKETS]; |
193a37cb TH |
992 | |
993 | /* Total ZIO latency (ns). Includes queuing and disk access time */ | |
7e945072 | 994 | uint64_t vsx_total_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS]; |
193a37cb TH |
995 | |
996 | /* Amount of time to read/write the disk (ns) */ | |
7e945072 TH |
997 | uint64_t vsx_disk_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS]; |
998 | ||
999 | /* "lookup the bucket for a value" histogram macros */ | |
1000 | #define HISTO(val, buckets) (val != 0 ? MIN(highbit64(val) - 1, \ | |
1001 | buckets - 1) : 0) | |
1002 | #define L_HISTO(a) HISTO(a, VDEV_L_HISTO_BUCKETS) | |
1003 | #define RQ_HISTO(a) HISTO(a, VDEV_RQ_HISTO_BUCKETS) | |
1004 | ||
1005 | /* Physical IO histogram */ | |
1006 | uint64_t vsx_ind_histo[ZIO_PRIORITY_NUM_QUEUEABLE] | |
1007 | [VDEV_RQ_HISTO_BUCKETS]; | |
193a37cb | 1008 | |
7e945072 TH |
1009 | /* Delegated (aggregated) physical IO histogram */ |
1010 | uint64_t vsx_agg_histo[ZIO_PRIORITY_NUM_QUEUEABLE] | |
1011 | [VDEV_RQ_HISTO_BUCKETS]; | |
193a37cb TH |
1012 | |
1013 | } vdev_stat_ex_t; | |
1014 | ||
428870ff BB |
1015 | /* |
1016 | * DDT statistics. Note: all fields should be 64-bit because this | |
1017 | * is passed between kernel and userland as an nvlist uint64 array. | |
1018 | */ | |
1019 | typedef struct ddt_object { | |
4e33ba4c | 1020 | uint64_t ddo_count; /* number of elements in ddt */ |
428870ff BB |
1021 | uint64_t ddo_dspace; /* size of ddt on disk */ |
1022 | uint64_t ddo_mspace; /* size of ddt in-core */ | |
1023 | } ddt_object_t; | |
1024 | ||
1025 | typedef struct ddt_stat { | |
1026 | uint64_t dds_blocks; /* blocks */ | |
1027 | uint64_t dds_lsize; /* logical size */ | |
1028 | uint64_t dds_psize; /* physical size */ | |
1029 | uint64_t dds_dsize; /* deflated allocated size */ | |
1030 | uint64_t dds_ref_blocks; /* referenced blocks */ | |
1031 | uint64_t dds_ref_lsize; /* referenced lsize * refcnt */ | |
1032 | uint64_t dds_ref_psize; /* referenced psize * refcnt */ | |
1033 | uint64_t dds_ref_dsize; /* referenced dsize * refcnt */ | |
1034 | } ddt_stat_t; | |
1035 | ||
1036 | typedef struct ddt_histogram { | |
1037 | ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */ | |
1038 | } ddt_histogram_t; | |
1039 | ||
34dc7c2f BB |
1040 | #define ZVOL_DRIVER "zvol" |
1041 | #define ZFS_DRIVER "zfs" | |
1042 | #define ZFS_DEV "/dev/zfs" | |
2bac6814 | 1043 | #define ZFS_SHARETAB "/etc/dfs/sharetab" |
34dc7c2f | 1044 | |
774ee3c7 GM |
1045 | #define ZFS_SUPER_MAGIC 0x2fc12fc1 |
1046 | ||
428870ff | 1047 | /* general zvol path */ |
60101509 BB |
1048 | #define ZVOL_DIR "/dev" |
1049 | ||
1050 | #define ZVOL_MAJOR 230 | |
1051 | #define ZVOL_MINOR_BITS 4 | |
1052 | #define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1) | |
1053 | #define ZVOL_MINORS (1 << 4) | |
4c0d8e50 | 1054 | #define ZVOL_DEV_NAME "zd" |
34dc7c2f BB |
1055 | |
1056 | #define ZVOL_PROP_NAME "name" | |
428870ff | 1057 | #define ZVOL_DEFAULT_BLOCKSIZE 8192 |
34dc7c2f BB |
1058 | |
1059 | /* | |
1060 | * /dev/zfs ioctl numbers. | |
1061 | */ | |
34dc7c2f | 1062 | typedef enum zfs_ioc { |
2e0358cb | 1063 | /* |
43e52edd | 1064 | * Illumos - 71/128 numbers reserved. |
2e0358cb | 1065 | */ |
6f1ffb06 MA |
1066 | ZFS_IOC_FIRST = ('Z' << 8), |
1067 | ZFS_IOC = ZFS_IOC_FIRST, | |
1068 | ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, | |
34dc7c2f BB |
1069 | ZFS_IOC_POOL_DESTROY, |
1070 | ZFS_IOC_POOL_IMPORT, | |
1071 | ZFS_IOC_POOL_EXPORT, | |
1072 | ZFS_IOC_POOL_CONFIGS, | |
1073 | ZFS_IOC_POOL_STATS, | |
1074 | ZFS_IOC_POOL_TRYIMPORT, | |
428870ff | 1075 | ZFS_IOC_POOL_SCAN, |
34dc7c2f BB |
1076 | ZFS_IOC_POOL_FREEZE, |
1077 | ZFS_IOC_POOL_UPGRADE, | |
1078 | ZFS_IOC_POOL_GET_HISTORY, | |
1079 | ZFS_IOC_VDEV_ADD, | |
1080 | ZFS_IOC_VDEV_REMOVE, | |
1081 | ZFS_IOC_VDEV_SET_STATE, | |
1082 | ZFS_IOC_VDEV_ATTACH, | |
1083 | ZFS_IOC_VDEV_DETACH, | |
1084 | ZFS_IOC_VDEV_SETPATH, | |
9babb374 | 1085 | ZFS_IOC_VDEV_SETFRU, |
34dc7c2f BB |
1086 | ZFS_IOC_OBJSET_STATS, |
1087 | ZFS_IOC_OBJSET_ZPLPROPS, | |
1088 | ZFS_IOC_DATASET_LIST_NEXT, | |
1089 | ZFS_IOC_SNAPSHOT_LIST_NEXT, | |
1090 | ZFS_IOC_SET_PROP, | |
34dc7c2f BB |
1091 | ZFS_IOC_CREATE, |
1092 | ZFS_IOC_DESTROY, | |
1093 | ZFS_IOC_ROLLBACK, | |
1094 | ZFS_IOC_RENAME, | |
1095 | ZFS_IOC_RECV, | |
1096 | ZFS_IOC_SEND, | |
1097 | ZFS_IOC_INJECT_FAULT, | |
1098 | ZFS_IOC_CLEAR_FAULT, | |
1099 | ZFS_IOC_INJECT_LIST_NEXT, | |
1100 | ZFS_IOC_ERROR_LOG, | |
1101 | ZFS_IOC_CLEAR, | |
1102 | ZFS_IOC_PROMOTE, | |
34dc7c2f BB |
1103 | ZFS_IOC_SNAPSHOT, |
1104 | ZFS_IOC_DSOBJ_TO_DSNAME, | |
1105 | ZFS_IOC_OBJ_TO_PATH, | |
1106 | ZFS_IOC_POOL_SET_PROPS, | |
1107 | ZFS_IOC_POOL_GET_PROPS, | |
1108 | ZFS_IOC_SET_FSACL, | |
1109 | ZFS_IOC_GET_FSACL, | |
34dc7c2f | 1110 | ZFS_IOC_SHARE, |
9babb374 BB |
1111 | ZFS_IOC_INHERIT_PROP, |
1112 | ZFS_IOC_SMB_ACL, | |
1113 | ZFS_IOC_USERSPACE_ONE, | |
1114 | ZFS_IOC_USERSPACE_MANY, | |
45d1cae3 BB |
1115 | ZFS_IOC_USERSPACE_UPGRADE, |
1116 | ZFS_IOC_HOLD, | |
1117 | ZFS_IOC_RELEASE, | |
428870ff BB |
1118 | ZFS_IOC_GET_HOLDS, |
1119 | ZFS_IOC_OBJSET_RECVD_PROPS, | |
572e2857 BB |
1120 | ZFS_IOC_VDEV_SPLIT, |
1121 | ZFS_IOC_NEXT_OBJ, | |
1122 | ZFS_IOC_DIFF, | |
1123 | ZFS_IOC_TMP_SNAPSHOT, | |
26685276 | 1124 | ZFS_IOC_OBJ_TO_STATS, |
330d06f9 MA |
1125 | ZFS_IOC_SPACE_WRITTEN, |
1126 | ZFS_IOC_SPACE_SNAPS, | |
2e0358cb BB |
1127 | ZFS_IOC_DESTROY_SNAPS, |
1128 | ZFS_IOC_POOL_REGUID, | |
1bd201e7 | 1129 | ZFS_IOC_POOL_REOPEN, |
37abac6d | 1130 | ZFS_IOC_SEND_PROGRESS, |
6f1ffb06 MA |
1131 | ZFS_IOC_LOG_HISTORY, |
1132 | ZFS_IOC_SEND_NEW, | |
1133 | ZFS_IOC_SEND_SPACE, | |
1134 | ZFS_IOC_CLONE, | |
da536844 MA |
1135 | ZFS_IOC_BOOKMARK, |
1136 | ZFS_IOC_GET_BOOKMARKS, | |
1137 | ZFS_IOC_DESTROY_BOOKMARKS, | |
d99a0153 | 1138 | ZFS_IOC_CHANNEL_PROGRAM, |
43e52edd | 1139 | ZFS_IOC_RECV_NEW, |
bec1067d | 1140 | ZFS_IOC_POOL_SYNC, |
b5256303 TC |
1141 | ZFS_IOC_LOAD_KEY, |
1142 | ZFS_IOC_UNLOAD_KEY, | |
1143 | ZFS_IOC_CHANGE_KEY, | |
a1d477c2 | 1144 | ZFS_IOC_REMAP, |
2e0358cb BB |
1145 | |
1146 | /* | |
1147 | * Linux - 3/64 numbers reserved. | |
1148 | */ | |
1149 | ZFS_IOC_LINUX = ('Z' << 8) + 0x80, | |
1150 | ZFS_IOC_EVENTS_NEXT, | |
1151 | ZFS_IOC_EVENTS_CLEAR, | |
75e3ff58 | 1152 | ZFS_IOC_EVENTS_SEEK, |
2e0358cb BB |
1153 | |
1154 | /* | |
1155 | * FreeBSD - 1/64 numbers reserved. | |
1156 | */ | |
1157 | ZFS_IOC_FREEBSD = ('Z' << 8) + 0xC0, | |
1158 | ||
6f1ffb06 | 1159 | ZFS_IOC_LAST |
34dc7c2f BB |
1160 | } zfs_ioc_t; |
1161 | ||
4c0d8e50 FN |
1162 | /* |
1163 | * zvol ioctl to get dataset name | |
1164 | */ | |
eca7b760 | 1165 | #define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN]) |
4c0d8e50 | 1166 | |
34dc7c2f BB |
1167 | /* |
1168 | * Internal SPA load state. Used by FMA diagnosis engine. | |
1169 | */ | |
1170 | typedef enum { | |
428870ff BB |
1171 | SPA_LOAD_NONE, /* no load in progress */ |
1172 | SPA_LOAD_OPEN, /* normal open */ | |
1173 | SPA_LOAD_IMPORT, /* import in progress */ | |
1174 | SPA_LOAD_TRYIMPORT, /* tryimport in progress */ | |
1175 | SPA_LOAD_RECOVER, /* recovery requested */ | |
3dfb57a3 DB |
1176 | SPA_LOAD_ERROR, /* load failed */ |
1177 | SPA_LOAD_CREATE /* creation in progress */ | |
34dc7c2f BB |
1178 | } spa_load_state_t; |
1179 | ||
1180 | /* | |
1181 | * Bookmark name values. | |
1182 | */ | |
1183 | #define ZPOOL_ERR_LIST "error list" | |
1184 | #define ZPOOL_ERR_DATASET "dataset" | |
1185 | #define ZPOOL_ERR_OBJECT "object" | |
1186 | ||
1187 | #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) | |
1188 | ||
1189 | /* | |
1190 | * The following are names used in the nvlist describing | |
1191 | * the pool's history log. | |
1192 | */ | |
1193 | #define ZPOOL_HIST_RECORD "history record" | |
1194 | #define ZPOOL_HIST_TIME "history time" | |
1195 | #define ZPOOL_HIST_CMD "history command" | |
1196 | #define ZPOOL_HIST_WHO "history who" | |
1197 | #define ZPOOL_HIST_ZONE "history zone" | |
1198 | #define ZPOOL_HIST_HOST "history hostname" | |
1199 | #define ZPOOL_HIST_TXG "history txg" | |
1200 | #define ZPOOL_HIST_INT_EVENT "history internal event" | |
1201 | #define ZPOOL_HIST_INT_STR "history internal str" | |
6f1ffb06 MA |
1202 | #define ZPOOL_HIST_INT_NAME "internal_name" |
1203 | #define ZPOOL_HIST_IOCTL "ioctl" | |
1204 | #define ZPOOL_HIST_INPUT_NVL "in_nvl" | |
1205 | #define ZPOOL_HIST_OUTPUT_NVL "out_nvl" | |
1206 | #define ZPOOL_HIST_DSNAME "dsname" | |
1207 | #define ZPOOL_HIST_DSID "dsid" | |
d99a0153 | 1208 | #define ZPOOL_HIST_ERRNO "errno" |
34dc7c2f | 1209 | |
b5256303 TC |
1210 | /* |
1211 | * Special nvlist name that will not have its args recorded in the pool's | |
1212 | * history log. | |
1213 | */ | |
1214 | #define ZPOOL_HIDDEN_ARGS "hidden_args" | |
1215 | ||
34dc7c2f BB |
1216 | /* |
1217 | * Flags for ZFS_IOC_VDEV_SET_STATE | |
1218 | */ | |
1219 | #define ZFS_ONLINE_CHECKREMOVE 0x1 | |
1220 | #define ZFS_ONLINE_UNSPARE 0x2 | |
1221 | #define ZFS_ONLINE_FORCEFAULT 0x4 | |
9babb374 | 1222 | #define ZFS_ONLINE_EXPAND 0x8 |
34dc7c2f BB |
1223 | #define ZFS_OFFLINE_TEMPORARY 0x1 |
1224 | ||
572e2857 BB |
1225 | /* |
1226 | * Flags for ZFS_IOC_POOL_IMPORT | |
1227 | */ | |
1228 | #define ZFS_IMPORT_NORMAL 0x0 | |
1229 | #define ZFS_IMPORT_VERBATIM 0x1 | |
1230 | #define ZFS_IMPORT_ANY_HOST 0x2 | |
1231 | #define ZFS_IMPORT_MISSING_LOG 0x4 | |
1232 | #define ZFS_IMPORT_ONLY 0x8 | |
26b42f3f | 1233 | #define ZFS_IMPORT_TEMP_NAME 0x10 |
379ca9cf | 1234 | #define ZFS_IMPORT_SKIP_MMP 0x20 |
b5256303 | 1235 | #define ZFS_IMPORT_LOAD_KEYS 0x40 |
572e2857 | 1236 | |
d99a0153 CW |
1237 | /* |
1238 | * Channel program argument/return nvlist keys and defaults. | |
1239 | */ | |
1240 | #define ZCP_ARG_PROGRAM "program" | |
1241 | #define ZCP_ARG_ARGLIST "arg" | |
5b72a38d | 1242 | #define ZCP_ARG_SYNC "sync" |
d99a0153 CW |
1243 | #define ZCP_ARG_INSTRLIMIT "instrlimit" |
1244 | #define ZCP_ARG_MEMLIMIT "memlimit" | |
1245 | ||
1246 | #define ZCP_ARG_CLIARGV "argv" | |
1247 | ||
1248 | #define ZCP_RET_ERROR "error" | |
1249 | #define ZCP_RET_RETURN "return" | |
1250 | ||
1251 | #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000) | |
1252 | #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) | |
1253 | #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) | |
1254 | #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) | |
1255 | ||
34dc7c2f BB |
1256 | /* |
1257 | * Sysevent payload members. ZFS will generate the following sysevents with the | |
1258 | * given payloads: | |
1259 | * | |
1260 | * ESC_ZFS_RESILVER_START | |
1261 | * ESC_ZFS_RESILVER_END | |
1262 | * ESC_ZFS_POOL_DESTROY | |
3541dc6d | 1263 | * ESC_ZFS_POOL_REGUID |
34dc7c2f BB |
1264 | * |
1265 | * ZFS_EV_POOL_NAME DATA_TYPE_STRING | |
1266 | * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 | |
1267 | * | |
1268 | * ESC_ZFS_VDEV_REMOVE | |
1269 | * ESC_ZFS_VDEV_CLEAR | |
1270 | * ESC_ZFS_VDEV_CHECK | |
1271 | * | |
1272 | * ZFS_EV_POOL_NAME DATA_TYPE_STRING | |
1273 | * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 | |
1274 | * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) | |
1275 | * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 | |
12fa0466 DE |
1276 | * |
1277 | * ESC_ZFS_HISTORY_EVENT | |
1278 | * | |
1279 | * ZFS_EV_POOL_NAME DATA_TYPE_STRING | |
1280 | * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 | |
1281 | * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) | |
1282 | * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) | |
1283 | * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) | |
1284 | * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) | |
1285 | * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) | |
1286 | * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) | |
1287 | * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) | |
1288 | * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) | |
1289 | * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) | |
1290 | * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) | |
1291 | * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) | |
1292 | * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) | |
1293 | * | |
1294 | * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the | |
1295 | * history log nvlist. The keynames will be free of any spaces or other | |
1296 | * characters that could be potentially unexpected to consumers of the | |
1297 | * sysevents. | |
34dc7c2f BB |
1298 | */ |
1299 | #define ZFS_EV_POOL_NAME "pool_name" | |
1300 | #define ZFS_EV_POOL_GUID "pool_guid" | |
1301 | #define ZFS_EV_VDEV_PATH "vdev_path" | |
1302 | #define ZFS_EV_VDEV_GUID "vdev_guid" | |
12fa0466 DE |
1303 | #define ZFS_EV_HIST_TIME "history_time" |
1304 | #define ZFS_EV_HIST_CMD "history_command" | |
1305 | #define ZFS_EV_HIST_WHO "history_who" | |
1306 | #define ZFS_EV_HIST_ZONE "history_zone" | |
1307 | #define ZFS_EV_HIST_HOST "history_hostname" | |
1308 | #define ZFS_EV_HIST_TXG "history_txg" | |
1309 | #define ZFS_EV_HIST_INT_EVENT "history_internal_event" | |
1310 | #define ZFS_EV_HIST_INT_STR "history_internal_str" | |
1311 | #define ZFS_EV_HIST_INT_NAME "history_internal_name" | |
1312 | #define ZFS_EV_HIST_IOCTL "history_ioctl" | |
1313 | #define ZFS_EV_HIST_DSNAME "history_dsname" | |
1314 | #define ZFS_EV_HIST_DSID "history_dsid" | |
34dc7c2f | 1315 | |
34dc7c2f BB |
1316 | #ifdef __cplusplus |
1317 | } | |
1318 | #endif | |
1319 | ||
1320 | #endif /* _SYS_FS_ZFS_H */ |