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
23 /**
24 * \file
25 * \brief Deprecated Pacemaker utilities
26 * \ingroup core
27 * \deprecated Do not include this header directly. The utilities in this
28 * header, and the header itself, will be removed in a future
29 * release.
30 */
31
32 //! \deprecated Use '\0' instead
33 #define EOS '\0'
34
35 //! \deprecated This defined constant will be removed in a future release
36 #define MAX_IPC_DELAY 120
37
38 // NOTE: sbd (as of at least 1.5.2) uses this
39 //! \deprecated Use PCMK_SCORE_INFINITY instead
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 */
46 //! \deprecated Use PCMK_SCORE_INFINITY instead
47 #undef INFINITY
48 #define INFINITY PCMK_SCORE_INFINITY
49
50 //! \deprecated Use PCMK_VALUE_INFINITY instead
51 #define CRM_INFINITY_S PCMK_VALUE_INFINITY
52
53 //! \deprecated Use PCMK_VALUE_MINUS_INFINITY instead
54 #define CRM_MINUS_INFINITY_S PCMK_VALUE_MINUS_INFINITY
55
56 //! \deprecated Use PCMK_VALUE_PLUS_INFINITY instead
57 #define CRM_PLUS_INFINITY_S PCMK_VALUE_PLUS_INFINITY
58
59 //! \deprecated Use PCMK_VALUE_INFINITY instead
60 #define INFINITY_S "INFINITY"
61
62 //! \deprecated Use PCMK_VALUE_MINUS_INFINITY instead
63 #define MINUS_INFINITY_S "-INFINITY"
64
65 //! \deprecated Use PCMK_ACTION_STONITH instead
66 #define CRM_OP_FENCE PCMK_ACTION_STONITH
67
68 //! \deprecated This defined constant will be removed in a future release
69 #define CRM_OP_LRM_QUERY "lrm_query"
70
71 //! \deprecated Use PCMK_ACTION_CLONE_ONE_OR_MORE instead
72 #define CRM_OP_RELAXED_CLONE PCMK_ACTION_CLONE_ONE_OR_MORE
73
74 //! \deprecated Use PCMK_ACTION_ONE_OR_MORE instead
75 #define CRM_OP_RELAXED_SET PCMK_ACTION_ONE_OR_MORE
76
77 //! \deprecated This defined constant will be removed in a future release
78 #define CRM_ATTR_RA_VERSION "#ra-version"
79
80 //! \deprecated Use PCMK_ACTION_CANCEL instead
81 #define CRMD_ACTION_CANCEL PCMK_ACTION_CANCEL
82
83 //! \deprecated Use PCMK_ACTION_DELETE instead
84 #define CRMD_ACTION_DELETE PCMK_ACTION_DELETE
85
86 //! \deprecated Use PCMK_ACTION_DEMOTE instead
87 #define CRMD_ACTION_DEMOTE PCMK_ACTION_DEMOTE
88
89 //! \deprecated Use PCMK_ACTION_DEMOTED instead
90 #define CRMD_ACTION_DEMOTED PCMK_ACTION_DEMOTED
91
92 //! \deprecated Use PCMK_ACTION_META_DATA instead
93 #define CRMD_ACTION_METADATA PCMK_ACTION_META_DATA
94
95 //! \deprecated Use PCMK_ACTION_MIGRATE_TO instead
96 #define CRMD_ACTION_MIGRATE PCMK_ACTION_MIGRATE_TO
97
98 //! \deprecated Use PCMK_ACTION_MIGRATE_FROM instead
99 #define CRMD_ACTION_MIGRATED PCMK_ACTION_MIGRATE_FROM
100
101 //! \deprecated Use PCMK_ACTION_NOTIFIED instead
102 #define CRMD_ACTION_NOTIFIED PCMK_ACTION_NOTIFIED
103
104 //! \deprecated Use PCMK_ACTION_NOTIFY instead
105 #define CRMD_ACTION_NOTIFY PCMK_ACTION_NOTIFY
106
107 //! \deprecated Use PCMK_ACTION_PROMOTE instead
108 #define CRMD_ACTION_PROMOTE PCMK_ACTION_PROMOTE
109
110 //! \deprecated Use PCMK_ACTION_PROMOTED instead
111 #define CRMD_ACTION_PROMOTED PCMK_ACTION_PROMOTED
112
113 //! \deprecated Use PCMK_ACTION_RELOAD instead
114 #define CRMD_ACTION_RELOAD PCMK_ACTION_RELOAD
115
116 //! \deprecated Use PCMK_ACTION_RELOAD_AGENT instead
117 #define CRMD_ACTION_RELOAD_AGENT PCMK_ACTION_RELOAD_AGENT
118
119 //! \deprecated Use PCMK_ACTION_START instead
120 #define CRMD_ACTION_START PCMK_ACTION_START
121
122 //! \deprecated Use PCMK_ACTION_RUNNING instead
123 #define CRMD_ACTION_STARTED PCMK_ACTION_RUNNING
124
125 //! \deprecated Use PCMK_ACTION_MONITOR instead
126 #define CRMD_ACTION_STATUS PCMK_ACTION_MONITOR
127
128 //! \deprecated Use PCMK_ACTION_STOP instead
129 #define CRMD_ACTION_STOP PCMK_ACTION_STOP
130
131 //! \deprecated Use PCMK_ACTION_STOPPED instead
132 #define CRMD_ACTION_STOPPED PCMK_ACTION_STOPPED
133
134 //! \deprecated Do not use
135 #define CRMD_METADATA_CALL_TIMEOUT PCMK_DEFAULT_METADATA_TIMEOUT_MS
136
137 //! \deprecated Use PCMK_ACTION_CANCEL instead
138 #define RSC_CANCEL PCMK_ACTION_CANCEL
139
140 //! \deprecated Use PCMK_ACTION_DELETE instead
141 #define RSC_DELETE PCMK_ACTION_DELETE
142
143 //! \deprecated Use PCMK_ACTION_DEMOTE instead
144 #define RSC_DEMOTE PCMK_ACTION_DEMOTE
145
146 //! \deprecated Use PCMK_ACTION_DEMOTED instead
147 #define RSC_DEMOTED PCMK_ACTION_DEMOTED
148
149 //! \deprecated Use PCMK_ACTION_META_DATA instead
150 #define RSC_METADATA PCMK_ACTION_META_DATA
151
152 //! \deprecated Use PCMK_ACTION_MIGRATE_TO instead
153 #define RSC_MIGRATE PCMK_ACTION_MIGRATE_TO
154
155 //! \deprecated Use PCMK_ACTION_MIGRATE_FROM instead
156 #define RSC_MIGRATED PCMK_ACTION_MIGRATE_FROM
157
158 //! \deprecated Use PCMK_ACTION_NOTIFIED instead
159 #define RSC_NOTIFIED PCMK_ACTION_NOTIFIED
160
161 //! \deprecated Use PCMK_ACTION_NOTIFY instead
162 #define RSC_NOTIFY PCMK_ACTION_NOTIFY
163
164 //! \deprecated Use PCMK_ACTION_PROMOTE instead
165 #define RSC_PROMOTE PCMK_ACTION_PROMOTE
166
167 //! \deprecated Use PCMK_ACTION_PROMOTED instead
168 #define RSC_PROMOTED PCMK_ACTION_PROMOTED
169
170 //! \deprecated Use PCMK_ACTION_START instead
171 #define RSC_START PCMK_ACTION_START
172
173 //! \deprecated Use PCMK_ACTION_RUNNING instead
174 #define RSC_STARTED PCMK_ACTION_RUNNING
175
176 //! \deprecated Use PCMK_ACTION_MONITOR instead
177 #define RSC_STATUS PCMK_ACTION_MONITOR
178
179 //! \deprecated Use PCMK_ACTION_STOP instead
180 #define RSC_STOP PCMK_ACTION_STOP
181
182 //! \deprecated Use PCMK_ACTION_STOPPED instead
183 #define RSC_STOPPED PCMK_ACTION_STOPPED
184
185 //! \deprecated Do not use
186 #define CRM_OP_LOCAL_SHUTDOWN "start_shutdown"
187
188 //!@{
189 //! \deprecated This macro will be removed in a future release
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
200 //!@}
201
202 // NOTE: sbd (as of at least 1.5.2) uses this
203 //! \deprecated Use GList * instead
204 typedef GList *GListPtr;
205
206 //! \deprecated Do not use
207 static inline const char *
208 crm_action_str(const char *task, guint interval_ms) {
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
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