aboutsummaryrefslogtreecommitdiffstats
path: root/install/wipe_data.cpp
diff options
context:
space:
mode:
authorSimon Shields <simon@lineageos.org>2019-10-02 00:21:45 +1000
committerMichael Bestas <mkbestas@lineageos.org>2019-12-11 19:08:08 +0200
commit9fe59e41c2b973c2dc3183e5149c0c8e643ceff3 (patch)
tree69826b3e1fe980d1bbab984423d5872bdf7f96ed /install/wipe_data.cpp
parenta9ac955f0a7aeb2b6f1aff7873ecc3d21c8021e0 (diff)
downloadandroid_bootable_recovery-9fe59e41c2b973c2dc3183e5149c0c8e643ceff3.tar.gz
android_bootable_recovery-9fe59e41c2b973c2dc3183e5149c0c8e643ceff3.tar.bz2
android_bootable_recovery-9fe59e41c2b973c2dc3183e5149c0c8e643ceff3.zip
otautil: add support for unmounting entire volumes
When wiping /system, the partition isn't actually mounted at /system or / - it's mounted at /mnt/system. This breaks 'format system' from recovery if the partition has been mounted. This patch adds an ensure_volume_unmounted function that finds all mounts of a given device and unmounts them, meaning the device can be safely formatted. Change-Id: Id4f727f845308a89e865f1ba60dc284f5ebc66e1
Diffstat (limited to 'install/wipe_data.cpp')
-rw-r--r--install/wipe_data.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/install/wipe_data.cpp b/install/wipe_data.cpp
index 765a8152..ed672073 100644
--- a/install/wipe_data.cpp
+++ b/install/wipe_data.cpp
@@ -52,7 +52,11 @@ static bool EraseVolume(const char* volume, RecoveryUI* ui, bool convert_fbe) {
ui->Print("Formatting %s...\n", volume);
- ensure_path_unmounted(volume);
+ Volume* vol = volume_for_mount_point(volume);
+ if (ensure_volume_unmounted(vol->blk_device) == -1) {
+ PLOG(ERROR) << "Failed to unmount volume!";
+ return false;
+ }
int result;
if (is_data && convert_fbe) {