summaryrefslogtreecommitdiffstats
path: root/lib/common/cib.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
commit07d7f4cfa4b10de87a31b68191036ff446add675 (patch)
tree7162524d8aaf1aef62d2f4fa51f595ed113981ff /lib/common/cib.c
parentAdding upstream version 2.1.6. (diff)
downloadpacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.tar.xz
pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.zip
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/common/cib.c')
-rw-r--r--lib/common/cib.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/common/cib.c b/lib/common/cib.c
index b84c5e8..fee7881 100644
--- a/lib/common/cib.c
+++ b/lib/common/cib.c
@@ -1,6 +1,6 @@
/*
* Original copyright 2004 International Business Machines
- * Later changes copyright 2008-2021 the Pacemaker project contributors
+ * Later changes copyright 2008-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -14,6 +14,8 @@
#include <libxml/tree.h> // xmlNode
#include <crm/msg_xml.h>
+#include <crm/common/cib.h>
+#include <crm/common/cib_internal.h>
/*
* Functions to help find particular sections of the CIB
@@ -99,7 +101,7 @@ static struct {
};
/*!
- * \brief Get the XPath needed to find a specified CIB element name
+ * \brief Get the relative XPath needed to find a specified CIB element name
*
* \param[in] element_name Name of CIB element
*
@@ -120,6 +122,23 @@ pcmk_cib_xpath_for(const char *element_name)
}
/*!
+ * \internal
+ * \brief Get the absolute XPath needed to find a specified CIB element name
+ *
+ * \param[in] element Name of CIB element
+ *
+ * \return XPath for finding \p element in CIB XML (or \c NULL if unknown)
+ */
+const char *
+pcmk__cib_abs_xpath_for(const char *element)
+{
+ const char *xpath = pcmk_cib_xpath_for(element);
+
+ // XPaths returned by pcmk_cib_xpath_for() are relative (starting with "//")
+ return ((xpath != NULL)? (xpath + 1) : NULL);
+}
+
+/*!
* \brief Get the parent element name of a given CIB element name
*
* \param[in] element_name Name of CIB element