]> git.proxmox.com Git - mirror_zfs.git/blob - include/sys/fs/zfs.h
Cross-platform xattr user namespace compatibility
[mirror_zfs.git] / include / sys / fs / zfs.h
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 */
21
22 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved.
27 * Copyright (c) 2014 Integros [integros.com]
28 * Copyright (c) 2017, Intel Corporation.
29 * Copyright (c) 2019 Datto Inc.
30 * Portions Copyright 2010 Robert Milkowski
31 * Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
32 */
33
34 #ifndef _SYS_FS_ZFS_H
35 #define _SYS_FS_ZFS_H extern __attribute__((visibility("default")))
36
37 #include <sys/time.h>
38 #include <sys/zio_priority.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45 * Types and constants shared between userland and the kernel.
46 */
47
48 /*
49 * Each dataset can be one of the following types. These constants can be
50 * combined into masks that can be passed to various functions.
51 */
52 typedef enum {
53 ZFS_TYPE_FILESYSTEM = (1 << 0),
54 ZFS_TYPE_SNAPSHOT = (1 << 1),
55 ZFS_TYPE_VOLUME = (1 << 2),
56 ZFS_TYPE_POOL = (1 << 3),
57 ZFS_TYPE_BOOKMARK = (1 << 4),
58 ZFS_TYPE_VDEV = (1 << 5),
59 } zfs_type_t;
60
61 /*
62 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
63 * if it represents a real type of a dataset that can be created from userland.
64 */
65 typedef enum dmu_objset_type {
66 DMU_OST_NONE,
67 DMU_OST_META,
68 DMU_OST_ZFS,
69 DMU_OST_ZVOL,
70 DMU_OST_OTHER, /* For testing only! */
71 DMU_OST_ANY, /* Be careful! */
72 DMU_OST_NUMTYPES
73 } dmu_objset_type_t;
74
75 #define ZFS_TYPE_DATASET \
76 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
77
78 /*
79 * All of these include the terminating NUL byte.
80 */
81 #define ZAP_MAXNAMELEN 256
82 #define ZAP_MAXVALUELEN (1024 * 8)
83 #define ZAP_OLDMAXVALUELEN 1024
84 #define ZFS_MAX_DATASET_NAME_LEN 256
85
86 /*
87 * Dataset properties are identified by these constants and must be added to
88 * the end of this list to ensure that external consumers are not affected
89 * by the change. If you make any changes to this list, be sure to update
90 * the property table in module/zcommon/zfs_prop.c.
91 */
92 typedef enum {
93 ZPROP_CONT = -2,
94 ZPROP_INVAL = -1,
95 ZFS_PROP_TYPE = 0,
96 ZFS_PROP_CREATION,
97 ZFS_PROP_USED,
98 ZFS_PROP_AVAILABLE,
99 ZFS_PROP_REFERENCED,
100 ZFS_PROP_COMPRESSRATIO,
101 ZFS_PROP_MOUNTED,
102 ZFS_PROP_ORIGIN,
103 ZFS_PROP_QUOTA,
104 ZFS_PROP_RESERVATION,
105 ZFS_PROP_VOLSIZE,
106 ZFS_PROP_VOLBLOCKSIZE,
107 ZFS_PROP_RECORDSIZE,
108 ZFS_PROP_MOUNTPOINT,
109 ZFS_PROP_SHARENFS,
110 ZFS_PROP_CHECKSUM,
111 ZFS_PROP_COMPRESSION,
112 ZFS_PROP_ATIME,
113 ZFS_PROP_DEVICES,
114 ZFS_PROP_EXEC,
115 ZFS_PROP_SETUID,
116 ZFS_PROP_READONLY,
117 ZFS_PROP_ZONED,
118 ZFS_PROP_SNAPDIR,
119 ZFS_PROP_ACLMODE,
120 ZFS_PROP_ACLINHERIT,
121 ZFS_PROP_CREATETXG,
122 ZFS_PROP_NAME, /* not exposed to the user */
123 ZFS_PROP_CANMOUNT,
124 ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */
125 ZFS_PROP_XATTR,
126 ZFS_PROP_NUMCLONES, /* not exposed to the user */
127 ZFS_PROP_COPIES,
128 ZFS_PROP_VERSION,
129 ZFS_PROP_UTF8ONLY,
130 ZFS_PROP_NORMALIZE,
131 ZFS_PROP_CASE,
132 ZFS_PROP_VSCAN,
133 ZFS_PROP_NBMAND,
134 ZFS_PROP_SHARESMB,
135 ZFS_PROP_REFQUOTA,
136 ZFS_PROP_REFRESERVATION,
137 ZFS_PROP_GUID,
138 ZFS_PROP_PRIMARYCACHE,
139 ZFS_PROP_SECONDARYCACHE,
140 ZFS_PROP_USEDSNAP,
141 ZFS_PROP_USEDDS,
142 ZFS_PROP_USEDCHILD,
143 ZFS_PROP_USEDREFRESERV,
144 ZFS_PROP_USERACCOUNTING, /* not exposed to the user */
145 ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */
146 ZFS_PROP_DEFER_DESTROY,
147 ZFS_PROP_USERREFS,
148 ZFS_PROP_LOGBIAS,
149 ZFS_PROP_UNIQUE, /* not exposed to the user */
150 ZFS_PROP_OBJSETID,
151 ZFS_PROP_DEDUP,
152 ZFS_PROP_MLSLABEL,
153 ZFS_PROP_SYNC,
154 ZFS_PROP_DNODESIZE,
155 ZFS_PROP_REFRATIO,
156 ZFS_PROP_WRITTEN,
157 ZFS_PROP_CLONES,
158 ZFS_PROP_LOGICALUSED,
159 ZFS_PROP_LOGICALREFERENCED,
160 ZFS_PROP_INCONSISTENT, /* not exposed to the user */
161 ZFS_PROP_VOLMODE,
162 ZFS_PROP_FILESYSTEM_LIMIT,
163 ZFS_PROP_SNAPSHOT_LIMIT,
164 ZFS_PROP_FILESYSTEM_COUNT,
165 ZFS_PROP_SNAPSHOT_COUNT,
166 ZFS_PROP_SNAPDEV,
167 ZFS_PROP_ACLTYPE,
168 ZFS_PROP_SELINUX_CONTEXT,
169 ZFS_PROP_SELINUX_FSCONTEXT,
170 ZFS_PROP_SELINUX_DEFCONTEXT,
171 ZFS_PROP_SELINUX_ROOTCONTEXT,
172 ZFS_PROP_RELATIME,
173 ZFS_PROP_REDUNDANT_METADATA,
174 ZFS_PROP_OVERLAY,
175 ZFS_PROP_PREV_SNAP,
176 ZFS_PROP_RECEIVE_RESUME_TOKEN,
177 ZFS_PROP_ENCRYPTION,
178 ZFS_PROP_KEYLOCATION,
179 ZFS_PROP_KEYFORMAT,
180 ZFS_PROP_PBKDF2_SALT,
181 ZFS_PROP_PBKDF2_ITERS,
182 ZFS_PROP_ENCRYPTION_ROOT,
183 ZFS_PROP_KEY_GUID,
184 ZFS_PROP_KEYSTATUS,
185 ZFS_PROP_REMAPTXG, /* obsolete - no longer used */
186 ZFS_PROP_SPECIAL_SMALL_BLOCKS,
187 ZFS_PROP_IVSET_GUID, /* not exposed to the user */
188 ZFS_PROP_REDACTED,
189 ZFS_PROP_REDACT_SNAPS,
190 ZFS_NUM_PROPS
191 } zfs_prop_t;
192
193 typedef enum {
194 ZFS_PROP_USERUSED,
195 ZFS_PROP_USERQUOTA,
196 ZFS_PROP_GROUPUSED,
197 ZFS_PROP_GROUPQUOTA,
198 ZFS_PROP_USEROBJUSED,
199 ZFS_PROP_USEROBJQUOTA,
200 ZFS_PROP_GROUPOBJUSED,
201 ZFS_PROP_GROUPOBJQUOTA,
202 ZFS_PROP_PROJECTUSED,
203 ZFS_PROP_PROJECTQUOTA,
204 ZFS_PROP_PROJECTOBJUSED,
205 ZFS_PROP_PROJECTOBJQUOTA,
206 ZFS_NUM_USERQUOTA_PROPS
207 } zfs_userquota_prop_t;
208
209 _SYS_FS_ZFS_H const char *const zfs_userquota_prop_prefixes[
210 ZFS_NUM_USERQUOTA_PROPS];
211
212 /*
213 * Pool properties are identified by these constants and must be added to the
214 * end of this list to ensure that external consumers are not affected
215 * by the change. Properties must be registered in zfs_prop_init().
216 */
217 typedef enum {
218 ZPOOL_PROP_INVAL = -1,
219 ZPOOL_PROP_NAME,
220 ZPOOL_PROP_SIZE,
221 ZPOOL_PROP_CAPACITY,
222 ZPOOL_PROP_ALTROOT,
223 ZPOOL_PROP_HEALTH,
224 ZPOOL_PROP_GUID,
225 ZPOOL_PROP_VERSION,
226 ZPOOL_PROP_BOOTFS,
227 ZPOOL_PROP_DELEGATION,
228 ZPOOL_PROP_AUTOREPLACE,
229 ZPOOL_PROP_CACHEFILE,
230 ZPOOL_PROP_FAILUREMODE,
231 ZPOOL_PROP_LISTSNAPS,
232 ZPOOL_PROP_AUTOEXPAND,
233 ZPOOL_PROP_DEDUPDITTO,
234 ZPOOL_PROP_DEDUPRATIO,
235 ZPOOL_PROP_FREE,
236 ZPOOL_PROP_ALLOCATED,
237 ZPOOL_PROP_READONLY,
238 ZPOOL_PROP_ASHIFT,
239 ZPOOL_PROP_COMMENT,
240 ZPOOL_PROP_EXPANDSZ,
241 ZPOOL_PROP_FREEING,
242 ZPOOL_PROP_FRAGMENTATION,
243 ZPOOL_PROP_LEAKED,
244 ZPOOL_PROP_MAXBLOCKSIZE,
245 ZPOOL_PROP_TNAME,
246 ZPOOL_PROP_MAXDNODESIZE,
247 ZPOOL_PROP_MULTIHOST,
248 ZPOOL_PROP_CHECKPOINT,
249 ZPOOL_PROP_LOAD_GUID,
250 ZPOOL_PROP_AUTOTRIM,
251 ZPOOL_PROP_COMPATIBILITY,
252 ZPOOL_NUM_PROPS
253 } zpool_prop_t;
254
255 /* Small enough to not hog a whole line of printout in zpool(8). */
256 #define ZPROP_MAX_COMMENT 32
257 #define ZPROP_BOOLEAN_NA 2
258
259 #define ZPROP_VALUE "value"
260 #define ZPROP_SOURCE "source"
261
262 typedef enum {
263 ZPROP_SRC_NONE = 0x1,
264 ZPROP_SRC_DEFAULT = 0x2,
265 ZPROP_SRC_TEMPORARY = 0x4,
266 ZPROP_SRC_LOCAL = 0x8,
267 ZPROP_SRC_INHERITED = 0x10,
268 ZPROP_SRC_RECEIVED = 0x20
269 } zprop_source_t;
270
271 #define ZPROP_SRC_ALL 0x3f
272
273 #define ZPROP_SOURCE_VAL_RECVD "$recvd"
274 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
275
276 /*
277 * Dataset flag implemented as a special entry in the props zap object
278 * indicating that the dataset has received properties on or after
279 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
280 * just as it did in earlier versions, and thereafter, local properties are
281 * preserved.
282 */
283 #define ZPROP_HAS_RECVD "$hasrecvd"
284
285 typedef enum {
286 ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
287 ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
288 } zprop_errflags_t;
289
290 typedef int (*zprop_func)(int, void *);
291
292 /*
293 * Properties to be set on the root file system of a new pool
294 * are stuffed into their own nvlist, which is then included in
295 * the properties nvlist with the pool properties.
296 */
297 #define ZPOOL_ROOTFS_PROPS "root-props-nvl"
298
299 /*
300 * Length of 'written@' and 'written#'
301 */
302 #define ZFS_WRITTEN_PROP_PREFIX_LEN 8
303
304 /*
305 * VDEV properties are identified by these constants and must be added to the
306 * end of this list to ensure that external consumers are not affected
307 * by the change. If you make any changes to this list, be sure to update
308 * the property table in usr/src/common/zfs/zpool_prop.c.
309 */
310 typedef enum {
311 VDEV_PROP_INVAL = -1,
312 #define VDEV_PROP_USER VDEV_PROP_INVAL
313 VDEV_PROP_NAME,
314 VDEV_PROP_CAPACITY,
315 VDEV_PROP_STATE,
316 VDEV_PROP_GUID,
317 VDEV_PROP_ASIZE,
318 VDEV_PROP_PSIZE,
319 VDEV_PROP_ASHIFT,
320 VDEV_PROP_SIZE,
321 VDEV_PROP_FREE,
322 VDEV_PROP_ALLOCATED,
323 VDEV_PROP_COMMENT,
324 VDEV_PROP_EXPANDSZ,
325 VDEV_PROP_FRAGMENTATION,
326 VDEV_PROP_BOOTSIZE,
327 VDEV_PROP_PARITY,
328 VDEV_PROP_PATH,
329 VDEV_PROP_DEVID,
330 VDEV_PROP_PHYS_PATH,
331 VDEV_PROP_ENC_PATH,
332 VDEV_PROP_FRU,
333 VDEV_PROP_PARENT,
334 VDEV_PROP_CHILDREN,
335 VDEV_PROP_NUMCHILDREN,
336 VDEV_PROP_READ_ERRORS,
337 VDEV_PROP_WRITE_ERRORS,
338 VDEV_PROP_CHECKSUM_ERRORS,
339 VDEV_PROP_INITIALIZE_ERRORS,
340 VDEV_PROP_OPS_NULL,
341 VDEV_PROP_OPS_READ,
342 VDEV_PROP_OPS_WRITE,
343 VDEV_PROP_OPS_FREE,
344 VDEV_PROP_OPS_CLAIM,
345 VDEV_PROP_OPS_TRIM,
346 VDEV_PROP_BYTES_NULL,
347 VDEV_PROP_BYTES_READ,
348 VDEV_PROP_BYTES_WRITE,
349 VDEV_PROP_BYTES_FREE,
350 VDEV_PROP_BYTES_CLAIM,
351 VDEV_PROP_BYTES_TRIM,
352 VDEV_PROP_REMOVING,
353 VDEV_PROP_ALLOCATING,
354 VDEV_NUM_PROPS
355 } vdev_prop_t;
356
357 /*
358 * Dataset property functions shared between libzfs and kernel.
359 */
360 _SYS_FS_ZFS_H const char *zfs_prop_default_string(zfs_prop_t);
361 _SYS_FS_ZFS_H uint64_t zfs_prop_default_numeric(zfs_prop_t);
362 _SYS_FS_ZFS_H boolean_t zfs_prop_readonly(zfs_prop_t);
363 _SYS_FS_ZFS_H boolean_t zfs_prop_visible(zfs_prop_t prop);
364 _SYS_FS_ZFS_H boolean_t zfs_prop_inheritable(zfs_prop_t);
365 _SYS_FS_ZFS_H boolean_t zfs_prop_setonce(zfs_prop_t);
366 _SYS_FS_ZFS_H boolean_t zfs_prop_encryption_key_param(zfs_prop_t);
367 _SYS_FS_ZFS_H boolean_t zfs_prop_valid_keylocation(const char *, boolean_t);
368 _SYS_FS_ZFS_H const char *zfs_prop_to_name(zfs_prop_t);
369 _SYS_FS_ZFS_H zfs_prop_t zfs_name_to_prop(const char *);
370 _SYS_FS_ZFS_H boolean_t zfs_prop_user(const char *);
371 _SYS_FS_ZFS_H boolean_t zfs_prop_userquota(const char *);
372 _SYS_FS_ZFS_H boolean_t zfs_prop_written(const char *);
373 _SYS_FS_ZFS_H int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
374 _SYS_FS_ZFS_H int zfs_prop_string_to_index(zfs_prop_t, const char *,
375 uint64_t *);
376 _SYS_FS_ZFS_H uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
377 _SYS_FS_ZFS_H boolean_t zfs_prop_valid_for_type(int, zfs_type_t, boolean_t);
378
379 /*
380 * Pool property functions shared between libzfs and kernel.
381 */
382 _SYS_FS_ZFS_H zpool_prop_t zpool_name_to_prop(const char *);
383 _SYS_FS_ZFS_H const char *zpool_prop_to_name(zpool_prop_t);
384 _SYS_FS_ZFS_H const char *zpool_prop_default_string(zpool_prop_t);
385 _SYS_FS_ZFS_H uint64_t zpool_prop_default_numeric(zpool_prop_t);
386 _SYS_FS_ZFS_H boolean_t zpool_prop_readonly(zpool_prop_t);
387 _SYS_FS_ZFS_H boolean_t zpool_prop_setonce(zpool_prop_t);
388 _SYS_FS_ZFS_H boolean_t zpool_prop_feature(const char *);
389 _SYS_FS_ZFS_H boolean_t zpool_prop_unsupported(const char *);
390 _SYS_FS_ZFS_H int zpool_prop_index_to_string(zpool_prop_t, uint64_t,
391 const char **);
392 _SYS_FS_ZFS_H int zpool_prop_string_to_index(zpool_prop_t, const char *,
393 uint64_t *);
394 _SYS_FS_ZFS_H uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
395
396 /*
397 * VDEV property functions shared between libzfs and kernel.
398 */
399 _SYS_FS_ZFS_H vdev_prop_t vdev_name_to_prop(const char *);
400 _SYS_FS_ZFS_H boolean_t vdev_prop_user(const char *name);
401 _SYS_FS_ZFS_H const char *vdev_prop_to_name(vdev_prop_t);
402 _SYS_FS_ZFS_H const char *vdev_prop_default_string(vdev_prop_t);
403 _SYS_FS_ZFS_H uint64_t vdev_prop_default_numeric(vdev_prop_t);
404 _SYS_FS_ZFS_H boolean_t vdev_prop_readonly(vdev_prop_t prop);
405 _SYS_FS_ZFS_H int vdev_prop_index_to_string(vdev_prop_t, uint64_t,
406 const char **);
407 _SYS_FS_ZFS_H int vdev_prop_string_to_index(vdev_prop_t, const char *,
408 uint64_t *);
409 _SYS_FS_ZFS_H boolean_t zpool_prop_vdev(const char *name);
410 _SYS_FS_ZFS_H uint64_t vdev_prop_random_value(vdev_prop_t prop, uint64_t seed);
411
412 /*
413 * Definitions for the Delegation.
414 */
415 typedef enum {
416 ZFS_DELEG_WHO_UNKNOWN = 0,
417 ZFS_DELEG_USER = 'u',
418 ZFS_DELEG_USER_SETS = 'U',
419 ZFS_DELEG_GROUP = 'g',
420 ZFS_DELEG_GROUP_SETS = 'G',
421 ZFS_DELEG_EVERYONE = 'e',
422 ZFS_DELEG_EVERYONE_SETS = 'E',
423 ZFS_DELEG_CREATE = 'c',
424 ZFS_DELEG_CREATE_SETS = 'C',
425 ZFS_DELEG_NAMED_SET = 's',
426 ZFS_DELEG_NAMED_SET_SETS = 'S'
427 } zfs_deleg_who_type_t;
428
429 typedef enum {
430 ZFS_DELEG_NONE = 0,
431 ZFS_DELEG_PERM_LOCAL = 1,
432 ZFS_DELEG_PERM_DESCENDENT = 2,
433 ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
434 ZFS_DELEG_PERM_CREATE = 4
435 } zfs_deleg_inherit_t;
436
437 #define ZFS_DELEG_PERM_UID "uid"
438 #define ZFS_DELEG_PERM_GID "gid"
439 #define ZFS_DELEG_PERM_GROUPS "groups"
440
441 #define ZFS_MLSLABEL_DEFAULT "none"
442
443 #define ZFS_SMB_ACL_SRC "src"
444 #define ZFS_SMB_ACL_TARGET "target"
445
446 typedef enum {
447 ZFS_CANMOUNT_OFF = 0,
448 ZFS_CANMOUNT_ON = 1,
449 ZFS_CANMOUNT_NOAUTO = 2
450 } zfs_canmount_type_t;
451
452 typedef enum {
453 ZFS_LOGBIAS_LATENCY = 0,
454 ZFS_LOGBIAS_THROUGHPUT = 1
455 } zfs_logbias_op_t;
456
457 typedef enum zfs_share_op {
458 ZFS_SHARE_NFS = 0,
459 ZFS_UNSHARE_NFS = 1,
460 ZFS_SHARE_SMB = 2,
461 ZFS_UNSHARE_SMB = 3
462 } zfs_share_op_t;
463
464 typedef enum zfs_smb_acl_op {
465 ZFS_SMB_ACL_ADD,
466 ZFS_SMB_ACL_REMOVE,
467 ZFS_SMB_ACL_RENAME,
468 ZFS_SMB_ACL_PURGE
469 } zfs_smb_acl_op_t;
470
471 typedef enum zfs_cache_type {
472 ZFS_CACHE_NONE = 0,
473 ZFS_CACHE_METADATA = 1,
474 ZFS_CACHE_ALL = 2
475 } zfs_cache_type_t;
476
477 typedef enum {
478 ZFS_SYNC_STANDARD = 0,
479 ZFS_SYNC_ALWAYS = 1,
480 ZFS_SYNC_DISABLED = 2
481 } zfs_sync_type_t;
482
483 typedef enum {
484 ZFS_XATTR_OFF = 0,
485 ZFS_XATTR_DIR = 1,
486 ZFS_XATTR_SA = 2
487 } zfs_xattr_type_t;
488
489 typedef enum {
490 ZFS_DNSIZE_LEGACY = 0,
491 ZFS_DNSIZE_AUTO = 1,
492 ZFS_DNSIZE_1K = 1024,
493 ZFS_DNSIZE_2K = 2048,
494 ZFS_DNSIZE_4K = 4096,
495 ZFS_DNSIZE_8K = 8192,
496 ZFS_DNSIZE_16K = 16384
497 } zfs_dnsize_type_t;
498
499 typedef enum {
500 ZFS_REDUNDANT_METADATA_ALL,
501 ZFS_REDUNDANT_METADATA_MOST
502 } zfs_redundant_metadata_type_t;
503
504 typedef enum {
505 ZFS_VOLMODE_DEFAULT = 0,
506 ZFS_VOLMODE_GEOM = 1,
507 ZFS_VOLMODE_DEV = 2,
508 ZFS_VOLMODE_NONE = 3
509 } zfs_volmode_t;
510
511 typedef enum zfs_keystatus {
512 ZFS_KEYSTATUS_NONE = 0,
513 ZFS_KEYSTATUS_UNAVAILABLE,
514 ZFS_KEYSTATUS_AVAILABLE,
515 } zfs_keystatus_t;
516
517 typedef enum zfs_keyformat {
518 ZFS_KEYFORMAT_NONE = 0,
519 ZFS_KEYFORMAT_RAW,
520 ZFS_KEYFORMAT_HEX,
521 ZFS_KEYFORMAT_PASSPHRASE,
522 ZFS_KEYFORMAT_FORMATS
523 } zfs_keyformat_t;
524
525 typedef enum zfs_key_location {
526 ZFS_KEYLOCATION_NONE = 0,
527 ZFS_KEYLOCATION_PROMPT,
528 ZFS_KEYLOCATION_URI,
529 ZFS_KEYLOCATION_LOCATIONS
530 } zfs_keylocation_t;
531
532 #define DEFAULT_PBKDF2_ITERATIONS 350000
533 #define MIN_PBKDF2_ITERATIONS 100000
534
535 /*
536 * On-disk version number.
537 */
538 #define SPA_VERSION_1 1ULL
539 #define SPA_VERSION_2 2ULL
540 #define SPA_VERSION_3 3ULL
541 #define SPA_VERSION_4 4ULL
542 #define SPA_VERSION_5 5ULL
543 #define SPA_VERSION_6 6ULL
544 #define SPA_VERSION_7 7ULL
545 #define SPA_VERSION_8 8ULL
546 #define SPA_VERSION_9 9ULL
547 #define SPA_VERSION_10 10ULL
548 #define SPA_VERSION_11 11ULL
549 #define SPA_VERSION_12 12ULL
550 #define SPA_VERSION_13 13ULL
551 #define SPA_VERSION_14 14ULL
552 #define SPA_VERSION_15 15ULL
553 #define SPA_VERSION_16 16ULL
554 #define SPA_VERSION_17 17ULL
555 #define SPA_VERSION_18 18ULL
556 #define SPA_VERSION_19 19ULL
557 #define SPA_VERSION_20 20ULL
558 #define SPA_VERSION_21 21ULL
559 #define SPA_VERSION_22 22ULL
560 #define SPA_VERSION_23 23ULL
561 #define SPA_VERSION_24 24ULL
562 #define SPA_VERSION_25 25ULL
563 #define SPA_VERSION_26 26ULL
564 #define SPA_VERSION_27 27ULL
565 #define SPA_VERSION_28 28ULL
566 #define SPA_VERSION_5000 5000ULL
567
568 /*
569 * The incrementing pool version number has been replaced by pool feature
570 * flags. For more details, see zfeature.c.
571 */
572 #define SPA_VERSION SPA_VERSION_5000
573 #define SPA_VERSION_STRING "5000"
574
575 /*
576 * Symbolic names for the changes that caused a SPA_VERSION switch.
577 * Used in the code when checking for presence or absence of a feature.
578 * Feel free to define multiple symbolic names for each version if there
579 * were multiple changes to on-disk structures during that version.
580 *
581 * NOTE: When checking the current SPA_VERSION in your code, be sure
582 * to use spa_version() since it reports the version of the
583 * last synced uberblock. Checking the in-flight version can
584 * be dangerous in some cases.
585 */
586 #define SPA_VERSION_INITIAL SPA_VERSION_1
587 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
588 #define SPA_VERSION_SPARES SPA_VERSION_3
589 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3
590 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
591 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
592 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
593 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
594 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
595 #define SPA_VERSION_BOOTFS SPA_VERSION_6
596 #define SPA_VERSION_SLOGS SPA_VERSION_7
597 #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
598 #define SPA_VERSION_FUID SPA_VERSION_9
599 #define SPA_VERSION_REFRESERVATION SPA_VERSION_9
600 #define SPA_VERSION_REFQUOTA SPA_VERSION_9
601 #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
602 #define SPA_VERSION_L2CACHE SPA_VERSION_10
603 #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
604 #define SPA_VERSION_ORIGIN SPA_VERSION_11
605 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
606 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
607 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
608 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
609 #define SPA_VERSION_USERSPACE SPA_VERSION_15
610 #define SPA_VERSION_STMF_PROP SPA_VERSION_16
611 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17
612 #define SPA_VERSION_USERREFS SPA_VERSION_18
613 #define SPA_VERSION_HOLES SPA_VERSION_19
614 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
615 #define SPA_VERSION_DEDUP SPA_VERSION_21
616 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
617 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
618 #define SPA_VERSION_SA SPA_VERSION_24
619 #define SPA_VERSION_SCAN SPA_VERSION_25
620 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26
621 #define SPA_VERSION_DEADLISTS SPA_VERSION_26
622 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27
623 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
624 #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28
625 #define SPA_VERSION_FEATURES SPA_VERSION_5000
626
627 #define SPA_VERSION_IS_SUPPORTED(v) \
628 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
629 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
630
631 /*
632 * ZPL version - rev'd whenever an incompatible on-disk format change
633 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
634 * also update the version_table[] and help message in zfs_prop.c.
635 */
636 #define ZPL_VERSION_1 1ULL
637 #define ZPL_VERSION_2 2ULL
638 #define ZPL_VERSION_3 3ULL
639 #define ZPL_VERSION_4 4ULL
640 #define ZPL_VERSION_5 5ULL
641 #define ZPL_VERSION ZPL_VERSION_5
642 #define ZPL_VERSION_STRING "5"
643
644 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
645 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
646 #define ZPL_VERSION_FUID ZPL_VERSION_3
647 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
648 #define ZPL_VERSION_SYSATTR ZPL_VERSION_3
649 #define ZPL_VERSION_USERSPACE ZPL_VERSION_4
650 #define ZPL_VERSION_SA ZPL_VERSION_5
651
652 /* Persistent L2ARC version */
653 #define L2ARC_PERSISTENT_VERSION_1 1ULL
654 #define L2ARC_PERSISTENT_VERSION L2ARC_PERSISTENT_VERSION_1
655 #define L2ARC_PERSISTENT_VERSION_STRING "1"
656
657 /* Rewind policy information */
658 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
659 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
660 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
661 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
662 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
663 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
664 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
665
666 typedef struct zpool_load_policy {
667 uint32_t zlp_rewind; /* rewind policy requested */
668 uint64_t zlp_maxmeta; /* max acceptable meta-data errors */
669 uint64_t zlp_maxdata; /* max acceptable data errors */
670 uint64_t zlp_txg; /* specific txg to load */
671 } zpool_load_policy_t;
672
673 /*
674 * The following are configuration names used in the nvlist describing a pool's
675 * configuration. New on-disk names should be prefixed with "<reversed-DNS>:"
676 * (e.g. "org.openzfs:") to avoid conflicting names being developed
677 * independently.
678 */
679 #define ZPOOL_CONFIG_VERSION "version"
680 #define ZPOOL_CONFIG_POOL_NAME "name"
681 #define ZPOOL_CONFIG_POOL_STATE "state"
682 #define ZPOOL_CONFIG_POOL_TXG "txg"
683 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
684 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
685 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
686 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
687 #define ZPOOL_CONFIG_TYPE "type"
688 #define ZPOOL_CONFIG_CHILDREN "children"
689 #define ZPOOL_CONFIG_ID "id"
690 #define ZPOOL_CONFIG_GUID "guid"
691 #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object"
692 #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births"
693 #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
694 #define ZPOOL_CONFIG_PATH "path"
695 #define ZPOOL_CONFIG_DEVID "devid"
696 #define ZPOOL_CONFIG_SPARE_ID "spareid"
697 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
698 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
699 #define ZPOOL_CONFIG_ASHIFT "ashift"
700 #define ZPOOL_CONFIG_ASIZE "asize"
701 #define ZPOOL_CONFIG_DTL "DTL"
702 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
703 #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */
704 #define ZPOOL_CONFIG_CHECKPOINT_STATS "checkpoint_stats" /* not on disk */
705 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
706 #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */
707
708 /* container nvlist of extended stats */
709 #define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex"
710
711 /* Active queue read/write stats */
712 #define ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE "vdev_sync_r_active_queue"
713 #define ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE "vdev_sync_w_active_queue"
714 #define ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE "vdev_async_r_active_queue"
715 #define ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE "vdev_async_w_active_queue"
716 #define ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE "vdev_async_scrub_active_queue"
717 #define ZPOOL_CONFIG_VDEV_TRIM_ACTIVE_QUEUE "vdev_async_trim_active_queue"
718 #define ZPOOL_CONFIG_VDEV_REBUILD_ACTIVE_QUEUE "vdev_rebuild_active_queue"
719
720 /* Queue sizes */
721 #define ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE "vdev_sync_r_pend_queue"
722 #define ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE "vdev_sync_w_pend_queue"
723 #define ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE "vdev_async_r_pend_queue"
724 #define ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE "vdev_async_w_pend_queue"
725 #define ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE "vdev_async_scrub_pend_queue"
726 #define ZPOOL_CONFIG_VDEV_TRIM_PEND_QUEUE "vdev_async_trim_pend_queue"
727 #define ZPOOL_CONFIG_VDEV_REBUILD_PEND_QUEUE "vdev_rebuild_pend_queue"
728
729 /* Latency read/write histogram stats */
730 #define ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO "vdev_tot_r_lat_histo"
731 #define ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO "vdev_tot_w_lat_histo"
732 #define ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO "vdev_disk_r_lat_histo"
733 #define ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO "vdev_disk_w_lat_histo"
734 #define ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO "vdev_sync_r_lat_histo"
735 #define ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO "vdev_sync_w_lat_histo"
736 #define ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO "vdev_async_r_lat_histo"
737 #define ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO "vdev_async_w_lat_histo"
738 #define ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO "vdev_scrub_histo"
739 #define ZPOOL_CONFIG_VDEV_TRIM_LAT_HISTO "vdev_trim_histo"
740 #define ZPOOL_CONFIG_VDEV_REBUILD_LAT_HISTO "vdev_rebuild_histo"
741
742 /* Request size histograms */
743 #define ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO "vdev_sync_ind_r_histo"
744 #define ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO "vdev_sync_ind_w_histo"
745 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO "vdev_async_ind_r_histo"
746 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO "vdev_async_ind_w_histo"
747 #define ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO "vdev_ind_scrub_histo"
748 #define ZPOOL_CONFIG_VDEV_IND_TRIM_HISTO "vdev_ind_trim_histo"
749 #define ZPOOL_CONFIG_VDEV_IND_REBUILD_HISTO "vdev_ind_rebuild_histo"
750 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO "vdev_sync_agg_r_histo"
751 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO "vdev_sync_agg_w_histo"
752 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO "vdev_async_agg_r_histo"
753 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO "vdev_async_agg_w_histo"
754 #define ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO "vdev_agg_scrub_histo"
755 #define ZPOOL_CONFIG_VDEV_AGG_TRIM_HISTO "vdev_agg_trim_histo"
756 #define ZPOOL_CONFIG_VDEV_AGG_REBUILD_HISTO "vdev_agg_rebuild_histo"
757
758 /* Number of slow IOs */
759 #define ZPOOL_CONFIG_VDEV_SLOW_IOS "vdev_slow_ios"
760
761 /* vdev enclosure sysfs path */
762 #define ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH "vdev_enc_sysfs_path"
763
764 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
765 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
766 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
767 #define ZPOOL_CONFIG_SPARES "spares"
768 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
769 #define ZPOOL_CONFIG_NPARITY "nparity"
770 #define ZPOOL_CONFIG_HOSTID "hostid"
771 #define ZPOOL_CONFIG_HOSTNAME "hostname"
772 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
773 #define ZPOOL_CONFIG_UNSPARE "unspare"
774 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
775 #define ZPOOL_CONFIG_IS_LOG "is_log"
776 #define ZPOOL_CONFIG_L2CACHE "l2cache"
777 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
778 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
779 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
780 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
781 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
782 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
783 #define ZPOOL_CONFIG_SPLIT "splitcfg"
784 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
785 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
786 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
787 #define ZPOOL_CONFIG_NONALLOCATING "non_allocating"
788 #define ZPOOL_CONFIG_REMOVING "removing"
789 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
790 #define ZPOOL_CONFIG_REBUILD_TXG "rebuild_txg"
791 #define ZPOOL_CONFIG_COMMENT "comment"
792 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
793 #define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */
794 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
795 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
796 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
797 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
798 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
799 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
800 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
801 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
802 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
803 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
804 #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */
805 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
806 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
807 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
808 #define ZPOOL_CONFIG_RESILVER_DEFER "com.datto:resilver_defer"
809 #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */
810 #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */
811 #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */
812 #define ZPOOL_CONFIG_MMP_SEQ "mmp_seq" /* not stored on disk */
813 #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */
814 #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */
815 #define ZPOOL_CONFIG_ALLOCATION_BIAS "alloc_bias" /* not stored on disk */
816 #define ZPOOL_CONFIG_EXPANSION_TIME "expansion_time" /* not stored */
817 #define ZPOOL_CONFIG_REBUILD_STATS "org.openzfs:rebuild_stats"
818 #define ZPOOL_CONFIG_COMPATIBILITY "compatibility"
819
820 /*
821 * The persistent vdev state is stored as separate values rather than a single
822 * 'vdev_state' entry. This is because a device can be in multiple states, such
823 * as offline and degraded.
824 */
825 #define ZPOOL_CONFIG_OFFLINE "offline"
826 #define ZPOOL_CONFIG_FAULTED "faulted"
827 #define ZPOOL_CONFIG_DEGRADED "degraded"
828 #define ZPOOL_CONFIG_REMOVED "removed"
829 #define ZPOOL_CONFIG_FRU "fru"
830 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
831
832 /* Pool load policy parameters */
833 #define ZPOOL_LOAD_POLICY "load-policy"
834 #define ZPOOL_LOAD_REWIND_POLICY "load-rewind-policy"
835 #define ZPOOL_LOAD_REQUEST_TXG "load-request-txg"
836 #define ZPOOL_LOAD_META_THRESH "load-meta-thresh"
837 #define ZPOOL_LOAD_DATA_THRESH "load-data-thresh"
838
839 /* Rewind data discovered */
840 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
841 #define ZPOOL_CONFIG_LOAD_META_ERRORS "verify_meta_errors"
842 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
843 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
844
845 /* dRAID configuration */
846 #define ZPOOL_CONFIG_DRAID_NDATA "draid_ndata"
847 #define ZPOOL_CONFIG_DRAID_NSPARES "draid_nspares"
848 #define ZPOOL_CONFIG_DRAID_NGROUPS "draid_ngroups"
849
850 #define VDEV_TYPE_ROOT "root"
851 #define VDEV_TYPE_MIRROR "mirror"
852 #define VDEV_TYPE_REPLACING "replacing"
853 #define VDEV_TYPE_RAIDZ "raidz"
854 #define VDEV_TYPE_DRAID "draid"
855 #define VDEV_TYPE_DRAID_SPARE "dspare"
856 #define VDEV_TYPE_DISK "disk"
857 #define VDEV_TYPE_FILE "file"
858 #define VDEV_TYPE_MISSING "missing"
859 #define VDEV_TYPE_HOLE "hole"
860 #define VDEV_TYPE_SPARE "spare"
861 #define VDEV_TYPE_LOG "log"
862 #define VDEV_TYPE_L2CACHE "l2cache"
863 #define VDEV_TYPE_INDIRECT "indirect"
864
865 #define VDEV_RAIDZ_MAXPARITY 3
866
867 #define VDEV_DRAID_MAXPARITY 3
868 #define VDEV_DRAID_MIN_CHILDREN 2
869 #define VDEV_DRAID_MAX_CHILDREN UINT8_MAX
870
871 /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
872 #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
873 "com.delphix:indirect_obsolete_sm"
874 #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
875 "com.delphix:obsolete_counts_are_precise"
876 #define VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
877 "com.delphix:pool_checkpoint_sm"
878 #define VDEV_TOP_ZAP_MS_UNFLUSHED_PHYS_TXGS \
879 "com.delphix:ms_unflushed_phys_txgs"
880
881 #define VDEV_TOP_ZAP_VDEV_REBUILD_PHYS \
882 "org.openzfs:vdev_rebuild"
883
884 #define VDEV_TOP_ZAP_ALLOCATION_BIAS \
885 "org.zfsonlinux:allocation_bias"
886
887 /* vdev metaslab allocation bias */
888 #define VDEV_ALLOC_BIAS_LOG "log"
889 #define VDEV_ALLOC_BIAS_SPECIAL "special"
890 #define VDEV_ALLOC_BIAS_DEDUP "dedup"
891
892 /* vdev initialize state */
893 #define VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET \
894 "com.delphix:next_offset_to_initialize"
895 #define VDEV_LEAF_ZAP_INITIALIZE_STATE \
896 "com.delphix:vdev_initialize_state"
897 #define VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME \
898 "com.delphix:vdev_initialize_action_time"
899
900 /* vdev TRIM state */
901 #define VDEV_LEAF_ZAP_TRIM_LAST_OFFSET \
902 "org.zfsonlinux:next_offset_to_trim"
903 #define VDEV_LEAF_ZAP_TRIM_STATE \
904 "org.zfsonlinux:vdev_trim_state"
905 #define VDEV_LEAF_ZAP_TRIM_ACTION_TIME \
906 "org.zfsonlinux:vdev_trim_action_time"
907 #define VDEV_LEAF_ZAP_TRIM_RATE \
908 "org.zfsonlinux:vdev_trim_rate"
909 #define VDEV_LEAF_ZAP_TRIM_PARTIAL \
910 "org.zfsonlinux:vdev_trim_partial"
911 #define VDEV_LEAF_ZAP_TRIM_SECURE \
912 "org.zfsonlinux:vdev_trim_secure"
913
914 /*
915 * This is needed in userland to report the minimum necessary device size.
916 */
917 #define SPA_MINDEVSIZE (64ULL << 20)
918
919 /*
920 * Set if the fragmentation has not yet been calculated. This can happen
921 * because the space maps have not been upgraded or the histogram feature
922 * is not enabled.
923 */
924 #define ZFS_FRAG_INVALID UINT64_MAX
925
926 /*
927 * The location of the pool configuration repository, shared between kernel and
928 * userland.
929 */
930 #define ZPOOL_CACHE_BOOT "/boot/zfs/zpool.cache"
931 #define ZPOOL_CACHE "/etc/zfs/zpool.cache"
932 /*
933 * Settings for zpool compatibility features files
934 */
935 #define ZPOOL_SYSCONF_COMPAT_D SYSCONFDIR "/zfs/compatibility.d"
936 #define ZPOOL_DATA_COMPAT_D PKGDATADIR "/compatibility.d"
937 #define ZPOOL_COMPAT_MAXSIZE 16384
938
939 /*
940 * Hard-wired compatibility settings
941 */
942 #define ZPOOL_COMPAT_LEGACY "legacy"
943 #define ZPOOL_COMPAT_OFF "off"
944
945 /*
946 * vdev states are ordered from least to most healthy.
947 * A vdev that's CANT_OPEN or below is considered unusable.
948 */
949 typedef enum vdev_state {
950 VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */
951 VDEV_STATE_CLOSED, /* Not currently open */
952 VDEV_STATE_OFFLINE, /* Not allowed to open */
953 VDEV_STATE_REMOVED, /* Explicitly removed from system */
954 VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
955 VDEV_STATE_FAULTED, /* External request to fault device */
956 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
957 VDEV_STATE_HEALTHY /* Presumed good */
958 } vdev_state_t;
959
960 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
961
962 /*
963 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
964 * of the vdev stats structure uses these constants to distinguish why.
965 */
966 typedef enum vdev_aux {
967 VDEV_AUX_NONE, /* no error */
968 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
969 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
970 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
971 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
972 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
973 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
974 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
975 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
976 VDEV_AUX_UNSUP_FEAT, /* unsupported features */
977 VDEV_AUX_SPARED, /* hot spare used in another pool */
978 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
979 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
980 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
981 VDEV_AUX_EXTERNAL, /* external diagnosis or forced fault */
982 VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */
983 VDEV_AUX_BAD_ASHIFT, /* vdev ashift is invalid */
984 VDEV_AUX_EXTERNAL_PERSIST, /* persistent forced fault */
985 VDEV_AUX_ACTIVE, /* vdev active on a different host */
986 VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline */
987 VDEV_AUX_ASHIFT_TOO_BIG, /* vdev's min block size is too large */
988 } vdev_aux_t;
989
990 /*
991 * pool state. The following states are written to disk as part of the normal
992 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
993 * states are software abstractions used at various levels to communicate
994 * pool state.
995 */
996 typedef enum pool_state {
997 POOL_STATE_ACTIVE = 0, /* In active use */
998 POOL_STATE_EXPORTED, /* Explicitly exported */
999 POOL_STATE_DESTROYED, /* Explicitly destroyed */
1000 POOL_STATE_SPARE, /* Reserved for hot spare use */
1001 POOL_STATE_L2CACHE, /* Level 2 ARC device */
1002 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
1003 POOL_STATE_UNAVAIL, /* Internal libzfs state */
1004 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
1005 } pool_state_t;
1006
1007 /*
1008 * mmp state. The following states provide additional detail describing
1009 * why a pool couldn't be safely imported.
1010 */
1011 typedef enum mmp_state {
1012 MMP_STATE_ACTIVE = 0, /* In active use */
1013 MMP_STATE_INACTIVE, /* Inactive and safe to import */
1014 MMP_STATE_NO_HOSTID /* System hostid is not set */
1015 } mmp_state_t;
1016
1017 /*
1018 * Scan Functions.
1019 */
1020 typedef enum pool_scan_func {
1021 POOL_SCAN_NONE,
1022 POOL_SCAN_SCRUB,
1023 POOL_SCAN_RESILVER,
1024 POOL_SCAN_FUNCS
1025 } pool_scan_func_t;
1026
1027 /*
1028 * Used to control scrub pause and resume.
1029 */
1030 typedef enum pool_scrub_cmd {
1031 POOL_SCRUB_NORMAL = 0,
1032 POOL_SCRUB_PAUSE,
1033 POOL_SCRUB_FLAGS_END
1034 } pool_scrub_cmd_t;
1035
1036 typedef enum {
1037 CS_NONE,
1038 CS_CHECKPOINT_EXISTS,
1039 CS_CHECKPOINT_DISCARDING,
1040 CS_NUM_STATES
1041 } checkpoint_state_t;
1042
1043 typedef struct pool_checkpoint_stat {
1044 uint64_t pcs_state; /* checkpoint_state_t */
1045 uint64_t pcs_start_time; /* time checkpoint/discard started */
1046 uint64_t pcs_space; /* checkpointed space */
1047 } pool_checkpoint_stat_t;
1048
1049 /*
1050 * ZIO types. Needed to interpret vdev statistics below.
1051 */
1052 typedef enum zio_type {
1053 ZIO_TYPE_NULL = 0,
1054 ZIO_TYPE_READ,
1055 ZIO_TYPE_WRITE,
1056 ZIO_TYPE_FREE,
1057 ZIO_TYPE_CLAIM,
1058 ZIO_TYPE_IOCTL,
1059 ZIO_TYPE_TRIM,
1060 ZIO_TYPES
1061 } zio_type_t;
1062
1063 /*
1064 * Pool statistics. Note: all fields should be 64-bit because this
1065 * is passed between kernel and userland as an nvlist uint64 array.
1066 */
1067 typedef struct pool_scan_stat {
1068 /* values stored on disk */
1069 uint64_t pss_func; /* pool_scan_func_t */
1070 uint64_t pss_state; /* dsl_scan_state_t */
1071 uint64_t pss_start_time; /* scan start time */
1072 uint64_t pss_end_time; /* scan end time */
1073 uint64_t pss_to_examine; /* total bytes to scan */
1074 uint64_t pss_examined; /* total bytes located by scanner */
1075 uint64_t pss_to_process; /* total bytes to process */
1076 uint64_t pss_processed; /* total processed bytes */
1077 uint64_t pss_errors; /* scan errors */
1078
1079 /* values not stored on disk */
1080 uint64_t pss_pass_exam; /* examined bytes per scan pass */
1081 uint64_t pss_pass_start; /* start time of a scan pass */
1082 uint64_t pss_pass_scrub_pause; /* pause time of a scrub pass */
1083 /* cumulative time scrub spent paused, needed for rate calculation */
1084 uint64_t pss_pass_scrub_spent_paused;
1085 uint64_t pss_pass_issued; /* issued bytes per scan pass */
1086 uint64_t pss_issued; /* total bytes checked by scanner */
1087 } pool_scan_stat_t;
1088
1089 typedef struct pool_removal_stat {
1090 uint64_t prs_state; /* dsl_scan_state_t */
1091 uint64_t prs_removing_vdev;
1092 uint64_t prs_start_time;
1093 uint64_t prs_end_time;
1094 uint64_t prs_to_copy; /* bytes that need to be copied */
1095 uint64_t prs_copied; /* bytes copied so far */
1096 /*
1097 * bytes of memory used for indirect mappings.
1098 * This includes all removed vdevs.
1099 */
1100 uint64_t prs_mapping_memory;
1101 } pool_removal_stat_t;
1102
1103 typedef enum dsl_scan_state {
1104 DSS_NONE,
1105 DSS_SCANNING,
1106 DSS_FINISHED,
1107 DSS_CANCELED,
1108 DSS_NUM_STATES
1109 } dsl_scan_state_t;
1110
1111 typedef struct vdev_rebuild_stat {
1112 uint64_t vrs_state; /* vdev_rebuild_state_t */
1113 uint64_t vrs_start_time; /* time_t */
1114 uint64_t vrs_end_time; /* time_t */
1115 uint64_t vrs_scan_time_ms; /* total run time (millisecs) */
1116 uint64_t vrs_bytes_scanned; /* allocated bytes scanned */
1117 uint64_t vrs_bytes_issued; /* read bytes issued */
1118 uint64_t vrs_bytes_rebuilt; /* rebuilt bytes */
1119 uint64_t vrs_bytes_est; /* total bytes to scan */
1120 uint64_t vrs_errors; /* scanning errors */
1121 uint64_t vrs_pass_time_ms; /* pass run time (millisecs) */
1122 uint64_t vrs_pass_bytes_scanned; /* bytes scanned since start/resume */
1123 uint64_t vrs_pass_bytes_issued; /* bytes rebuilt since start/resume */
1124 } vdev_rebuild_stat_t;
1125
1126 /*
1127 * Errata described by https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-ER.
1128 * The ordering of this enum must be maintained to ensure the errata identifiers
1129 * map to the correct documentation. New errata may only be appended to the
1130 * list and must contain corresponding documentation at the above link.
1131 */
1132 typedef enum zpool_errata {
1133 ZPOOL_ERRATA_NONE,
1134 ZPOOL_ERRATA_ZOL_2094_SCRUB,
1135 ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY,
1136 ZPOOL_ERRATA_ZOL_6845_ENCRYPTION,
1137 ZPOOL_ERRATA_ZOL_8308_ENCRYPTION,
1138 } zpool_errata_t;
1139
1140 /*
1141 * Vdev statistics. Note: all fields should be 64-bit because this
1142 * is passed between kernel and user land as an nvlist uint64 array.
1143 *
1144 * The vs_ops[] and vs_bytes[] arrays must always be an array size of 6 in
1145 * order to keep subsequent members at their known fixed offsets. When
1146 * adding a new field it must be added to the end the structure.
1147 */
1148 #define VS_ZIO_TYPES 6
1149
1150 typedef struct vdev_stat {
1151 hrtime_t vs_timestamp; /* time since vdev load */
1152 uint64_t vs_state; /* vdev state */
1153 uint64_t vs_aux; /* see vdev_aux_t */
1154 uint64_t vs_alloc; /* space allocated */
1155 uint64_t vs_space; /* total capacity */
1156 uint64_t vs_dspace; /* deflated capacity */
1157 uint64_t vs_rsize; /* replaceable dev size */
1158 uint64_t vs_esize; /* expandable dev size */
1159 uint64_t vs_ops[VS_ZIO_TYPES]; /* operation count */
1160 uint64_t vs_bytes[VS_ZIO_TYPES]; /* bytes read/written */
1161 uint64_t vs_read_errors; /* read errors */
1162 uint64_t vs_write_errors; /* write errors */
1163 uint64_t vs_checksum_errors; /* checksum errors */
1164 uint64_t vs_initialize_errors; /* initializing errors */
1165 uint64_t vs_self_healed; /* self-healed bytes */
1166 uint64_t vs_scan_removing; /* removing? */
1167 uint64_t vs_scan_processed; /* scan processed bytes */
1168 uint64_t vs_fragmentation; /* device fragmentation */
1169 uint64_t vs_initialize_bytes_done; /* bytes initialized */
1170 uint64_t vs_initialize_bytes_est; /* total bytes to initialize */
1171 uint64_t vs_initialize_state; /* vdev_initializing_state_t */
1172 uint64_t vs_initialize_action_time; /* time_t */
1173 uint64_t vs_checkpoint_space; /* checkpoint-consumed space */
1174 uint64_t vs_resilver_deferred; /* resilver deferred */
1175 uint64_t vs_slow_ios; /* slow IOs */
1176 uint64_t vs_trim_errors; /* trimming errors */
1177 uint64_t vs_trim_notsup; /* supported by device */
1178 uint64_t vs_trim_bytes_done; /* bytes trimmed */
1179 uint64_t vs_trim_bytes_est; /* total bytes to trim */
1180 uint64_t vs_trim_state; /* vdev_trim_state_t */
1181 uint64_t vs_trim_action_time; /* time_t */
1182 uint64_t vs_rebuild_processed; /* bytes rebuilt */
1183 uint64_t vs_configured_ashift; /* TLV vdev_ashift */
1184 uint64_t vs_logical_ashift; /* vdev_logical_ashift */
1185 uint64_t vs_physical_ashift; /* vdev_physical_ashift */
1186 uint64_t vs_noalloc; /* allocations halted? */
1187 } vdev_stat_t;
1188
1189 #define VDEV_STAT_VALID(field, uint64_t_field_count) \
1190 ((uint64_t_field_count * sizeof (uint64_t)) >= \
1191 (offsetof(vdev_stat_t, field) + sizeof (((vdev_stat_t *)NULL)->field)))
1192
1193 /*
1194 * Extended stats
1195 *
1196 * These are stats which aren't included in the original iostat output. For
1197 * convenience, they are grouped together in vdev_stat_ex, although each stat
1198 * is individually exported as an nvlist.
1199 */
1200 typedef struct vdev_stat_ex {
1201 /* Number of ZIOs issued to disk and waiting to finish */
1202 uint64_t vsx_active_queue[ZIO_PRIORITY_NUM_QUEUEABLE];
1203
1204 /* Number of ZIOs pending to be issued to disk */
1205 uint64_t vsx_pend_queue[ZIO_PRIORITY_NUM_QUEUEABLE];
1206
1207 /*
1208 * Below are the histograms for various latencies. Buckets are in
1209 * units of nanoseconds.
1210 */
1211
1212 /*
1213 * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in
1214 * before this.
1215 */
1216 #define VDEV_L_HISTO_BUCKETS 37 /* Latency histo buckets */
1217 #define VDEV_RQ_HISTO_BUCKETS 25 /* Request size histo buckets */
1218
1219 /* Amount of time in ZIO queue (ns) */
1220 uint64_t vsx_queue_histo[ZIO_PRIORITY_NUM_QUEUEABLE]
1221 [VDEV_L_HISTO_BUCKETS];
1222
1223 /* Total ZIO latency (ns). Includes queuing and disk access time */
1224 uint64_t vsx_total_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS];
1225
1226 /* Amount of time to read/write the disk (ns) */
1227 uint64_t vsx_disk_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS];
1228
1229 /* "lookup the bucket for a value" histogram macros */
1230 #define HISTO(val, buckets) (val != 0 ? MIN(highbit64(val) - 1, \
1231 buckets - 1) : 0)
1232 #define L_HISTO(a) HISTO(a, VDEV_L_HISTO_BUCKETS)
1233 #define RQ_HISTO(a) HISTO(a, VDEV_RQ_HISTO_BUCKETS)
1234
1235 /* Physical IO histogram */
1236 uint64_t vsx_ind_histo[ZIO_PRIORITY_NUM_QUEUEABLE]
1237 [VDEV_RQ_HISTO_BUCKETS];
1238
1239 /* Delegated (aggregated) physical IO histogram */
1240 uint64_t vsx_agg_histo[ZIO_PRIORITY_NUM_QUEUEABLE]
1241 [VDEV_RQ_HISTO_BUCKETS];
1242
1243 } vdev_stat_ex_t;
1244
1245 /*
1246 * Initialize functions.
1247 */
1248 typedef enum pool_initialize_func {
1249 POOL_INITIALIZE_START,
1250 POOL_INITIALIZE_CANCEL,
1251 POOL_INITIALIZE_SUSPEND,
1252 POOL_INITIALIZE_FUNCS
1253 } pool_initialize_func_t;
1254
1255 /*
1256 * TRIM functions.
1257 */
1258 typedef enum pool_trim_func {
1259 POOL_TRIM_START,
1260 POOL_TRIM_CANCEL,
1261 POOL_TRIM_SUSPEND,
1262 POOL_TRIM_FUNCS
1263 } pool_trim_func_t;
1264
1265 /*
1266 * DDT statistics. Note: all fields should be 64-bit because this
1267 * is passed between kernel and userland as an nvlist uint64 array.
1268 */
1269 typedef struct ddt_object {
1270 uint64_t ddo_count; /* number of elements in ddt */
1271 uint64_t ddo_dspace; /* size of ddt on disk */
1272 uint64_t ddo_mspace; /* size of ddt in-core */
1273 } ddt_object_t;
1274
1275 typedef struct ddt_stat {
1276 uint64_t dds_blocks; /* blocks */
1277 uint64_t dds_lsize; /* logical size */
1278 uint64_t dds_psize; /* physical size */
1279 uint64_t dds_dsize; /* deflated allocated size */
1280 uint64_t dds_ref_blocks; /* referenced blocks */
1281 uint64_t dds_ref_lsize; /* referenced lsize * refcnt */
1282 uint64_t dds_ref_psize; /* referenced psize * refcnt */
1283 uint64_t dds_ref_dsize; /* referenced dsize * refcnt */
1284 } ddt_stat_t;
1285
1286 typedef struct ddt_histogram {
1287 ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */
1288 } ddt_histogram_t;
1289
1290 #define ZVOL_DRIVER "zvol"
1291 #define ZFS_DRIVER "zfs"
1292 #define ZFS_DEV "/dev/zfs"
1293
1294 #define ZFS_SUPER_MAGIC 0x2fc12fc1
1295
1296 /* general zvol path */
1297 #define ZVOL_DIR "/dev/zvol/"
1298
1299 #define ZVOL_MAJOR 230
1300 #define ZVOL_MINOR_BITS 4
1301 #define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1)
1302 #define ZVOL_MINORS (1 << 4)
1303 #define ZVOL_DEV_NAME "zd"
1304
1305 #define ZVOL_PROP_NAME "name"
1306 #define ZVOL_DEFAULT_BLOCKSIZE 16384
1307
1308 typedef enum {
1309 VDEV_INITIALIZE_NONE,
1310 VDEV_INITIALIZE_ACTIVE,
1311 VDEV_INITIALIZE_CANCELED,
1312 VDEV_INITIALIZE_SUSPENDED,
1313 VDEV_INITIALIZE_COMPLETE
1314 } vdev_initializing_state_t;
1315
1316 typedef enum {
1317 VDEV_TRIM_NONE,
1318 VDEV_TRIM_ACTIVE,
1319 VDEV_TRIM_CANCELED,
1320 VDEV_TRIM_SUSPENDED,
1321 VDEV_TRIM_COMPLETE,
1322 } vdev_trim_state_t;
1323
1324 typedef enum {
1325 VDEV_REBUILD_NONE,
1326 VDEV_REBUILD_ACTIVE,
1327 VDEV_REBUILD_CANCELED,
1328 VDEV_REBUILD_COMPLETE,
1329 } vdev_rebuild_state_t;
1330
1331 /*
1332 * nvlist name constants. Facilitate restricting snapshot iteration range for
1333 * the "list next snapshot" ioctl
1334 */
1335 #define SNAP_ITER_MIN_TXG "snap_iter_min_txg"
1336 #define SNAP_ITER_MAX_TXG "snap_iter_max_txg"
1337
1338 /*
1339 * /dev/zfs ioctl numbers.
1340 *
1341 * These numbers cannot change over time. New ioctl numbers must be appended.
1342 */
1343 typedef enum zfs_ioc {
1344 /*
1345 * Core features - 81/128 numbers reserved.
1346 */
1347 #ifdef __FreeBSD__
1348 ZFS_IOC_FIRST = 0,
1349 #else
1350 ZFS_IOC_FIRST = ('Z' << 8),
1351 #endif
1352 ZFS_IOC = ZFS_IOC_FIRST,
1353 ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, /* 0x5a00 */
1354 ZFS_IOC_POOL_DESTROY, /* 0x5a01 */
1355 ZFS_IOC_POOL_IMPORT, /* 0x5a02 */
1356 ZFS_IOC_POOL_EXPORT, /* 0x5a03 */
1357 ZFS_IOC_POOL_CONFIGS, /* 0x5a04 */
1358 ZFS_IOC_POOL_STATS, /* 0x5a05 */
1359 ZFS_IOC_POOL_TRYIMPORT, /* 0x5a06 */
1360 ZFS_IOC_POOL_SCAN, /* 0x5a07 */
1361 ZFS_IOC_POOL_FREEZE, /* 0x5a08 */
1362 ZFS_IOC_POOL_UPGRADE, /* 0x5a09 */
1363 ZFS_IOC_POOL_GET_HISTORY, /* 0x5a0a */
1364 ZFS_IOC_VDEV_ADD, /* 0x5a0b */
1365 ZFS_IOC_VDEV_REMOVE, /* 0x5a0c */
1366 ZFS_IOC_VDEV_SET_STATE, /* 0x5a0d */
1367 ZFS_IOC_VDEV_ATTACH, /* 0x5a0e */
1368 ZFS_IOC_VDEV_DETACH, /* 0x5a0f */
1369 ZFS_IOC_VDEV_SETPATH, /* 0x5a10 */
1370 ZFS_IOC_VDEV_SETFRU, /* 0x5a11 */
1371 ZFS_IOC_OBJSET_STATS, /* 0x5a12 */
1372 ZFS_IOC_OBJSET_ZPLPROPS, /* 0x5a13 */
1373 ZFS_IOC_DATASET_LIST_NEXT, /* 0x5a14 */
1374 ZFS_IOC_SNAPSHOT_LIST_NEXT, /* 0x5a15 */
1375 ZFS_IOC_SET_PROP, /* 0x5a16 */
1376 ZFS_IOC_CREATE, /* 0x5a17 */
1377 ZFS_IOC_DESTROY, /* 0x5a18 */
1378 ZFS_IOC_ROLLBACK, /* 0x5a19 */
1379 ZFS_IOC_RENAME, /* 0x5a1a */
1380 ZFS_IOC_RECV, /* 0x5a1b */
1381 ZFS_IOC_SEND, /* 0x5a1c */
1382 ZFS_IOC_INJECT_FAULT, /* 0x5a1d */
1383 ZFS_IOC_CLEAR_FAULT, /* 0x5a1e */
1384 ZFS_IOC_INJECT_LIST_NEXT, /* 0x5a1f */
1385 ZFS_IOC_ERROR_LOG, /* 0x5a20 */
1386 ZFS_IOC_CLEAR, /* 0x5a21 */
1387 ZFS_IOC_PROMOTE, /* 0x5a22 */
1388 ZFS_IOC_SNAPSHOT, /* 0x5a23 */
1389 ZFS_IOC_DSOBJ_TO_DSNAME, /* 0x5a24 */
1390 ZFS_IOC_OBJ_TO_PATH, /* 0x5a25 */
1391 ZFS_IOC_POOL_SET_PROPS, /* 0x5a26 */
1392 ZFS_IOC_POOL_GET_PROPS, /* 0x5a27 */
1393 ZFS_IOC_SET_FSACL, /* 0x5a28 */
1394 ZFS_IOC_GET_FSACL, /* 0x5a29 */
1395 ZFS_IOC_SHARE, /* 0x5a2a */
1396 ZFS_IOC_INHERIT_PROP, /* 0x5a2b */
1397 ZFS_IOC_SMB_ACL, /* 0x5a2c */
1398 ZFS_IOC_USERSPACE_ONE, /* 0x5a2d */
1399 ZFS_IOC_USERSPACE_MANY, /* 0x5a2e */
1400 ZFS_IOC_USERSPACE_UPGRADE, /* 0x5a2f */
1401 ZFS_IOC_HOLD, /* 0x5a30 */
1402 ZFS_IOC_RELEASE, /* 0x5a31 */
1403 ZFS_IOC_GET_HOLDS, /* 0x5a32 */
1404 ZFS_IOC_OBJSET_RECVD_PROPS, /* 0x5a33 */
1405 ZFS_IOC_VDEV_SPLIT, /* 0x5a34 */
1406 ZFS_IOC_NEXT_OBJ, /* 0x5a35 */
1407 ZFS_IOC_DIFF, /* 0x5a36 */
1408 ZFS_IOC_TMP_SNAPSHOT, /* 0x5a37 */
1409 ZFS_IOC_OBJ_TO_STATS, /* 0x5a38 */
1410 ZFS_IOC_SPACE_WRITTEN, /* 0x5a39 */
1411 ZFS_IOC_SPACE_SNAPS, /* 0x5a3a */
1412 ZFS_IOC_DESTROY_SNAPS, /* 0x5a3b */
1413 ZFS_IOC_POOL_REGUID, /* 0x5a3c */
1414 ZFS_IOC_POOL_REOPEN, /* 0x5a3d */
1415 ZFS_IOC_SEND_PROGRESS, /* 0x5a3e */
1416 ZFS_IOC_LOG_HISTORY, /* 0x5a3f */
1417 ZFS_IOC_SEND_NEW, /* 0x5a40 */
1418 ZFS_IOC_SEND_SPACE, /* 0x5a41 */
1419 ZFS_IOC_CLONE, /* 0x5a42 */
1420 ZFS_IOC_BOOKMARK, /* 0x5a43 */
1421 ZFS_IOC_GET_BOOKMARKS, /* 0x5a44 */
1422 ZFS_IOC_DESTROY_BOOKMARKS, /* 0x5a45 */
1423 ZFS_IOC_RECV_NEW, /* 0x5a46 */
1424 ZFS_IOC_POOL_SYNC, /* 0x5a47 */
1425 ZFS_IOC_CHANNEL_PROGRAM, /* 0x5a48 */
1426 ZFS_IOC_LOAD_KEY, /* 0x5a49 */
1427 ZFS_IOC_UNLOAD_KEY, /* 0x5a4a */
1428 ZFS_IOC_CHANGE_KEY, /* 0x5a4b */
1429 ZFS_IOC_REMAP, /* 0x5a4c */
1430 ZFS_IOC_POOL_CHECKPOINT, /* 0x5a4d */
1431 ZFS_IOC_POOL_DISCARD_CHECKPOINT, /* 0x5a4e */
1432 ZFS_IOC_POOL_INITIALIZE, /* 0x5a4f */
1433 ZFS_IOC_POOL_TRIM, /* 0x5a50 */
1434 ZFS_IOC_REDACT, /* 0x5a51 */
1435 ZFS_IOC_GET_BOOKMARK_PROPS, /* 0x5a52 */
1436 ZFS_IOC_WAIT, /* 0x5a53 */
1437 ZFS_IOC_WAIT_FS, /* 0x5a54 */
1438 ZFS_IOC_VDEV_GET_PROPS, /* 0x5a55 */
1439 ZFS_IOC_VDEV_SET_PROPS, /* 0x5a56 */
1440
1441 /*
1442 * Per-platform (Optional) - 8/128 numbers reserved.
1443 */
1444 ZFS_IOC_PLATFORM = ZFS_IOC_FIRST + 0x80,
1445 ZFS_IOC_EVENTS_NEXT, /* 0x81 (Linux) */
1446 ZFS_IOC_EVENTS_CLEAR, /* 0x82 (Linux) */
1447 ZFS_IOC_EVENTS_SEEK, /* 0x83 (Linux) */
1448 ZFS_IOC_NEXTBOOT, /* 0x84 (FreeBSD) */
1449 ZFS_IOC_JAIL, /* 0x85 (FreeBSD) */
1450 ZFS_IOC_UNJAIL, /* 0x86 (FreeBSD) */
1451 ZFS_IOC_SET_BOOTENV, /* 0x87 */
1452 ZFS_IOC_GET_BOOTENV, /* 0x88 */
1453 ZFS_IOC_LAST
1454 } zfs_ioc_t;
1455
1456 /*
1457 * zvol ioctl to get dataset name
1458 */
1459 #define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
1460
1461 /*
1462 * ZFS-specific error codes used for returning descriptive errors
1463 * to the userland through zfs ioctls.
1464 *
1465 * The enum implicitly includes all the error codes from errno.h.
1466 * New code should use and extend this enum for errors that are
1467 * not described precisely by generic errno codes.
1468 *
1469 * These numbers should not change over time. New entries should be appended.
1470 *
1471 * (Keep in sync with contrib/pyzfs/libzfs_core/_constants.py)
1472 */
1473 typedef enum {
1474 ZFS_ERR_CHECKPOINT_EXISTS = 1024,
1475 ZFS_ERR_DISCARDING_CHECKPOINT,
1476 ZFS_ERR_NO_CHECKPOINT,
1477 ZFS_ERR_DEVRM_IN_PROGRESS,
1478 ZFS_ERR_VDEV_TOO_BIG,
1479 ZFS_ERR_IOC_CMD_UNAVAIL,
1480 ZFS_ERR_IOC_ARG_UNAVAIL,
1481 ZFS_ERR_IOC_ARG_REQUIRED,
1482 ZFS_ERR_IOC_ARG_BADTYPE,
1483 ZFS_ERR_WRONG_PARENT,
1484 ZFS_ERR_FROM_IVSET_GUID_MISSING,
1485 ZFS_ERR_FROM_IVSET_GUID_MISMATCH,
1486 ZFS_ERR_SPILL_BLOCK_FLAG_MISSING,
1487 ZFS_ERR_UNKNOWN_SEND_STREAM_FEATURE,
1488 ZFS_ERR_EXPORT_IN_PROGRESS,
1489 ZFS_ERR_BOOKMARK_SOURCE_NOT_ANCESTOR,
1490 ZFS_ERR_STREAM_TRUNCATED,
1491 ZFS_ERR_STREAM_LARGE_BLOCK_MISMATCH,
1492 ZFS_ERR_RESILVER_IN_PROGRESS,
1493 ZFS_ERR_REBUILD_IN_PROGRESS,
1494 ZFS_ERR_BADPROP,
1495 ZFS_ERR_VDEV_NOTSUP,
1496 } zfs_errno_t;
1497
1498 /*
1499 * Internal SPA load state. Used by FMA diagnosis engine.
1500 */
1501 typedef enum {
1502 SPA_LOAD_NONE, /* no load in progress */
1503 SPA_LOAD_OPEN, /* normal open */
1504 SPA_LOAD_IMPORT, /* import in progress */
1505 SPA_LOAD_TRYIMPORT, /* tryimport in progress */
1506 SPA_LOAD_RECOVER, /* recovery requested */
1507 SPA_LOAD_ERROR, /* load failed */
1508 SPA_LOAD_CREATE /* creation in progress */
1509 } spa_load_state_t;
1510
1511 typedef enum {
1512 ZPOOL_WAIT_CKPT_DISCARD,
1513 ZPOOL_WAIT_FREE,
1514 ZPOOL_WAIT_INITIALIZE,
1515 ZPOOL_WAIT_REPLACE,
1516 ZPOOL_WAIT_REMOVE,
1517 ZPOOL_WAIT_RESILVER,
1518 ZPOOL_WAIT_SCRUB,
1519 ZPOOL_WAIT_TRIM,
1520 ZPOOL_WAIT_NUM_ACTIVITIES
1521 } zpool_wait_activity_t;
1522
1523 typedef enum {
1524 ZFS_WAIT_DELETEQ,
1525 ZFS_WAIT_NUM_ACTIVITIES
1526 } zfs_wait_activity_t;
1527
1528 /*
1529 * Bookmark name values.
1530 */
1531 #define ZPOOL_ERR_LIST "error list"
1532 #define ZPOOL_ERR_DATASET "dataset"
1533 #define ZPOOL_ERR_OBJECT "object"
1534
1535 #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
1536
1537 /*
1538 * The following are names used in the nvlist describing
1539 * the pool's history log.
1540 */
1541 #define ZPOOL_HIST_RECORD "history record"
1542 #define ZPOOL_HIST_TIME "history time"
1543 #define ZPOOL_HIST_CMD "history command"
1544 #define ZPOOL_HIST_WHO "history who"
1545 #define ZPOOL_HIST_ZONE "history zone"
1546 #define ZPOOL_HIST_HOST "history hostname"
1547 #define ZPOOL_HIST_TXG "history txg"
1548 #define ZPOOL_HIST_INT_EVENT "history internal event"
1549 #define ZPOOL_HIST_INT_STR "history internal str"
1550 #define ZPOOL_HIST_INT_NAME "internal_name"
1551 #define ZPOOL_HIST_IOCTL "ioctl"
1552 #define ZPOOL_HIST_INPUT_NVL "in_nvl"
1553 #define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
1554 #define ZPOOL_HIST_OUTPUT_SIZE "out_size"
1555 #define ZPOOL_HIST_DSNAME "dsname"
1556 #define ZPOOL_HIST_DSID "dsid"
1557 #define ZPOOL_HIST_ERRNO "errno"
1558 #define ZPOOL_HIST_ELAPSED_NS "elapsed_ns"
1559
1560 /*
1561 * Special nvlist name that will not have its args recorded in the pool's
1562 * history log.
1563 */
1564 #define ZPOOL_HIDDEN_ARGS "hidden_args"
1565
1566 /*
1567 * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE.
1568 */
1569 #define ZPOOL_INITIALIZE_COMMAND "initialize_command"
1570 #define ZPOOL_INITIALIZE_VDEVS "initialize_vdevs"
1571
1572 /*
1573 * The following are names used when invoking ZFS_IOC_POOL_TRIM.
1574 */
1575 #define ZPOOL_TRIM_COMMAND "trim_command"
1576 #define ZPOOL_TRIM_VDEVS "trim_vdevs"
1577 #define ZPOOL_TRIM_RATE "trim_rate"
1578 #define ZPOOL_TRIM_SECURE "trim_secure"
1579
1580 /*
1581 * The following are names used when invoking ZFS_IOC_POOL_WAIT.
1582 */
1583 #define ZPOOL_WAIT_ACTIVITY "wait_activity"
1584 #define ZPOOL_WAIT_TAG "wait_tag"
1585 #define ZPOOL_WAIT_WAITED "wait_waited"
1586
1587 /*
1588 * The following are names used when invoking ZFS_IOC_VDEV_GET_PROP.
1589 */
1590 #define ZPOOL_VDEV_PROPS_GET_VDEV "vdevprops_get_vdev"
1591 #define ZPOOL_VDEV_PROPS_GET_PROPS "vdevprops_get_props"
1592
1593 /*
1594 * The following are names used when invoking ZFS_IOC_VDEV_SET_PROP.
1595 */
1596 #define ZPOOL_VDEV_PROPS_SET_VDEV "vdevprops_set_vdev"
1597 #define ZPOOL_VDEV_PROPS_SET_PROPS "vdevprops_set_props"
1598
1599 /*
1600 * The following are names used when invoking ZFS_IOC_WAIT_FS.
1601 */
1602 #define ZFS_WAIT_ACTIVITY "wait_activity"
1603 #define ZFS_WAIT_WAITED "wait_waited"
1604
1605 /*
1606 * Flags for ZFS_IOC_VDEV_SET_STATE
1607 */
1608 #define ZFS_ONLINE_CHECKREMOVE 0x1
1609 #define ZFS_ONLINE_UNSPARE 0x2
1610 #define ZFS_ONLINE_FORCEFAULT 0x4
1611 #define ZFS_ONLINE_EXPAND 0x8
1612 #define ZFS_OFFLINE_TEMPORARY 0x1
1613
1614 /*
1615 * Flags for ZFS_IOC_POOL_IMPORT
1616 */
1617 #define ZFS_IMPORT_NORMAL 0x0
1618 #define ZFS_IMPORT_VERBATIM 0x1
1619 #define ZFS_IMPORT_ANY_HOST 0x2
1620 #define ZFS_IMPORT_MISSING_LOG 0x4
1621 #define ZFS_IMPORT_ONLY 0x8
1622 #define ZFS_IMPORT_TEMP_NAME 0x10
1623 #define ZFS_IMPORT_SKIP_MMP 0x20
1624 #define ZFS_IMPORT_LOAD_KEYS 0x40
1625 #define ZFS_IMPORT_CHECKPOINT 0x80
1626
1627 /*
1628 * Channel program argument/return nvlist keys and defaults.
1629 */
1630 #define ZCP_ARG_PROGRAM "program"
1631 #define ZCP_ARG_ARGLIST "arg"
1632 #define ZCP_ARG_SYNC "sync"
1633 #define ZCP_ARG_INSTRLIMIT "instrlimit"
1634 #define ZCP_ARG_MEMLIMIT "memlimit"
1635
1636 #define ZCP_ARG_CLIARGV "argv"
1637
1638 #define ZCP_RET_ERROR "error"
1639 #define ZCP_RET_RETURN "return"
1640
1641 #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000)
1642 #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT)
1643 #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024)
1644 #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT)
1645
1646 /*
1647 * Sysevent payload members. ZFS will generate the following sysevents with the
1648 * given payloads:
1649 *
1650 * ESC_ZFS_RESILVER_START
1651 * ESC_ZFS_RESILVER_FINISH
1652 *
1653 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1654 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1655 * ZFS_EV_RESILVER_TYPE DATA_TYPE_STRING
1656 *
1657 * ESC_ZFS_POOL_DESTROY
1658 * ESC_ZFS_POOL_REGUID
1659 *
1660 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1661 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1662 *
1663 * ESC_ZFS_VDEV_REMOVE
1664 * ESC_ZFS_VDEV_CLEAR
1665 * ESC_ZFS_VDEV_CHECK
1666 *
1667 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1668 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1669 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
1670 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
1671 *
1672 * ESC_ZFS_HISTORY_EVENT
1673 *
1674 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1675 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1676 * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional)
1677 * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional)
1678 * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional)
1679 * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional)
1680 * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional)
1681 * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional)
1682 * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional)
1683 * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional)
1684 * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional)
1685 * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional)
1686 * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional)
1687 * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional)
1688 *
1689 * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1690 * history log nvlist. The keynames will be free of any spaces or other
1691 * characters that could be potentially unexpected to consumers of the
1692 * sysevents.
1693 */
1694 #define ZFS_EV_POOL_NAME "pool_name"
1695 #define ZFS_EV_POOL_GUID "pool_guid"
1696 #define ZFS_EV_VDEV_PATH "vdev_path"
1697 #define ZFS_EV_VDEV_GUID "vdev_guid"
1698 #define ZFS_EV_HIST_TIME "history_time"
1699 #define ZFS_EV_HIST_CMD "history_command"
1700 #define ZFS_EV_HIST_WHO "history_who"
1701 #define ZFS_EV_HIST_ZONE "history_zone"
1702 #define ZFS_EV_HIST_HOST "history_hostname"
1703 #define ZFS_EV_HIST_TXG "history_txg"
1704 #define ZFS_EV_HIST_INT_EVENT "history_internal_event"
1705 #define ZFS_EV_HIST_INT_STR "history_internal_str"
1706 #define ZFS_EV_HIST_INT_NAME "history_internal_name"
1707 #define ZFS_EV_HIST_IOCTL "history_ioctl"
1708 #define ZFS_EV_HIST_DSNAME "history_dsname"
1709 #define ZFS_EV_HIST_DSID "history_dsid"
1710 #define ZFS_EV_RESILVER_TYPE "resilver_type"
1711
1712 /*
1713 * We currently support block sizes from 512 bytes to 16MB.
1714 * The benefits of larger blocks, and thus larger IO, need to be weighed
1715 * against the cost of COWing a giant block to modify one byte, and the
1716 * large latency of reading or writing a large block.
1717 *
1718 * Note that although blocks up to 16MB are supported, the recordsize
1719 * property can not be set larger than zfs_max_recordsize (default 1MB).
1720 * See the comment near zfs_max_recordsize in dsl_dataset.c for details.
1721 *
1722 * Note that although the LSIZE field of the blkptr_t can store sizes up
1723 * to 32MB, the dnode's dn_datablkszsec can only store sizes up to
1724 * 32MB - 512 bytes. Therefore, we limit SPA_MAXBLOCKSIZE to 16MB.
1725 */
1726 #define SPA_MINBLOCKSHIFT 9
1727 #define SPA_OLD_MAXBLOCKSHIFT 17
1728 #define SPA_MAXBLOCKSHIFT 24
1729 #define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
1730 #define SPA_OLD_MAXBLOCKSIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT)
1731 #define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
1732
1733 /* supported encryption algorithms */
1734 enum zio_encrypt {
1735 ZIO_CRYPT_INHERIT = 0,
1736 ZIO_CRYPT_ON,
1737 ZIO_CRYPT_OFF,
1738 ZIO_CRYPT_AES_128_CCM,
1739 ZIO_CRYPT_AES_192_CCM,
1740 ZIO_CRYPT_AES_256_CCM,
1741 ZIO_CRYPT_AES_128_GCM,
1742 ZIO_CRYPT_AES_192_GCM,
1743 ZIO_CRYPT_AES_256_GCM,
1744 ZIO_CRYPT_FUNCTIONS
1745 };
1746
1747 #define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_256_GCM
1748 #define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF
1749
1750 /*
1751 * xattr namespace prefixes. These are forbidden in xattr names.
1752 *
1753 * For cross-platform compatibility, xattrs in the user namespace should not be
1754 * prefixed with the namespace name, but for backwards compatibility with older
1755 * ZFS on Linux versions we do prefix the namespace.
1756 */
1757 #define ZFS_XA_NS_FREEBSD_PREFIX "freebsd:"
1758 #define ZFS_XA_NS_FREEBSD_PREFIX_LEN strlen("freebsd:")
1759 #define ZFS_XA_NS_LINUX_SECURITY_PREFIX "security."
1760 #define ZFS_XA_NS_LINUX_SECURITY_PREFIX_LEN strlen("security.")
1761 #define ZFS_XA_NS_LINUX_SYSTEM_PREFIX "system."
1762 #define ZFS_XA_NS_LINUX_SYSTEM_PREFIX_LEN strlen("system.")
1763 #define ZFS_XA_NS_LINUX_TRUSTED_PREFIX "trusted."
1764 #define ZFS_XA_NS_LINUX_TRUSTED_PREFIX_LEN strlen("trusted.")
1765 #define ZFS_XA_NS_LINUX_USER_PREFIX "user."
1766 #define ZFS_XA_NS_LINUX_USER_PREFIX_LEN strlen("user.")
1767
1768 #define ZFS_XA_NS_PREFIX_MATCH(ns, name) \
1769 (strncmp(name, ZFS_XA_NS_##ns##_PREFIX, \
1770 ZFS_XA_NS_##ns##_PREFIX_LEN) == 0)
1771
1772 #define ZFS_XA_NS_PREFIX_FORBIDDEN(name) \
1773 (ZFS_XA_NS_PREFIX_MATCH(FREEBSD, name) || \
1774 ZFS_XA_NS_PREFIX_MATCH(LINUX_SECURITY, name) || \
1775 ZFS_XA_NS_PREFIX_MATCH(LINUX_SYSTEM, name) || \
1776 ZFS_XA_NS_PREFIX_MATCH(LINUX_TRUSTED, name) || \
1777 ZFS_XA_NS_PREFIX_MATCH(LINUX_USER, name))
1778
1779 #ifdef __cplusplus
1780 }
1781 #endif
1782
1783 #endif /* _SYS_FS_ZFS_H */