Add serialization for bios-settings-manager
Tested: Restarted the biosconfig-manager application and
BaseBIOSTable and PendingAttributes were restored.
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Change-Id: Iddbe69ed45a6895a324d236a14b6f21586315c62
diff --git a/include/manager.hpp b/include/manager.hpp
index 702e30f..3182126 100644
--- a/include/manager.hpp
+++ b/include/manager.hpp
@@ -15,10 +15,13 @@
*/
#pragma once
+#include "config.h"
+
#include <sdbusplus/asio/object_server.hpp>
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/BIOSConfig/Manager/server.hpp>
+#include <filesystem>
#include <string>
namespace bios_config
@@ -26,8 +29,10 @@
static constexpr auto service = "xyz.openbmc_project.BIOSConfigManager";
static constexpr auto objectPath = "/xyz/openbmc_project/bios_config/manager";
+constexpr auto biosPersistFile = "biosData";
using Base = sdbusplus::xyz::openbmc_project::BIOSConfig::server::Manager;
+namespace fs = std::filesystem;
/** @class Manager
*
@@ -131,6 +136,7 @@
sdbusplus::asio::object_server& objServer;
std::shared_ptr<sdbusplus::asio::connection>& systemBus;
+ std::filesystem::path biosFile;
};
} // namespace bios_config
diff --git a/include/manager_serialize.hpp b/include/manager_serialize.hpp
new file mode 100644
index 0000000..000314e
--- /dev/null
+++ b/include/manager_serialize.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "manager.hpp"
+
+#include <filesystem>
+
+namespace bios_config
+{
+
+/** @brief Serialize and persist the bios manager object
+ *
+ * @param[in] obj - bios manager object
+ * @param[in] path - path to the file where the bios manager object
+ * is to be serialized
+ */
+void serialize(const Manager& obj, const fs::path& path);
+
+/** @brief Deserialize the persisted data and populate the bios manager object
+ *
+ * @param[in] path - path to the persisted file
+ * @param[in/out] entry - reference to the bios manager object which is the
+ * target of deserialization.
+ *
+ * @return bool - true if the deserialization was successful, false otherwise.
+ */
+bool deserialize(const fs::path& path, Manager& entry);
+
+} // namespace bios_config
\ No newline at end of file