diff options
author | mm <mm@FreeBSD.org> | 2013-03-17 22:24:08 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2013-03-17 22:24:08 +0000 |
commit | da897e350b0958d2948223afca3a685866ac6e9c (patch) | |
tree | 7397a0f6925bc157850a1a7a5db99ce98102bdc1 /cddl/contrib/opensolaris/lib/libzfs_core/common | |
parent | 71bf489e1dedab6b58142f0d7e5b523b8685ab9a (diff) | |
download | FreeBSD-src-da897e350b0958d2948223afca3a685866ac6e9c.zip FreeBSD-src-da897e350b0958d2948223afca3a685866ac6e9c.tar.gz |
Fix working with zfs_ioctl_version in libzfs_compat.h and include mirror
lzc_ioctl_version in libzfs_core
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzfs_core/common')
3 files changed, 17 insertions, 14 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c index c8b401e..3319d20 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c @@ -84,10 +84,11 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/zfs_ioctl.h> -#include <libzfs_compat.h> +#include "libzfs_core_compat.h" +#include "libzfs_compat.h" #ifdef __FreeBSD__ -extern int zfs_ioctl_version; +int lzc_ioctl_version = -1; #endif static int g_fd; @@ -107,6 +108,7 @@ libzfs_core_init(void) } g_refcount++; (void) pthread_mutex_unlock(&g_lock); + return (0); } @@ -138,7 +140,10 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); #ifdef __FreeBSD__ - if (zfs_ioctl_version < ZFS_IOCVER_LZC) { + if (lzc_ioctl_version == -1) + lzc_ioctl_version = get_zfs_ioctl_version(); + + if (lzc_ioctl_version < ZFS_IOCVER_LZC) { oldsource = source; error = lzc_compat_pre(&zc, &ioc, &source); if (error) @@ -185,7 +190,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, } #ifdef __FreeBSD__ - if (zfs_ioctl_version < ZFS_IOCVER_LZC) + if (lzc_ioctl_version < ZFS_IOCVER_LZC) lzc_compat_post(&zc, ioc); #endif if (zc.zc_nvlist_dst_filled) { @@ -195,12 +200,12 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, *resultp = NULL; } #ifdef __FreeBSD__ - if (zfs_ioctl_version < ZFS_IOCVER_LZC) + if (lzc_ioctl_version < ZFS_IOCVER_LZC) lzc_compat_outnvl(&zc, ioc, resultp); #endif out: #ifdef __FreeBSD__ - if (zfs_ioctl_version < ZFS_IOCVER_LZC) { + if (lzc_ioctl_version < ZFS_IOCVER_LZC) { if (source != oldsource) nvlist_free(source); source = oldsource; diff --git a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h index ee19d17..c8bfbef 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h @@ -31,9 +31,6 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/fs/zfs.h> -#ifdef __FreeBSD__ -#include "libzfs_core_compat.h" -#endif #ifdef __cplusplus extern "C" { diff --git a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c index e5eb7ae..0ab12b6 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core_compat.c @@ -24,9 +24,10 @@ */ #include <sys/zfs_ioctl.h> -#include <libzfs_compat.h> +#include <zfs_ioctl_compat.h> +#include "libzfs_core_compat.h" -extern int zfs_ioctl_version; +extern int lzc_ioctl_version; int lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source) @@ -39,7 +40,7 @@ lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source) int error = 0; int pos; - if (zfs_ioctl_version >= ZFS_IOCVER_LZC) + if (lzc_ioctl_version >= ZFS_IOCVER_LZC) return (0); vecnum = *ioc; @@ -98,7 +99,7 @@ lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source) void lzc_compat_post(zfs_cmd_t *zc, const zfs_ioc_t ioc) { - if (zfs_ioctl_version >= ZFS_IOCVER_LZC) + if (lzc_ioctl_version >= ZFS_IOCVER_LZC) return; switch (ioc) { @@ -117,7 +118,7 @@ lzc_compat_outnvl(zfs_cmd_t *zc, const zfs_ioc_t ioc, nvlist_t **outnvl) { nvlist_t *nvl; - if (zfs_ioctl_version >= ZFS_IOCVER_LZC) + if (lzc_ioctl_version >= ZFS_IOCVER_LZC) return (0); switch (ioc) { |