Item Updater: Implement BMC factory reset
This commit implements the generic factory reset interface for the BMC
software updater. When the reset function is called, a service file is
called which sets the environmental variable to reset the RW volume.
Change-Id: Ic69b5d145edd654ed75295a9e9aeef9f53779dad
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/item_updater.hpp b/item_updater.hpp
index 75b2a68..e4fdd69 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -3,6 +3,7 @@
#include <sdbusplus/server.hpp>
#include "activation.hpp"
#include "version.hpp"
+#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
namespace phosphor
{
@@ -11,21 +12,17 @@
namespace updater
{
+using ItemUpdaterInherit = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Common::server::FactoryReset>;
+
namespace MatchRules = sdbusplus::bus::match::rules;
/** @class ItemUpdater
* @brief Manages the activation of the BMC version items.
*/
-class ItemUpdater
+class ItemUpdater : public ItemUpdaterInherit
{
public:
- ItemUpdater() = delete;
- ~ItemUpdater() = default;
- ItemUpdater(const ItemUpdater&) = delete;
- ItemUpdater& operator=(const ItemUpdater&) = delete;
- ItemUpdater(ItemUpdater&&) = delete;
- ItemUpdater& operator=(ItemUpdater&&) = delete;
-
/*
* @brief Types of Activation status for image validation.
*/
@@ -40,7 +37,8 @@
*
* @param[in] bus - The Dbus bus object
*/
- ItemUpdater(sdbusplus::bus::bus& bus) :
+ ItemUpdater(sdbusplus::bus::bus& bus, const std::string& path) :
+ ItemUpdaterInherit(bus, path.c_str()),
bus(bus),
versionMatch(
bus,
@@ -88,6 +86,10 @@
*/
ActivationStatus validateSquashFSImage(const std::string& filePath);
+ /** @brief BMC factory reset - marks the read-write partition for
+ * recreation upon reboot. */
+ void reset() override;
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;