Allow wiping f2fs to reserve space for a crypto footer
We will convert a -16384 to 16384 if needed because mkfs.f2fs
does not like negative numbers like make_ext4fs does. Also enable
trim by default on f2fs.
Change-Id: I8b41e65d1ff894433665c65d0569a51803c67891
diff --git a/partition.cpp b/partition.cpp
index e30e6c1..0651541 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1642,7 +1642,18 @@
gui_print("Formatting %s using mkfs.f2fs...\n", Display_Name.c_str());
Find_Actual_Block_Device();
- command = "mkfs.f2fs " + Actual_Block_Device;
+ command = "mkfs.f2fs -t 1";
+ if (!Is_Decrypted && Length != 0) {
+ // Only use length if we're not decrypted
+ char len[32];
+ int mod_length = Length;
+ if (Length < 0)
+ mod_length *= -1;
+ sprintf(len, "%i", mod_length);
+ command += " -r ";
+ command += len;
+ }
+ command += " " + Actual_Block_Device;
if (TWFunc::Exec_Cmd(command) == 0) {
Recreate_AndSec_Folder();
gui_print("Done.\n");