summaryrefslogtreecommitdiffstats
path: root/ubi
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-02-28 14:26:37 +0800
committerLei YU <mine260309@gmail.com>2019-03-13 11:01:53 +0800
commit6da3dae3b40bdbe9663b94e1f36dd3e2833d9c14 (patch)
tree87542e570ae26f49a051a867d124c1fca9ee7b7b /ubi
parent6cecc9b4a8e11327b5c59924c2865da5865f7d7d (diff)
downloadopenpower-pnor-code-mgmt-6da3dae3b40bdbe9663b94e1f36dd3e2833d9c14.tar.gz
openpower-pnor-code-mgmt-6da3dae3b40bdbe9663b94e1f36dd3e2833d9c14.zip
Static layout: Do not update PNOR when host is on
Static layout only has 1 active and functional PNOR. When host is running, do not update PNOR. This is done by checking the return value of freeSpace(), and if it returns false, it means there is no space for PNOR because the host is running and erase() returns false. Tested: Verify the status becomes Failed when trying to activate a PNOR while host is running. Change-Id: Ie2986b0c6fd29557685f67eb77ccc29709e1669a Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'ubi')
-rw-r--r--ubi/item_updater_ubi.cpp5
-rw-r--r--ubi/item_updater_ubi.hpp2
2 files changed, 5 insertions, 2 deletions
diff --git a/ubi/item_updater_ubi.cpp b/ubi/item_updater_ubi.cpp
index 875847f6e..61a8e0156 100644
--- a/ubi/item_updater_ubi.cpp
+++ b/ubi/item_updater_ubi.cpp
@@ -357,8 +357,9 @@ void ItemUpdaterUbi::deleteAll()
}
// TODO: openbmc/openbmc#1402 Monitor flash usage
-void ItemUpdaterUbi::freeSpace()
+bool ItemUpdaterUbi::freeSpace()
{
+ bool isSpaceFreed = false;
// Versions with the highest priority in front
std::priority_queue<std::pair<int, std::string>,
std::vector<std::pair<int, std::string>>,
@@ -393,7 +394,9 @@ void ItemUpdaterUbi::freeSpace()
erase(versionsPQ.top().second);
versionsPQ.pop();
count--;
+ isSpaceFreed = true;
}
+ return isSpaceFreed;
}
std::string ItemUpdaterUbi::determineId(const std::string& symlinkPath)
diff --git a/ubi/item_updater_ubi.hpp b/ubi/item_updater_ubi.hpp
index 5de51d34e..ce1b5b87d 100644
--- a/ubi/item_updater_ubi.hpp
+++ b/ubi/item_updater_ubi.hpp
@@ -35,7 +35,7 @@ class ItemUpdaterUbi : public ItemUpdater
void deleteAll() override;
- void freeSpace() override;
+ bool freeSpace() override;
bool isVersionFunctional(const std::string& versionId) override;
OpenPOWER on IntegriCloud