summaryrefslogtreecommitdiffstats
path: root/partition.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-08-17 15:14:43 +0200
committerGerrit Code Review <gerrit@198.50.184.117>2013-08-24 14:42:30 +0200
commita95f55c3ef657411f92c0c00a2e23ceb1d52b851 (patch)
treeca5c779bea6a16f5e1b397c59de80058fe9b7bb0 /partition.cpp
parentMerge "Fix AOSP decrypt when TouchWiz code is present" into twrp2.5 (diff)
downloadandroid_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.gz
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.bz2
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.lz
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.xz
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.tar.zst
android_bootable_recovery-a95f55c3ef657411f92c0c00a2e23ceb1d52b851.zip
Diffstat (limited to '')
-rw-r--r--partition.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/partition.cpp b/partition.cpp
index f81748d72..dc71bb9a4 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -49,10 +49,15 @@ extern "C" {
#ifdef TW_INCLUDE_CRYPTO_SAMSUNG
#include "crypto/libcrypt_samsung/include/libcrypt_samsung.h"
#endif
+#ifdef USE_EXT4
+ #include "make_ext4fs.h"
+#endif
}
using namespace std;
+extern struct selabel_handle *selinux_handle;
+
TWPartition::TWPartition(void) {
Can_Be_Mounted = false;
Can_Be_Wiped = false;
@@ -1257,6 +1262,19 @@ bool TWPartition::Wipe_EXT4() {
if (!UnMount(true))
return false;
+#ifdef USE_EXT4
+ gui_print("Formatting %s using make_ext4fs function.\n", Display_Name.c_str());
+#ifdef HAVE_SELINUX
+ if (make_ext4fs(Actual_Block_Device.c_str(), Length, Mount_Point.c_str(), selinux_handle) != 0) {
+#else
+ if (make_ext4fs(Actual_Block_Device.c_str(), Length) != 0) {
+#endif
+ LOGERR("Unable to wipe '%s' using function call.\n", Mount_Point.c_str());
+ return false;
+ } else {
+ return true;
+ }
+#else
if (TWFunc::Path_Exists("/sbin/make_ext4fs")) {
string Command, result;
@@ -1283,7 +1301,7 @@ bool TWPartition::Wipe_EXT4() {
}
} else
return Wipe_EXT23("ext4");
-
+#endif
return false;
}