This source file includes following definitions.
- attrd_get_node_xml_id
- attrd_set_node_xml_id
- attrd_forget_node_xml_id
- attrd_cleanup_xml_ids
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdio.h>
13 #include <glib.h>
14
15 #include "pacemaker-attrd.h"
16
17
18 static GHashTable *node_xml_ids = NULL;
19
20
21
22
23
24
25
26
27
28
29
30
31 const char *
32 attrd_get_node_xml_id(const char *node_name)
33 {
34 if (node_xml_ids == NULL) {
35 return NULL;
36 }
37 return g_hash_table_lookup(node_xml_ids, node_name);
38 }
39
40
41
42
43
44
45
46
47 void
48 attrd_set_node_xml_id(const char *node_name, const char *node_xml_id)
49 {
50 if (node_xml_ids == NULL) {
51 node_xml_ids = pcmk__strikey_table(free, free);
52 }
53 pcmk__insert_dup(node_xml_ids, node_name, node_xml_id);
54 }
55
56
57
58
59
60
61
62 void
63 attrd_forget_node_xml_id(const char *node_name)
64 {
65 if (node_xml_ids == NULL) {
66 return;
67 }
68 g_hash_table_remove(node_xml_ids, node_name);
69 }
70
71
72
73
74
75 void
76 attrd_cleanup_xml_ids(void)
77 {
78 if (node_xml_ids != NULL) {
79 g_hash_table_destroy(node_xml_ids);
80 node_xml_ids = NULL;
81 }
82 }