Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3fa75fd authored by dhacker29's avatar dhacker29 Committed by Ethan Yonker
Browse files

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
parent 1b03920c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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");