pacemaker  1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
utils.h File Reference
#include <syslog.h>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  crm_child_s
 
struct  pcmk_env_s
 

Macros

#define SIZEOF(a)   (sizeof(a) / sizeof(a[0]))
 
#define do_ais_log(level, fmt, args...)
 
#define ais_perror(fmt, args...)
 
#define ais_crit(fmt, args...)   do_ais_log(LOG_CRIT, fmt , ##args)
 
#define ais_err(fmt, args...)   do_ais_log(LOG_ERR, fmt , ##args)
 
#define ais_warn(fmt, args...)   do_ais_log(LOG_WARNING, fmt , ##args)
 
#define ais_notice(fmt, args...)   do_ais_log(LOG_NOTICE, fmt , ##args)
 
#define ais_info(fmt, args...)   do_ais_log(LOG_INFO, fmt , ##args)
 
#define ais_debug(fmt, args...)   do_ais_log(LOG_DEBUG, fmt , ##args)
 
#define ais_trace(fmt, args...)   do_ais_log(LOG_DEBUG+1, fmt , ##args)
 
#define ais_malloc0(malloc_obj, length)
 
#define ais_free(obj)
 
#define AIS_ASSERT(expr)
 
#define AIS_CHECK(expr, failure_action)
 

Typedefs

typedef struct crm_child_s crm_child_t
 

Functions

void destroy_ais_node (gpointer data)
 
void delete_member (uint32_t id, const char *uname)
 
int update_member (unsigned int id, uint64_t born, uint64_t seq, int32_t votes, uint32_t procs, const char *uname, const char *state, const char *version)
 
const char * member_uname (uint32_t id)
 
char * append_member (char *data, crm_node_t *node)
 
void member_loop_fn (gpointer key, gpointer value, gpointer user_data)
 
gboolean stop_child (crm_child_t *child, int signal)
 
gboolean spawn_child (crm_child_t *child)
 
void swap_sender (AIS_Message *msg)
 
char * get_ais_data (const AIS_Message *msg)
 
gboolean route_ais_message (const AIS_Message *msg, gboolean local)
 
gboolean process_ais_message (const AIS_Message *msg)
 
int send_plugin_msg (enum crm_ais_msg_types type, const char *host, const char *data)
 
int send_client_msg (void *conn, enum crm_ais_msg_class class, enum crm_ais_msg_types type, const char *data)
 
void send_member_notification (void)
 
void log_ais_message (int level, const AIS_Message *msg)
 
hdb_handle_t config_find_init (struct corosync_api_v1 *config, char *name)
 
hdb_handle_t config_find_next (struct corosync_api_v1 *config, char *name, hdb_handle_t top_handle)
 
void config_find_done (struct corosync_api_v1 *config, hdb_handle_t local_handle)
 
int get_config_opt (struct corosync_api_v1 *config, hdb_handle_t object_service_handle, char *key, char **value, const char *fallback)
 
int ais_get_boolean (const char *s)
 
long long ais_get_int (const char *text, char **end_text)
 
char * ais_concat (const char *prefix, const char *suffix, char join)
 
int send_client_ipc (void *conn, const AIS_Message *ais_msg)
 
int pcmk_user_lookup (const char *name, uid_t *uid, gid_t *gid)
 

Variables

GHashTable * membership_list
 
pthread_t crm_wait_thread
 
int plugin_log_level
 
char * local_uname
 
int local_uname_len
 
unsigned int local_nodeid
 
struct pcmk_env_s pcmk_env
 

Macro Definition Documentation

#define AIS_ASSERT (   expr)
Value:
if((expr) == FALSE) { \
ais_crit("Assertion failure line %d: %s", __LINE__, #expr); \
abort(); \
}
#define ais_crit(fmt, args...)
Definition: utils.h:160

Definition at line 183 of file utils.h.

#define AIS_CHECK (   expr,
  failure_action 
)
Value:
if((expr) == FALSE) { \
int p = fork(); \
if(p == 0) { abort(); } \
ais_err("Child %d spawned to record non-fatal assertion failure line %d: %s", p, __LINE__, #expr); \
failure_action; \
}
#define ais_err(fmt, args...)
Definition: utils.h:161

Definition at line 188 of file utils.h.

#define ais_crit (   fmt,
  args... 
)    do_ais_log(LOG_CRIT, fmt , ##args)

Definition at line 160 of file utils.h.

#define ais_debug (   fmt,
  args... 
)    do_ais_log(LOG_DEBUG, fmt , ##args)

Definition at line 165 of file utils.h.

#define ais_err (   fmt,
  args... 
)    do_ais_log(LOG_ERR, fmt , ##args)

Definition at line 161 of file utils.h.

#define ais_free (   obj)
Value:
do { \
if(obj) { \
free(obj); \
obj = NULL; \
} \
} while(0)

Definition at line 176 of file utils.h.

#define ais_info (   fmt,
  args... 
)    do_ais_log(LOG_INFO, fmt , ##args)

Definition at line 164 of file utils.h.

#define ais_malloc0 (   malloc_obj,
  length 
)
Value:
do { \
malloc_obj = malloc(length); \
if(malloc_obj == NULL) { \
abort(); \
} \
memset(malloc_obj, 0, length); \
} while(0)

