summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorChris Dunlap <[email protected]>2014-09-19 11:10:28 -0700
committerBrian Behlendorf <[email protected]>2014-09-25 13:54:17 -0700
commitdcca723acee9803561dd7ef456a28c4684c28e86 (patch)
tree082e642033d282e30adf72f07b0678083009cd0d /cmd
parent8cb8cf91df8a4902025d814b62b9332ad1b291c7 (diff)
Refer to ZED's scripts as ZEDLETs
The executables invoked by the ZED in response to a given zevent have been generically referred to as "scripts". By convention, these scripts have aimed to be /bin/sh compatible for reasons of portability and comprehensibility. However, the ZED only requires they be executable and (ideally) capable of reading environment variables. As such, these scripts are now referred to as ZEDLETs (ZFS Event Daemon Linkage for Executable Tasks). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2735
Diffstat (limited to 'cmd')
-rwxr-xr-xcmd/zed/zed.d/all-debug.sh2
-rwxr-xr-xcmd/zed/zed.d/all-syslog.sh2
-rwxr-xr-xcmd/zed/zed.d/data-email.sh2
-rwxr-xr-xcmd/zed/zed.d/generic-email.sh2
-rwxr-xr-xcmd/zed/zed.d/io-email.sh2
-rwxr-xr-xcmd/zed/zed.d/io-spare.sh2
-rwxr-xr-xcmd/zed/zed.d/scrub.finish-email.sh2
-rw-r--r--cmd/zed/zed.h4
-rw-r--r--cmd/zed/zed_conf.c54
-rw-r--r--cmd/zed/zed_conf.h4
-rw-r--r--cmd/zed/zed_event.c4
-rw-r--r--cmd/zed/zed_exec.c20
-rw-r--r--cmd/zed/zed_exec.h2
13 files changed, 51 insertions, 51 deletions
diff --git a/cmd/zed/zed.d/all-debug.sh b/cmd/zed/zed.d/all-debug.sh
index ae64e0a79..aa20ef268 100755
--- a/cmd/zed/zed.d/all-debug.sh
+++ b/cmd/zed/zed.d/all-debug.sh
@@ -2,7 +2,7 @@
#
# Log all environment variables to ZED_DEBUG_LOG.
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
# Override the default umask to restrict access to a newly-created logfile.
umask 077
diff --git a/cmd/zed/zed.d/all-syslog.sh b/cmd/zed/zed.d/all-syslog.sh
index b8bd307a1..acf9e83bd 100755
--- a/cmd/zed/zed.d/all-syslog.sh
+++ b/cmd/zed/zed.d/all-syslog.sh
@@ -2,7 +2,7 @@
#
# Log the zevent via syslog.
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
logger -t "${ZED_SYSLOG_TAG:=zed}" -p "${ZED_SYSLOG_PRIORITY:=daemon.notice}" \
eid="${ZEVENT_EID}" class="${ZEVENT_SUBCLASS}" \
diff --git a/cmd/zed/zed.d/data-email.sh b/cmd/zed/zed.d/data-email.sh
index f056ac803..543b8fe55 100755
--- a/cmd/zed/zed.d/data-email.sh
+++ b/cmd/zed/zed.d/data-email.sh
@@ -14,7 +14,7 @@
# State File Format:
# POOL;TIME_OF_LAST_EMAIL
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
test -n "${ZEVENT_POOL}" || exit 5
test -n "${ZEVENT_SUBCLASS}" || exit 5
diff --git a/cmd/zed/zed.d/generic-email.sh b/cmd/zed/zed.d/generic-email.sh
index 16bbdb197..357aedee5 100755
--- a/cmd/zed/zed.d/generic-email.sh
+++ b/cmd/zed/zed.d/generic-email.sh
@@ -12,7 +12,7 @@
# 2: email suppressed
# 3: missing executable
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
# Only send email if ZED_EMAIL has been configured.
test -n "${ZED_EMAIL}" || exit 2
diff --git a/cmd/zed/zed.d/io-email.sh b/cmd/zed/zed.d/io-email.sh
index f97591175..9edbe6670 100755
--- a/cmd/zed/zed.d/io-email.sh
+++ b/cmd/zed/zed.d/io-email.sh
@@ -14,7 +14,7 @@
# State File Format:
# POOL;VDEV_PATH;TIME_OF_LAST_EMAIL
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
test -n "${ZEVENT_POOL}" || exit 5
test -n "${ZEVENT_SUBCLASS}" || exit 5
diff --git a/cmd/zed/zed.d/io-spare.sh b/cmd/zed/zed.d/io-spare.sh
index 894817317..2fcbfb791 100755
--- a/cmd/zed/zed.d/io-spare.sh
+++ b/cmd/zed/zed.d/io-spare.sh
@@ -28,7 +28,7 @@
# 4: unsupported event class
# 5: internal error
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
test -n "${ZEVENT_POOL}" || exit 5
test -n "${ZEVENT_SUBCLASS}" || exit 5
diff --git a/cmd/zed/zed.d/scrub.finish-email.sh b/cmd/zed/zed.d/scrub.finish-email.sh
index b5ce3f74d..d92ccfea1 100755
--- a/cmd/zed/zed.d/scrub.finish-email.sh
+++ b/cmd/zed/zed.d/scrub.finish-email.sh
@@ -12,7 +12,7 @@
# 4: unsupported event class
# 5: internal error
#
-test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+test -f "${ZED_ZEDLET_DIR}/zed.rc" && . "${ZED_ZEDLET_DIR}/zed.rc"
test -n "${ZEVENT_POOL}" || exit 5
test -n "${ZEVENT_SUBCLASS}" || exit 5
diff --git a/cmd/zed/zed.h b/cmd/zed/zed.h
index 179006cd3..1e8716c99 100644
--- a/cmd/zed/zed.h
+++ b/cmd/zed/zed.h
@@ -43,9 +43,9 @@
#define ZED_STATE_FILE RUNSTATEDIR "/zed.state"
/*
- * Absolute path for the default zed script directory.
+ * Absolute path for the default zed zedlet directory.
*/
-#define ZED_SCRIPT_DIR SYSCONFDIR "/zfs/zed.d"
+#define ZED_ZEDLET_DIR SYSCONFDIR "/zfs/zed.d"
/*
* Reserved for future use.
diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c
index fc7bd8a7e..5e21a3db9 100644
--- a/cmd/zed/zed_conf.c
+++ b/cmd/zed/zed_conf.c
@@ -58,7 +58,7 @@ zed_conf_create(void)
zcp->syslog_facility = LOG_DAEMON;
zcp->min_events = ZED_MIN_EVENTS;
zcp->max_events = ZED_MAX_EVENTS;
- zcp->scripts = NULL; /* created via zed_conf_scan_dir() */
+ zcp->zedlets = NULL; /* created via zed_conf_scan_dir() */
zcp->state_fd = -1; /* opened via zed_conf_open_state() */
zcp->zfs_hdl = NULL; /* opened via zed_event_init() */
zcp->zevent_fd = -1; /* opened via zed_event_init() */
@@ -69,7 +69,7 @@ zed_conf_create(void)
if (!(zcp->pid_file = strdup(ZED_PID_FILE)))
goto nomem;
- if (!(zcp->script_dir = strdup(ZED_SCRIPT_DIR)))
+ if (!(zcp->zedlet_dir = strdup(ZED_ZEDLET_DIR)))
goto nomem;
if (!(zcp->state_file = strdup(ZED_STATE_FILE)))
@@ -111,14 +111,14 @@ zed_conf_destroy(struct zed_conf *zcp)
if (zcp->pid_file)
free(zcp->pid_file);
- if (zcp->script_dir)
- free(zcp->script_dir);
+ if (zcp->zedlet_dir)
+ free(zcp->zedlet_dir);
if (zcp->state_file)
free(zcp->state_file);
- if (zcp->scripts)
- zed_strings_destroy(zcp->scripts);
+ if (zcp->zedlets)
+ zed_strings_destroy(zcp->zedlets);
free(zcp);
}
@@ -161,7 +161,7 @@ _zed_conf_display_help(const char *prog, int got_err)
"Read configuration from FILE.", ZED_CONF_FILE);
#endif
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-d DIR",
- "Read enabled scripts from DIR.", ZED_SCRIPT_DIR);
+ "Read enabled ZEDLETs from DIR.", ZED_ZEDLET_DIR);
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-p FILE",
"Write daemon's PID to FILE.", ZED_PID_FILE);
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-s FILE",
@@ -269,7 +269,7 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
_zed_conf_parse_path(&zcp->conf_file, optarg);
break;
case 'd':
- _zed_conf_parse_path(&zcp->script_dir, optarg);
+ _zed_conf_parse_path(&zcp->zedlet_dir, optarg);
break;
case 'p':
_zed_conf_parse_path(&zcp->pid_file, optarg);
@@ -318,19 +318,19 @@ zed_conf_parse_file(struct zed_conf *zcp)
}
/*
- * Scan the [zcp] script_dir for files to exec based on the event class.
+ * Scan the [zcp] zedlet_dir for files to exec based on the event class.
* Files must be executable by user, but not writable by group or other.
* Dotfiles are ignored.
*
- * Return 0 on success with an updated set of scripts,
+ * Return 0 on success with an updated set of zedlets,
* or -1 on error with errno set.
*
- * FIXME: Check if script_dir and all parent dirs are secure.
+ * FIXME: Check if zedlet_dir and all parent dirs are secure.
*/
int
zed_conf_scan_dir(struct zed_conf *zcp)
{
- zed_strings_t *scripts;
+ zed_strings_t *zedlets;
DIR *dirp;
struct dirent *direntp;
char pathname[PATH_MAX];
@@ -339,23 +339,23 @@ zed_conf_scan_dir(struct zed_conf *zcp)
if (!zcp) {
errno = EINVAL;
- zed_log_msg(LOG_ERR, "Failed to scan script dir: %s",
+ zed_log_msg(LOG_ERR, "Failed to scan zedlet dir: %s",
strerror(errno));
return (-1);
}
- scripts = zed_strings_create();
- if (!scripts) {
+ zedlets = zed_strings_create();
+ if (!zedlets) {
errno = ENOMEM;
zed_log_msg(LOG_WARNING, "Failed to scan dir \"%s\": %s",
- zcp->script_dir, strerror(errno));
+ zcp->zedlet_dir, strerror(errno));
return (-1);
}
- dirp = opendir(zcp->script_dir);
+ dirp = opendir(zcp->zedlet_dir);
if (!dirp) {
int errno_bak = errno;
zed_log_msg(LOG_WARNING, "Failed to open dir \"%s\": %s",
- zcp->script_dir, strerror(errno));
- zed_strings_destroy(scripts);
+ zcp->zedlet_dir, strerror(errno));
+ zed_strings_destroy(zedlets);
errno = errno_bak;
return (-1);
}
@@ -364,7 +364,7 @@ zed_conf_scan_dir(struct zed_conf *zcp)
continue;
n = snprintf(pathname, sizeof (pathname),
- "%s/%s", zcp->script_dir, direntp->d_name);
+ "%s/%s", zcp->zedlet_dir, direntp->d_name);
if ((n < 0) || (n >= sizeof (pathname))) {
zed_log_msg(LOG_WARNING, "Failed to stat \"%s\": %s",
direntp->d_name, strerror(ENAMETOOLONG));
@@ -405,7 +405,7 @@ zed_conf_scan_dir(struct zed_conf *zcp)
direntp->d_name);
continue;
}
- if (zed_strings_add(scripts, direntp->d_name) < 0) {
+ if (zed_strings_add(zedlets, direntp->d_name) < 0) {
zed_log_msg(LOG_WARNING,
"Failed to register \"%s\": %s",
direntp->d_name, strerror(errno));
@@ -413,20 +413,20 @@ zed_conf_scan_dir(struct zed_conf *zcp)
}
if (zcp->do_verbose)
zed_log_msg(LOG_INFO,
- "Registered script \"%s\"", direntp->d_name);
+ "Registered zedlet \"%s\"", direntp->d_name);
}
if (closedir(dirp) < 0) {
int errno_bak = errno;
zed_log_msg(LOG_WARNING, "Failed to close dir \"%s\": %s",
- zcp->script_dir, strerror(errno));
- zed_strings_destroy(scripts);
+ zcp->zedlet_dir, strerror(errno));
+ zed_strings_destroy(zedlets);
errno = errno_bak;
return (-1);
}
- if (zcp->scripts)
- zed_strings_destroy(zcp->scripts);
+ if (zcp->zedlets)
+ zed_strings_destroy(zcp->zedlets);
- zcp->scripts = scripts;
+ zcp->zedlets = zedlets;
return (0);
}
diff --git a/cmd/zed/zed_conf.h b/cmd/zed/zed_conf.h
index 51b98ea76..126075842 100644
--- a/cmd/zed/zed_conf.h
+++ b/cmd/zed/zed_conf.h
@@ -42,8 +42,8 @@ struct zed_conf {
int max_events; /* RESERVED FOR FUTURE USE */
char *conf_file; /* abs path to config file */
char *pid_file; /* abs path to pid file */
- char *script_dir; /* abs path to script dir */
- zed_strings_t *scripts; /* names of enabled scripts */
+ char *zedlet_dir; /* abs path to zedlet dir */
+ zed_strings_t *zedlets; /* names of enabled zedlets */
char *state_file; /* abs path to state file */
int state_fd; /* fd to state file */
libzfs_handle_t *zfs_hdl; /* handle to libzfs */
diff --git a/cmd/zed/zed_event.c b/cmd/zed/zed_event.c
index 940172bc3..f3f201800 100644
--- a/cmd/zed/zed_event.c
+++ b/cmd/zed/zed_event.c
@@ -814,7 +814,7 @@ zed_event_service(struct zed_conf *zcp)
_zed_event_add_var(eid, zsp, "%s%s=%d",
ZED_VAR_PREFIX, "PID", (int) getpid());
_zed_event_add_var(eid, zsp, "%s%s=%s",
- ZED_VAR_PREFIX, "SCRIPT_DIR", zcp->script_dir);
+ ZED_VAR_PREFIX, "ZEDLET_DIR", zcp->zedlet_dir);
subclass = _zed_event_get_subclass(class);
_zed_event_add_var(eid, zsp, "%s%s=%s",
@@ -823,7 +823,7 @@ zed_event_service(struct zed_conf *zcp)
_zed_event_add_time_strings(eid, zsp, etime);
zed_exec_process(eid, class, subclass,
- zcp->script_dir, zcp->scripts, zsp, zcp->zevent_fd);
+ zcp->zedlet_dir, zcp->zedlets, zsp, zcp->zevent_fd);
zed_conf_write_state(zcp, eid, etime);
diff --git a/cmd/zed/zed_exec.c b/cmd/zed/zed_exec.c
index 19fc30b59..d4193219f 100644
--- a/cmd/zed/zed_exec.c
+++ b/cmd/zed/zed_exec.c
@@ -156,13 +156,13 @@ restart:
}
/*
- * Process the event [eid] by synchronously invoking all scripts with a
+ * Process the event [eid] by synchronously invoking all zedlets with a
* matching class prefix.
*
- * Each executable in [scripts] from the directory [dir] is matched against
+ * Each executable in [zedlets] from the directory [dir] is matched against
* the event's [class], [subclass], and the "all" class (which matches
- * all events). Every script with a matching class prefix is invoked.
- * The NAME=VALUE strings in [envs] will be passed to the script as
+ * all events). Every zedlet with a matching class prefix is invoked.
+ * The NAME=VALUE strings in [envs] will be passed to the zedlet as
* environment variables.
*
* The file descriptor [zfd] is the zevent_fd used to track the
@@ -172,16 +172,16 @@ restart:
*/
int
zed_exec_process(uint64_t eid, const char *class, const char *subclass,
- const char *dir, zed_strings_t *scripts, zed_strings_t *envs, int zfd)
+ const char *dir, zed_strings_t *zedlets, zed_strings_t *envs, int zfd)
{
const char *class_strings[4];
const char *allclass = "all";
const char **csp;
- const char *s;
+ const char *z;
char **e;
int n;
- if (!dir || !scripts || !envs || zfd < 0)
+ if (!dir || !zedlets || !envs || zfd < 0)
return (-1);
csp = class_strings;
@@ -199,11 +199,11 @@ zed_exec_process(uint64_t eid, const char *class, const char *subclass,
e = _zed_exec_create_env(envs);
- for (s = zed_strings_first(scripts); s; s = zed_strings_next(scripts)) {
+ for (z = zed_strings_first(zedlets); z; z = zed_strings_next(zedlets)) {
for (csp = class_strings; *csp; csp++) {
n = strlen(*csp);
- if ((strncmp(s, *csp, n) == 0) && !isalpha(s[n]))
- _zed_exec_fork_child(eid, dir, s, e, zfd);
+ if ((strncmp(z, *csp, n) == 0) && !isalpha(z[n]))
+ _zed_exec_fork_child(eid, dir, z, e, zfd);
}
}
free(e);
diff --git a/cmd/zed/zed_exec.h b/cmd/zed/zed_exec.h
index 52bdc12a8..fee068fb6 100644
--- a/cmd/zed/zed_exec.h
+++ b/cmd/zed/zed_exec.h
@@ -30,7 +30,7 @@
#include <stdint.h>
int zed_exec_process(uint64_t eid, const char *class, const char *subclass,
- const char *dir, zed_strings_t *scripts, zed_strings_t *envs,
+ const char *dir, zed_strings_t *zedlets, zed_strings_t *envs,
int zevent_fd);
#endif /* !ZED_EXEC_H */