diff options
author | Brooks Davis <[email protected]> | 2022-10-27 22:45:44 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-11-07 15:55:26 -0800 |
commit | 20b867f5f716fedab675f5eac395e7e1ea54572d (patch) | |
tree | a3d54a1e59c29651ae77ca71b93fb9b81e455f32 /lib/libzfs_core | |
parent | 6c89cffc2cccbca82314bf276d31512f9dc4f6ec (diff) |
freebsd: add ifdefs around legacy ioctl support
Require that ZFS_LEGACY_SUPPORT be defined for legacy ioctl support to
be built. For now, define it in zfs_ioctl_compat.h so support is always
built. This will allow systems that need never support pre-openzfs
tools a mechanism to remove support at build time. This code should
be removed once the need for tool compatability is gone.
No functional change at this time.
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Brooks Davis <[email protected]>
Closes #14127
Diffstat (limited to 'lib/libzfs_core')
-rw-r--r-- | lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c b/lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c index 36fbbd88c..72f8f3930 100644 --- a/lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c +++ b/lib/libzfs_core/os/freebsd/libzfs_core_ioctl.c @@ -46,8 +46,11 @@ get_zfs_ioctl_version(void) static int zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag) { - int newrequest, ret; + int ret; +#ifdef ZFS_LEGACY_SUPPORT + int newrequest; void *zc_c = NULL; +#endif unsigned long ncmd; zfs_iocparm_t zp; @@ -58,6 +61,7 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag) zp.zfs_cmd_size = sizeof (zfs_cmd_t); zp.zfs_ioctl_version = ZFS_IOCVER_OZFS; break; +#ifdef ZFS_LEGACY_SUPPORT case ZFS_CMD_COMPAT_LEGACY: newrequest = zfs_ioctl_ozfs_to_legacy(request); ncmd = _IOWR('Z', newrequest, zfs_iocparm_t); @@ -67,6 +71,7 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag) zp.zfs_cmd_size = sizeof (zfs_cmd_legacy_t); zp.zfs_ioctl_version = ZFS_IOCVER_LEGACY; break; +#endif default: abort(); return (EINVAL); @@ -74,14 +79,18 @@ zcmd_ioctl_compat(int fd, int request, zfs_cmd_t *zc, const int cflag) ret = ioctl(fd, ncmd, &zp); if (ret) { +#ifdef ZFS_LEGACY_SUPPORT if (zc_c) free(zc_c); +#endif return (ret); } +#ifdef ZFS_LEGACY_SUPPORT if (zc_c) { zfs_cmd_legacy_to_ozfs(zc_c, zc); free(zc_c); } +#endif return (ret); } @@ -100,9 +109,11 @@ lzc_ioctl_fd(int fd, unsigned long request, zfs_cmd_t *zc) zfs_ioctl_version = get_zfs_ioctl_version(); switch (zfs_ioctl_version) { +#ifdef ZFS_LEGACY_SUPPORT case ZFS_IOCVER_LEGACY: cflag = ZFS_CMD_COMPAT_LEGACY; break; +#endif case ZFS_IOCVER_OZFS: cflag = ZFS_CMD_COMPAT_NONE; break; |