summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am1
-rw-r--r--include/libzfs.h23
-rw-r--r--include/libzfs_core.h62
-rw-r--r--include/libzfs_impl.h10
-rw-r--r--include/sys/dmu.h24
-rw-r--r--include/sys/dmu_objset.h11
-rw-r--r--include/sys/dsl_dataset.h7
-rw-r--r--include/sys/dsl_deleg.h5
-rw-r--r--include/sys/dsl_prop.h3
-rw-r--r--include/sys/fs/zfs.h80
-rw-r--r--include/sys/rrwlock.h4
-rw-r--r--include/sys/spa.h32
-rw-r--r--include/sys/zfs_context.h1
-rw-r--r--include/sys/zfs_ioctl.h31
-rw-r--r--include/zfs_comutil.h4
15 files changed, 163 insertions, 135 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 64141d9bc..2e1c31aaf 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -18,6 +18,7 @@ USER_H = \
$(top_srcdir)/include/libuutil.h \
$(top_srcdir)/include/libuutil_impl.h \
$(top_srcdir)/include/libzfs.h \
+ $(top_srcdir)/include/libzfs_core.h \
$(top_srcdir)/include/libzfs_impl.h
EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
diff --git a/include/libzfs.h b/include/libzfs.h
index 3472b7699..d51a71d75 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -63,7 +63,8 @@ extern char *zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE];
/*
* libzfs errors
*/
-enum {
+typedef enum zfs_error {
+ EZFS_SUCCESS = 0, /* no error -- success */
EZFS_NOMEM = 2000, /* out of memory */
EZFS_BADPROP, /* invalid property value */
EZFS_PROPREADONLY, /* cannot set readonly property */
@@ -135,7 +136,7 @@ enum {
EZFS_DIFFDATA, /* bad zfs diff data */
EZFS_POOLREADONLY, /* pool is in read-only mode */
EZFS_UNKNOWN
-};
+} zfs_error_t;
/*
* The following data structures are all part
@@ -191,6 +192,9 @@ extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *);
extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t);
+extern void zfs_save_arguments(int argc, char **, char *, int);
+extern int zpool_log_history(libzfs_handle_t *, const char *);
+
extern int libzfs_errno(libzfs_handle_t *);
extern const char *libzfs_error_action(libzfs_handle_t *);
extern const char *libzfs_error_description(libzfs_handle_t *);
@@ -226,7 +230,7 @@ extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
*/
extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,
nvlist_t *, nvlist_t *);
-extern int zpool_destroy(zpool_handle_t *);
+extern int zpool_destroy(zpool_handle_t *, const char *);
extern int zpool_add(zpool_handle_t *, nvlist_t *);
typedef struct splitflags {
@@ -350,8 +354,8 @@ extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
/*
* Import and export functions
*/
-extern int zpool_export(zpool_handle_t *, boolean_t);
-extern int zpool_export_force(zpool_handle_t *);
+extern int zpool_export(zpool_handle_t *, boolean_t, const char *);
+extern int zpool_export_force(zpool_handle_t *, const char *);
extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
char *altroot);
extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
@@ -385,7 +389,7 @@ extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *,
*/
struct zfs_cmd;
-extern const char *zfs_history_event_names[LOG_END];
+extern const char *zfs_history_event_names[];
extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *,
boolean_t verbose);
@@ -393,9 +397,6 @@ extern int zpool_upgrade(zpool_handle_t *, uint64_t);
extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
nvlist_t ***, uint_t *);
-extern void zpool_set_history_str(const char *subcommand, int argc,
- char **argv, char *history_str);
-extern int zpool_stage_history(libzfs_handle_t *, const char *);
extern int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, int, int);
extern int zpool_events_clear(libzfs_handle_t *, int *);
extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
@@ -450,8 +451,6 @@ extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,
char *propbuf, int proplen, boolean_t literal);
extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,
char *buf, size_t len);
-extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap,
- uint64_t *usedp);
extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **);
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);
@@ -567,6 +566,8 @@ extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
extern int zfs_destroy_snaps_nvl(zfs_handle_t *, nvlist_t *, boolean_t);
extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
+extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
+ nvlist_t *props);
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
diff --git a/include/libzfs_core.h b/include/libzfs_core.h
new file mode 100644
index 000000000..9edc884a1
--- /dev/null
+++ b/include/libzfs_core.h
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+#ifndef _LIBZFS_CORE_H
+#define _LIBZFS_CORE_H
+
+#include <libnvpair.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/fs/zfs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int libzfs_core_init(void);
+void libzfs_core_fini(void);
+
+int lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist);
+int lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props);
+int lzc_clone(const char *fsname, const char *origin, nvlist_t *props);
+int lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist);
+
+int lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
+ uint64_t *usedp);
+
+int lzc_send(const char *snapname, const char *fromsnap, int fd);
+int lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
+ boolean_t force, int fd);
+int lzc_send_space(const char *snapname, const char *fromsnap,
+ uint64_t *result);
+
+boolean_t lzc_exists(const char *dataset);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LIBZFS_CORE_H */
diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h
index fabcb1183..7daf8348b 100644
--- a/include/libzfs_impl.h
+++ b/include/libzfs_impl.h
@@ -21,11 +21,11 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
-#ifndef _LIBFS_IMPL_H
-#define _LIBFS_IMPL_H
+#ifndef _LIBZFS_IMPL_H
+#define _LIBZFS_IMPL_H
#include <sys/dmu.h>
#include <sys/fs/zfs.h>
@@ -36,6 +36,7 @@
#include <libuutil.h>
#include <libzfs.h>
#include <libshare.h>
+#include <libzfs_core.h>
#if defined(HAVE_LIBTOPO)
#include <fm/libtopo.h>
@@ -69,7 +70,6 @@ struct libzfs_handle {
int libzfs_desc_active;
char libzfs_action[1024];
char libzfs_desc[1024];
- char *libzfs_log_str;
int libzfs_printerr;
int libzfs_storeerr; /* stuff error messages into buffer */
void *libzfs_sharehdl; /* libshare handle */
@@ -219,4 +219,4 @@ extern void libzfs_fru_clear(libzfs_handle_t *, boolean_t);
}
#endif
-#endif /* _LIBFS_IMPL_H */
+#endif /* _LIBZFS_IMPL_H */
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index adaab4c6b..c50df391e 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -42,6 +42,7 @@
#include <sys/param.h>
#include <sys/cred.h>
#include <sys/time.h>
+#include <sys/fs/zfs.h>
#include <sys/uio.h>
#ifdef __cplusplus
@@ -213,16 +214,6 @@ typedef enum dmu_object_type {
DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
} dmu_object_type_t;
-typedef enum dmu_objset_type {
- DMU_OST_NONE,
- DMU_OST_META,
- DMU_OST_ZFS,
- DMU_OST_ZVOL,
- DMU_OST_OTHER, /* For testing only! */
- DMU_OST_ANY, /* Be careful! */
- DMU_OST_NUMTYPES
-} dmu_objset_type_t;
-
void byteswap_uint64_array(void *buf, size_t size);
void byteswap_uint32_array(void *buf, size_t size);
void byteswap_uint16_array(void *buf, size_t size);
@@ -267,9 +258,11 @@ int dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags,
int dmu_objset_clone(const char *name, struct dsl_dataset *clone_origin,
uint64_t flags);
int dmu_objset_destroy(const char *name, boolean_t defer);
-int dmu_snapshots_destroy_nvl(struct nvlist *snaps, boolean_t defer, char *);
-int dmu_objset_snapshot(char *fsname, char *snapname, char *tag,
- struct nvlist *props, boolean_t recursive, boolean_t temporary, int fd);
+int dmu_snapshots_destroy_nvl(struct nvlist *snaps, boolean_t defer,
+ struct nvlist *errlist);
+int dmu_objset_snapshot(struct nvlist *snaps, struct nvlist *, struct nvlist *);
+int dmu_objset_snapshot_one(const char *fsname, const char *snapname);
+int dmu_objset_snapshot_tmp(const char *, const char *, int);
int dmu_objset_rename(const char *name, const char *newname,
boolean_t recursive);
int dmu_objset_find(char *name, int func(const char *, void *), void *arg,
@@ -792,10 +785,9 @@ typedef void (*dmu_traverse_cb_t)(objset_t *os, void *arg, struct blkptr *bp,
void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
dmu_traverse_cb_t cb, void *arg);
-int dmu_send(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
+int dmu_send(objset_t *tosnap, objset_t *fromsnap,
int outfd, struct vnode *vp, offset_t *off);
-int dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorign,
- uint64_t *sizep);
+int dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap, uint64_t *sizep);
typedef struct dmu_recv_cookie {
/*
diff --git a/include/sys/dmu_objset.h b/include/sys/dmu_objset.h
index 507f73222..79d3a6bc0 100644
--- a/include/sys/dmu_objset.h
+++ b/include/sys/dmu_objset.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
/* Portions Copyright 2010 Robert Milkowski */
@@ -140,24 +141,14 @@ void dmu_objset_rele(objset_t *os, void *tag);
void dmu_objset_disown(objset_t *os, void *tag);
int dmu_objset_from_ds(struct dsl_dataset *ds, objset_t **osp);
-int dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags,
- void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg);
-int dmu_objset_clone(const char *name, struct dsl_dataset *clone_origin,
- uint64_t flags);
-int dmu_objset_destroy(const char *name, boolean_t defer);
-int dmu_objset_snapshot(char *fsname, char *snapname, char *tag,
- struct nvlist *props, boolean_t recursive, boolean_t temporary, int fd);
void dmu_objset_stats(objset_t *os, nvlist_t *nv);
void dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat);
void dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp,
uint64_t *usedobjsp, uint64_t *availobjsp);
uint64_t dmu_objset_fsid_guid(objset_t *os);
-int dmu_objset_find(char *name, int func(const char *, void *), void *arg,
- int flags);
int dmu_objset_find_spa(spa_t *spa, const char *name,
int func(spa_t *, uint64_t, const char *, void *), void *arg, int flags);
int dmu_objset_prefetch(const char *name, void *arg);
-void dmu_objset_byteswap(void *buf, size_t size);
int dmu_objset_evict_dbufs(objset_t *os);
timestruc_t dmu_objset_snap_cmtime(objset_t *os);
diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h
index afcf2b794..735ccbbd3 100644
--- a/include/sys/dsl_dataset.h
+++ b/include/sys/dsl_dataset.h
@@ -180,7 +180,7 @@ struct dsl_ds_destroyarg {
struct dsl_ds_holdarg {
dsl_sync_task_group_t *dstg;
- char *htag;
+ const char *htag;
char *snapname;
boolean_t recursive;
boolean_t gotone;
@@ -215,12 +215,11 @@ uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
uint64_t flags, dmu_tx_t *tx);
int dsl_dataset_destroy(dsl_dataset_t *ds, void *tag, boolean_t defer);
-int dsl_snapshots_destroy(char *fsname, char *snapname, boolean_t defer);
dsl_checkfunc_t dsl_dataset_destroy_check;
dsl_syncfunc_t dsl_dataset_destroy_sync;
-dsl_checkfunc_t dsl_dataset_snapshot_check;
-dsl_syncfunc_t dsl_dataset_snapshot_sync;
dsl_syncfunc_t dsl_dataset_user_hold_sync;
+int dsl_dataset_snapshot_check(dsl_dataset_t *ds, const char *, dmu_tx_t *tx);
+void dsl_dataset_snapshot_sync(dsl_dataset_t *ds, const char *, dmu_tx_t *tx);
int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive);
int dsl_dataset_promote(const char *name, char *conflsnap);
int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
diff --git a/include/sys/dsl_deleg.h b/include/sys/dsl_deleg.h
index 9db6d07e8..5842639aa 100644
--- a/include/sys/dsl_deleg.h
+++ b/include/sys/dsl_deleg.h
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _SYS_DSL_DELEG_H
@@ -65,8 +65,7 @@ extern "C" {
int dsl_deleg_get(const char *ddname, nvlist_t **nvp);
int dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset);
int dsl_deleg_access(const char *ddname, const char *perm, cred_t *cr);
-int dsl_deleg_access_impl(struct dsl_dataset *ds, boolean_t descendent,
- const char *perm, cred_t *cr);
+int dsl_deleg_access_impl(struct dsl_dataset *ds, const char *perm, cred_t *cr);
void dsl_deleg_set_create_perms(dsl_dir_t *dd, dmu_tx_t *tx, cred_t *cr);
int dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr);
int dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr);
diff --git a/include/sys/dsl_prop.h b/include/sys/dsl_prop.h
index a636ad350..b0d9a52cd 100644
--- a/include/sys/dsl_prop.h
+++ b/include/sys/dsl_prop.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _SYS_DSL_PROP_H
@@ -89,8 +90,6 @@ dsl_syncfunc_t dsl_props_set_sync;
int dsl_prop_set(const char *ddname, const char *propname,
zprop_source_t source, int intsz, int numints, const void *buf);
int dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *nvl);
-void dsl_dir_prop_set_uint64_sync(dsl_dir_t *dd, const char *name, uint64_t val,
- dmu_tx_t *tx);
void dsl_prop_setarg_init_uint64(dsl_prop_setarg_t *psa, const char *propname,
zprop_source_t source, uint64_t *value);
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 26c24fc00..164bf3591 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -52,6 +52,16 @@ typedef enum {
ZFS_TYPE_POOL = 0x8
} zfs_type_t;
+typedef enum dmu_objset_type {
+ DMU_OST_NONE,
+ DMU_OST_META,
+ DMU_OST_ZFS,
+ DMU_OST_ZVOL,
+ DMU_OST_OTHER, /* For testing only! */
+ DMU_OST_ANY, /* Be careful! */
+ DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
#define ZFS_TYPE_DATASET \
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
@@ -753,10 +763,10 @@ typedef struct ddt_histogram {
/*
* /dev/zfs ioctl numbers.
*/
-#define ZFS_IOC ('Z' << 8)
-
typedef enum zfs_ioc {
- ZFS_IOC_POOL_CREATE = ZFS_IOC,
+ ZFS_IOC_FIRST = ('Z' << 8),
+ ZFS_IOC = ZFS_IOC_FIRST,
+ ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
ZFS_IOC_POOL_DESTROY,
ZFS_IOC_POOL_IMPORT,
ZFS_IOC_POOL_EXPORT,
@@ -793,7 +803,7 @@ typedef enum zfs_ioc {
ZFS_IOC_ERROR_LOG,
ZFS_IOC_CLEAR,
ZFS_IOC_PROMOTE,
- ZFS_IOC_DESTROY_SNAPS_NVL,
+ ZFS_IOC_DESTROY_SNAPS,
ZFS_IOC_SNAPSHOT,
ZFS_IOC_DSOBJ_TO_DSNAME,
ZFS_IOC_OBJ_TO_PATH,
@@ -823,6 +833,11 @@ typedef enum zfs_ioc {
ZFS_IOC_SPACE_SNAPS,
ZFS_IOC_POOL_REOPEN,
ZFS_IOC_SEND_PROGRESS,
+ ZFS_IOC_LOG_HISTORY,
+ ZFS_IOC_SEND_NEW,
+ ZFS_IOC_SEND_SPACE,
+ ZFS_IOC_CLONE,
+ ZFS_IOC_LAST
} zfs_ioc_t;
/*
@@ -864,6 +879,12 @@ typedef enum {
#define ZPOOL_HIST_TXG "history txg"
#define ZPOOL_HIST_INT_EVENT "history internal event"
#define ZPOOL_HIST_INT_STR "history internal str"
+#define ZPOOL_HIST_INT_NAME "internal_name"
+#define ZPOOL_HIST_IOCTL "ioctl"
+#define ZPOOL_HIST_INPUT_NVL "in_nvl"
+#define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
+#define ZPOOL_HIST_DSNAME "dsname"
+#define ZPOOL_HIST_DSID "dsid"
/*
* Flags for ZFS_IOC_VDEV_SET_STATE
@@ -909,57 +930,6 @@ typedef enum {
#define ZFS_EV_VDEV_PATH "vdev_path"
#define ZFS_EV_VDEV_GUID "vdev_guid"
-/*
- * Note: This is encoded on-disk, so new events must be added to the
- * end, and unused events can not be removed. Be sure to edit
- * libzfs_pool.c: hist_event_table[].
- */
-typedef enum history_internal_events {
- LOG_NO_EVENT = 0,
- LOG_POOL_CREATE,
- LOG_POOL_VDEV_ADD,
- LOG_POOL_REMOVE,
- LOG_POOL_DESTROY,
- LOG_POOL_EXPORT,
- LOG_POOL_IMPORT,
- LOG_POOL_VDEV_ATTACH,
- LOG_POOL_VDEV_REPLACE,
- LOG_POOL_VDEV_DETACH,
- LOG_POOL_VDEV_ONLINE,
- LOG_POOL_VDEV_OFFLINE,
- LOG_POOL_UPGRADE,
- LOG_POOL_CLEAR,
- LOG_POOL_SCAN,
- LOG_POOL_PROPSET,
- LOG_DS_CREATE,
- LOG_DS_CLONE,
- LOG_DS_DESTROY,
- LOG_DS_DESTROY_BEGIN,
- LOG_DS_INHERIT,
- LOG_DS_PROPSET,
- LOG_DS_QUOTA,
- LOG_DS_PERM_UPDATE,
- LOG_DS_PERM_REMOVE,
- LOG_DS_PERM_WHO_REMOVE,
- LOG_DS_PROMOTE,
- LOG_DS_RECEIVE,
- LOG_DS_RENAME,
- LOG_DS_RESERVATION,
- LOG_DS_REPLAY_INC_SYNC,
- LOG_DS_REPLAY_FULL_SYNC,
- LOG_DS_ROLLBACK,
- LOG_DS_SNAPSHOT,
- LOG_DS_UPGRADE,
- LOG_DS_REFQUOTA,
- LOG_DS_REFRESERV,
- LOG_POOL_SCAN_DONE,
- LOG_DS_USER_HOLD,
- LOG_DS_USER_RELEASE,
- LOG_POOL_SPLIT,
- LOG_POOL_GUID_CHANGE,
- LOG_END
-} history_internal_events_t;
-
#ifdef __cplusplus
}
#endif
diff --git a/include/sys/rrwlock.h b/include/sys/rrwlock.h
index 798a015d1..8fde3a3be 100644
--- a/include/sys/rrwlock.h
+++ b/include/sys/rrwlock.h
@@ -22,6 +22,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
#ifndef _SYS_RR_RW_LOCK_H
#define _SYS_RR_RW_LOCK_H
@@ -69,6 +72,7 @@ void rrw_destroy(rrwlock_t *rrl);
void rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag);
void rrw_exit(rrwlock_t *rrl, void *tag);
boolean_t rrw_held(rrwlock_t *rrl, krw_t rw);
+void rrw_tsd_destroy(void *arg);
#define RRW_READ_HELD(x) rrw_held(x, RW_READER)
#define RRW_WRITE_HELD(x) rrw_held(x, RW_WRITER)
diff --git a/include/sys/spa.h b/include/sys/spa.h
index 8f2af8af2..1af9137f8 100644
--- a/include/sys/spa.h
+++ b/include/sys/spa.h
@@ -52,6 +52,7 @@ typedef struct spa_aux_vdev spa_aux_vdev_t;
typedef struct ddt ddt_t;
typedef struct ddt_entry ddt_entry_t;
struct dsl_pool;
+struct dsl_dataset;
/*
* General-purpose 32-bit and 64-bit bitfield encodings.
@@ -419,7 +420,7 @@ extern int spa_open_rewind(const char *pool, spa_t **, void *tag,
extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
size_t buflen);
extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
- const char *history_str, nvlist_t *zplprops);
+ nvlist_t *zplprops);
extern int spa_import_rootpool(char *devpath, char *devid);
extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props,
uint64_t flags);
@@ -629,31 +630,20 @@ extern boolean_t spa_writeable(spa_t *spa);
extern int spa_mode(spa_t *spa);
extern uint64_t strtonum(const char *str, char **nptr);
-/* history logging */
-typedef enum history_log_type {
- LOG_CMD_POOL_CREATE,
- LOG_CMD_NORMAL,
- LOG_INTERNAL
-} history_log_type_t;
-
-typedef struct history_arg {
- char *ha_history_str;
- history_log_type_t ha_log_type;
- history_internal_events_t ha_event;
- char *ha_zone;
- uid_t ha_uid;
-} history_arg_t;
-
extern char *spa_his_ievent_table[];
extern void spa_history_create_obj(spa_t *spa, dmu_tx_t *tx);
extern int spa_history_get(spa_t *spa, uint64_t *offset, uint64_t *len_read,
char *his_buf);
-extern int spa_history_log(spa_t *spa, const char *his_buf,
- history_log_type_t what);
-extern void spa_history_log_internal(history_internal_events_t event,
- spa_t *spa, dmu_tx_t *tx, const char *fmt, ...);
-extern void spa_history_log_version(spa_t *spa, history_internal_events_t evt);
+extern int spa_history_log(spa_t *spa, const char *his_buf);
+extern int spa_history_log_nvl(spa_t *spa, nvlist_t *nvl);
+extern void spa_history_log_version(spa_t *spa, const char *operation);
+extern void spa_history_log_internal(spa_t *spa, const char *operation,
+ dmu_tx_t *tx, const char *fmt, ...);
+extern void spa_history_log_internal_ds(struct dsl_dataset *ds, const char *op,
+ dmu_tx_t *tx, const char *fmt, ...);
+extern void spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation,
+ dmu_tx_t *tx, const char *fmt, ...);
/* error handling */
struct zbookmark;
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index 4b342595f..599b97a9b 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -293,6 +293,7 @@ extern void rw_exit(krwlock_t *rwlp);
#define rw_downgrade(rwlp) do { } while (0)
extern uid_t crgetuid(cred_t *cr);
+extern uid_t crgetruid(cred_t *cr);
extern gid_t crgetgid(cred_t *cr);
extern int crgetngroups(cred_t *cr);
extern gid_t *crgetgroups(cred_t *cr);
diff --git a/include/sys/zfs_ioctl.h b/include/sys/zfs_ioctl.h
index c0cb4705d..21bfe2b8f 100644
--- a/include/sys/zfs_ioctl.h
+++ b/include/sys/zfs_ioctl.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _SYS_ZFS_IOCTL_H
@@ -41,6 +42,15 @@ extern "C" {
#endif
/*
+ * The structures in this file are passed between userland and the
+ * kernel. Userland may be running a 32-bit process, while the kernel
+ * is 64-bit. Therefore, these structures need to compile the same in
+ * 32-bit and 64-bit. This means not using type "long", and adding
+ * explicit padding so that the 32-bit structure will not be packed more
+ * tightly than the 64-bit structure (which requires 64-bit alignment).
+ */
+
+/*
* Property values for snapdir
*/
#define ZFS_SNAPDIR_HIDDEN 0
@@ -277,22 +287,29 @@ typedef enum zfs_case {
} zfs_case_t;
typedef struct zfs_cmd {
- char zc_name[MAXPATHLEN];
+ char zc_name[MAXPATHLEN]; /* name of pool or dataset */
+ uint64_t zc_nvlist_src; /* really (char *) */
+ uint64_t zc_nvlist_src_size;
+ uint64_t zc_nvlist_dst; /* really (char *) */
+ uint64_t zc_nvlist_dst_size;
+ boolean_t zc_nvlist_dst_filled; /* put an nvlist in dst? */
+ int zc_pad2;
+
+ /*
+ * The following members are for legacy ioctls which haven't been
+ * converted to the new method.
+ */
+ uint64_t zc_history; /* really (char *) */
char zc_value[MAXPATHLEN * 2];
char zc_string[MAXNAMELEN];
char zc_top_ds[MAXPATHLEN];
uint64_t zc_guid;
uint64_t zc_nvlist_conf; /* really (char *) */
uint64_t zc_nvlist_conf_size;
- uint64_t zc_nvlist_src; /* really (char *) */
- uint64_t zc_nvlist_src_size;
- uint64_t zc_nvlist_dst; /* really (char *) */
- uint64_t zc_nvlist_dst_size;
uint64_t zc_cookie;
uint64_t zc_objset_type;
uint64_t zc_perm_action;
- uint64_t zc_history; /* really (char *) */
- uint64_t zc_history_len;
+ uint64_t zc_history_len;
uint64_t zc_history_offset;
uint64_t zc_obj;
uint64_t zc_iflags; /* internal to zfs(7fs) */
diff --git a/include/zfs_comutil.h b/include/zfs_comutil.h
index 61327f9aa..f89054388 100644
--- a/include/zfs_comutil.h
+++ b/include/zfs_comutil.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _ZFS_COMUTIL_H
@@ -37,7 +38,8 @@ extern void zpool_get_rewind_policy(nvlist_t *, zpool_rewind_policy_t *);
extern int zfs_zpl_version_map(int spa_version);
extern int zfs_spa_version_map(int zpl_version);
-extern const char *zfs_history_event_names[LOG_END];
+#define ZFS_NUM_LEGACY_HISTORY_EVENTS 41
+extern const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS];
#ifdef __cplusplus
}