]> granicus.if.org Git - zfs/blob - cmd/zed/zed_conf.h
systemd encryption key support
[zfs] / cmd / zed / zed_conf.h
1 /*
2  * This file is part of the ZFS Event Daemon (ZED)
3  * for ZFS on Linux (ZoL) <http://zfsonlinux.org/>.
4  * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
5  * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
6  * Refer to the ZoL git commit log for authoritative copyright attribution.
7  *
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License Version 1.0 (CDDL-1.0).
10  * You can obtain a copy of the license from the top-level file
11  * "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
12  * You may not use this file except in compliance with the license.
13  */
14
15 #ifndef ZED_CONF_H
16 #define ZED_CONF_H
17
18 #include <libzfs.h>
19 #include <stdint.h>
20 #include "zed_strings.h"
21
22 struct zed_conf {
23         unsigned        do_force:1;             /* true if force enabled */
24         unsigned        do_foreground:1;        /* true if run in foreground */
25         unsigned        do_memlock:1;           /* true if locking memory */
26         unsigned        do_verbose:1;           /* true if verbosity enabled */
27         unsigned        do_zero:1;              /* true if zeroing state */
28         int             syslog_facility;        /* syslog facility value */
29         int             min_events;             /* RESERVED FOR FUTURE USE */
30         int             max_events;             /* RESERVED FOR FUTURE USE */
31         char            *conf_file;             /* abs path to config file */
32         char            *pid_file;              /* abs path to pid file */
33         int             pid_fd;                 /* fd to pid file for lock */
34         char            *zedlet_dir;            /* abs path to zedlet dir */
35         zed_strings_t   *zedlets;               /* names of enabled zedlets */
36         char            *state_file;            /* abs path to state file */
37         int             state_fd;               /* fd to state file */
38         libzfs_handle_t *zfs_hdl;               /* handle to libzfs */
39         int             zevent_fd;              /* fd for access to zevents */
40         char            *path;          /* custom $PATH for zedlets to use */
41 };
42
43 struct zed_conf *zed_conf_create(void);
44
45 void zed_conf_destroy(struct zed_conf *zcp);
46
47 void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv);
48
49 void zed_conf_parse_file(struct zed_conf *zcp);
50
51 int zed_conf_scan_dir(struct zed_conf *zcp);
52
53 int zed_conf_write_pid(struct zed_conf *zcp);
54
55 int zed_conf_open_state(struct zed_conf *zcp);
56
57 int zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[]);
58
59 int zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[]);
60
61 #endif  /* !ZED_CONF_H */