Cater to report error in checkstop app
Added error yaml file and auto-generated error header file
Change-Id: I18814ea314b94936986f5efc624f8eec671fbfbb
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 5e963b8..4f6770d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,3 +2,5 @@
sbin_PROGRAMS = checkstop_app
checkstop_app_SOURCES = checkstop_app.cpp
+checkstop_app_LDFLAGS = $(PHOSPHOR_LOGGING_LIBS)
+checkstop_app_CXXFLAGS = $(PHOSPHOR_LOGGING_CFLAGS)
diff --git a/checkstop_app.cpp b/checkstop_app.cpp
index b3373cc..f3a044b 100644
--- a/checkstop_app.cpp
+++ b/checkstop_app.cpp
@@ -1,5 +1,12 @@
+#include <phosphor-logging/elog.hpp>
+#include "elog-errors.hpp"
+
int main(int argc, char* argv[])
{
+ using namespace phosphor::logging;
+ using error = org::open_power::Host::Checkstop;
+ report<error>();
+
return 0;
}
diff --git a/configure.ac b/configure.ac
index 9f962c3..476dc72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,14 @@
LT_INIT
+# Checks for libraries.
+AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [],
+[AC_MSG_ERROR(["systemd required and not found."])])
+
+# Checks for modules
+PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,
+ [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
+
# Create configured output
AC_CONFIG_FILES([Makefile ])
AC_OUTPUT
diff --git a/elog-errors.hpp b/elog-errors.hpp
new file mode 100644
index 0000000..92dc044
--- /dev/null
+++ b/elog-errors.hpp
@@ -0,0 +1,89 @@
+// This file was autogenerated. Do not edit!
+// See elog-gen.py for more details
+#pragma once
+
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <sdbusplus/exception.hpp>
+#include <phosphor-logging/log.hpp>
+
+namespace sdbusplus
+{
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace Error
+{
+ struct Checkstop;
+} // namespace Error
+} // namespace Host
+} // namespace open_power
+} // namespace org
+} // namespace sdbusplus
+
+
+namespace phosphor
+{
+
+namespace logging
+{
+
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace _Checkstop
+{
+
+
+} // namespace _Checkstop
+
+struct Checkstop : public sdbusplus::exception_t
+{
+ static constexpr auto errName = "org.open_power.Host.Checkstop";
+ static constexpr auto errDesc = "Checkstop condition detected";
+ static constexpr auto L = level::ERR;
+ using metadata_types = std::tuple<>;
+
+ const char* name() const noexcept
+ {
+ return errName;
+ }
+
+ const char* description() const noexcept
+ {
+ return errDesc;
+ }
+
+ const char* what() const noexcept
+ {
+ return errName;
+ }
+};
+
+} // namespace Host
+} // namespace open_power
+} // namespace org
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::org::open_power::Host::Error::Checkstop>
+{
+ using type = org::open_power::Host::Checkstop;
+};
+
+}
+
+
+} // namespace logging
+
+} // namespace phosphor
diff --git a/org/open_power/Host.errors.yaml b/org/open_power/Host.errors.yaml
new file mode 100644
index 0000000..b356f57
--- /dev/null
+++ b/org/open_power/Host.errors.yaml
@@ -0,0 +1,2 @@
+- name: Checkstop
+ description: Host checkstop condition detected
diff --git a/org/open_power/Host.metadata.yaml b/org/open_power/Host.metadata.yaml
new file mode 100644
index 0000000..39c312f
--- /dev/null
+++ b/org/open_power/Host.metadata.yaml
@@ -0,0 +1,2 @@
+- name: Checkstop
+ level: ERR