PNOR: Restore RedundancyPriority on reset

This commit extends the functionality of the PNOR software updater by
preserving RedundancyPriority values through any kind of reset.

This is accomplished by storing priority values in serial files in
/var/lib/obmc/openpower-pnor-code-mgmt/ using the Cereal library. Each
time a priority value is modified, the value in the corresponding
version file is adjusted.

When the item updater resets, it reads back the priority values from
these files.

Resolves openbmc/openbmc#2040

Change-Id: I908431801e541a1e5b39bcf49ae057f7e340eecc
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/serialize.hpp b/serialize.hpp
new file mode 100644
index 0000000..90210a5
--- /dev/null
+++ b/serialize.hpp
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <experimental/filesystem>
+#include "config.h"
+
+namespace openpower
+{
+namespace software
+{
+namespace updater
+{
+
+namespace fs = std::experimental::filesystem;
+
+/** @brief Serialization function - stores activation information to file
+ *  @param[in] versionId - The version for which to store information.
+ *  @param[in] priority - RedundancyPriority value for that version.
+ */
+void storeToFile(std::string versionId, uint8_t priority);
+
+/** @brief Serialization function - restores activation information from file
+ *  @param[in] versionId - The version for which to retrieve information.
+ *  @param[in] priority - RedundancyPriority pointer for that version.
+ */
+void restoreFromFile(std::string versionId, uint8_t *priority);
+
+/** @brief Removes the serial file for a given version.
+ *  @param[in] versionId - The version for which to remove a file, if it exists.
+ */
+void removeFile(std::string versionId);
+
+} // namespace updater
+} // namespace software
+} // namespace openpower