#include <sys/zfs_ioctl.h>
#include <time.h>
#include <unistd.h>
+#include <sys/fm/fs/zfs.h>
#include "zed.h"
#include "zed_conf.h"
+#include "zed_disk_event.h"
#include "zed_exec.h"
#include "zed_file.h"
#include "zed_log.h"
#include "zed_strings.h"
+#include "agents/zfs_agents.h"
+
#define MAXBUF 4096
/*
if (zcp->zevent_fd < 0)
zed_log_die("Failed to open \"%s\": %s",
ZFS_DEV, strerror(errno));
+
+ zfs_agent_init(zcp->zfs_hdl);
+
+ if (zed_disk_event_init() != 0)
+ zed_log_die("Failed to initialize disk events");
}
/*
if (!zcp)
zed_log_die("Failed zed_event_fini: %s", strerror(EINVAL));
+ zed_disk_event_fini();
+ zfs_agent_fini();
+
if (zcp->zevent_fd >= 0) {
if (close(zcp->zevent_fd) < 0)
zed_log_msg(LOG_WARNING, "Failed to close \"%s\": %s",
_zed_event_add_var(eid, zsp, prefix, name,
(_zed_event_value_is_hex(name) ? "0x%.16llX" : "%llu"),
(u_longlong_t) i64);
+ /*
+ * shadow readable strings for vdev state pairs
+ */
+ if (strcmp(name, FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE) == 0 ||
+ strcmp(name, FM_EREPORT_PAYLOAD_ZFS_VDEV_LASTSTATE) == 0) {
+ char alt[32];
+
+ (void) snprintf(alt, sizeof (alt), "%s_str", name);
+ _zed_event_add_var(eid, zsp, prefix, alt, "%s",
+ zpool_state_to_name(i64, VDEV_AUX_NONE));
+ }
break;
case DATA_TYPE_DOUBLE:
(void) nvpair_value_double(nvp, &d);
zed_log_msg(LOG_WARNING,
"Failed to lookup zevent class (eid=%llu)", eid);
} else {
+ /* let internal modules see this event first */
+ zfs_agent_post_event(class, NULL, nvl);
+
zsp = zed_strings_create();
nvp = NULL;
subclass = _zed_event_get_subclass(class);
_zed_event_add_var(eid, zsp, ZEVENT_VAR_PREFIX, "SUBCLASS",
"%s", (subclass ? subclass : class));
+
_zed_event_add_time_strings(eid, zsp, etime);
zed_exec_process(eid, class, subclass,