summaryrefslogtreecommitdiffstats
path: root/pnor_partition_table.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pnor_partition_table.cpp')
-rw-r--r--pnor_partition_table.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index eafdca5..bb9e05d 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -104,20 +104,38 @@ inline void Table::writeUserdata(pnor_partition& part,
uint32_t version,
const std::string& data)
{
- if (std::string::npos != data.find("ECC"))
- {
- part.data.user.data[0] = PARTITION_ECC_PROTECTED;
- }
-
+ std::istringstream stream(data);
+ std::string flag {};
auto perms = 0;
- if (std::string::npos != data.find("READONLY"))
- {
- perms |= PARTITION_READONLY;
- }
- if (std::string::npos != data.find("PRESERVED"))
+
+ while (std::getline(stream, flag, ','))
{
- perms |= PARTITION_PRESERVED;
+ if (flag == "ECC")
+ {
+ part.data.user.data[0] = PARTITION_ECC_PROTECTED;
+ }
+ else if (flag == "READONLY")
+ {
+ perms |= PARTITION_READONLY;
+ }
+ else if (flag == "PRESERVED")
+ {
+ perms |= PARTITION_PRESERVED;
+ }
+ else if (flag == "REPROVISION")
+ {
+ perms |= PARTITION_REPROVISION;
+ }
+ else if (flag == "VOLATILE")
+ {
+ perms |= PARTITION_VOLATILE;
+ }
+ else if (flag == "CLEARECC")
+ {
+ perms |= PARTITION_CLEARECC;
+ }
}
+
part.data.user.data[1] = perms;
part.data.user.data[1] |= version;
OpenPOWER on IntegriCloud