summaryrefslogtreecommitdiffstats
path: root/elog_watch.hpp
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2017-09-04 22:07:06 -0500
committerJayanth Othayoth <ojayanth@in.ibm.com>2017-09-14 06:39:09 +0000
commit2496482acd4df532ebb2850679d2b55680c2ec9f (patch)
treebbe3e54471370d2e5124aa134cfe13b59823032d /elog_watch.hpp
parentd0f0064eb989a93e241c599641654f12141ef636 (diff)
downloadphosphor-debug-collector-2496482acd4df532ebb2850679d2b55680c2ec9f.tar.gz
phosphor-debug-collector-2496482acd4df532ebb2850679d2b55680c2ec9f.zip
Enable support to handle InternalFailure type dump, during elog restore
Resolves openbmc/openbmc#2078 Change-Id: Iea47b9b7c0cd6cae21642057b21c4e99d85be1e8 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Diffstat (limited to 'elog_watch.hpp')
-rw-r--r--elog_watch.hpp63
1 files changed, 45 insertions, 18 deletions
diff --git a/elog_watch.hpp b/elog_watch.hpp
index cfdf41a..588ac34 100644
--- a/elog_watch.hpp
+++ b/elog_watch.hpp
@@ -1,9 +1,12 @@
#pragma once
+#include <set>
+#include <cereal/access.hpp>
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
-#include "config.h"
+#include "config.h"
#include "dump_manager.hpp"
namespace phosphor
@@ -14,9 +17,11 @@ namespace elog
{
using IMgr = phosphor::dump::internal::Manager;
+using EId = uint32_t;
+using ElogList = std::set<EId>;
/** @class Watch
- * @brief Adds d-bus signal based watch for elog commit.
+ * @brief Adds d-bus signal based watch for elog add and delete.
* @details This implements methods for watching for InternalFailure
* type error message and call appropriate function to initiate dump
*/
@@ -30,36 +35,58 @@ class Watch
Watch(Watch&&) = default;
Watch& operator=(Watch&&) = default;
- /** @brief constructs watch for elog commits.
+ /** @brief constructs watch for elog add and delete signals.
* @param[in] bus - The Dbus bus object
* @param[in] intMgr - Dump internal Manager object
*/
- Watch(sdbusplus::bus::bus& bus, IMgr& iMgr):
- iMgr(iMgr),
- elogMatch(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
- sdbusplus::bus::match::rules::path_namespace(
- OBJ_LOGGING),
- std::bind(std::mem_fn(&Watch::callback),
- this, std::placeholders::_1))
+ Watch(sdbusplus::bus::bus& bus, IMgr& iMgr);
+ private:
+
+ friend class cereal::access;
+
+ /** @brief Function required by Cereal to perform serialization.
+ * @tparam Archive - Cereal archive type (binary in our case).
+ * @param[in] a - reference to Cereal archive.
+ */
+ template<class Archive>
+ void serialize(Archive& a)
{
- //Do nothing
+ a(elogList);
}
- private:
- /** @brief Callback function for error log commit.
+ /** @brief Callback function for error log add.
* @details InternalError type error message initiates
* Internal error type dump request.
* @param[in] msg - Data associated with subscribed signal
*/
- void callback(sdbusplus::message::message& msg);
+ void addCallback(sdbusplus::message::message& msg);
+
+ /** @brief Callback function for error log delete.
+ * @param[in] msg - Data associated with subscribed signal
+ */
+ void delCallback(sdbusplus::message::message& msg);
+
+ /** @brief get elog ID from elog entry object string.
+ * @param[in] objectPath - elog entry object path.
+ * @return - elog id.
+ */
+ inline EId getEid(const std::string& objectPath)
+ {
+ fs::path path(objectPath);
+ return std::stoul(path.filename());
+ }
/** @brief Dump internal Manager object. */
IMgr& iMgr;
- /** @brief sdbusplus signal match for elog commit */
- sdbusplus::bus::match_t elogMatch;
+ /** @brief sdbusplus signal match for elog add */
+ sdbusplus::bus::match_t addMatch;
+
+ /** @brief sdbusplus signal match for elog delete */
+ sdbusplus::bus::match_t delMatch;
+
+ /** @brief List of elog ids, which have associated dumps created */
+ ElogList elogList;
};
}//namespace elog
OpenPOWER on IntegriCloud