MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cib_get_operation_id

Function cib_get_operation_id

cib/common.c:212–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210/* *INDENT-ON* */
211
212int
213cib_get_operation_id(const char *op, int *operation)
214{
215 static GHashTable *operation_hash = NULL;
216
217 if (operation_hash == NULL) {
218 int lpc = 0;
219 int max_msg_types = DIMOF(cib_server_ops);
220
221 operation_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, g_hash_destroy_str);
222 for (lpc = 1; lpc < max_msg_types; lpc++) {
223 /* coverity[returned_null] Ignore */
224 int *value = malloc(sizeof(int));
225
226 *value = lpc;
227 g_hash_table_insert(operation_hash, (gpointer) cib_server_ops[lpc].operation, value);
228 }
229 }
230
231 if (op != NULL) {
232 int *value = g_hash_table_lookup(operation_hash, op);
233
234 if (value) {
235 *operation = *value;
236 return pcmk_ok;
237 }
238 }
239 crm_err("Operation %s is not valid", op);
240 *operation = -1;
241 return -EINVAL;
242}
243
244xmlNode *
245cib_msg_copy(xmlNode * msg, gboolean with_data)

Callers 2

cib_process_requestFunction · 0.85
cib_process_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected