2019-05-24 12:04:05 +02:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2021-05-06 18:06:44 -07:00
/*
2005-12-15 14:31:23 -08:00
* heartbeat . h
*
* Function prototypes
*
* Copyright ( C ) 2004 Oracle . All rights reserved .
*/
# ifndef O2CLUSTER_HEARTBEAT_H
# define O2CLUSTER_HEARTBEAT_H
# include "ocfs2_heartbeat.h"
# define O2HB_REGION_TIMEOUT_MS 2000
2010-10-07 14:31:06 -07:00
# define O2HB_MAX_REGION_NAME_LEN 32
2005-12-15 14:31:23 -08:00
/* number of changes to be seen as live */
# define O2HB_LIVE_THRESHOLD 2
/* number of equal samples to be seen as dead */
extern unsigned int o2hb_dead_threshold ;
2007-11-06 16:10:23 -08:00
# define O2HB_DEFAULT_DEAD_THRESHOLD 31
2005-12-15 14:31:23 -08:00
/* Otherwise MAX_WRITE_TIMEOUT will be zero... */
# define O2HB_MIN_DEAD_THRESHOLD 2
# define O2HB_MAX_WRITE_TIMEOUT_MS (O2HB_REGION_TIMEOUT_MS * (o2hb_dead_threshold - 1))
# define O2HB_CB_MAGIC 0x51d1e4ec
/* callback stuff */
enum o2hb_callback_type {
O2HB_NODE_DOWN_CB = 0 ,
O2HB_NODE_UP_CB ,
O2HB_NUM_CB
} ;
struct o2nm_node ;
typedef void ( o2hb_cb_func ) ( struct o2nm_node * , int , void * ) ;
struct o2hb_callback_func {
u32 hc_magic ;
struct list_head hc_item ;
o2hb_cb_func * hc_func ;
void * hc_data ;
int hc_priority ;
enum o2hb_callback_type hc_type ;
} ;
struct config_group * o2hb_alloc_hb_set ( void ) ;
void o2hb_free_hb_set ( struct config_group * group ) ;
void o2hb_setup_callback ( struct o2hb_callback_func * hc ,
enum o2hb_callback_type type ,
o2hb_cb_func * func ,
void * data ,
int priority ) ;
2007-06-14 21:40:49 -07:00
int o2hb_register_callback ( const char * region_uuid ,
struct o2hb_callback_func * hc ) ;
void o2hb_unregister_callback ( const char * region_uuid ,
struct o2hb_callback_func * hc ) ;
2005-12-15 14:31:23 -08:00
void o2hb_fill_node_map ( unsigned long * map ,
2022-10-07 20:48:45 +08:00
unsigned int bits ) ;
2008-12-17 14:17:42 -08:00
void o2hb_exit ( void ) ;
2019-07-11 20:53:12 -07:00
void o2hb_init ( void ) ;
2014-10-09 15:25:13 -07:00
int o2hb_check_node_heartbeating_no_sem ( u8 node_num ) ;
2005-12-15 14:31:23 -08:00
int o2hb_check_node_heartbeating_from_callback ( u8 node_num ) ;
void o2hb_stop_all_regions ( void ) ;
2010-10-07 14:31:06 -07:00
int o2hb_get_all_regions ( char * region_uuids , u8 numregions ) ;
int o2hb_global_heartbeat_active ( void ) ;
2005-12-15 14:31:23 -08:00
# endif /* O2CLUSTER_HEARTBEAT_H */