pacemaker  2.0.4-2deceaa
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
internal.h File Reference
#include <unistd.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <glib.h>
#include <libxml/tree.h>
#include <crm/common/util.h>
Include dependency graph for internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pcmk__config_err(fmt...)
 
#define pcmk__config_warn(fmt...)
 
#define PCMK__OP_FMT   "%s_%s_%u"
 
#define pcmk__plural_alt(i, s1, s2)   (((i) == 1)? (s1) : (s2))
 
#define pcmk__plural_s(i)   pcmk__plural_alt(i, "", "s")
 
#define PCMK__FAIL_COUNT_PREFIX   "fail-count"
 
#define PCMK__LAST_FAILURE_PREFIX   "last-failure"
 

Functions

char * pcmk__uid2username (uid_t uid)
 
const char * pcmk__update_acl_user (xmlNode *request, const char *field, const char *peer_user)
 
bool pcmk__verify_digest (xmlNode *input, const char *expected)
 
int pcmk__real_path (const char *path, char **resolved_path)
 
char * pcmk__series_filename (const char *directory, const char *series, int sequence, bool bzip)
 
int pcmk__read_series_sequence (const char *directory, const char *series, unsigned int *seq)
 
void pcmk__write_series_sequence (const char *directory, const char *series, unsigned int sequence, int max)
 
int pcmk__chown_series_sequence (const char *directory, const char *series, uid_t uid, gid_t gid)
 
int pcmk__build_path (const char *path_c, mode_t mode)
 
bool pcmk__daemon_can_write (const char *dir, const char *file)
 
void pcmk__sync_directory (const char *name)
 
int pcmk__file_contents (const char *filename, char **contents)
 
int pcmk__write_sync (int fd, const char *contents)
 
int pcmk__set_nonblocking (int fd)
 
const char * pcmk__get_tmpdir (void)
 
void pcmk__close_fds_in_child (bool)
 
pid_t pcmk__procfs_pid_of (const char *name)
 
unsigned int pcmk__procfs_num_cores (void)
 
void crm_schema_init (void)
 
void crm_schema_cleanup (void)
 
int pcmk__pid_active (pid_t pid, const char *daemon)
 
int pcmk__read_pidfile (const char *filename, pid_t *pid)
 
int pcmk__pidfile_matches (const char *filename, pid_t expected_pid, const char *expected_name, pid_t *pid)
 
int pcmk__lock_pidfile (const char *filename, const char *name)
 
char * pcmk__op_key (const char *rsc_id, const char *op_type, guint interval_ms)
 Generate an operation key (RESOURCE_ACTION_INTERVAL) More...
 
char * pcmk__notify_key (const char *rsc_id, const char *notify_type, const char *op_type)
 
char * pcmk__transition_key (int transition_id, int action_id, int target_rc, const char *node)
 
void pcmk__filter_op_for_digest (xmlNode *param_set)
 
const char * pcmk_message_name (const char *name)
 Get name to be used as identifier for cluster messages. More...
 
int pcmk__guint_from_hash (GHashTable *table, const char *key, guint default_val, guint *result)
 
bool pcmk__starts_with (const char *str, const char *prefix)
 Check whether a string starts with a certain sequence. More...
 
bool pcmk__ends_with (const char *s, const char *match)
 
bool pcmk__ends_with_ext (const char *s, const char *match)
 
char * pcmk__add_word (char *list, const char *word)
 
int pcmk__compress (const char *data, unsigned int length, unsigned int max, char **result, unsigned int *result_len)
 

Variables

int pcmk__score_red
 
int pcmk__score_green
 
int pcmk__score_yellow
 

Macro Definition Documentation

#define pcmk__config_err (   fmt...)
Value:
do { \
crm_err(fmt); \
} while (0)
gboolean crm_config_error
Definition: utils.c:50
#define crm_err(fmt, args...)
Definition: logging.h:363

Definition at line 95 of file internal.h.

#define pcmk__config_warn (   fmt...)
Value:
do { \
crm_warn(fmt); \
} while (0)
#define crm_warn(fmt, args...)
Definition: logging.h:364
gboolean crm_config_warning
Definition: utils.c:51

Definition at line 100 of file internal.h.

#define PCMK__FAIL_COUNT_PREFIX   "fail-count"

Definition at line 228 of file internal.h.

#define PCMK__LAST_FAILURE_PREFIX   "last-failure"

Definition at line 229 of file internal.h.

#define PCMK__OP_FMT   "%s_%s_%u"

Definition at line 147 of file internal.h.

#define pcmk__plural_alt (   i,
  s1,
  s2 
)    (((i) == 1)? (s1) : (s2))

Definition at line 195 of file internal.h.

#define pcmk__plural_s (   i)    pcmk__plural_alt(i, "", "s")

Definition at line 198 of file internal.h.

Function Documentation

void crm_schema_cleanup ( void  )

Definition at line 554 of file schemas.c.

void crm_schema_init ( void  )

Definition at line 379 of file schemas.c.

char* pcmk__add_word ( char *  list,
const char *  word 
)

Definition at line 517 of file strings.c.

int pcmk__build_path ( const char *  path_c,
mode_t  mode 
)

