1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright (c) 2012, 2024 by Delphix. All rights reserved. 25 * Copyright 2016 RackTop Systems. 26 * Copyright (c) 2017, Intel Corporation. 27 * Copyright (c) 2024-2025, Klara, Inc. 28 */ 29 30 #ifndef _SYS_ZFS_IOCTL_H 31 #define _SYS_ZFS_IOCTL_H 32 33 #include <sys/cred.h> 34 #include <sys/dmu.h> 35 #include <sys/zio.h> 36 #include <sys/dsl_deleg.h> 37 #include <sys/spa.h> 38 #include <sys/zfs_stat.h> 39 40 #ifdef _KERNEL 41 #include <sys/nvpair.h> 42 #endif /* _KERNEL */ 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /* 49 * The structures in this file are passed between userland and the 50 * kernel. Userland may be running a 32-bit process, while the kernel 51 * is 64-bit. Therefore, these structures need to compile the same in 52 * 32-bit and 64-bit. This means not using type "long", and adding 53 * explicit padding so that the 32-bit structure will not be packed more 54 * tightly than the 64-bit structure (which requires 64-bit alignment). 55 */ 56 57 /* 58 * Property values for snapdir 59 */ 60 #define ZFS_SNAPDIR_HIDDEN 0 61 #define ZFS_SNAPDIR_VISIBLE 1 62 #define ZFS_SNAPDIR_DISABLED 2 63 64 /* 65 * Property values for snapdev 66 */ 67 #define ZFS_SNAPDEV_HIDDEN 0 68 #define ZFS_SNAPDEV_VISIBLE 1 69 /* 70 * Property values for acltype 71 */ 72 #define ZFS_ACLTYPE_OFF 0 73 #define ZFS_ACLTYPE_POSIX 1 74 #define ZFS_ACLTYPE_NFSV4 2 75 76 /* 77 * The drr_versioninfo field of the dmu_replay_record has the 78 * following layout: 79 * 80 * 64 56 48 40 32 24 16 8 0 81 * +-------+-------+-------+-------+-------+-------+-------+-------+ 82 * |reserve| feature-flags |C|S| 83 * +-------+-------+-------+-------+-------+-------+-------+-------+ 84 * 85 * The low order two bits indicate the header type: SUBSTREAM (0x1) 86 * or COMPOUNDSTREAM (0x2). Using two bits for this is historical: 87 * this field used to be a version number, where the two version types 88 * were 1 and 2. Using two bits for this allows earlier versions of 89 * the code to be able to recognize send streams that don't use any 90 * of the features indicated by feature flags. 91 * 92 * The top 8 bits are reserved for future expansion. At time of writing there 93 * are no plans for these. If you want to use them, please reach out to the 94 * OpenZFS community, e.g., on GitHub or Slack. 95 */ 96 97 /* 98 * Field manipulation macros for the drr_versioninfo field of the 99 * send stream header. 100 */ 101 #define DMU_GET_STREAM_HDRTYPE(vi) BF64_GET((vi), 0, 2) 102 #define DMU_SET_STREAM_HDRTYPE(vi, x) BF64_SET((vi), 0, 2, x) 103 104 #define DMU_GET_FEATUREFLAGS(vi) BF64_GET((vi), 2, 56) 105 #define DMU_SET_FEATUREFLAGS(vi, x) BF64_SET((vi), 2, 56, x) 106 107 /* 108 * Header types for zfs send streams. 109 */ 110 typedef enum drr_headertype { 111 DMU_SUBSTREAM = 0x1, 112 DMU_COMPOUNDSTREAM = 0x2 113 } drr_headertype_t; 114 115 /* 116 * Feature flags for zfs send streams (flags in drr_versioninfo) 117 */ 118 #define DMU_BACKUP_FEATURE_DEDUP (1 << 0) 119 #define DMU_BACKUP_FEATURE_DEDUPPROPS (1 << 1) 120 #define DMU_BACKUP_FEATURE_SA_SPILL (1 << 2) 121 /* flags #3 - #15 are reserved for incompatible closed-source implementations */ 122 #define DMU_BACKUP_FEATURE_EMBED_DATA (1 << 16) 123 #define DMU_BACKUP_FEATURE_LZ4 (1 << 17) 124 /* flag #18 is reserved for a Delphix feature */ 125 #define DMU_BACKUP_FEATURE_LARGE_BLOCKS (1 << 19) 126 #define DMU_BACKUP_FEATURE_RESUMING (1 << 20) 127 #define DMU_BACKUP_FEATURE_REDACTED (1 << 21) 128 #define DMU_BACKUP_FEATURE_COMPRESSED (1 << 22) 129 #define DMU_BACKUP_FEATURE_LARGE_DNODE (1 << 23) 130 #define DMU_BACKUP_FEATURE_RAW (1 << 24) 131 #define DMU_BACKUP_FEATURE_ZSTD (1 << 25) 132 #define DMU_BACKUP_FEATURE_HOLDS (1 << 26) 133 /* 134 * The SWITCH_TO_LARGE_BLOCKS feature indicates that we can receive 135 * incremental LARGE_BLOCKS streams (those with WRITE records of >128KB) even 136 * if the previous send did not use LARGE_BLOCKS, and thus its large blocks 137 * were split into multiple 128KB WRITE records. (See 138 * flush_write_batch_impl() and receive_object()). Older software that does 139 * not support this flag may encounter a bug when switching to large blocks, 140 * which causes files to incorrectly be zeroed. 141 * 142 * This flag is currently not set on any send streams. In the future, we 143 * intend for incremental send streams of snapshots that have large blocks to 144 * use LARGE_BLOCKS by default, and these streams will also have the 145 * SWITCH_TO_LARGE_BLOCKS feature set. This ensures that streams from the 146 * default use of "zfs send" won't encounter the bug mentioned above. 147 */ 148 #define DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS (1 << 27) 149 #define DMU_BACKUP_FEATURE_LONGNAME (1 << 28) 150 #define DMU_BACKUP_FEATURE_LARGE_MICROZAP (1 << 29) 151 152 /* 153 * Mask of all supported backup features 154 */ 155 #define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_SA_SPILL | \ 156 DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_LZ4 | \ 157 DMU_BACKUP_FEATURE_RESUMING | DMU_BACKUP_FEATURE_LARGE_BLOCKS | \ 158 DMU_BACKUP_FEATURE_COMPRESSED | DMU_BACKUP_FEATURE_LARGE_DNODE | \ 159 DMU_BACKUP_FEATURE_RAW | DMU_BACKUP_FEATURE_HOLDS | \ 160 DMU_BACKUP_FEATURE_REDACTED | DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS | \ 161 DMU_BACKUP_FEATURE_ZSTD | DMU_BACKUP_FEATURE_LONGNAME | \ 162 DMU_BACKUP_FEATURE_LARGE_MICROZAP) 163 164 /* Are all features in the given flag word currently supported? */ 165 #define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK)) 166 167 typedef enum dmu_send_resume_token_version { 168 ZFS_SEND_RESUME_TOKEN_VERSION = 1 169 } dmu_send_resume_token_version_t; 170 171 #define DMU_BACKUP_MAGIC 0x2F5bacbacULL 172 173 /* 174 * Send stream flags. Bits 24-31 are reserved for vendor-specific 175 * implementations and should not be used. 176 */ 177 #define DRR_FLAG_CLONE (1<<0) 178 #define DRR_FLAG_CI_DATA (1<<1) 179 /* 180 * This send stream, if it is a full send, includes the FREE and FREEOBJECT 181 * records that are created by the sending process. This means that the send 182 * stream can be received as a clone, even though it is not an incremental. 183 * This is not implemented as a feature flag, because the receiving side does 184 * not need to have implemented it to receive this stream; it is fully backwards 185 * compatible. We need a flag, though, because full send streams without it 186 * cannot necessarily be received as a clone correctly. 187 */ 188 #define DRR_FLAG_FREERECORDS (1<<2) 189 /* 190 * When DRR_FLAG_SPILL_BLOCK is set it indicates the DRR_OBJECT_SPILL 191 * and DRR_SPILL_UNMODIFIED flags are meaningful in the send stream. 192 * 193 * When DRR_FLAG_SPILL_BLOCK is set, DRR_OBJECT records will have 194 * DRR_OBJECT_SPILL set if and only if they should have a spill block 195 * (either an existing one, or a new one in the send stream). When clear 196 * the object does not have a spill block and any existing spill block 197 * should be freed. 198 * 199 * Similarly, when DRR_FLAG_SPILL_BLOCK is set, DRR_SPILL records will 200 * have DRR_SPILL_UNMODIFIED set if and only if they were included for 201 * backward compatibility purposes, and can be safely ignored by new versions 202 * of zfs receive. Previous versions of ZFS which do not understand the 203 * DRR_FLAG_SPILL_BLOCK will process this record and recreate any missing 204 * spill blocks. 205 */ 206 #define DRR_FLAG_SPILL_BLOCK (1<<3) 207 208 /* 209 * flags in the drr_flags field in the DRR_WRITE, DRR_SPILL, DRR_OBJECT, 210 * DRR_WRITE_BYREF, and DRR_OBJECT_RANGE blocks 211 */ 212 #define DRR_CHECKSUM_DEDUP (1<<0) /* not used for SPILL records */ 213 #define DRR_RAW_BYTESWAP (1<<1) 214 #define DRR_OBJECT_SPILL (1<<2) /* OBJECT record has a spill block */ 215 #define DRR_SPILL_UNMODIFIED (1<<2) /* SPILL record for unmodified block */ 216 217 #define DRR_IS_DEDUP_CAPABLE(flags) ((flags) & DRR_CHECKSUM_DEDUP) 218 #define DRR_IS_RAW_BYTESWAPPED(flags) ((flags) & DRR_RAW_BYTESWAP) 219 #define DRR_OBJECT_HAS_SPILL(flags) ((flags) & DRR_OBJECT_SPILL) 220 #define DRR_SPILL_IS_UNMODIFIED(flags) ((flags) & DRR_SPILL_UNMODIFIED) 221 222 /* deal with compressed drr_write replay records */ 223 #define DRR_WRITE_COMPRESSED(drrw) ((drrw)->drr_compressiontype != 0) 224 #define DRR_WRITE_PAYLOAD_SIZE(drrw) \ 225 (DRR_WRITE_COMPRESSED(drrw) ? (drrw)->drr_compressed_size : \ 226 (drrw)->drr_logical_size) 227 #define DRR_SPILL_PAYLOAD_SIZE(drrs) \ 228 ((drrs)->drr_compressed_size ? \ 229 (drrs)->drr_compressed_size : (drrs)->drr_length) 230 #define DRR_OBJECT_PAYLOAD_SIZE(drro) \ 231 ((drro)->drr_raw_bonuslen != 0 ? \ 232 (drro)->drr_raw_bonuslen : P2ROUNDUP((drro)->drr_bonuslen, 8)) 233 234 /* Header is used in C++ so can't forward declare untagged struct */ 235 struct drr_begin { 236 uint64_t drr_magic; 237 uint64_t drr_versioninfo; /* was drr_version */ 238 uint64_t drr_creation_time; 239 dmu_objset_type_t drr_type; 240 uint32_t drr_flags; 241 uint64_t drr_toguid; 242 uint64_t drr_fromguid; 243 char drr_toname[MAXNAMELEN]; 244 }; 245 246 typedef struct dmu_replay_record { 247 enum { 248 DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, 249 DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF, 250 DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_OBJECT_RANGE, DRR_REDACT, 251 DRR_NUMTYPES 252 } drr_type; 253 uint32_t drr_payloadlen; 254 union { 255 struct drr_begin drr_begin; 256 struct drr_end { 257 zio_cksum_t drr_checksum; 258 uint64_t drr_toguid; 259 } drr_end; 260 struct drr_object { 261 uint64_t drr_object; 262 dmu_object_type_t drr_type; 263 dmu_object_type_t drr_bonustype; 264 uint32_t drr_blksz; 265 uint32_t drr_bonuslen; 266 uint8_t drr_checksumtype; 267 uint8_t drr_compress; 268 uint8_t drr_dn_slots; 269 uint8_t drr_flags; 270 uint32_t drr_raw_bonuslen; 271 uint64_t drr_toguid; 272 /* only (possibly) nonzero for raw streams */ 273 uint8_t drr_indblkshift; 274 uint8_t drr_nlevels; 275 uint8_t drr_nblkptr; 276 uint8_t drr_pad[5]; 277 uint64_t drr_maxblkid; 278 /* bonus content follows */ 279 } drr_object; 280 struct drr_freeobjects { 281 uint64_t drr_firstobj; 282 uint64_t drr_numobjs; 283 uint64_t drr_toguid; 284 } drr_freeobjects; 285 struct drr_write { 286 uint64_t drr_object; 287 dmu_object_type_t drr_type; 288 uint32_t drr_pad; 289 uint64_t drr_offset; 290 uint64_t drr_logical_size; 291 uint64_t drr_toguid; 292 uint8_t drr_checksumtype; 293 uint8_t drr_flags; 294 uint8_t drr_compressiontype; 295 uint8_t drr_pad2[5]; 296 /* deduplication key */ 297 ddt_key_t drr_key; 298 /* only nonzero if drr_compressiontype is not 0 */ 299 uint64_t drr_compressed_size; 300 /* only nonzero for raw streams */ 301 uint8_t drr_salt[ZIO_DATA_SALT_LEN]; 302 uint8_t drr_iv[ZIO_DATA_IV_LEN]; 303 uint8_t drr_mac[ZIO_DATA_MAC_LEN]; 304 /* content follows */ 305 } drr_write; 306 struct drr_free { 307 uint64_t drr_object; 308 uint64_t drr_offset; 309 uint64_t drr_length; 310 uint64_t drr_toguid; 311 } drr_free; 312 struct drr_write_byref { 313 /* where to put the data */ 314 uint64_t drr_object; 315 uint64_t drr_offset; 316 uint64_t drr_length; 317 uint64_t drr_toguid; 318 /* where to find the prior copy of the data */ 319 uint64_t drr_refguid; 320 uint64_t drr_refobject; 321 uint64_t drr_refoffset; 322 /* properties of the data */ 323 uint8_t drr_checksumtype; 324 uint8_t drr_flags; 325 uint8_t drr_pad2[6]; 326 ddt_key_t drr_key; /* deduplication key */ 327 } drr_write_byref; 328 struct drr_spill { 329 uint64_t drr_object; 330 uint64_t drr_length; 331 uint64_t drr_toguid; 332 uint8_t drr_flags; 333 uint8_t drr_compressiontype; 334 uint8_t drr_pad[6]; 335 /* only nonzero for raw streams */ 336 uint64_t drr_compressed_size; 337 uint8_t drr_salt[ZIO_DATA_SALT_LEN]; 338 uint8_t drr_iv[ZIO_DATA_IV_LEN]; 339 uint8_t drr_mac[ZIO_DATA_MAC_LEN]; 340 dmu_object_type_t drr_type; 341 /* spill data follows */ 342 } drr_spill; 343 struct drr_write_embedded { 344 uint64_t drr_object; 345 uint64_t drr_offset; 346 /* logical length, should equal blocksize */ 347 uint64_t drr_length; 348 uint64_t drr_toguid; 349 uint8_t drr_compression; 350 uint8_t drr_etype; 351 uint8_t drr_pad[6]; 352 uint32_t drr_lsize; /* uncompressed size of payload */ 353 uint32_t drr_psize; /* compr. (real) size of payload */ 354 /* (possibly compressed) content follows */ 355 } drr_write_embedded; 356 struct drr_object_range { 357 uint64_t drr_firstobj; 358 uint64_t drr_numslots; 359 uint64_t drr_toguid; 360 uint8_t drr_salt[ZIO_DATA_SALT_LEN]; 361 uint8_t drr_iv[ZIO_DATA_IV_LEN]; 362 uint8_t drr_mac[ZIO_DATA_MAC_LEN]; 363 uint8_t drr_flags; 364 uint8_t drr_pad[3]; 365 } drr_object_range; 366 struct drr_redact { 367 uint64_t drr_object; 368 uint64_t drr_offset; 369 uint64_t drr_length; 370 uint64_t drr_toguid; 371 } drr_redact; 372 373 /* 374 * Note: drr_checksum is overlaid with all record types 375 * except DRR_BEGIN. Therefore its (non-pad) members 376 * must not overlap with members from the other structs. 377 * We accomplish this by putting its members at the very 378 * end of the struct. 379 */ 380 struct drr_checksum { 381 uint64_t drr_pad[34]; 382 /* 383 * fletcher-4 checksum of everything preceding the 384 * checksum. 385 */ 386 zio_cksum_t drr_checksum; 387 } drr_checksum; 388 } drr_u; 389 } dmu_replay_record_t; 390 391 /* diff record range types */ 392 typedef enum diff_type { 393 DDR_NONE = 0x1, 394 DDR_INUSE = 0x2, 395 DDR_FREE = 0x4 396 } diff_type_t; 397 398 /* 399 * The diff reports back ranges of free or in-use objects. 400 */ 401 typedef struct dmu_diff_record { 402 uint64_t ddr_type; 403 uint64_t ddr_first; 404 uint64_t ddr_last; 405 } dmu_diff_record_t; 406 407 typedef struct zinject_record { 408 uint64_t zi_objset; 409 uint64_t zi_object; 410 uint64_t zi_start; 411 uint64_t zi_end; 412 uint64_t zi_guid; 413 uint32_t zi_level; 414 uint32_t zi_error; 415 uint64_t zi_type; 416 uint32_t zi_freq; 417 uint32_t zi_failfast; 418 char zi_func[MAXNAMELEN]; 419 uint32_t zi_iotype; 420 int32_t zi_duration; 421 uint64_t zi_timer; 422 uint64_t zi_nlanes; 423 uint32_t zi_cmd; 424 uint32_t zi_dvas; 425 uint64_t zi_match_count; /* count of times matched */ 426 uint64_t zi_inject_count; /* count of times injected */ 427 } zinject_record_t; 428 429 #define ZINJECT_NULL 0x1 430 #define ZINJECT_FLUSH_ARC 0x2 431 #define ZINJECT_UNLOAD_SPA 0x4 432 #define ZINJECT_CALC_RANGE 0x8 433 434 #define ZEVENT_NONE 0x0 435 #define ZEVENT_NONBLOCK 0x1 436 #define ZEVENT_SIZE 1024 437 438 #define ZEVENT_SEEK_START 0 439 #define ZEVENT_SEEK_END UINT64_MAX 440 441 /* scaled frequency ranges */ 442 #define ZI_PERCENTAGE_MIN 4294UL 443 #define ZI_PERCENTAGE_MAX UINT32_MAX 444 445 #define ZI_NO_DVA (-1) 446 447 typedef enum zinject_type { 448 ZINJECT_UNINITIALIZED, 449 ZINJECT_DATA_FAULT, 450 ZINJECT_DEVICE_FAULT, 451 ZINJECT_LABEL_FAULT, 452 ZINJECT_IGNORED_WRITES, 453 ZINJECT_PANIC, 454 ZINJECT_DELAY_IO, 455 ZINJECT_DECRYPT_FAULT, 456 ZINJECT_DELAY_IMPORT, 457 ZINJECT_DELAY_EXPORT, 458 } zinject_type_t; 459 460 typedef enum zinject_iotype { 461 /* 462 * Compatibility: zi_iotype used to be set to ZIO_TYPE_, so make sure 463 * the corresponding ZINJECT_IOTYPE_ matches. Note that existing here 464 * does not mean that injections are possible for all these types. 465 */ 466 ZINJECT_IOTYPE_NULL = ZIO_TYPE_NULL, 467 ZINJECT_IOTYPE_READ = ZIO_TYPE_READ, 468 ZINJECT_IOTYPE_WRITE = ZIO_TYPE_WRITE, 469 ZINJECT_IOTYPE_FREE = ZIO_TYPE_FREE, 470 ZINJECT_IOTYPE_CLAIM = ZIO_TYPE_CLAIM, 471 ZINJECT_IOTYPE_FLUSH = ZIO_TYPE_FLUSH, 472 ZINJECT_IOTYPE_TRIM = ZIO_TYPE_TRIM, 473 ZINJECT_IOTYPE_ALL = ZIO_TYPES, 474 /* Room for future expansion for ZIO_TYPE_* */ 475 ZINJECT_IOTYPE_PROBE = 16, 476 ZINJECT_IOTYPES, 477 } zinject_iotype_t; 478 479 typedef struct zfs_share { 480 uint64_t z_exportdata; 481 uint64_t z_sharedata; 482 uint64_t z_sharetype; /* 0 = share, 1 = unshare */ 483 uint64_t z_sharemax; /* max length of share string */ 484 } zfs_share_t; 485 486 /* 487 * ZFS file systems may behave the usual, POSIX-compliant way, where 488 * name lookups are case-sensitive. They may also be set up so that 489 * all the name lookups are case-insensitive, or so that only some 490 * lookups, the ones that set an FIGNORECASE flag, are case-insensitive. 491 */ 492 typedef enum zfs_case { 493 ZFS_CASE_SENSITIVE, 494 ZFS_CASE_INSENSITIVE, 495 ZFS_CASE_MIXED 496 } zfs_case_t; 497 498 /* 499 * zfs ioctl command structure 500 */ 501 502 /* 503 * Note: this struct must have the same layout in 32-bit and 64-bit, so 504 * that 32-bit processes (like /sbin/zfs) can pass it to the 64-bit 505 * kernel. Therefore, we add padding to it so that no "hidden" padding 506 * is automatically added on 64-bit (but not on 32-bit). 507 */ 508 typedef struct zfs_cmd { 509 char zc_name[MAXPATHLEN]; /* name of pool or dataset */ 510 uint64_t zc_nvlist_src; /* really (char *) */ 511 uint64_t zc_nvlist_src_size; 512 uint64_t zc_nvlist_dst; /* really (char *) */ 513 uint64_t zc_nvlist_dst_size; 514 boolean_t zc_nvlist_dst_filled; /* put an nvlist in dst? */ 515 int zc_pad2; 516 517 /* 518 * The following members are for legacy ioctls which haven't been 519 * converted to the new method. 520 */ 521 uint64_t zc_history; /* really (char *) */ 522 char zc_value[MAXPATHLEN * 2]; 523 char zc_string[MAXNAMELEN]; 524 uint64_t zc_guid; 525 uint64_t zc_nvlist_conf; /* really (char *) */ 526 uint64_t zc_nvlist_conf_size; 527 uint64_t zc_cookie; 528 uint64_t zc_objset_type; 529 uint64_t zc_perm_action; 530 uint64_t zc_history_len; 531 uint64_t zc_history_offset; 532 uint64_t zc_obj; 533 uint64_t zc_iflags; /* internal to zfs(7fs) */ 534 zfs_share_t zc_share; 535 dmu_objset_stats_t zc_objset_stats; 536 struct drr_begin zc_begin_record; 537 zinject_record_t zc_inject_record; 538 uint32_t zc_defer_destroy; 539 uint32_t zc_flags; 540 uint64_t zc_action_handle; 541 int zc_cleanup_fd; 542 uint8_t zc_simple; 543 uint8_t zc_pad[3]; /* alignment */ 544 uint64_t zc_sendobj; 545 uint64_t zc_fromobj; 546 uint64_t zc_createtxg; 547 zfs_stat_t zc_stat; 548 uint64_t zc_zoneid; 549 } zfs_cmd_t; 550 551 typedef struct zfs_useracct { 552 char zu_domain[256]; 553 uid_t zu_rid; 554 uint32_t zu_pad; 555 uint64_t zu_space; 556 } zfs_useracct_t; 557 558 #define ZFSDEV_MAX_MINOR (1 << 16) 559 560 #define ZPOOL_EXPORT_AFTER_SPLIT 0x1 561 562 #ifdef _KERNEL 563 struct objset; 564 struct zfsvfs; 565 566 typedef struct zfs_creat { 567 nvlist_t *zct_zplprops; 568 nvlist_t *zct_props; 569 } zfs_creat_t; 570 571 extern int zfs_secpolicy_snapshot_perms(const char *, cred_t *); 572 extern int zfs_secpolicy_rename_perms(const char *, const char *, cred_t *); 573 extern int zfs_secpolicy_destroy_perms(const char *, cred_t *); 574 extern void zfs_unmount_snap(const char *); 575 extern void zfs_destroy_unmount_origin(const char *); 576 extern int getzfsvfs_impl(struct objset *, struct zfsvfs **); 577 extern int getzfsvfs(const char *, struct zfsvfs **); 578 579 enum zfsdev_state_type { 580 ZST_ONEXIT, 581 ZST_ZEVENT, 582 ZST_ALL, 583 }; 584 585 /* 586 * The zfsdev_state_t structure is managed as a singly-linked list 587 * from which items are never deleted. This allows for lock-free 588 * reading of the list so long as assignments to the zs_next and 589 * reads from zs_minor are performed atomically. Empty items are 590 * indicated by storing -1 into zs_minor. 591 */ 592 typedef struct zfsdev_state { 593 struct zfsdev_state *zs_next; /* next zfsdev_state_t link */ 594 minor_t zs_minor; /* made up minor number */ 595 void *zs_onexit; /* onexit data */ 596 void *zs_zevent; /* zevent data */ 597 } zfsdev_state_t; 598 599 extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which); 600 extern int zfsdev_getminor(zfs_file_t *fp, minor_t *minorp); 601 602 extern uint_t zfs_allow_log_key; 603 604 #endif /* _KERNEL */ 605 606 #ifdef __cplusplus 607 } 608 #endif 609 610 #endif /* _SYS_ZFS_IOCTL_H */ 611