diff options
author | avg <avg@FreeBSD.org> | 2016-04-22 13:00:27 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2016-04-22 13:00:27 +0000 |
commit | 2a471649019b98c148ff2ee6e1ab87cc96a3a845 (patch) | |
tree | f4347ef540d8c19c2261ad1fe498b5813025285a /cddl/contrib/opensolaris/lib/libzfs_core | |
parent | 1f176af7b394740bac04dec96b22481c88bd00ed (diff) | |
download | FreeBSD-src-2a471649019b98c148ff2ee6e1ab87cc96a3a845.zip FreeBSD-src-2a471649019b98c148ff2ee6e1ab87cc96a3a845.tar.gz |
MFV r298471: 6052 decouple lzc_create() from the implementation details
illumos/illumos-gate@26455f9efcf9b1e44937d4d86d1ce37b006f25a9
https://github.com/illumos/illumos-gate/commit/26455f9efcf9b1e44937d4d86d1ce37b006f25a9
https://www.illumos.org/issues/6052
At the moment type parameter of lzc_create() is of dmu_objset_type_t type.
That exposes an implementation detail and requires sys/fs/zfs.h to be included
in libzfs_core.h creating unnecessary coupling between libzfs_core interface
and ZFS internals.
I think that dmu_objset_type_t should be replaced with a libzfs_core
enumeration of supported dataset types.
For ABI reasons the new enumeration could be bit-compatible with
dmu_objset_type_t.
For example:
typedef enum {
LZC_DST_ZFS = 2,
LZC_DST_ZVOL
} lzc_dataset_type_t;
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>
MFC after: 2 weeks
Sponsored by: ClusterHQ
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzfs_core')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c | 4 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h | 11 |
2 files changed, 11 insertions, 4 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 3accb2c..09289a6 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c @@ -218,11 +218,11 @@ out: } int -lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props) +lzc_create(const char *fsname, enum lzc_dataset_type type, nvlist_t *props) { int error; nvlist_t *args = fnvlist_alloc(); - fnvlist_add_int32(args, "type", type); + fnvlist_add_int32(args, "type", (dmu_objset_type_t)type); if (props != NULL) fnvlist_add_nvlist(args, "props", props); error = lzc_ioctl(ZFS_IOC_CREATE, fsname, args, NULL); 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 b9235d1..d922ab5 100644 --- a/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h +++ b/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h @@ -30,7 +30,6 @@ #include <libnvpair.h> #include <sys/param.h> #include <sys/types.h> -#include <sys/fs/zfs.h> #ifdef __cplusplus extern "C" { @@ -39,8 +38,16 @@ extern "C" { int libzfs_core_init(void); void libzfs_core_fini(void); +/* + * NB: this type should be kept binary compatible with dmu_objset_type_t. + */ +enum lzc_dataset_type { + LZC_DATSET_TYPE_ZFS = 2, + LZC_DATSET_TYPE_ZVOL +}; + int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **); -int lzc_create(const char *, dmu_objset_type_t, nvlist_t *); +int lzc_create(const char *, enum lzc_dataset_type, nvlist_t *); int lzc_clone(const char *, const char *, nvlist_t *); int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **); int lzc_bookmark(nvlist_t *, nvlist_t **); |