mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
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 <cdunlap@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2735
This commit is contained in:
committed by
Brian Behlendorf
parent
8cb8cf91df
commit
dcca723ace
+10
-10
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user