summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Eddy <[email protected]>2017-05-30 11:39:17 -0700
committerBrian Behlendorf <[email protected]>2017-07-12 21:28:13 -0700
commit12fa0466df8773fc6151e8b55367a1c4f76ec407 (patch)
treedc8627f3df85f8d2c0ce515afec0d17f20702a98 /include
parent314be68aa93a543f89d7c0137f25848e4c692653 (diff)
OpenZFS 6939 - add sysevents to zfs core for commands
Authored by: Dave Eddy <[email protected]> Reviewed by: Patrick Mooney <[email protected]> Reviewed by: Joshua M. Clulow <[email protected]> Reviewed by: Josh Wilsdon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Alan Somers <[email protected]> Reviewed by: Andrew Stormont <[email protected]> Approved by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6939 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ce1577b Closes #6328
Diffstat (limited to 'include')
-rw-r--r--include/sys/fm/util.h1
-rw-r--r--include/sys/fs/zfs.h37
-rw-r--r--include/sys/spa.h8
-rw-r--r--include/sys/sysevent.h6
-rw-r--r--include/sys/sysevent/eventdefs.h2
5 files changed, 51 insertions, 3 deletions
diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h
index 6ee31764b..ff54b05bb 100644
--- a/include/sys/fm/util.h
+++ b/include/sys/fm/util.h
@@ -93,6 +93,7 @@ typedef struct zfs_zevent {
extern void fm_init(void);
extern void fm_fini(void);
extern void fm_nvprint(nvlist_t *);
+extern void zfs_zevent_post_cb(nvlist_t *nvl, nvlist_t *detector);
extern int zfs_zevent_post(nvlist_t *, nvlist_t *, zevent_cb_t *);
extern void zfs_zevent_drain_all(int *);
extern int zfs_zevent_fd_hold(int, minor_t *, zfs_zevent_t **);
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index b634635c8..9fbcfbef3 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -23,7 +23,8 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 Integros [integros.com]
* Copyright (c) 2017 Datto Inc.
*/
@@ -1146,11 +1147,45 @@ typedef enum {
* ZFS_EV_POOL_GUID DATA_TYPE_UINT64
* ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
* ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
+ *
+ * ESC_ZFS_HISTORY_EVENT
+ *
+ * ZFS_EV_POOL_NAME DATA_TYPE_STRING
+ * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
+ * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional)
+ * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional)
+ * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional)
+ * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional)
+ * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional)
+ * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional)
+ *
+ * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
+ * history log nvlist. The keynames will be free of any spaces or other
+ * characters that could be potentially unexpected to consumers of the
+ * sysevents.
*/
#define ZFS_EV_POOL_NAME "pool_name"
#define ZFS_EV_POOL_GUID "pool_guid"
#define ZFS_EV_VDEV_PATH "vdev_path"
#define ZFS_EV_VDEV_GUID "vdev_guid"
+#define ZFS_EV_HIST_TIME "history_time"
+#define ZFS_EV_HIST_CMD "history_command"
+#define ZFS_EV_HIST_WHO "history_who"
+#define ZFS_EV_HIST_ZONE "history_zone"
+#define ZFS_EV_HIST_HOST "history_hostname"
+#define ZFS_EV_HIST_TXG "history_txg"
+#define ZFS_EV_HIST_INT_EVENT "history_internal_event"
+#define ZFS_EV_HIST_INT_STR "history_internal_str"
+#define ZFS_EV_HIST_INT_NAME "history_internal_name"
+#define ZFS_EV_HIST_IOCTL "history_ioctl"
+#define ZFS_EV_HIST_DSNAME "history_dsname"
+#define ZFS_EV_HIST_DSID "history_dsid"
#ifdef __cplusplus
}
diff --git a/include/sys/spa.h b/include/sys/spa.h
index 33f3a7805..dd86aad40 100644
--- a/include/sys/spa.h
+++ b/include/sys/spa.h
@@ -24,6 +24,8 @@
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
* Copyright 2013 Saso Kiselkov. All rights reserved.
+ * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2017 Joyent, Inc.
* Copyright (c) 2017 Datto Inc.
*/
@@ -882,10 +884,11 @@ struct zbookmark_phys;
extern void spa_log_error(spa_t *spa, zio_t *zio);
extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd,
zio_t *zio, uint64_t stateoroffset, uint64_t length);
+extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type,
+ const char *name, nvlist_t *aux);
extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate);
extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
-extern void zfs_post_sysevent(spa_t *spa, vdev_t *vd, const char *name);
extern uint64_t spa_get_errlog_size(spa_t *spa);
extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
extern void spa_errlog_rotate(spa_t *spa);
@@ -909,7 +912,8 @@ extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx);
extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t);
/* asynchronous event notification */
-extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
+extern void spa_event_notify(spa_t *spa, vdev_t *vdev, nvlist_t *hist_nvl,
+ const char *name);
#ifdef ZFS_DEBUG
#define dprintf_bp(bp, fmt, ...) do { \
diff --git a/include/sys/sysevent.h b/include/sys/sysevent.h
index 2922e3072..6510297d6 100644
--- a/include/sys/sysevent.h
+++ b/include/sys/sysevent.h
@@ -27,4 +27,10 @@
#ifndef _SYS_SYSEVENT_H
#define _SYS_SYSEVENT_H
+#include <sys/nvpair.h>
+
+typedef struct sysevent {
+ nvlist_t *resource;
+} sysevent_t;
+
#endif
diff --git a/include/sys/sysevent/eventdefs.h b/include/sys/sysevent/eventdefs.h
index eadaaef58..fc2687842 100644
--- a/include/sys/sysevent/eventdefs.h
+++ b/include/sys/sysevent/eventdefs.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
*/
#ifndef _SYS_SYSEVENT_EVENTDEFS_H
@@ -112,6 +113,7 @@ extern "C" {
#define ESC_ZFS_VDEV_AUTOEXPAND "vdev_autoexpand"
#define ESC_ZFS_BOOTFS_VDEV_ATTACH "bootfs_vdev_attach"
#define ESC_ZFS_POOL_REGUID "pool_reguid"
+#define ESC_ZFS_HISTORY_EVENT "history_event"
/*
* datalink subclass definitions.