1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * https://opensource.org/license/CDDL-1.0. 11 */ 12 /* 13 * This file is part of the ZFS Event Daemon (ZED). 14 * 15 * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). 16 * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. 17 */ 18 19 #ifndef ZED_CONF_H 20 #define ZED_CONF_H 21 22 #include <libzfs.h> 23 #include <stdint.h> 24 #include "zed_strings.h" 25 26 struct zed_conf { 27 char *pid_file; /* abs path to pid file */ 28 char *zedlet_dir; /* abs path to zedlet dir */ 29 char *state_file; /* abs path to state file */ 30 31 libzfs_handle_t *zfs_hdl; /* handle to libzfs */ 32 zed_strings_t *zedlets; /* names of enabled zedlets */ 33 char *path; /* custom $PATH for zedlets to use */ 34 35 int pid_fd; /* fd to pid file for lock */ 36 int state_fd; /* fd to state file */ 37 int zevent_fd; /* fd for access to zevents */ 38 39 int16_t max_jobs; /* max zedlets to run at one time */ 40 int32_t max_zevent_buf_len; /* max size of kernel event list */ 41 42 boolean_t do_force:1; /* true if force enabled */ 43 boolean_t do_foreground:1; /* true if run in foreground */ 44 boolean_t do_memlock:1; /* true if locking memory */ 45 boolean_t do_verbose:1; /* true if verbosity enabled */ 46 boolean_t do_zero:1; /* true if zeroing state */ 47 boolean_t do_idle:1; /* true if idle enabled */ 48 }; 49 50 void zed_conf_init(struct zed_conf *zcp); 51 void zed_conf_destroy(struct zed_conf *zcp); 52 53 void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv); 54 55 int zed_conf_scan_dir(struct zed_conf *zcp); 56 57 int zed_conf_write_pid(struct zed_conf *zcp); 58 59 int zed_conf_open_state(struct zed_conf *zcp); 60 int zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[]); 61 int zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[]); 62 63 #endif /* !ZED_CONF_H */ 64