aboutsummaryrefslogtreecommitdiffstats
path: root/android/snaphost-android.c
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2012-01-19 11:02:20 -0800
committerVladimir Chtchetkine <vchtchetkine@google.com>2012-01-19 11:02:20 -0800
commit237ade6beb817b5c73d496c69747ac02757cf897 (patch)
treef9d0b4f73e96714464b5270903513b63d976cc77 /android/snaphost-android.c
parent0d407bca26ffc4978083240c518cd0d0a627a584 (diff)
downloadexternal_qemu-237ade6beb817b5c73d496c69747ac02757cf897.zip
external_qemu-237ade6beb817b5c73d496c69747ac02757cf897.tar.gz
external_qemu-237ade6beb817b5c73d496c69747ac02757cf897.tar.bz2
Check for data partition init path on snapshot load.
Makes sure that snapshots are not loaded if data partition for which the snapshot has been saved is overwritten (with -wipe-data option for example). We want the loaded snapshot to be consistent with the data underneath it. Change-Id: I605c9b5a66870aad76ffd97d641a08c75730de7f
Diffstat (limited to 'android/snaphost-android.c')
-rw-r--r--android/snaphost-android.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/android/snaphost-android.c b/android/snaphost-android.c
index 205531c..4e3d1c4 100644
--- a/android/snaphost-android.c
+++ b/android/snaphost-android.c
@@ -167,6 +167,14 @@ snaphost_save_config(const char* name)
}
androidHwConfig_write(android_hw, hwcfg_bkp);
+ /* Invalidate data partition initialization path in the backup copy of HW
+ * config. The reason we need to do this is that we want the system loading
+ * from the snapshot to be in sync with the data partition the snapshot was
+ * saved for. For that we must disalow overwritting it on snapshot load. In
+ * other words, we should allow snapshot loading only on condition
+ * that disk.dataPartition.initPath is empty. */
+ iniFile_setValue(hwcfg_bkp, "disk.dataPartition.initPath", "");
+
/* Save backup file. */
if (!iniFile_saveToFileClean(hwcfg_bkp, bkp_path)) {
D("HW config has been backed up to '%s'", bkp_path);