From a3fa75fd663e1488cdc0017a4fbf66150833b929 Mon Sep 17 00:00:00 2001 From: dhacker29 Date: Sat, 17 Jan 2015 19:42:33 -0500 Subject: 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 --- partition.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/partition.cpp b/partition.cpp index e30e6c11d..065154150 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1642,7 +1642,18 @@ bool TWPartition::Wipe_F2FS() { 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"); -- cgit v1.2.3