diff options
author | Lei YU <mine260309@gmail.com> | 2019-02-21 16:10:41 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2019-03-13 11:01:53 +0800 |
commit | 322f3f4702cda3c2114091c51fa7d88014b7cef8 (patch) | |
tree | b9465b18857b53e3fb39f1466cbd28fc8f2480d1 | |
parent | dcb3fd799cd353925aaa269413b68b672f99315c (diff) | |
download | openpower-pnor-code-mgmt-322f3f4702cda3c2114091c51fa7d88014b7cef8.tar.gz openpower-pnor-code-mgmt-322f3f4702cda3c2114091c51fa7d88014b7cef8.zip |
Static layout: Add dummy item_updater
This commit only adds the functions without implementation.
Tested: Verify the code compiles with or without static layout.
Change-Id: Id57640b367f9594d07e6780d446479eb7ac06007
Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r-- | item_updater_main.cpp | 4 | ||||
-rw-r--r-- | static/Makefile.am.include | 2 | ||||
-rw-r--r-- | static/item_updater_static.cpp | 69 | ||||
-rw-r--r-- | static/item_updater_static.hpp | 68 |
4 files changed, 142 insertions, 1 deletions
diff --git a/item_updater_main.cpp b/item_updater_main.cpp index e54239a89..9ba705bca 100644 --- a/item_updater_main.cpp +++ b/item_updater_main.cpp @@ -3,6 +3,8 @@ #ifdef UBIFS_LAYOUT #include "ubi/item_updater_ubi.hpp" #include "ubi/watch.hpp" +#else +#include "static/item_updater_static.hpp" #endif #include <phosphor-logging/log.hpp> @@ -30,6 +32,8 @@ int main(int argc, char* argv[]) #ifdef UBIFS_LAYOUT ItemUpdaterUbi updater(bus, SOFTWARE_OBJPATH); +#else + ItemUpdaterStatic updater(bus, SOFTWARE_OBJPATH); #endif bus.request_name(BUSNAME_UPDATER); diff --git a/static/Makefile.am.include b/static/Makefile.am.include index 73f96e38a..827e2fde1 100644 --- a/static/Makefile.am.include +++ b/static/Makefile.am.include @@ -1,2 +1,2 @@ openpower_update_manager_SOURCES += \ - %reldir%/item_updater.cpp + %reldir%/item_updater_static.cpp diff --git a/static/item_updater_static.cpp b/static/item_updater_static.cpp new file mode 100644 index 000000000..95912a5bf --- /dev/null +++ b/static/item_updater_static.cpp @@ -0,0 +1,69 @@ +#include "config.h" + +#include "item_updater_static.hpp" + +namespace openpower +{ +namespace software +{ +namespace updater +{ + +std::unique_ptr<Activation> ItemUpdaterStatic::createActivationObject( + const std::string& path, const std::string& versionId, + const std::string& extVersion, + sdbusplus::xyz::openbmc_project::Software::server::Activation::Activations + activationStatus, + AssociationList& assocs) +{ + return {}; +} + +std::unique_ptr<Version> ItemUpdaterStatic::createVersionObject( + const std::string& objPath, const std::string& versionId, + const std::string& versionString, + sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose + versionPurpose, + const std::string& filePath) +{ + return {}; +} + +bool ItemUpdaterStatic::validateImage(const std::string& path) +{ + return true; +} + +void ItemUpdaterStatic::processPNORImage() +{ +} + +void ItemUpdaterStatic::reset() +{ +} + +bool ItemUpdaterStatic::isVersionFunctional(const std::string& versionId) +{ + return true; +} + +void ItemUpdaterStatic::freePriority(uint8_t value, + const std::string& versionId) +{ +} + +void ItemUpdaterStatic::deleteAll() +{ +} + +void ItemUpdaterStatic::freeSpace() +{ +} + +void GardReset::reset() +{ +} + +} // namespace updater +} // namespace software +} // namespace openpower diff --git a/static/item_updater_static.hpp b/static/item_updater_static.hpp new file mode 100644 index 000000000..dd7245fbb --- /dev/null +++ b/static/item_updater_static.hpp @@ -0,0 +1,68 @@ +#pragma once + +#include "item_updater.hpp" + +namespace openpower +{ +namespace software +{ +namespace updater +{ + +/** @class ItemUpdaterStatic + * @brief Manages the activation of the host version items for static layout + */ +class ItemUpdaterStatic : public ItemUpdater +{ + public: + ItemUpdaterStatic(sdbusplus::bus::bus& bus, const std::string& path) : + ItemUpdater(bus, path) + { + processPNORImage(); + gardReset = std::make_unique<GardReset>(bus, GARD_PATH); + volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath); + + // Emit deferred signal. + emit_object_added(); + } + virtual ~ItemUpdaterStatic() = default; + + void freePriority(uint8_t value, const std::string& versionId) override; + + void processPNORImage() override; + + void deleteAll() override; + + void freeSpace() override; + + bool isVersionFunctional(const std::string& versionId) override; + + private: + /** @brief Create Activation object */ + std::unique_ptr<Activation> createActivationObject( + const std::string& path, const std::string& versionId, + const std::string& extVersion, + sdbusplus::xyz::openbmc_project::Software::server::Activation:: + Activations activationStatus, + AssociationList& assocs) override; + + /** @brief Create Version object */ + std::unique_ptr<Version> + createVersionObject(const std::string& objPath, + const std::string& versionId, + const std::string& versionString, + sdbusplus::xyz::openbmc_project::Software::server:: + Version::VersionPurpose versionPurpose, + const std::string& filePath) override; + + /** @brief Validate if image is valid or not */ + bool validateImage(const std::string& path); + + /** @brief Host factory reset - clears PNOR partitions for each + * Activation D-Bus object */ + void reset() override; +}; + +} // namespace updater +} // namespace software +} // namespace openpower |