zed: purge all mentions of a configuration file

There simply isn't a need for one, since the flags the daemon takes
are all short (mostly just toggles) and administrative in nature,
and are therefore better served by the age-old tradition of sourcing an
environment file and preparing the cmdline in the init-specific handler
itself, if needed at all

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11834
This commit is contained in:
наб 2021-04-02 15:57:23 +02:00 committed by Brian Behlendorf
parent 0a51083e39
commit 01219379cf
5 changed files with 1 additions and 45 deletions

View File

@ -230,8 +230,6 @@ main(int argc, char *argv[])
if (geteuid() != 0) if (geteuid() != 0)
zed_log_die("Must be run as root"); zed_log_die("Must be run as root");
zed_conf_parse_file(zcp);
zed_file_close_from(STDERR_FILENO + 1); zed_file_close_from(STDERR_FILENO + 1);
(void) umask(0); (void) umask(0);

View File

@ -15,11 +15,6 @@
#ifndef ZED_H #ifndef ZED_H
#define ZED_H #define ZED_H
/*
* Absolute path for the default zed configuration file.
*/
#define ZED_CONF_FILE SYSCONFDIR "/zfs/zed.conf"
/* /*
* Absolute path for the default zed pid file. * Absolute path for the default zed pid file.
*/ */

View File

@ -53,9 +53,6 @@ zed_conf_create(void)
zcp->zevent_fd = -1; /* opened via zed_event_init() */ zcp->zevent_fd = -1; /* opened via zed_event_init() */
zcp->max_jobs = 16; zcp->max_jobs = 16;
if (!(zcp->conf_file = strdup(ZED_CONF_FILE)))
goto nomem;
if (!(zcp->pid_file = strdup(ZED_PID_FILE))) if (!(zcp->pid_file = strdup(ZED_PID_FILE)))
goto nomem; goto nomem;
@ -103,10 +100,6 @@ zed_conf_destroy(struct zed_conf *zcp)
zcp->pid_file, strerror(errno)); zcp->pid_file, strerror(errno));
zcp->pid_fd = -1; zcp->pid_fd = -1;
} }
if (zcp->conf_file) {
free(zcp->conf_file);
zcp->conf_file = NULL;
}
if (zcp->pid_file) { if (zcp->pid_file) {
free(zcp->pid_file); free(zcp->pid_file);
zcp->pid_file = NULL; zcp->pid_file = NULL;
@ -163,10 +156,6 @@ _zed_conf_display_help(const char *prog, int got_err)
fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-Z", fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-Z",
"Zero state file."); "Zero state file.");
fprintf(fp, "\n"); fprintf(fp, "\n");
#if 0
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-c FILE",
"Read configuration from FILE.", ZED_CONF_FILE);
#endif
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-d DIR", fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-d DIR",
"Read enabled ZEDLETs from DIR.", ZED_ZEDLET_DIR); "Read enabled ZEDLETs from DIR.", ZED_ZEDLET_DIR);
fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-p FILE", fprintf(fp, "%*c%*s %s [%s]\n", w1, 0x20, -w2, "-p FILE",
@ -254,7 +243,7 @@ _zed_conf_parse_path(char **resultp, const char *path)
void void
zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv) zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
{ {
const char * const opts = ":hLVc:d:p:P:s:vfFMZIj:"; const char * const opts = ":hLVd:p:P:s:vfFMZIj:";
int opt; int opt;
unsigned long raw; unsigned long raw;
@ -274,9 +263,6 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
case 'V': case 'V':
_zed_conf_display_version(); _zed_conf_display_version();
break; break;
case 'c':
_zed_conf_parse_path(&zcp->conf_file, optarg);
break;
case 'd': case 'd':
_zed_conf_parse_path(&zcp->zedlet_dir, optarg); _zed_conf_parse_path(&zcp->zedlet_dir, optarg);
break; break;
@ -331,18 +317,6 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
} }
} }
/*
* Parse the configuration file into the configuration [zcp].
*
* FIXME: Not yet implemented.
*/
void
zed_conf_parse_file(struct zed_conf *zcp)
{
if (!zcp)
zed_log_die("Failed to parse config: %s", strerror(EINVAL));
}
/* /*
* Scan the [zcp] zedlet_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. * Files must be executable by user, but not writable by group or other.

View File

@ -29,7 +29,6 @@ struct zed_conf {
int syslog_facility; /* syslog facility value */ int syslog_facility; /* syslog facility value */
int min_events; /* RESERVED FOR FUTURE USE */ int min_events; /* RESERVED FOR FUTURE USE */
int max_events; /* RESERVED FOR FUTURE USE */ int max_events; /* RESERVED FOR FUTURE USE */
char *conf_file; /* abs path to config file */
char *pid_file; /* abs path to pid file */ char *pid_file; /* abs path to pid file */
int pid_fd; /* fd to pid file for lock */ int pid_fd; /* fd to pid file for lock */
char *zedlet_dir; /* abs path to zedlet dir */ char *zedlet_dir; /* abs path to zedlet dir */
@ -48,8 +47,6 @@ void zed_conf_destroy(struct zed_conf *zcp);
void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv); void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv);
void zed_conf_parse_file(struct zed_conf *zcp);
int zed_conf_scan_dir(struct zed_conf *zcp); int zed_conf_scan_dir(struct zed_conf *zcp);
int zed_conf_write_pid(struct zed_conf *zcp); int zed_conf_write_pid(struct zed_conf *zcp);

View File

@ -76,9 +76,6 @@ while the daemon is running.
.BI \-Z .BI \-Z
Zero the daemon's state, thereby allowing zevents still within the kernel Zero the daemon's state, thereby allowing zevents still within the kernel
to be reprocessed. to be reprocessed.
.\" .TP
.\" .BI \-c\ configfile
.\" Read the configuration from the specified file.
.TP .TP
.BI \-d\ zedletdir .BI \-d\ zedletdir
Read the enabled ZEDLETs from the specified directory. Read the enabled ZEDLETs from the specified directory.
@ -203,9 +200,6 @@ the following executables are defined: \fBZDB\fR, \fBZED\fR, \fBZFS\fR,
rc file if needed. rc file if needed.
.SH FILES .SH FILES
.\" .TP
.\" @sysconfdir@/zfs/zed.conf
.\" The default configuration file for the daemon.
.TP .TP
.I @sysconfdir@/zfs/zed.d .I @sysconfdir@/zfs/zed.d
The default directory for enabled ZEDLETs. The default directory for enabled ZEDLETs.
@ -250,8 +244,6 @@ environment variables having a "_NOT_IMPLEMENTED_" value.
.PP .PP
Internationalization support via gettext has not been added. Internationalization support via gettext has not been added.
.PP .PP
The configuration file is not yet implemented.
.PP
The diagnosis engine is not yet implemented. The diagnosis engine is not yet implemented.
.SH LICENSE .SH LICENSE