summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAndriy Gapon <andriy.gapon@clusterhq.com>2015-10-09 12:02:05 +0300
committerRichard Lowe <richlowe@richlowe.net>2016-04-21 11:29:18 -0400
commit26455f9efcf9b1e44937d4d86d1ce37b006f25a9 (patch)
tree5dfc3a0627c5ec3ac490f0d4d59ecbdf1f09ec6c /usr/src
parent20fea7a47472aceb64d3ed48cc2a3ea268bc4795 (diff)
downloadillumos-joyent-26455f9efcf9b1e44937d4d86d1ce37b006f25a9.tar.gz
6052 decouple lzc_create() from the implementation details
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c6
-rw-r--r--usr/src/lib/libzfs_core/common/libzfs_core.c4
-rw-r--r--usr/src/lib/libzfs_core/common/libzfs_core.h11
-rw-r--r--usr/src/uts/common/sys/fs/zfs.h4
4 files changed, 18 insertions, 7 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index e72d0e8d00..4eb953b174 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -3167,7 +3167,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
uint64_t blocksize = zfs_prop_default_numeric(ZFS_PROP_VOLBLOCKSIZE);
char errbuf[1024];
uint64_t zoned;
- dmu_objset_type_t ost;
+ enum lzc_dataset_type ost;
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot create '%s'"), path);
@@ -3194,9 +3194,9 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
}
if (type == ZFS_TYPE_VOLUME)
- ost = DMU_OST_ZVOL;
+ ost = LZC_DATSET_TYPE_ZVOL;
else
- ost = DMU_OST_ZFS;
+ ost = LZC_DATSET_TYPE_ZFS;
/* open zpool handle for prop validation */
char pool_path[MAXNAMELEN];
diff --git a/usr/src/lib/libzfs_core/common/libzfs_core.c b/usr/src/lib/libzfs_core/common/libzfs_core.c
index 76a0798d6b..0dd32a2b3b 100644
--- a/usr/src/lib/libzfs_core/common/libzfs_core.c
+++ b/usr/src/lib/libzfs_core/common/libzfs_core.c
@@ -171,11 +171,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/usr/src/lib/libzfs_core/common/libzfs_core.h b/usr/src/lib/libzfs_core/common/libzfs_core.h
index 938afbbc8f..6b4575ddeb 100644
--- a/usr/src/lib/libzfs_core/common/libzfs_core.h
+++ b/usr/src/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 **);
diff --git a/usr/src/uts/common/sys/fs/zfs.h b/usr/src/uts/common/sys/fs/zfs.h
index 7ecd889c5e..cf1df2378e 100644
--- a/usr/src/uts/common/sys/fs/zfs.h
+++ b/usr/src/uts/common/sys/fs/zfs.h
@@ -54,6 +54,10 @@ typedef enum {
ZFS_TYPE_BOOKMARK = (1 << 4)
} zfs_type_t;
+/*
+ * NB: lzc_dataset_type should be updated whenever a new objset type is added,
+ * if it represents a real type of a dataset that can be created from userland.
+ */
typedef enum dmu_objset_type {
DMU_OST_NONE,
DMU_OST_META,