vpnor: Use the partition in rw if it exists
Look for the partition file in the rw directory first as the default.
This allows mboxd to support a single writable directory for the case
where the partition files (including the read-only ones) need to be
modified at runtime by the BMC, for example to support two different
configurations of a system using the same firmware image.
Tested: Enabled debug traces to check where the read and write requests
were being fulfilled from and copied some partition files to
the patch directory:
On witherspoon, verified the reads/writes were done on the patch
directory for the files that existed there, and reads were
fulfilled from the ro dir, and writes from the rw dir.
On rainier where all partitions exist in the rw dir, verified
the reads/writes were done on the patch dir for the files that
existed there, and reads/writes were done to the rw dir. For the
HB_VOLATILE partition that gets erased, the ro dir was then used
to read after it was deleted from the rw dir.
Change-Id: I3fe1875bd6a47aa82e9a1f23bc136a5a4f499c7f
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/vpnor/partition.cpp b/vpnor/partition.cpp
index cfefc0a..4595387 100644
--- a/vpnor/partition.cpp
+++ b/vpnor/partition.cpp
@@ -48,6 +48,13 @@
return dst;
}
+ // Check if partition exists in rw location (default)
+ dst = fs::path(priv->paths.rw_loc) / partition.data.name;
+ if (fs::exists(dst))
+ {
+ return dst;
+ }
+
switch (partition.data.user.data[1] &
(PARTITION_PRESERVED | PARTITION_READONLY))
{