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/VolumeManager.cpp b/VolumeManager.cpp
index a1930d1..180387c 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -167,7 +167,7 @@
return 0;
}
-int VolumeManager::formatVolume(const char *label) {
+int VolumeManager::formatVolume(const char *label, bool wipe) {
Volume *v = lookupVolume(label);
if (!v) {
@@ -180,7 +180,7 @@
return -1;
}
- return v->formatVol();
+ return v->formatVol(wipe);
}
int VolumeManager::getObbMountPath(const char *sourceFile, char *mountPath, int mountPathLen) {
@@ -414,7 +414,7 @@
if (usingExt4) {
formatStatus = Ext4::format(dmDevice, mountPoint);
} else {
- formatStatus = Fat::format(dmDevice, numImgSectors);
+ formatStatus = Fat::format(dmDevice, numImgSectors, 0);
}
if (formatStatus < 0) {