1eda14cbcSMatt Macy /* 2180f8225SMatt Macy * This file is part of the ZFS Event Daemon (ZED). 3180f8225SMatt Macy * 4eda14cbcSMatt Macy * Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). 5eda14cbcSMatt Macy * Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. 616038816SMartin Matuska * Refer to the OpenZFS git commit log for authoritative copyright attribution. 7eda14cbcSMatt Macy * 8eda14cbcSMatt Macy * The contents of this file are subject to the terms of the 9eda14cbcSMatt Macy * Common Development and Distribution License Version 1.0 (CDDL-1.0). 10eda14cbcSMatt Macy * You can obtain a copy of the license from the top-level file 11eda14cbcSMatt Macy * "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>. 12eda14cbcSMatt Macy * You may not use this file except in compliance with the license. 13eda14cbcSMatt Macy */ 14eda14cbcSMatt Macy 15eda14cbcSMatt Macy #ifndef ZED_CONF_H 16eda14cbcSMatt Macy #define ZED_CONF_H 17eda14cbcSMatt Macy 18eda14cbcSMatt Macy #include <libzfs.h> 19eda14cbcSMatt Macy #include <stdint.h> 20eda14cbcSMatt Macy #include "zed_strings.h" 21eda14cbcSMatt Macy 22eda14cbcSMatt Macy struct zed_conf { 23eda14cbcSMatt Macy char *pid_file; /* abs path to pid file */ 24eda14cbcSMatt Macy char *zedlet_dir; /* abs path to zedlet dir */ 25eda14cbcSMatt Macy char *state_file; /* abs path to state file */ 2616038816SMartin Matuska 27eda14cbcSMatt Macy libzfs_handle_t *zfs_hdl; /* handle to libzfs */ 2816038816SMartin Matuska zed_strings_t *zedlets; /* names of enabled zedlets */ 29eda14cbcSMatt Macy char *path; /* custom $PATH for zedlets to use */ 3016038816SMartin Matuska 3116038816SMartin Matuska int pid_fd; /* fd to pid file for lock */ 3216038816SMartin Matuska int state_fd; /* fd to state file */ 3316038816SMartin Matuska int zevent_fd; /* fd for access to zevents */ 3416038816SMartin Matuska 3516038816SMartin Matuska int16_t max_jobs; /* max zedlets to run at one time */ 36*08aba0aeSMartin Matuska int32_t max_zevent_buf_len; /* max size of kernel event list */ 3716038816SMartin Matuska 3816038816SMartin Matuska boolean_t do_force:1; /* true if force enabled */ 3916038816SMartin Matuska boolean_t do_foreground:1; /* true if run in foreground */ 4016038816SMartin Matuska boolean_t do_memlock:1; /* true if locking memory */ 4116038816SMartin Matuska boolean_t do_verbose:1; /* true if verbosity enabled */ 4216038816SMartin Matuska boolean_t do_zero:1; /* true if zeroing state */ 4316038816SMartin Matuska boolean_t do_idle:1; /* true if idle enabled */ 44eda14cbcSMatt Macy }; 45eda14cbcSMatt Macy 4616038816SMartin Matuska void zed_conf_init(struct zed_conf *zcp); 47eda14cbcSMatt Macy void zed_conf_destroy(struct zed_conf *zcp); 48eda14cbcSMatt Macy 49eda14cbcSMatt Macy void zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv); 50eda14cbcSMatt Macy 51eda14cbcSMatt Macy int zed_conf_scan_dir(struct zed_conf *zcp); 52eda14cbcSMatt Macy 53eda14cbcSMatt Macy int zed_conf_write_pid(struct zed_conf *zcp); 54eda14cbcSMatt Macy 55eda14cbcSMatt Macy int zed_conf_open_state(struct zed_conf *zcp); 56eda14cbcSMatt Macy int zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[]); 57eda14cbcSMatt Macy int zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[]); 58eda14cbcSMatt Macy 59eda14cbcSMatt Macy #endif /* !ZED_CONF_H */ 60