2007-08-21 20:26:07 +04:00
/*
* Copyright ( C ) 2005 - 2007 Red Hat , Inc . All rights reserved .
*
* This file is part of the device - mapper userspace tools .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v .2 .1 .
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
2005-12-02 18:39:16 +03:00
# ifndef __DMEVENTD_DOT_H__
# define __DMEVENTD_DOT_H__
2007-01-08 18:18:52 +03:00
/* FIXME This stuff must be configurable. */
2012-06-21 16:41:52 +04:00
# define DM_EVENT_FIFO_CLIENT DEFAULT_DM_RUN_DIR " / dmeventd-client"
# define DM_EVENT_FIFO_SERVER DEFAULT_DM_RUN_DIR " / dmeventd-server"
2007-01-08 18:18:52 +03:00
# define DM_EVENT_DEFAULT_TIMEOUT 10
/* Commands for the daemon passed in the message below. */
enum dm_event_command {
DM_EVENT_CMD_ACTIVE = 1 ,
DM_EVENT_CMD_REGISTER_FOR_EVENT ,
DM_EVENT_CMD_UNREGISTER_FOR_EVENT ,
DM_EVENT_CMD_GET_REGISTERED_DEVICE ,
DM_EVENT_CMD_GET_NEXT_REGISTERED_DEVICE ,
DM_EVENT_CMD_SET_TIMEOUT ,
DM_EVENT_CMD_GET_TIMEOUT ,
2007-02-02 20:08:51 +03:00
DM_EVENT_CMD_HELLO ,
2010-10-20 19:12:12 +04:00
DM_EVENT_CMD_DIE ,
DM_EVENT_CMD_GET_STATUS ,
2014-02-04 20:01:54 +04:00
DM_EVENT_CMD_GET_PARAMETERS ,
2007-01-08 18:18:52 +03:00
} ;
/* Message passed between client and daemon. */
struct dm_event_daemon_message {
uint32_t cmd ;
uint32_t size ;
char * data ;
} ;
/* FIXME Is this meant to be exported? I can't see where the
interface uses it . */
/* Fifos for client/daemon communication. */
struct dm_event_fifos {
int client ;
int server ;
const char * client_path ;
const char * server_path ;
} ;
/* EXIT_SUCCESS 0 -- stdlib.h */
/* EXIT_FAILURE 1 -- stdlib.h */
2010-07-13 17:51:01 +04:00
/* EXIT_LOCKFILE_INUSE 2 -- obsoleted */
2005-12-02 18:39:16 +03:00
# define EXIT_DESC_CLOSE_FAILURE 3
2007-01-08 18:18:52 +03:00
# define EXIT_DESC_OPEN_FAILURE 4
2010-07-13 17:51:01 +04:00
/* EXIT_OPEN_PID_FAILURE 5 -- obsoleted */
2007-01-08 18:18:52 +03:00
# define EXIT_FIFO_FAILURE 6
# define EXIT_CHDIR_FAILURE 7
2005-12-02 18:39:16 +03:00
2010-10-20 19:12:12 +04:00
/* Implemented in libdevmapper-event.c, but not part of public API. */
2012-02-27 15:46:25 +04:00
// FIXME misuse of bitmask as enum
2010-10-20 19:12:12 +04:00
int daemon_talk ( struct dm_event_fifos * fifos ,
struct dm_event_daemon_message * msg , int cmd ,
const char * dso_name , const char * dev_name ,
enum dm_event_mask evmask , uint32_t timeout ) ;
int init_fifos ( struct dm_event_fifos * fifos ) ;
void fini_fifos ( struct dm_event_fifos * fifos ) ;
2011-04-04 20:11:09 +04:00
int dm_event_get_version ( struct dm_event_fifos * fifos , int * version ) ;
2010-10-20 19:12:12 +04:00
2005-12-02 18:39:16 +03:00
# endif /* __DMEVENTD_DOT_H__ */