diff options
author | Lei YU <mine260309@gmail.com> | 2019-02-26 11:36:34 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2019-03-07 10:46:52 +0800 |
commit | bee5140642e935c266766906d41d3712da04d6ff (patch) | |
tree | 655a851bb718fc30cbe29c57ad6a8d7c1c6cc39b | |
parent | da6ab6cb250354a69e0be1239323ee3c370dfe7d (diff) | |
download | openpower-pnor-code-mgmt-bee5140642e935c266766906d41d3712da04d6ff.tar.gz openpower-pnor-code-mgmt-bee5140642e935c266766906d41d3712da04d6ff.zip |
Refactor: Move determinId to ubi
The function determinId is used only in ubi case, move it to ubi.
Tested: On the last commit of the patch series, run code update and
factory reset on Witherspoon and all work fine.
Change-Id: I8974d25bf904a5202b913fc185790c5ecf8eca90
Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r-- | item_updater.hpp | 8 | ||||
-rw-r--r-- | ubi/item_updater_ubi.cpp | 2 | ||||
-rw-r--r-- | ubi/item_updater_ubi.hpp | 8 | ||||
-rw-r--r-- | ubi/watch.cpp | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/item_updater.hpp b/item_updater.hpp index 96ef29c0e..7a67d6969 100644 --- a/item_updater.hpp +++ b/item_updater.hpp @@ -139,14 +139,6 @@ class ItemUpdater : public ItemUpdaterInherit */ virtual void freeSpace() = 0; - /** @brief Determine the software version id - * from the symlink target (e.g. /media/ro-2a1022fe). - * - * @param[in] symlinkPath - The path of the symlink. - * @param[out] id - The version id as a string. - */ - static std::string determineId(const std::string& symlinkPath); - /** @brief Creates an active association to the * newly active software image * diff --git a/ubi/item_updater_ubi.cpp b/ubi/item_updater_ubi.cpp index 1c2926a0f..354610b81 100644 --- a/ubi/item_updater_ubi.cpp +++ b/ubi/item_updater_ubi.cpp @@ -487,7 +487,7 @@ void ItemUpdaterUbi::freeSpace() } } -std::string ItemUpdater::determineId(const std::string& symlinkPath) +std::string ItemUpdaterUbi::determineId(const std::string& symlinkPath) { if (!fs::exists(symlinkPath)) { diff --git a/ubi/item_updater_ubi.hpp b/ubi/item_updater_ubi.hpp index af330a81b..dfc8e530a 100644 --- a/ubi/item_updater_ubi.hpp +++ b/ubi/item_updater_ubi.hpp @@ -41,6 +41,14 @@ class ItemUpdaterUbi : public ItemUpdater bool isVersionFunctional(const std::string& versionId) override; + /** @brief Determine the software version id + * from the symlink target (e.g. /media/ro-2a1022fe). + * + * @param[in] symlinkPath - The path of the symlink. + * @param[out] id - The version id as a string. + */ + static std::string determineId(const std::string& symlinkPath); + private: /** @brief Callback function for Software.Version match. * @details Creates an Activation D-Bus object. diff --git a/ubi/watch.cpp b/ubi/watch.cpp index 192d3d9b9..60d0014fe 100644 --- a/ubi/watch.cpp +++ b/ubi/watch.cpp @@ -2,7 +2,7 @@ #include "watch.hpp" -#include "item_updater.hpp" +#include "item_updater_ubi.hpp" #include <sys/inotify.h> #include <unistd.h> @@ -93,7 +93,7 @@ int Watch::callback(sd_event_source* s, int fd, uint32_t revents, path /= event->name; if (fs::equivalent(path, PNOR_RO_ACTIVE_PATH)) { - auto id = ItemUpdater::determineId(path); + auto id = ItemUpdaterUbi::determineId(path); static_cast<Watch*>(userdata)->functionalCallback(id); } offset += offsetof(inotify_event, name) + event->len; |