2 * Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
4 * This file is part of the device-mapper userspace tools.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU Lesser General Public License v.2.1.
10 * You should have received a copy of the GNU Lesser General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 #ifndef __DMEVENTD_DOT_H__
16 #define __DMEVENTD_DOT_H__
18 /* FIXME This stuff must be configurable. */
20 #define DM_EVENT_DAEMON "/sbin/dmeventd"
21 #define DM_EVENT_LOCKFILE "/var/lock/dmeventd"
22 #define DM_EVENT_FIFO_CLIENT "/var/run/dmeventd-client"
23 #define DM_EVENT_FIFO_SERVER "/var/run/dmeventd-server"
24 #define DM_EVENT_PIDFILE "/var/run/dmeventd.pid"
26 #define DM_EVENT_DEFAULT_TIMEOUT 10
28 /* Commands for the daemon passed in the message below. */
29 enum dm_event_command {
30 DM_EVENT_CMD_ACTIVE = 1,
31 DM_EVENT_CMD_REGISTER_FOR_EVENT,
32 DM_EVENT_CMD_UNREGISTER_FOR_EVENT,
33 DM_EVENT_CMD_GET_REGISTERED_DEVICE,
34 DM_EVENT_CMD_GET_NEXT_REGISTERED_DEVICE,
35 DM_EVENT_CMD_SET_TIMEOUT,
36 DM_EVENT_CMD_GET_TIMEOUT,
39 DM_EVENT_CMD_GET_STATUS,
42 /* Message passed between client and daemon. */
43 struct dm_event_daemon_message {
49 /* FIXME Is this meant to be exported? I can't see where the
51 /* Fifos for client/daemon communication. */
52 struct dm_event_fifos {
55 const char *client_path;
56 const char *server_path;
59 /* EXIT_SUCCESS 0 -- stdlib.h */
60 /* EXIT_FAILURE 1 -- stdlib.h */
61 /* EXIT_LOCKFILE_INUSE 2 -- obsoleted */
62 #define EXIT_DESC_CLOSE_FAILURE 3
63 #define EXIT_DESC_OPEN_FAILURE 4
64 /* EXIT_OPEN_PID_FAILURE 5 -- obsoleted */
65 #define EXIT_FIFO_FAILURE 6
66 #define EXIT_CHDIR_FAILURE 7
68 /* Implemented in libdevmapper-event.c, but not part of public API. */
69 int daemon_talk(struct dm_event_fifos *fifos,
70 struct dm_event_daemon_message *msg, int cmd,
71 const char *dso_name, const char *dev_name,
72 enum dm_event_mask evmask, uint32_t timeout);
73 int init_fifos(struct dm_event_fifos *fifos);
74 void fini_fifos(struct dm_event_fifos *fifos);
76 #endif /* __DMEVENTD_DOT_H__ */