pacemaker  1.1.15-e174ec8
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
util.h File Reference

Utility functions. More...

#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>
#include <signal.h>
#include <sysexits.h>
#include <crm/lrmd.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NORMALNODE   "normal"
 
#define ACTIVESTATUS   "active"/* fully functional, and all links are up */
 
#define DEADSTATUS   "dead"
 
#define PINGSTATUS   "ping"
 
#define JOINSTATUS   "join"
 
#define LEAVESTATUS   "leave"
 
#define ONLINESTATUS   "online"/* Status of an online client */
 
#define OFFLINESTATUS   "offline"
 
#define safe_str_eq(a, b)   crm_str_eq(a, b, FALSE)
 
#define crm_atoi(text, default_text)   crm_parse_int(text, default_text)
 

Functions

char * crm_itoa_stack (int an_int, char *buf, size_t len)
 
char * crm_itoa (int an_int)
 
gboolean crm_is_true (const char *s)
 
int crm_str_to_boolean (const char *s, int *ret)
 
int crm_parse_int (const char *text, const char *default_text)
 
long long crm_get_msec (const char *input)
 
unsigned long long crm_get_interval (const char *input)
 
int char2score (const char *score)
 
char * score2char (int score)
 
char * score2char_stack (int score, char *buf, size_t len)
 
int compare_version (const char *version1, const char *version2)
 
gboolean parse_op_key (const char *key, char **rsc_id, char **op_type, int *interval)
 
gboolean decode_transition_key (const char *key, char **uuid, int *action, int *transition_id, int *target_rc)
 
gboolean decode_transition_magic (const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc)
 
char * crm_strip_trailing_newline (char *str)
 
gboolean crm_str_eq (const char *a, const char *b, gboolean use_case)
 
gboolean safe_str_neq (const char *a, const char *b)
 
void crm_abort (const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork)
 
char * crm_meta_name (const char *field)
 
const char * crm_meta_value (GHashTable *hash, const char *field)
 
int rsc_op_expected_rc (lrmd_event_data_t *event)
 
gboolean did_rsc_op_fail (lrmd_event_data_t *event, int target_rc)
 
char * crm_md5sum (const char *buffer)
 
char * crm_generate_uuid (void)
 
void crm_build_path (const char *path_c, mode_t mode)
 Create a directory, including any parent directories needed. More...
 
int crm_user_lookup (const char *name, uid_t *uid, gid_t *gid)
 
int crm_exit (int rc)
 
bool pcmk_acl_required (const char *user)
 

Detailed Description

Utility functions.

Definition in file util.h.

Macro Definition Documentation

#define ACTIVESTATUS   "active"/* fully functional, and all links are up */

Definition at line 39 of file util.h.

#define crm_atoi (   text,
  default_text 
)    crm_parse_int(text, default_text)

Definition at line 87 of file util.h.

#define DEADSTATUS   "dead"

Definition at line 40 of file util.h.

#define JOINSTATUS   "join"

Definition at line 44 of file util.h.

#define LEAVESTATUS   "leave"

Definition at line 46 of file util.h.

#define NORMALNODE   "normal"

Definition at line 38 of file util.h.

#define OFFLINESTATUS   "offline"

Definition at line 49 of file util.h.

#define ONLINESTATUS   "online"/* Status of an online client */

Definition at line 48 of file util.h.

#define PINGSTATUS   "ping"

Definition at line 42 of file util.h.

#define safe_str_eq (   a,
 
)    crm_str_eq(a, b, FALSE)

Definition at line 74 of file util.h.

Function Documentation

int char2score ( const char *  score)

Definition at line 253 of file utils.c.

int compare_version ( const char *  version1,
const char *  version2 
)

Definition at line 536 of file utils.c.

void crm_abort ( const char *  file,
const char *  function,
int  line,
const char *  condition,
gboolean  do_core,
gboolean  do_fork 
)

Definition at line 1154 of file utils.c.

void crm_build_path ( const char *  path_c,
mode_t  mode 
)

Create a directory, including any parent directories needed.

Parameters
[in]path_cPathname of the directory to create
[in]modePermissions to be used (with current umask) when creating
Note
This logs errors but does not return them to the caller.

Definition at line 49 of file io.c.

int crm_exit ( int  rc)

Definition at line 87 of file utils.c.

char* crm_generate_uuid ( void  )

Definition at line 2361 of file utils.c.

unsigned long long crm_get_interval ( const char *  input)

Definition at line 751 of file utils.c.

long long crm_get_msec ( const char *  input)

Definition at line 776 of file utils.c.

gboolean crm_is_true ( const char *  s)

Definition at line 711 of file utils.c.

char* crm_itoa ( int  an_int)

Definition at line 469 of file utils.c.

char* crm_itoa_stack ( int  an_int,
char *  buf,
size_t  len 
)

Definition at line 459 of file utils.c.

char* crm_md5sum ( const char *  buffer)

Definition at line 2374 of file utils.c.

char* crm_meta_name ( const char *  field)

Definition at line 1461 of file utils.c.

const char* crm_meta_value ( GHashTable *  hash,
const char *  field 
)

Definition at line 1483 of file utils.c.

int crm_parse_int ( const char *  text,
const char *  default_text 
)

Definition at line 671 of file utils.c.

gboolean crm_str_eq ( const char *  a,
const char *  b,
gboolean  use_case 
)

Definition at line 1441 of file utils.c.

int crm_str_to_boolean ( const char *  s,
int *  ret 
)

Definition at line 722 of file utils.c.

char* crm_strip_trailing_newline ( char *  str)

Definition at line 1425 of file utils.c.

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

Definition at line 483 of file utils.c.

gboolean decode_transition_key ( const char *  key,
char **  uuid,
int *  action,
int *  transition_id,
int *  target_rc 
)

Definition at line 1019 of file utils.c.

gboolean decode_transition_magic ( const char *  magic,
char **  uuid,
int *  transition_id,
int *  action_id,
int *  op_status,
int *  op_rc,
int *  target_rc 
)

Definition at line 976 of file utils.c.

gboolean did_rsc_op_fail ( lrmd_event_data_t event,
int  target_rc 
)

Definition at line 1958 of file utils.c.

gboolean parse_op_key ( const char *  key,
char **  rsc_id,
char **  op_type,
int *  interval 
)

Definition at line 848 of file utils.c.

bool pcmk_acl_required ( const char *  user)

Definition at line 2151 of file utils.c.

int rsc_op_expected_rc ( lrmd_event_data_t event)

Definition at line 1943 of file utils.c.

gboolean safe_str_neq ( const char *  a,
const char *  b 
)

Definition at line 696 of file utils.c.

char* score2char ( int  score)

Definition at line 305 of file utils.c.

char* score2char_stack ( int  score,
char *  buf,
size_t  len 
)

Definition at line 291 of file utils.c.