pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
crm_compat.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_CRM_COMPAT__H
11 # define PCMK__CRM_CRM_COMPAT__H
12 
13 #include <strings.h>
14 #include <glib.h>
15 
16 #include <crm/common/actions.h>
17 #include <crm/common/scores.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
32 #define EOS '\0'
34 
36 #define MAX_IPC_DELAY 120
37 
38 // NOTE: sbd (as of at least 1.5.2) uses this
40 #define CRM_SCORE_INFINITY PCMK_SCORE_INFINITY
41 
42 /* INFINITY might be defined elsewhere (such as math.h), so undefine it first.
43  * This, of course, complicates any attempt to use the other definition in any
44  * code that includes this header.
45  */
47 #undef INFINITY
48 #define INFINITY PCMK_SCORE_INFINITY
49 
51 #define CRM_INFINITY_S PCMK_VALUE_INFINITY
52 
54 #define CRM_MINUS_INFINITY_S PCMK_VALUE_MINUS_INFINITY
55 
57 #define CRM_PLUS_INFINITY_S PCMK_VALUE_PLUS_INFINITY
58 
60 #define INFINITY_S "INFINITY"
61 
63 #define MINUS_INFINITY_S "-INFINITY"
64 
66 #define CRM_OP_FENCE PCMK_ACTION_STONITH
67 
69 #define CRM_OP_LRM_QUERY "lrm_query"
70 
72 #define CRM_OP_RELAXED_CLONE PCMK_ACTION_CLONE_ONE_OR_MORE
73 
75 #define CRM_OP_RELAXED_SET PCMK_ACTION_ONE_OR_MORE
76 
78 #define CRM_ATTR_RA_VERSION "#ra-version"
79 
81 #define CRMD_ACTION_CANCEL PCMK_ACTION_CANCEL
82 
84 #define CRMD_ACTION_DELETE PCMK_ACTION_DELETE
85 
87 #define CRMD_ACTION_DEMOTE PCMK_ACTION_DEMOTE
88 
90 #define CRMD_ACTION_DEMOTED PCMK_ACTION_DEMOTED
91 
93 #define CRMD_ACTION_METADATA PCMK_ACTION_META_DATA
94 
96 #define CRMD_ACTION_MIGRATE PCMK_ACTION_MIGRATE_TO
97 
99 #define CRMD_ACTION_MIGRATED PCMK_ACTION_MIGRATE_FROM
100 
102 #define CRMD_ACTION_NOTIFIED PCMK_ACTION_NOTIFIED
103 
105 #define CRMD_ACTION_NOTIFY PCMK_ACTION_NOTIFY
106 
108 #define CRMD_ACTION_PROMOTE PCMK_ACTION_PROMOTE
109 
111 #define CRMD_ACTION_PROMOTED PCMK_ACTION_PROMOTED
112 
114 #define CRMD_ACTION_RELOAD PCMK_ACTION_RELOAD
115 
117 #define CRMD_ACTION_RELOAD_AGENT PCMK_ACTION_RELOAD_AGENT
118 
120 #define CRMD_ACTION_START PCMK_ACTION_START
121 
123 #define CRMD_ACTION_STARTED PCMK_ACTION_RUNNING
124 
126 #define CRMD_ACTION_STATUS PCMK_ACTION_MONITOR
127 
129 #define CRMD_ACTION_STOP PCMK_ACTION_STOP
130 
132 #define CRMD_ACTION_STOPPED PCMK_ACTION_STOPPED
133 
135 #define CRMD_METADATA_CALL_TIMEOUT PCMK_DEFAULT_METADATA_TIMEOUT_MS
136 
138 #define RSC_CANCEL PCMK_ACTION_CANCEL
139 
141 #define RSC_DELETE PCMK_ACTION_DELETE
142 
144 #define RSC_DEMOTE PCMK_ACTION_DEMOTE
145 
147 #define RSC_DEMOTED PCMK_ACTION_DEMOTED
148 
150 #define RSC_METADATA PCMK_ACTION_META_DATA
151 
153 #define RSC_MIGRATE PCMK_ACTION_MIGRATE_TO
154 
156 #define RSC_MIGRATED PCMK_ACTION_MIGRATE_FROM
157 
159 #define RSC_NOTIFIED PCMK_ACTION_NOTIFIED
160 
162 #define RSC_NOTIFY PCMK_ACTION_NOTIFY
163 
165 #define RSC_PROMOTE PCMK_ACTION_PROMOTE
166 
168 #define RSC_PROMOTED PCMK_ACTION_PROMOTED
169 
171 #define RSC_START PCMK_ACTION_START
172 
174 #define RSC_STARTED PCMK_ACTION_RUNNING
175 
177 #define RSC_STATUS PCMK_ACTION_MONITOR
178 
180 #define RSC_STOP PCMK_ACTION_STOP
181 
183 #define RSC_STOPPED PCMK_ACTION_STOPPED
184 
186 #define CRM_OP_LOCAL_SHUTDOWN "start_shutdown"
187 
190 
191 # ifndef __GNUC__
192 # define __builtin_expect(expr, result) (expr)
193 # endif
194 
195 #define __likely(expr) __builtin_expect(expr, 1)
196 
197 #define __unlikely(expr) __builtin_expect(expr, 0)
198 
199 // This ends the doxygen deprecation comment
201 
202 // NOTE: sbd (as of at least 1.5.2) uses this
204 typedef GList *GListPtr;
205 
207 static inline const char *
208 crm_action_str(const char *task, guint interval_ms) {
209  if ((task != NULL) && (interval_ms == 0)
210  && (strcasecmp(task, PCMK_ACTION_MONITOR) == 0)) {
211  return "probe";
212  }
213  return task;
214 }
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 #endif // PCMK__CRM_CRM_COMPAT__H
GList * GListPtr
Definition: crm_compat.h:204
APIs related to actions.
#define PCMK_ACTION_MONITOR
Definition: actions.h:60
Pacemaker APIs related to scores.