diff options
author | delphij <delphij@FreeBSD.org> | 2014-07-01 20:57:39 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2014-07-01 20:57:39 +0000 |
commit | be1d315a0495d0ceec39374f3f49a5674595bf93 (patch) | |
tree | 21daf12c5cd8018702b134080ff54f8814e0c8de /cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c | |
parent | 8c4948bf022f4d0ea6c54e0888660a51ad7fd9a1 (diff) | |
download | FreeBSD-src-be1d315a0495d0ceec39374f3f49a5674595bf93.zip FreeBSD-src-be1d315a0495d0ceec39374f3f49a5674595bf93.tar.gz |
- Fix handling of "new" style of ioctl in compatiblity mode [1];
- Reorganize code and reduce diff from upstream;
- Improve forward compatibility shims for previous kernel;
Reported by: sbruno [1]
X-MFC-With: r268075
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c index 3c8119d..a3f6129 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c @@ -72,16 +72,23 @@ zcmd_ioctl(int fd, int request, zfs_cmd_t *zc) if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) zfs_ioctl_version = get_zfs_ioctl_version(); - if (zfs_ioctl_version == ZFS_IOCVER_LZC) - cflag = ZFS_CMD_COMPAT_LZC; - else if (zfs_ioctl_version == ZFS_IOCVER_DEADMAN) - cflag = ZFS_CMD_COMPAT_DEADMAN; - - /* - * If vfs.zfs.version.ioctl is not defined, assume we have v28 - * compatible binaries and use vfs.zfs.version.spa to test for v15 - */ - if (zfs_ioctl_version < ZFS_IOCVER_DEADMAN) { + if (zfs_ioctl_version >= ZFS_IOCVER_DEADMAN) { + switch (zfs_ioctl_version) { + case ZFS_IOCVER_ZCMD: + cflag = ZFS_CMD_COMPAT_ZCMD; + break; + case ZFS_IOCVER_LZC: + cflag = ZFS_CMD_COMPAT_LZC; + break; + case ZFS_IOCVER_DEADMAN: + cflag = ZFS_CMD_COMPAT_DEADMAN; + break; + } + } else { + /* + * If vfs.zfs.version.ioctl is not defined, assume we have v28 + * compatible binaries and use vfs.zfs.version.spa to test for v15 + */ cflag = ZFS_CMD_COMPAT_V28; if (zfs_spa_version < 0) |