]> granicus.if.org Git - zfs/blob - cmd/zed/zed_conf.h
Refer to ZED's scripts as ZEDLETs
[zfs] / cmd / zed / zed_conf.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license from the top-level
9  * OPENSOLARIS.LICENSE or <http://opensource.org/licenses/CDDL-1.0>.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each file
14  * and include the License file from the top-level OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21
22 /*
23  * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
24  * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
25  */
26
27 #ifndef ZED_CONF_H
28 #define ZED_CONF_H
29
30 #include <libzfs.h>
31 #include <stdint.h>
32 #include "zed_strings.h"
33
34 struct zed_conf {
35         unsigned        do_force:1;             /* true if force enabled */
36         unsigned        do_foreground:1;        /* true if run in foreground */
37         unsigned        do_memlock:1;           /* true if locking memory */
38         unsigned        do_verbose:1;           /* true if verbosity enabled */
39         unsigned        do_zero:1;              /* true if zeroing state */
40         int             syslog_facility;        /* syslog facility value */
41         int             min_events;             /* RESERVED FOR FUTURE USE */
42         int             max_events;             /* RESERVED FOR FUTURE USE */
43         char            *conf_file;             /* abs path to config file */
44         char            *pid_file;              /* abs path to pid file */
45         char            *zedlet_dir;            /* abs path to zedlet dir */
46         zed_strings_t   *zedlets;               /* names of enabled zedlets */
47         char            *state_file;            /* abs path to state file */
48         int             state_fd;               /* fd to state file */
49         libzfs_handle_t *zfs_hdl;               /* handle to libzfs */
50         int             zevent_fd;              /* fd for access to zevents */
51 };
52
53 struct zed_conf *zed_conf_create(void);
54
55 void zed_conf_destroy(struct zed_conf *zcp);
56
57 void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv);
58
59 void zed_conf_parse_file(struct zed_conf *zcp);
60
61 int zed_conf_scan_dir(struct zed_conf *zcp);
62
63 int zed_conf_write_pid(struct zed_conf *zcp);
64
65 int zed_conf_open_state(struct zed_conf *zcp);
66
67 int zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[]);
68
69 int zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[]);
70
71 #endif  /* !ZED_CONF_H */