pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
Functions | Variables
scores.c File Reference
#include <crm_internal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <crm/common/scores_compat.h>
Include dependency graph for scores.c:

Go to the source code of this file.

Functions

int pcmk_parse_score (const char *score_s, int *score, int default_score)
 Parse an integer score from a string. More...
 
const char * pcmk_readable_score (int score)
 Return a displayable static string for a score value. More...
 
bool pcmk_str_is_infinity (const char *s)
 
bool pcmk_str_is_minus_infinity (const char *s)
 
int pcmk__add_scores (int score1, int score2)
 
int char2score (const char *score)
 

Variables

int pcmk__score_red = 0
 
int pcmk__score_green = 0
 
int pcmk__score_yellow = 0
 

Function Documentation

◆ char2score()

int char2score ( const char *  score)
Deprecated:
Use pcmk_parse_score() instead

Definition at line 191 of file scores.c.

◆ pcmk__add_scores()

int pcmk__add_scores ( int  score1,
int  score2 
)

Definition at line 159 of file scores.c.

◆ pcmk_parse_score()

int pcmk_parse_score ( const char *  score_s,
int *  score,
int  default_score 
)

Parse an integer score from a string.

Parse an integer score from a string. This accepts infinity strings as well as red, yellow, and green, and bounds the result to +/-INFINITY.

Parameters
[in]score_sScore as string
[out]scoreWhere to store integer value corresponding to score_s (may be NULL to only check validity)
[in]default_scoreValue to use if score_s is NULL or invalid
Returns
Standard Pacemaker return code

Definition at line 34 of file scores.c.

◆ pcmk_readable_score()

const char* pcmk_readable_score ( int  score)

Return a displayable static string for a score value.

Given a score value, return a pointer to a static string representation of the score suitable for log messages, output, etc.

Parameters
[in]scoreScore to display
Returns
Pointer to static memory containing string representation of score
Note
Subsequent calls to this function will overwrite the returned value, so it should be used only in a local context such as a printf()-style statement.

Definition at line 102 of file scores.c.

◆ pcmk_str_is_infinity()

bool pcmk_str_is_infinity ( const char *  s)

Definition at line 130 of file scores.c.

◆ pcmk_str_is_minus_infinity()

bool pcmk_str_is_minus_infinity ( const char *  s)

Definition at line 144 of file scores.c.

Variable Documentation

◆ pcmk__score_green

int pcmk__score_green = 0

Definition at line 17 of file scores.c.

◆ pcmk__score_red

int pcmk__score_red = 0

Definition at line 16 of file scores.c.

◆ pcmk__score_yellow

int pcmk__score_yellow = 0

Definition at line 18 of file scores.c.