Definition at line 45 of file io.c.

int pcmk__chown_series_sequence ( const char *  directory,
const char *  series,
uid_t  uid,
gid_t  gid 
)

Definition at line 256 of file io.c.

void pcmk__close_fds_in_child ( bool  )

Definition at line 577 of file io.c.

int pcmk__compress ( const char *  data,
unsigned int  length,
unsigned int  max,
char **  result,
unsigned int *  result_len 
)

Definition at line 541 of file strings.c.

bool pcmk__daemon_can_write ( const char *  dir,
const char *  file 
)

Definition at line 346 of file io.c.

bool pcmk__ends_with ( const char *  s,
const char *  match 
)

Definition at line 410 of file strings.c.

bool pcmk__ends_with_ext ( const char *  s,
const char *  match 
)

Definition at line 437 of file strings.c.

int pcmk__file_contents ( const char *  filename,
char **  contents 
)

Definition at line 450 of file io.c.

void pcmk__filter_op_for_digest ( xmlNode *  param_set)

Definition at line 272 of file operations.c.

const char* pcmk__get_tmpdir ( void  )

Definition at line 559 of file io.c.

int pcmk__guint_from_hash ( GHashTable *  table,
const char *  key,
guint  default_val,
guint *  result 
)

Definition at line 162 of file strings.c.

int pcmk__lock_pidfile ( const char *  filename,
const char *  name 
)

Definition at line 214 of file pid.c.

char* pcmk__notify_key ( const char *  rsc_id,
const char *  notify_type,
const char *  op_type 
)

Definition at line 129 of file operations.c.

char* pcmk__op_key ( const char *  rsc_id,
const char *  op_type,
guint  interval_ms 
)

Generate an operation key (RESOURCE_ACTION_INTERVAL)

Parameters
[in]rsc_idID of resource being operated on
[in]op_typeOperation name
[in]interval_msOperation interval
Returns
Newly allocated memory containing operation key as string
Note
This function asserts on errors, so it will never return NULL. The caller is responsible for freeing the result with free().

Definition at line 40 of file operations.c.

int pcmk__pid_active ( pid_t  pid,
const char *  daemon 
)

Definition at line 23 of file pid.c.

int pcmk__pidfile_matches ( const char *  filename,
pid_t  expected_pid,
const char *  expected_name,
pid_t *  pid 
)

Definition at line 172 of file pid.c.

unsigned int pcmk__procfs_num_cores ( void  )

Definition at line 145 of file procfs.c.

pid_t pcmk__procfs_pid_of ( const char *  name)

Definition at line 111 of file procfs.c.

int pcmk__read_pidfile ( const char *  filename,
pid_t *  pid 
)

Definition at line 118 of file pid.c.

int pcmk__read_series_sequence ( const char *  directory,
const char *  series,
unsigned int *  seq 
)

Definition at line 159 of file io.c.

int pcmk__real_path ( const char *  path,
char **  resolved_path 
)

Definition at line 104 of file io.c.

char* pcmk__series_filename ( const char *  directory,
const char *  series,
int  sequence,
bool  bzip 
)

Definition at line 140 of file io.c.

int pcmk__set_nonblocking ( int  fd)

Definition at line 536 of file io.c.

bool pcmk__starts_with ( const char *  str,
const char *  prefix 
)

Check whether a string starts with a certain sequence.

Parameters
[in]strString to check
[in]prefixSequence to match against beginning of str
Returns
true if str begins with match, false otherwise
Note
This is equivalent to !strncmp(s, prefix, strlen(prefix)) but is likely less efficient when prefix is a string literal if the compiler optimizes away the strlen() at compile time, and more efficient otherwise.

Definition at line 358 of file strings.c.

void pcmk__sync_directory ( const char *  name)

Definition at line 414 of file io.c.

char* pcmk__transition_key ( int  transition_id,
int  action_id,
int  target_rc,
const char *  node 
)

Definition at line 196 of file operations.c.

char* pcmk__uid2username ( uid_t  uid)
const char* pcmk__update_acl_user ( xmlNode *  request,
const char *  field,
const char *  peer_user 
)
bool pcmk__verify_digest ( xmlNode *  input,
const char *  expected 
)

Definition at line 217 of file digest.c.

void pcmk__write_series_sequence ( const char *  directory,
const char *  series,
unsigned int  sequence,
int  max 
)

Definition at line 206 of file io.c.

int pcmk__write_sync ( int  fd,
const char *  contents 
)

Definition at line 506 of file io.c.

const char* pcmk_message_name ( const char *  name)

Get name to be used as identifier for cluster messages.

Parameters
[in]nameActual system name to check
Returns
Non-NULL cluster message identifier corresponding to name
Note
The Pacemaker daemons were renamed in version 2.0.0, but the old names must continue to be used as the identifier for cluster messages, so that mixed-version clusters are possible during a rolling upgrade.

Definition at line 517 of file utils.c.

Variable Documentation

int pcmk__score_green

Definition at line 55 of file utils.c.

int pcmk__score_red

Definition at line 54 of file utils.c.

int pcmk__score_yellow

Definition at line 56 of file utils.c.