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 2010 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_ZFS_IOCTL_COMPAT_H
27 #define _SYS_ZFS_IOCTL_COMPAT_H
32 #include <sys/dsl_deleg.h>
33 #include <sys/zfs_ioctl.h>
36 #include <sys/nvpair.h>
43 #define ZFS_CMD_COMPAT_NONE 0
44 #define ZFS_CMD_COMPAT_V15 1
46 #define ZFS_IOC_COMPAT_PASS 254
47 #define ZFS_IOC_COMPAT_FAIL 255
49 typedef struct zinject_record_v15 {
60 } zinject_record_v15_t;
62 typedef struct zfs_cmd_v15 {
63 char zc_name[MAXPATHLEN];
64 char zc_value[MAXPATHLEN];
65 char zc_string[MAXNAMELEN];
67 uint64_t zc_nvlist_conf; /* really (char *) */
68 uint64_t zc_nvlist_conf_size;
69 uint64_t zc_nvlist_src; /* really (char *) */
70 uint64_t zc_nvlist_src_size;
71 uint64_t zc_nvlist_dst; /* really (char *) */
72 uint64_t zc_nvlist_dst_size;
74 uint64_t zc_objset_type;
75 uint64_t zc_perm_action;
76 uint64_t zc_history; /* really (char *) */
77 uint64_t zc_history_len;
78 uint64_t zc_history_offset;
82 dmu_objset_stats_t zc_objset_stats;
83 struct drr_begin zc_begin_record;
84 zinject_record_v15_t zc_inject_record;
88 unsigned static long zfs_ioctl_v15_to_v28[] = {
89 0, /* 0 ZFS_IOC_POOL_CREATE */
90 1, /* 1 ZFS_IOC_POOL_DESTROY */
91 2, /* 2 ZFS_IOC_POOL_IMPORT */
92 3, /* 3 ZFS_IOC_POOL_EXPORT */
93 4, /* 4 ZFS_IOC_POOL_CONFIGS */
94 5, /* 5 ZFS_IOC_POOL_STATS */
95 6, /* 6 ZFS_IOC_POOL_TRYIMPORT */
96 7, /* 7 ZFS_IOC_POOL_SCRUB */
97 8, /* 8 ZFS_IOC_POOL_FREEZE */
98 9, /* 9 ZFS_IOC_POOL_UPGRADE */
99 10, /* 10 ZFS_IOC_POOL_GET_HISTORY */
100 11, /* 11 ZFS_IOC_VDEV_ADD */
101 12, /* 12 ZFS_IOC_VDEV_REMOVE */
102 13, /* 13 ZFS_IOC_VDEV_SET_STATE */
103 14, /* 14 ZFS_IOC_VDEV_ATTACH */
104 15, /* 15 ZFS_IOC_VDEV_DETACH */
105 16, /* 16 ZFS_IOC_VDEV_SETPATH */
106 18, /* 17 ZFS_IOC_OBJSET_STATS */
107 19, /* 18 ZFS_IOC_OBJSET_ZPLPROPS */
108 20, /* 19 ZFS_IOC_DATASET_LIST_NEXT */
109 21, /* 20 ZFS_IOC_SNAPSHOT_LIST_NEXT */
110 22, /* 21 ZFS_IOC_SET_PROP */
111 ZFS_IOC_COMPAT_PASS, /* 22 ZFS_IOC_CREATE_MINOR */
112 ZFS_IOC_COMPAT_PASS, /* 23 ZFS_IOC_REMOVE_MINOR */
113 23, /* 24 ZFS_IOC_CREATE */
114 24, /* 25 ZFS_IOC_DESTROY */
115 25, /* 26 ZFS_IOC_ROLLBACK */
116 26, /* 27 ZFS_IOC_RENAME */
117 27, /* 28 ZFS_IOC_RECV */
118 28, /* 29 ZFS_IOC_SEND */
119 29, /* 30 ZFS_IOC_INJECT_FAULT */
120 30, /* 31 ZFS_IOC_CLEAR_FAULT */
121 31, /* 32 ZFS_IOC_INJECT_LIST_NEXT */
122 32, /* 33 ZFS_IOC_ERROR_LOG */
123 33, /* 34 ZFS_IOC_CLEAR */
124 34, /* 35 ZFS_IOC_PROMOTE */
125 35, /* 36 ZFS_IOC_DESTROY_SNAPS */
126 36, /* 37 ZFS_IOC_SNAPSHOT */
127 37, /* 38 ZFS_IOC_DSOBJ_TO_DSNAME */
128 38, /* 39 ZFS_IOC_OBJ_TO_PATH */
129 39, /* 40 ZFS_IOC_POOL_SET_PROPS */
130 40, /* 41 ZFS_IOC_POOL_GET_PROPS */
131 41, /* 42 ZFS_IOC_SET_FSACL */
132 42, /* 43 ZFS_IOC_GET_FSACL */
133 ZFS_IOC_COMPAT_PASS, /* 44 ZFS_IOC_ISCSI_PERM_CHECK */
134 43, /* 45 ZFS_IOC_SHARE */
135 44, /* 46 ZFS_IOC_IHNERIT_PROP */
136 58, /* 47 ZFS_IOC_JAIL */
137 59, /* 48 ZFS_IOC_UNJAIL */
138 45, /* 49 ZFS_IOC_SMB_ACL */
139 46, /* 50 ZFS_IOC_USERSPACE_ONE */
140 47, /* 51 ZFS_IOC_USERSPACE_MANY */
141 48, /* 52 ZFS_IOC_USERSPACE_UPGRADE */
142 17, /* 53 ZFS_IOC_SETFRU */
146 unsigned static long zfs_ioctl_v28_to_v15[] = {
147 0, /* 0 ZFS_IOC_POOL_CREATE */
148 1, /* 1 ZFS_IOC_POOL_DESTROY */
149 2, /* 2 ZFS_IOC_POOL_IMPORT */
150 3, /* 3 ZFS_IOC_POOL_EXPORT */
151 4, /* 4 ZFS_IOC_POOL_CONFIGS */
152 5, /* 5 ZFS_IOC_POOL_STATS */
153 6, /* 6 ZFS_IOC_POOL_TRYIMPORT */
154 7, /* 7 ZFS_IOC_POOL_SCAN */
155 8, /* 8 ZFS_IOC_POOL_FREEZE */
156 9, /* 9 ZFS_IOC_POOL_UPGRADE */
157 10, /* 10 ZFS_IOC_POOL_GET_HISTORY */
158 11, /* 11 ZFS_IOC_VDEV_ADD */
159 12, /* 12 ZFS_IOC_VDEV_REMOVE */
160 13, /* 13 ZFS_IOC_VDEV_SET_STATE */
161 14, /* 14 ZFS_IOC_VDEV_ATTACH */
162 15, /* 15 ZFS_IOC_VDEV_DETACH */
163 16, /* 16 ZFS_IOC_VDEV_SETPATH */
164 53, /* 17 ZFS_IOC_VDEV_SETFRU */
165 17, /* 18 ZFS_IOC_OBJSET_STATS */
166 18, /* 19 ZFS_IOC_OBJSET_ZPLPROPS */
167 19, /* 20 ZFS_IOC_DATASET_LIST_NEXT */
168 20, /* 21 ZFS_IOC_SNAPSHOT_LIST_NEXT */
169 21, /* 22 ZFS_IOC_SET_PROP */
170 24, /* 23 ZFS_IOC_CREATE */
171 25, /* 24 ZFS_IOC_DESTROY */
172 26, /* 25 ZFS_IOC_ROLLBACK */
173 27, /* 26 ZFS_IOC_RENAME */
174 28, /* 27 ZFS_IOC_RECV */
175 29, /* 28 ZFS_IOC_SEND */
176 30, /* 39 ZFS_IOC_INJECT_FAULT */
177 31, /* 30 ZFS_IOC_CLEAR_FAULT */
178 32, /* 31 ZFS_IOC_INJECT_LIST_NEXT */
179 33, /* 32 ZFS_IOC_ERROR_LOG */
180 34, /* 33 ZFS_IOC_CLEAR */
181 35, /* 34 ZFS_IOC_PROMOTE */
182 36, /* 35 ZFS_IOC_DESTROY_SNAPS */
183 37, /* 36 ZFS_IOC_SNAPSHOT */
184 38, /* 37 ZFS_IOC_DSOBJ_TO_DSNAME */
185 39, /* 38 ZFS_IOC_OBJ_TO_PATH */
186 40, /* 39 ZFS_IOC_POOL_SET_PROPS */
187 41, /* 40 ZFS_IOC_POOL_GET_PROPS */
188 42, /* 41 ZFS_IOC_SET_FSACL */
189 43, /* 42 ZFS_IOC_GET_FSACL */
190 45, /* 43 ZFS_IOC_SHARE */
191 46, /* 44 ZFS_IOC_IHNERIT_PROP */
192 49, /* 45 ZFS_IOC_SMB_ACL */
193 50, /* 46 ZFS_IOC_USERSPACE_ONE */
194 51, /* 47 ZFS_IOC_USERSPACE_MANY */
195 52, /* 48 ZFS_IOC_USERSPACE_UPGRADE */
196 ZFS_IOC_COMPAT_FAIL, /* 49 ZFS_IOC_HOLD */
197 ZFS_IOC_COMPAT_FAIL, /* 50 ZFS_IOC_RELEASE */
198 ZFS_IOC_COMPAT_FAIL, /* 51 ZFS_IOC_GET_HOLDS */
199 ZFS_IOC_COMPAT_FAIL, /* 52 ZFS_IOC_OBJSET_RECVD_PROPS */
200 ZFS_IOC_COMPAT_FAIL, /* 53 ZFS_IOC_VDEV_SPLIT */
201 ZFS_IOC_COMPAT_FAIL, /* 54 ZFS_IOC_NEXT_OBJ */
202 ZFS_IOC_COMPAT_FAIL, /* 55 ZFS_IOC_DIFF */
203 ZFS_IOC_COMPAT_FAIL, /* 56 ZFS_IOC_TMP_SNAPSHOT */
204 ZFS_IOC_COMPAT_FAIL, /* 57 ZFS_IOC_OBJ_TO_STATS */
205 47, /* 58 ZFS_IOC_JAIL */
206 48, /* 59 ZFS_IOC_UNJAIL */
208 #endif /* ! _KERNEL */
211 void zfs_ioctl_compat_pre(zfs_cmd_t *, int *, const int);
212 void zfs_ioctl_compat_post(zfs_cmd_t *, const int, const int);
214 int zcmd_ioctl_compat(int, unsigned long, zfs_cmd_t *, const int);
216 void zfs_cmd_compat_get(zfs_cmd_t *, caddr_t, const int);
217 void zfs_cmd_compat_put(zfs_cmd_t *, caddr_t, const int);
223 #endif /* _SYS_ZFS_IOCTL_COMPAT_H */