Fix the long broken format function
* For EXT2/3:
* Align mke2fs options with Android 9.0 fs_mgr_format.cpp.
* For EXT4:
* Note that make_ext4fs is still in use on Android 8.1 to workaround
a FDE encryption bug even though mke2fs has become the default
choice. The bug is fixed in Android 9.0+.
* For F2FS:
* Drop the broken "-r" option, it's never ported to O, explicitly
pass number of sectors instead.
* Keep all options aligned with Pie fs_mgr.
* Check existence before start wiping, as Wipe_EXT4 does.
* For all:
* Calculate block size at runtime, and reserve the space specified
via negative "length" option from fstab. Note that positive length
will be ignored.
* If the partition has crypto footer, and "length" is not specified
in fstab, automatically reverse CRYPT_FOOTER_OFFSET (16384).
* Remove the default crypto key location: footer, this is a bad
assumption since most partitions don't use encryption! We need to
know the real situation to decide whether to reserve crypto footer
on format.
* If the current action is "wipe" or "change filesystem", wipe crypto
footer or block device after mkfs if the partition is
unencrypted or undecrypted (e.g., wrong password).
* If the current action is "format data", unconditionally wipe crypto
footer or block device.
Change-Id: I7304a8ee703131ea4a08ab7c60334af28cac28b3
diff --git a/partitions.hpp b/partitions.hpp
index a8fd70b..c124457 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -181,7 +181,7 @@
unsigned long long IOCTL_Get_Block_Size(); // Finds the partition size using ioctl
bool Find_Partition_Size(); // Finds the partition size from /proc/partitions
unsigned long long Get_Size_Via_du(string Path, bool Display_Error); // Uses du to get sizes
- bool Wipe_EXT23(string File_System); // Formats as ext3 or ext2
+ bool Wipe_EXTFS(string File_System); // Create an ext2/ext3/ext4 filesystem
bool Wipe_EXT4(); // Formats using ext4, uses make_ext4fs when present
bool Wipe_FAT(); // Formats as FAT if mkfs.fat exits otherwise rm -rf wipe
bool Wipe_EXFAT(); // Formats as EXFAT
@@ -191,6 +191,7 @@
bool Wipe_NTFS(); // Uses mkntfs to wipe
bool Wipe_Data_Without_Wiping_Media(); // Uses rm -rf to wipe but does not wipe /data/media
bool Wipe_Data_Without_Wiping_Media_Func(const string& parent); // Uses rm -rf to wipe but does not wipe /data/media
+ void Wipe_Crypto_Key(); // Wipe crypto key from either footer or block device
bool Backup_Tar(PartitionSettings *part_settings, pid_t *tar_fork_pid); // Backs up using tar for file systems
bool Backup_Image(PartitionSettings *part_settings); // Backs up using raw read/write for emmc memory types
bool Raw_Read_Write(PartitionSettings *part_settings);