diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-10-05 17:06:37 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-10-05 17:06:37 +0530 |
commit | 3108597441bf178bca34c9bf93fb061c56e26068 (patch) | |
tree | e428b4e20e555e40c95958f2c2745b0cec3833cf | |
parent | 3c899a4d2e3abe269c2b6ccc5260bd33f95e8e92 (diff) | |
download | phosphor-debug-collector-3108597441bf178bca34c9bf93fb061c56e26068.tar.gz phosphor-debug-collector-3108597441bf178bca34c9bf93fb061c56e26068.zip |
Enable Cereal class versioning
Change-Id: Ib6d212e730d25eb14ceed5b5f3f222ee3b47b35c
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | elog_watch.cpp | 5 | ||||
-rw-r--r-- | elog_watch.hpp | 8 |
3 files changed, 16 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index fa69297..d2565d7 100644 --- a/configure.ac +++ b/configure.ac @@ -83,5 +83,9 @@ AS_IF([test "x$ELOG_ID_PERSIST_PATH" == "x"], \ AC_DEFINE_UNQUOTED([ELOG_ID_PERSIST_PATH], ["$ELOG_ID_PERSIST_PATH"], \ [Path of file for storing elog id's, which have associated dumps]) +AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal]) +AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1]) +AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/elog_watch.cpp b/elog_watch.cpp index 5ab65df..6cb7a0f 100644 --- a/elog_watch.cpp +++ b/elog_watch.cpp @@ -1,9 +1,14 @@ +#include <cereal/cereal.hpp> #include <phosphor-logging/elog.hpp> #include "elog_watch.hpp" #include "dump_internal.hpp" #include "xyz/openbmc_project/Dump/Create/error.hpp" #include "dump_serialize.hpp" +#include "config.h" + +// Register class version with Cereal +CEREAL_CLASS_VERSION(phosphor::dump::elog::Watch, CLASS_VERSION); namespace phosphor { diff --git a/elog_watch.hpp b/elog_watch.hpp index 588ac34..4730311 100644 --- a/elog_watch.hpp +++ b/elog_watch.hpp @@ -47,11 +47,17 @@ class Watch /** @brief Function required by Cereal to perform serialization. * @tparam Archive - Cereal archive type (binary in our case). * @param[in] a - reference to Cereal archive. + * @param[in] version - Class version that enables handling + * a serialized data across code levels */ template<class Archive> - void serialize(Archive& a) + void serialize(Archive& a, const std::uint32_t version) { a(elogList); + + //TODO: openbmc/phosphor-debug-collector#1 + // Split into load/save so that it enables + // version compare during serialization } /** @brief Callback function for error log add. |