From f1a4eb3c615ea9fdb0c1dd5a9efeff7dd87483a9 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Feb 24 2021 16:09:00 +0000 Subject: Refactor: use PCMK__XP_ prefix instead of XPATH_ for XML constants --- diff --git a/include/crm/common/xml_internal.h b/include/crm/common/xml_internal.h index 969a57d..4501bee 100644 --- a/include/crm/common/xml_internal.h +++ b/include/crm/common/xml_internal.h @@ -126,18 +126,18 @@ do { /* XML search strings for guest, remote and pacemaker_remote nodes */ /* search string to find CIB resources entries for guest nodes */ -#define XPATH_GUEST_NODE_CONFIG \ +#define PCMK__XP_GUEST_NODE_CONFIG \ "//" XML_TAG_CIB "//" XML_CIB_TAG_CONFIGURATION "//" XML_CIB_TAG_RESOURCE \ "//" XML_TAG_META_SETS "//" XML_CIB_TAG_NVPAIR \ "[@name='" XML_RSC_ATTR_REMOTE_NODE "']" /* search string to find CIB resources entries for remote nodes */ -#define XPATH_REMOTE_NODE_CONFIG \ +#define PCMK__XP_REMOTE_NODE_CONFIG \ "//" XML_TAG_CIB "//" XML_CIB_TAG_CONFIGURATION "//" XML_CIB_TAG_RESOURCE \ "[@type='remote'][@provider='pacemaker']" /* search string to find CIB node status entries for pacemaker_remote nodes */ -#define XPATH_REMOTE_NODE_STATUS \ +#define PCMK__XP_REMOTE_NODE_STATUS \ "//" XML_TAG_CIB "//" XML_CIB_TAG_STATUS "//" XML_CIB_TAG_STATE \ "[@" XML_NODE_IS_REMOTE "='true']" diff --git a/lib/cluster/membership.c b/lib/cluster/membership.c index feed222..97b78cc 100644 --- a/lib/cluster/membership.c +++ b/lib/cluster/membership.c @@ -231,7 +231,7 @@ crm_remote_peer_cache_refresh(xmlNode *cib) /* Look for guest nodes and remote nodes in the status section */ data.field = "id"; data.has_state = TRUE; - crm_foreach_xpath_result(cib, XPATH_REMOTE_NODE_STATUS, + crm_foreach_xpath_result(cib, PCMK__XP_REMOTE_NODE_STATUS, remote_cache_refresh_helper, &data); /* Look for guest nodes and remote nodes in the configuration section, @@ -242,11 +242,11 @@ crm_remote_peer_cache_refresh(xmlNode *cib) */ data.field = "value"; data.has_state = FALSE; - crm_foreach_xpath_result(cib, XPATH_GUEST_NODE_CONFIG, + crm_foreach_xpath_result(cib, PCMK__XP_GUEST_NODE_CONFIG, remote_cache_refresh_helper, &data); data.field = "id"; data.has_state = FALSE; - crm_foreach_xpath_result(cib, XPATH_REMOTE_NODE_CONFIG, + crm_foreach_xpath_result(cib, PCMK__XP_REMOTE_NODE_CONFIG, remote_cache_refresh_helper, &data); /* Remove all old cache entries that weren't seen in the CIB */ @@ -1126,7 +1126,7 @@ known_peer_cache_refresh_helper(xmlNode *xml_node, void *user_data) } -#define XPATH_MEMBER_NODE_CONFIG \ +#define PCMK__XP_MEMBER_NODE_CONFIG \ "//" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_NODES \ "/" XML_CIB_TAG_NODE "[not(@type) or @type='member']" @@ -1137,7 +1137,7 @@ crm_known_peer_cache_refresh(xmlNode *cib) g_hash_table_foreach(crm_known_peer_cache, mark_dirty, NULL); - crm_foreach_xpath_result(cib, XPATH_MEMBER_NODE_CONFIG, + crm_foreach_xpath_result(cib, PCMK__XP_MEMBER_NODE_CONFIG, known_peer_cache_refresh_helper, NULL); /* Remove all old cache entries that weren't seen in the CIB */ diff --git a/lib/pacemaker/pcmk_cluster_queries.c b/lib/pacemaker/pcmk_cluster_queries.c index fc5cfc4..e512f32 100644 --- a/lib/pacemaker/pcmk_cluster_queries.c +++ b/lib/pacemaker/pcmk_cluster_queries.c @@ -467,21 +467,21 @@ pcmk__list_nodes(pcmk__output_t *out, char *node_types, gboolean BASH_EXPORT) if (pcmk__str_empty(node_types) || strstr(node_types, "pacemaker_remote")) { data.field = "id"; data.type = "pacemaker_remote"; - crm_foreach_xpath_result(xml_node, XPATH_REMOTE_NODE_STATUS, + crm_foreach_xpath_result(xml_node, PCMK__XP_REMOTE_NODE_STATUS, remote_node_print_helper, &data); } if (pcmk__str_empty(node_types) || strstr(node_types, "guest")) { data.field = "value"; data.type = "guest"; - crm_foreach_xpath_result(xml_node, XPATH_GUEST_NODE_CONFIG, + crm_foreach_xpath_result(xml_node, PCMK__XP_GUEST_NODE_CONFIG, remote_node_print_helper, &data); } if (pcmk__str_empty(node_types) || !pcmk__strcmp(node_types, ",|^remote", pcmk__str_regex)) { data.field = "id"; data.type = "remote"; - crm_foreach_xpath_result(xml_node, XPATH_REMOTE_NODE_CONFIG, + crm_foreach_xpath_result(xml_node, PCMK__XP_REMOTE_NODE_CONFIG, remote_node_print_helper, &data); }