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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_ZFS_IOCTL_H
27 #define _SYS_ZFS_IOCTL_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/dsl_deleg.h>
37 #include <sys/nvpair.h>
45 * Property values for snapdir
47 #define ZFS_SNAPDIR_HIDDEN 0
48 #define ZFS_SNAPDIR_VISIBLE 1
50 #define DMU_BACKUP_STREAM_VERSION (1ULL)
51 #define DMU_BACKUP_HEADER_VERSION (2ULL)
52 #define DMU_BACKUP_MAGIC 0x2F5bacbacULL
54 #define DRR_FLAG_CLONE (1<<0)
55 #define DRR_FLAG_CI_DATA (1<<1)
58 * zfs ioctl command structure
60 typedef struct dmu_replay_record {
62 DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
63 DRR_WRITE, DRR_FREE, DRR_END,
65 uint32_t drr_payloadlen;
70 uint64_t drr_creation_time;
71 dmu_objset_type_t drr_type;
74 uint64_t drr_fromguid;
75 char drr_toname[MAXNAMELEN];
78 zio_cksum_t drr_checksum;
82 dmu_object_type_t drr_type;
83 dmu_object_type_t drr_bonustype;
85 uint32_t drr_bonuslen;
89 /* bonus content follows */
91 struct drr_freeobjects {
92 uint64_t drr_firstobj;
97 dmu_object_type_t drr_type;
101 /* content follows */
109 } dmu_replay_record_t;
111 typedef struct zinject_record {
121 uint32_t zi_pad; /* pad out to 64 bit alignment */
124 #define ZINJECT_NULL 0x1
125 #define ZINJECT_FLUSH_ARC 0x2
126 #define ZINJECT_UNLOAD_SPA 0x4
128 typedef struct zfs_share {
129 uint64_t z_exportdata;
130 uint64_t z_sharedata;
131 uint64_t z_sharetype; /* 0 = share, 1 = unshare */
132 uint64_t z_sharemax; /* max length of share string */
136 * ZFS file systems may behave the usual, POSIX-compliant way, where
137 * name lookups are case-sensitive. They may also be set up so that
138 * all the name lookups are case-insensitive, or so that only some
139 * lookups, the ones that set an FIGNORECASE flag, are case-insensitive.
141 typedef enum zfs_case {
143 ZFS_CASE_INSENSITIVE,
147 typedef struct zfs_cmd {
148 char zc_name[MAXPATHLEN];
149 char zc_value[MAXPATHLEN * 2];
150 char zc_string[MAXNAMELEN];
152 uint64_t zc_nvlist_conf; /* really (char *) */
153 uint64_t zc_nvlist_conf_size;
154 uint64_t zc_nvlist_src; /* really (char *) */
155 uint64_t zc_nvlist_src_size;
156 uint64_t zc_nvlist_dst; /* really (char *) */
157 uint64_t zc_nvlist_dst_size;
159 uint64_t zc_objset_type;
160 uint64_t zc_perm_action;
161 uint64_t zc_history; /* really (char *) */
162 uint64_t zc_history_len;
163 uint64_t zc_history_offset;
165 zfs_share_t zc_share;
166 dmu_objset_stats_t zc_objset_stats;
167 struct drr_begin zc_begin_record;
168 zinject_record_t zc_inject_record;
171 #define ZVOL_MAX_MINOR (1 << 16)
172 #define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
176 typedef struct zfs_creat {
177 nvlist_t *zct_zplprops;
181 extern dev_info_t *zfs_dip;
183 extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
184 extern int zfs_secpolicy_rename_perms(const char *from,
185 const char *to, cred_t *cr);
186 extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
187 extern int zfs_busy(void);
188 extern int zfs_unmount_snap(char *, void *);
196 #endif /* _SYS_ZFS_IOCTL_H */