From 237ade6beb817b5c73d496c69747ac02757cf897 Mon Sep 17 00:00:00 2001 From: Vladimir Chtchetkine Date: Thu, 19 Jan 2012 11:02:20 -0800 Subject: 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 --- android/snaphost-android.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'android/snaphost-android.c') 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); -- cgit v1.1