Added openpower util file support
Created common file to keep all the common util functions.
In this commit
- added getService function to get d-bus service for given
interface.
- updated create_pel.cpp to start using common util interface.
- Moved formatting library to common build dependency for
both meson and automake.
Tested: Manually verified.
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: I39a642710c0476e81fae020eb3b4216ca8ce9ad5
diff --git a/util.hpp b/util.hpp
new file mode 100644
index 0000000..19a162e
--- /dev/null
+++ b/util.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+
+#include <string>
+
+namespace openpower
+{
+namespace util
+{
+/**
+ * Get D-Bus service name for the specified object and interface
+ *
+ * @param[in] bus - sdbusplus D-Bus to attach to
+ * @param[in] objectPath - D-Bus object path
+ * @param[in] interface - D-Bus interface name
+ *
+ * @return service name on success and exception on failure
+ */
+std::string getService(sdbusplus::bus::bus& bus, const std::string& objectPath,
+ const std::string& interface);
+} // namespace util
+} // namespace openpower