1 /* 2 * Copyright (c) 2020 iXsystems, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28 #include <sys/cdefs.h> 29 __FBSDID("$FreeBSD$"); 30 31 #include <sys/types.h> 32 #include <sys/param.h> 33 #include <sys/conf.h> 34 #include <sys/kernel.h> 35 #include <sys/lock.h> 36 #include <sys/malloc.h> 37 #include <sys/mutex.h> 38 #include <sys/errno.h> 39 #include <sys/cmn_err.h> 40 #include <sys/zfs_ioctl_compat.h> 41 42 enum zfs_ioc_legacy { 43 ZFS_IOC_LEGACY_NONE = -1, 44 ZFS_IOC_LEGACY_FIRST = 0, 45 ZFS_LEGACY_IOC = ZFS_IOC_LEGACY_FIRST, 46 ZFS_IOC_LEGACY_POOL_CREATE = ZFS_IOC_LEGACY_FIRST, 47 ZFS_IOC_LEGACY_POOL_DESTROY, 48 ZFS_IOC_LEGACY_POOL_IMPORT, 49 ZFS_IOC_LEGACY_POOL_EXPORT, 50 ZFS_IOC_LEGACY_POOL_CONFIGS, 51 ZFS_IOC_LEGACY_POOL_STATS, 52 ZFS_IOC_LEGACY_POOL_TRYIMPORT, 53 ZFS_IOC_LEGACY_POOL_SCAN, 54 ZFS_IOC_LEGACY_POOL_FREEZE, 55 ZFS_IOC_LEGACY_POOL_UPGRADE, 56 ZFS_IOC_LEGACY_POOL_GET_HISTORY, 57 ZFS_IOC_LEGACY_VDEV_ADD, 58 ZFS_IOC_LEGACY_VDEV_REMOVE, 59 ZFS_IOC_LEGACY_VDEV_SET_STATE, 60 ZFS_IOC_LEGACY_VDEV_ATTACH, 61 ZFS_IOC_LEGACY_VDEV_DETACH, 62 ZFS_IOC_LEGACY_VDEV_SETPATH, 63 ZFS_IOC_LEGACY_VDEV_SETFRU, 64 ZFS_IOC_LEGACY_OBJSET_STATS, 65 ZFS_IOC_LEGACY_OBJSET_ZPLPROPS, 66 ZFS_IOC_LEGACY_DATASET_LIST_NEXT, 67 ZFS_IOC_LEGACY_SNAPSHOT_LIST_NEXT, 68 ZFS_IOC_LEGACY_SET_PROP, 69 ZFS_IOC_LEGACY_CREATE, 70 ZFS_IOC_LEGACY_DESTROY, 71 ZFS_IOC_LEGACY_ROLLBACK, 72 ZFS_IOC_LEGACY_RENAME, 73 ZFS_IOC_LEGACY_RECV, 74 ZFS_IOC_LEGACY_SEND, 75 ZFS_IOC_LEGACY_INJECT_FAULT, 76 ZFS_IOC_LEGACY_CLEAR_FAULT, 77 ZFS_IOC_LEGACY_INJECT_LIST_NEXT, 78 ZFS_IOC_LEGACY_ERROR_LOG, 79 ZFS_IOC_LEGACY_CLEAR, 80 ZFS_IOC_LEGACY_PROMOTE, 81 ZFS_IOC_LEGACY_DESTROY_SNAPS, 82 ZFS_IOC_LEGACY_SNAPSHOT, 83 ZFS_IOC_LEGACY_DSOBJ_TO_DSNAME, 84 ZFS_IOC_LEGACY_OBJ_TO_PATH, 85 ZFS_IOC_LEGACY_POOL_SET_PROPS, 86 ZFS_IOC_LEGACY_POOL_GET_PROPS, 87 ZFS_IOC_LEGACY_SET_FSACL, 88 ZFS_IOC_LEGACY_GET_FSACL, 89 ZFS_IOC_LEGACY_SHARE, 90 ZFS_IOC_LEGACY_INHERIT_PROP, 91 ZFS_IOC_LEGACY_SMB_ACL, 92 ZFS_IOC_LEGACY_USERSPACE_ONE, 93 ZFS_IOC_LEGACY_USERSPACE_MANY, 94 ZFS_IOC_LEGACY_USERSPACE_UPGRADE, 95 ZFS_IOC_LEGACY_HOLD, 96 ZFS_IOC_LEGACY_RELEASE, 97 ZFS_IOC_LEGACY_GET_HOLDS, 98 ZFS_IOC_LEGACY_OBJSET_RECVD_PROPS, 99 ZFS_IOC_LEGACY_VDEV_SPLIT, 100 ZFS_IOC_LEGACY_NEXT_OBJ, 101 ZFS_IOC_LEGACY_DIFF, 102 ZFS_IOC_LEGACY_TMP_SNAPSHOT, 103 ZFS_IOC_LEGACY_OBJ_TO_STATS, 104 ZFS_IOC_LEGACY_JAIL, 105 ZFS_IOC_LEGACY_UNJAIL, 106 ZFS_IOC_LEGACY_POOL_REGUID, 107 ZFS_IOC_LEGACY_SPACE_WRITTEN, 108 ZFS_IOC_LEGACY_SPACE_SNAPS, 109 ZFS_IOC_LEGACY_SEND_PROGRESS, 110 ZFS_IOC_LEGACY_POOL_REOPEN, 111 ZFS_IOC_LEGACY_LOG_HISTORY, 112 ZFS_IOC_LEGACY_SEND_NEW, 113 ZFS_IOC_LEGACY_SEND_SPACE, 114 ZFS_IOC_LEGACY_CLONE, 115 ZFS_IOC_LEGACY_BOOKMARK, 116 ZFS_IOC_LEGACY_GET_BOOKMARKS, 117 ZFS_IOC_LEGACY_DESTROY_BOOKMARKS, 118 ZFS_IOC_LEGACY_NEXTBOOT, 119 ZFS_IOC_LEGACY_CHANNEL_PROGRAM, 120 ZFS_IOC_LEGACY_REMAP, 121 ZFS_IOC_LEGACY_POOL_CHECKPOINT, 122 ZFS_IOC_LEGACY_POOL_DISCARD_CHECKPOINT, 123 ZFS_IOC_LEGACY_POOL_INITIALIZE, 124 ZFS_IOC_LEGACY_POOL_SYNC, 125 ZFS_IOC_LEGACY_LAST 126 }; 127 128 unsigned static long zfs_ioctl_legacy_to_ozfs_[] = { 129 ZFS_IOC_POOL_CREATE, /* 0x00 */ 130 ZFS_IOC_POOL_DESTROY, /* 0x01 */ 131 ZFS_IOC_POOL_IMPORT, /* 0x02 */ 132 ZFS_IOC_POOL_EXPORT, /* 0x03 */ 133 ZFS_IOC_POOL_CONFIGS, /* 0x04 */ 134 ZFS_IOC_POOL_STATS, /* 0x05 */ 135 ZFS_IOC_POOL_TRYIMPORT, /* 0x06 */ 136 ZFS_IOC_POOL_SCAN, /* 0x07 */ 137 ZFS_IOC_POOL_FREEZE, /* 0x08 */ 138 ZFS_IOC_POOL_UPGRADE, /* 0x09 */ 139 ZFS_IOC_POOL_GET_HISTORY, /* 0x0a */ 140 ZFS_IOC_VDEV_ADD, /* 0x0b */ 141 ZFS_IOC_VDEV_REMOVE, /* 0x0c */ 142 ZFS_IOC_VDEV_SET_STATE, /* 0x0d */ 143 ZFS_IOC_VDEV_ATTACH, /* 0x0e */ 144 ZFS_IOC_VDEV_DETACH, /* 0x0f */ 145 ZFS_IOC_VDEV_SETPATH, /* 0x10 */ 146 ZFS_IOC_VDEV_SETFRU, /* 0x11 */ 147 ZFS_IOC_OBJSET_STATS, /* 0x12 */ 148 ZFS_IOC_OBJSET_ZPLPROPS, /* 0x13 */ 149 ZFS_IOC_DATASET_LIST_NEXT, /* 0x14 */ 150 ZFS_IOC_SNAPSHOT_LIST_NEXT, /* 0x15 */ 151 ZFS_IOC_SET_PROP, /* 0x16 */ 152 ZFS_IOC_CREATE, /* 0x17 */ 153 ZFS_IOC_DESTROY, /* 0x18 */ 154 ZFS_IOC_ROLLBACK, /* 0x19 */ 155 ZFS_IOC_RENAME, /* 0x1a */ 156 ZFS_IOC_RECV, /* 0x1b */ 157 ZFS_IOC_SEND, /* 0x1c */ 158 ZFS_IOC_INJECT_FAULT, /* 0x1d */ 159 ZFS_IOC_CLEAR_FAULT, /* 0x1e */ 160 ZFS_IOC_INJECT_LIST_NEXT, /* 0x1f */ 161 ZFS_IOC_ERROR_LOG, /* 0x20 */ 162 ZFS_IOC_CLEAR, /* 0x21 */ 163 ZFS_IOC_PROMOTE, /* 0x22 */ 164 /* start of mismatch */ 165 166 ZFS_IOC_DESTROY_SNAPS, /* 0x23:0x3b */ 167 ZFS_IOC_SNAPSHOT, /* 0x24:0x23 */ 168 ZFS_IOC_DSOBJ_TO_DSNAME, /* 0x25:0x24 */ 169 ZFS_IOC_OBJ_TO_PATH, /* 0x26:0x25 */ 170 ZFS_IOC_POOL_SET_PROPS, /* 0x27:0x26 */ 171 ZFS_IOC_POOL_GET_PROPS, /* 0x28:0x27 */ 172 ZFS_IOC_SET_FSACL, /* 0x29:0x28 */ 173 ZFS_IOC_GET_FSACL, /* 0x30:0x29 */ 174 ZFS_IOC_SHARE, /* 0x2b:0x2a */ 175 ZFS_IOC_INHERIT_PROP, /* 0x2c:0x2b */ 176 ZFS_IOC_SMB_ACL, /* 0x2d:0x2c */ 177 ZFS_IOC_USERSPACE_ONE, /* 0x2e:0x2d */ 178 ZFS_IOC_USERSPACE_MANY, /* 0x2f:0x2e */ 179 ZFS_IOC_USERSPACE_UPGRADE, /* 0x30:0x2f */ 180 ZFS_IOC_HOLD, /* 0x31:0x30 */ 181 ZFS_IOC_RELEASE, /* 0x32:0x31 */ 182 ZFS_IOC_GET_HOLDS, /* 0x33:0x32 */ 183 ZFS_IOC_OBJSET_RECVD_PROPS, /* 0x34:0x33 */ 184 ZFS_IOC_VDEV_SPLIT, /* 0x35:0x34 */ 185 ZFS_IOC_NEXT_OBJ, /* 0x36:0x35 */ 186 ZFS_IOC_DIFF, /* 0x37:0x36 */ 187 ZFS_IOC_TMP_SNAPSHOT, /* 0x38:0x37 */ 188 ZFS_IOC_OBJ_TO_STATS, /* 0x39:0x38 */ 189 ZFS_IOC_JAIL, /* 0x3a:0xc2 */ 190 ZFS_IOC_UNJAIL, /* 0x3b:0xc3 */ 191 ZFS_IOC_POOL_REGUID, /* 0x3c:0x3c */ 192 ZFS_IOC_SPACE_WRITTEN, /* 0x3d:0x39 */ 193 ZFS_IOC_SPACE_SNAPS, /* 0x3e:0x3a */ 194 ZFS_IOC_SEND_PROGRESS, /* 0x3f:0x3e */ 195 ZFS_IOC_POOL_REOPEN, /* 0x40:0x3d */ 196 ZFS_IOC_LOG_HISTORY, /* 0x41:0x3f */ 197 ZFS_IOC_SEND_NEW, /* 0x42:0x40 */ 198 ZFS_IOC_SEND_SPACE, /* 0x43:0x41 */ 199 ZFS_IOC_CLONE, /* 0x44:0x42 */ 200 ZFS_IOC_BOOKMARK, /* 0x45:0x43 */ 201 ZFS_IOC_GET_BOOKMARKS, /* 0x46:0x44 */ 202 ZFS_IOC_DESTROY_BOOKMARKS, /* 0x47:0x45 */ 203 ZFS_IOC_NEXTBOOT, /* 0x48:0xc1 */ 204 ZFS_IOC_CHANNEL_PROGRAM, /* 0x49:0x48 */ 205 ZFS_IOC_REMAP, /* 0x4a:0x4c */ 206 ZFS_IOC_POOL_CHECKPOINT, /* 0x4b:0x4d */ 207 ZFS_IOC_POOL_DISCARD_CHECKPOINT, /* 0x4c:0x4e */ 208 ZFS_IOC_POOL_INITIALIZE, /* 0x4d:0x4f */ 209 }; 210 211 unsigned static long zfs_ioctl_ozfs_to_legacy_common_[] = { 212 ZFS_IOC_POOL_CREATE, /* 0x00 */ 213 ZFS_IOC_POOL_DESTROY, /* 0x01 */ 214 ZFS_IOC_POOL_IMPORT, /* 0x02 */ 215 ZFS_IOC_POOL_EXPORT, /* 0x03 */ 216 ZFS_IOC_POOL_CONFIGS, /* 0x04 */ 217 ZFS_IOC_POOL_STATS, /* 0x05 */ 218 ZFS_IOC_POOL_TRYIMPORT, /* 0x06 */ 219 ZFS_IOC_POOL_SCAN, /* 0x07 */ 220 ZFS_IOC_POOL_FREEZE, /* 0x08 */ 221 ZFS_IOC_POOL_UPGRADE, /* 0x09 */ 222 ZFS_IOC_POOL_GET_HISTORY, /* 0x0a */ 223 ZFS_IOC_VDEV_ADD, /* 0x0b */ 224 ZFS_IOC_VDEV_REMOVE, /* 0x0c */ 225 ZFS_IOC_VDEV_SET_STATE, /* 0x0d */ 226 ZFS_IOC_VDEV_ATTACH, /* 0x0e */ 227 ZFS_IOC_VDEV_DETACH, /* 0x0f */ 228 ZFS_IOC_VDEV_SETPATH, /* 0x10 */ 229 ZFS_IOC_VDEV_SETFRU, /* 0x11 */ 230 ZFS_IOC_OBJSET_STATS, /* 0x12 */ 231 ZFS_IOC_OBJSET_ZPLPROPS, /* 0x13 */ 232 ZFS_IOC_DATASET_LIST_NEXT, /* 0x14 */ 233 ZFS_IOC_SNAPSHOT_LIST_NEXT, /* 0x15 */ 234 ZFS_IOC_SET_PROP, /* 0x16 */ 235 ZFS_IOC_CREATE, /* 0x17 */ 236 ZFS_IOC_DESTROY, /* 0x18 */ 237 ZFS_IOC_ROLLBACK, /* 0x19 */ 238 ZFS_IOC_RENAME, /* 0x1a */ 239 ZFS_IOC_RECV, /* 0x1b */ 240 ZFS_IOC_SEND, /* 0x1c */ 241 ZFS_IOC_INJECT_FAULT, /* 0x1d */ 242 ZFS_IOC_CLEAR_FAULT, /* 0x1e */ 243 ZFS_IOC_INJECT_LIST_NEXT, /* 0x1f */ 244 ZFS_IOC_ERROR_LOG, /* 0x20 */ 245 ZFS_IOC_CLEAR, /* 0x21 */ 246 ZFS_IOC_PROMOTE, /* 0x22 */ 247 /* start of mismatch */ 248 ZFS_IOC_LEGACY_SNAPSHOT, /* 0x23 */ 249 ZFS_IOC_LEGACY_DSOBJ_TO_DSNAME, /* 0x24 */ 250 ZFS_IOC_LEGACY_OBJ_TO_PATH, /* 0x25 */ 251 ZFS_IOC_LEGACY_POOL_SET_PROPS, /* 0x26 */ 252 ZFS_IOC_LEGACY_POOL_GET_PROPS, /* 0x27 */ 253 ZFS_IOC_LEGACY_SET_FSACL, /* 0x28 */ 254 ZFS_IOC_LEGACY_GET_FSACL, /* 0x29 */ 255 ZFS_IOC_LEGACY_SHARE, /* 0x2a */ 256 ZFS_IOC_LEGACY_INHERIT_PROP, /* 0x2b */ 257 ZFS_IOC_LEGACY_SMB_ACL, /* 0x2c */ 258 ZFS_IOC_LEGACY_USERSPACE_ONE, /* 0x2d */ 259 ZFS_IOC_LEGACY_USERSPACE_MANY, /* 0x2e */ 260 ZFS_IOC_LEGACY_USERSPACE_UPGRADE, /* 0x2f */ 261 ZFS_IOC_LEGACY_HOLD, /* 0x30 */ 262 ZFS_IOC_LEGACY_RELEASE, /* 0x31 */ 263 ZFS_IOC_LEGACY_GET_HOLDS, /* 0x32 */ 264 ZFS_IOC_LEGACY_OBJSET_RECVD_PROPS, /* 0x33 */ 265 ZFS_IOC_LEGACY_VDEV_SPLIT, /* 0x34 */ 266 ZFS_IOC_LEGACY_NEXT_OBJ, /* 0x35 */ 267 ZFS_IOC_LEGACY_DIFF, /* 0x36 */ 268 ZFS_IOC_LEGACY_TMP_SNAPSHOT, /* 0x37 */ 269 ZFS_IOC_LEGACY_OBJ_TO_STATS, /* 0x38 */ 270 ZFS_IOC_LEGACY_SPACE_WRITTEN, /* 0x39 */ 271 ZFS_IOC_LEGACY_SPACE_SNAPS, /* 0x3a */ 272 ZFS_IOC_LEGACY_DESTROY_SNAPS, /* 0x3b */ 273 ZFS_IOC_LEGACY_POOL_REGUID, /* 0x3c */ 274 ZFS_IOC_LEGACY_POOL_REOPEN, /* 0x3d */ 275 ZFS_IOC_LEGACY_SEND_PROGRESS, /* 0x3e */ 276 ZFS_IOC_LEGACY_LOG_HISTORY, /* 0x3f */ 277 ZFS_IOC_LEGACY_SEND_NEW, /* 0x40 */ 278 ZFS_IOC_LEGACY_SEND_SPACE, /* 0x41 */ 279 ZFS_IOC_LEGACY_CLONE, /* 0x42 */ 280 ZFS_IOC_LEGACY_BOOKMARK, /* 0x43 */ 281 ZFS_IOC_LEGACY_GET_BOOKMARKS, /* 0x44 */ 282 ZFS_IOC_LEGACY_DESTROY_BOOKMARKS, /* 0x45 */ 283 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_RECV_NEW */ 284 ZFS_IOC_LEGACY_POOL_SYNC, /* 0x47 */ 285 ZFS_IOC_LEGACY_CHANNEL_PROGRAM, /* 0x48 */ 286 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_LOAD_KEY */ 287 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_UNLOAD_KEY */ 288 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_CHANGE_KEY */ 289 ZFS_IOC_LEGACY_REMAP, /* 0x4c */ 290 ZFS_IOC_LEGACY_POOL_CHECKPOINT, /* 0x4d */ 291 ZFS_IOC_LEGACY_POOL_DISCARD_CHECKPOINT, /* 0x4e */ 292 ZFS_IOC_LEGACY_POOL_INITIALIZE, /* 0x4f */ 293 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_POOL_TRIM */ 294 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_REDACT */ 295 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_GET_BOOKMARK_PROPS */ 296 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_WAIT */ 297 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_WAIT_FS */ 298 }; 299 300 unsigned static long zfs_ioctl_ozfs_to_legacy_platform_[] = { 301 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_NEXT */ 302 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_CLEAR */ 303 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_SEEK */ 304 ZFS_IOC_LEGACY_NEXTBOOT, 305 ZFS_IOC_LEGACY_JAIL, 306 ZFS_IOC_LEGACY_UNJAIL, 307 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_SET_BOOTENV */ 308 ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_GET_BOOTENV */ 309 }; 310 311 int 312 zfs_ioctl_legacy_to_ozfs(int request) 313 { 314 if (request >= sizeof (zfs_ioctl_legacy_to_ozfs_)/sizeof (long)) 315 return (-1); 316 return (zfs_ioctl_legacy_to_ozfs_[request]); 317 } 318 319 int 320 zfs_ioctl_ozfs_to_legacy(int request) 321 { 322 if (request > ZFS_IOC_LAST) 323 return (-1); 324 325 if (request > ZFS_IOC_PLATFORM) { 326 request -= ZFS_IOC_PLATFORM + 1; 327 return (zfs_ioctl_ozfs_to_legacy_platform_[request]); 328 } 329 if (request >= sizeof (zfs_ioctl_ozfs_to_legacy_common_)/sizeof (long)) 330 return (-1); 331 return (zfs_ioctl_ozfs_to_legacy_common_[request]); 332 } 333 334 void 335 zfs_cmd_legacy_to_ozfs(zfs_cmd_legacy_t *src, zfs_cmd_t *dst) 336 { 337 memcpy(dst, src, offsetof(zfs_cmd_t, zc_objset_stats)); 338 *&dst->zc_objset_stats = *&src->zc_objset_stats; 339 memcpy(&dst->zc_begin_record, &src->zc_begin_record, 340 offsetof(zfs_cmd_t, zc_sendobj) - 341 offsetof(zfs_cmd_t, zc_begin_record)); 342 memcpy(&dst->zc_sendobj, &src->zc_sendobj, 343 sizeof (zfs_cmd_t) - 8 - offsetof(zfs_cmd_t, zc_sendobj)); 344 dst->zc_zoneid = src->zc_jailid; 345 } 346 347 void 348 zfs_cmd_ozfs_to_legacy(zfs_cmd_t *src, zfs_cmd_legacy_t *dst) 349 { 350 memcpy(dst, src, offsetof(zfs_cmd_t, zc_objset_stats)); 351 *&dst->zc_objset_stats = *&src->zc_objset_stats; 352 *&dst->zc_begin_record.drr_u.drr_begin = *&src->zc_begin_record; 353 dst->zc_begin_record.drr_payloadlen = 0; 354 dst->zc_begin_record.drr_type = 0; 355 356 memcpy(&dst->zc_inject_record, &src->zc_inject_record, 357 offsetof(zfs_cmd_t, zc_sendobj) - 358 offsetof(zfs_cmd_t, zc_inject_record)); 359 dst->zc_resumable = B_FALSE; 360 memcpy(&dst->zc_sendobj, &src->zc_sendobj, 361 sizeof (zfs_cmd_t) - 8 - offsetof(zfs_cmd_t, zc_sendobj)); 362 dst->zc_jailid = src->zc_zoneid; 363 } 364