vold: Add an optional wipe paramter to the volume format command
The new wipe option to the vold format command will invoke BLKDISCARD
on the partition before invoking newfs_msdos. This will be used whenever
a full wipe of the device is wanted, as this is more secure than just
doing newfs_msdos.
Bug: 9392982
Change-Id: Ie106f1b9cc70abc61206006d1821641c27c7ccae
diff --git a/Volume.cpp b/Volume.cpp
index 4a00ccc..4501e90 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -206,7 +206,7 @@
return 0;
}
-int Volume::formatVol() {
+int Volume::formatVol(bool wipe) {
if (getState() == Volume::State_NoMedia) {
errno = ENODEV;
@@ -250,7 +250,7 @@
SLOGI("Formatting volume %s (%s)", getLabel(), devicePath);
}
- if (Fat::format(devicePath, 0)) {
+ if (Fat::format(devicePath, 0, wipe)) {
SLOGE("Failed to format (%s)", strerror(errno));
goto err;
}