]>
git.proxmox.com Git - mirror_zfs.git/blob - lib/libzutil/os/freebsd/zutil_compat.c
5b0fe85485dbde2425397e13a440e8b345f053fd
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]
21 #include <sys/types.h>
22 #include <sys/param.h>
23 #include <sys/zfs_ioctl.h>
24 #include <os/freebsd/zfs/sys/zfs_ioctl_compat.h>
28 zcmd_ioctl_compat(int fd
, int request
, zfs_cmd_t
*zc
, const int cflag
)
36 case ZFS_CMD_COMPAT_NONE
:
37 ncmd
= _IOWR('Z', request
, zfs_iocparm_t
);
38 zp
.zfs_cmd
= (uint64_t)zc
;
39 zp
.zfs_cmd_size
= sizeof (zfs_cmd_t
);
40 zp
.zfs_ioctl_version
= ZFS_IOCVER_ZOF
;
41 return (ioctl(fd
, ncmd
, &zp
));
47 ret
= ioctl(fd
, ncmd
, zc_c
);
48 zfs_cmd_compat_get(zc
, (caddr_t
)zc_c
, cflag
);
55 * This is FreeBSD version of ioctl, because Solaris' ioctl() updates
56 * zc_nvlist_dst_size even if an error is returned, on FreeBSD if an
57 * error is returned zc_nvlist_dst_size won't be updated.
60 zfs_ioctl_fd(int fd
, unsigned long request
, zfs_cmd_t
*zc
)
63 int ret
, cflag
= ZFS_CMD_COMPAT_NONE
;
65 oldsize
= zc
->zc_nvlist_dst_size
;
66 ret
= zcmd_ioctl_compat(fd
, request
, zc
, cflag
);
68 if (ret
== 0 && oldsize
< zc
->zc_nvlist_dst_size
) {