Definition at line 168 of file utils.h.

#define ais_notice (   fmt,
  args... 
)    do_ais_log(LOG_NOTICE, fmt , ##args)

Definition at line 163 of file utils.h.

#define ais_perror (   fmt,
  args... 
)
Value:
log_printf( \
LOG_ERR, "%s: " fmt ": (%d) %s", \
__FUNCTION__ , ##args, errno, strerror(errno))
char * strerror(int errnum)

Definition at line 156 of file utils.h.

#define ais_trace (   fmt,
  args... 
)    do_ais_log(LOG_DEBUG+1, fmt , ##args)

Definition at line 166 of file utils.h.

#define ais_warn (   fmt,
  args... 
)    do_ais_log(LOG_WARNING, fmt , ##args)

Definition at line 162 of file utils.h.

#define do_ais_log (   level,
  fmt,
  args... 
)
Value:
do { \
if(plugin_log_level < (level)) { \
continue; \
} else if((level) > LOG_DEBUG) { \
log_printf(LOG_DEBUG, "debug%d: %s: " fmt, \
level-LOG_INFO, __FUNCTION__ , ##args); \
} else { \
log_printf(level, "%s: %s: " fmt, level2char(level), \
__FUNCTION__ , ##args); \
} \
} while(0)
int plugin_log_level
Definition: plugin.c:60

Definition at line 144 of file utils.h.

#define SIZEOF (   a)    (sizeof(a) / sizeof(a[0]))

Definition at line 65 of file utils.h.

Typedef Documentation

typedef struct crm_child_s crm_child_t

Function Documentation

char* ais_concat ( const char *  prefix,
const char *  suffix,
char  join 
)

Definition at line 604 of file utils.c.

int ais_get_boolean ( const char *  s)

Definition at line 697 of file utils.c.

long long ais_get_int ( const char *  text,
char **  end_text 
)

Definition at line 712 of file utils.c.

char* append_member ( char *  data,
crm_node_t node 
)

Definition at line 388 of file utils.c.

void config_find_done ( struct corosync_api_v1 *  config,
hdb_handle_t  local_handle 
)

Definition at line 652 of file utils.c.

hdb_handle_t config_find_init ( struct corosync_api_v1 *  config,
char *  name 
)

Definition at line 620 of file utils.c.

hdb_handle_t config_find_next ( struct corosync_api_v1 *  config,
char *  name,
hdb_handle_t  top_handle 
)

Definition at line 633 of file utils.c.

void delete_member ( uint32_t  id,
const char *  uname 
)

Definition at line 364 of file utils.c.

void destroy_ais_node ( gpointer  data)

Definition at line 282 of file utils.c.

char* get_ais_data ( const AIS_Message msg)

Definition at line 454 of file utils.c.

int get_config_opt ( struct corosync_api_v1 *  config,
hdb_handle_t  object_service_handle,
char *  key,
char **  value,
const char *  fallback 
)

Definition at line 660 of file utils.c.

void log_ais_message ( int  level,
const AIS_Message msg 
)

Definition at line 43 of file utils.c.

void member_loop_fn ( gpointer  key,
gpointer  value,
gpointer  user_data 
)

Definition at line 1167 of file plugin.c.

const char* member_uname ( uint32_t  id)

Definition at line 374 of file utils.c.

int pcmk_user_lookup ( const char *  name,
uid_t *  uid,
gid_t *  gid 
)

Definition at line 755 of file utils.c.

gboolean process_ais_message ( const AIS_Message msg)

Definition at line 1744 of file plugin.c.

gboolean route_ais_message ( const AIS_Message msg,
gboolean  local 
)

Definition at line 1454 of file plugin.c.

int send_client_ipc ( void *  conn,
const AIS_Message ais_msg 
)

Definition at line 527 of file utils.c.

int send_client_msg ( void *  conn,
enum crm_ais_msg_class  class,
enum crm_ais_msg_types  type,
const char *  data 
)

Definition at line 550 of file utils.c.

void send_member_notification ( void  )

Definition at line 1344 of file plugin.c.

int send_plugin_msg ( enum crm_ais_msg_types  type,
const char *  host,
const char *  data 
)

Definition at line 479 of file utils.c.

gboolean spawn_child ( crm_child_t child)

Definition at line 136 of file utils.c.

gboolean stop_child ( crm_child_t child,
int  signal 
)

Definition at line 252 of file utils.c.

void swap_sender ( AIS_Message msg)

Definition at line 435 of file utils.c.

int update_member ( unsigned int  id,
uint64_t  born,
uint64_t  seq,
int32_t  votes,
uint32_t  procs,
const char *  uname,
const char *  state,
const char *  version 
)

Definition at line 295 of file utils.c.

Variable Documentation

pthread_t crm_wait_thread
unsigned int local_nodeid

Definition at line 65 of file plugin.c.

char* local_uname

Definition at line 61 of file plugin.c.

int local_uname_len

Definition at line 62 of file plugin.c.

GHashTable* membership_list

Definition at line 76 of file plugin.c.

struct pcmk_env_s pcmk_env

Definition at line 40 of file utils.c.

int plugin_log_level

Definition at line 60 of file plugin.c.