From 3bf2b0e63052bb5537398f38ecc5b19fec7dec39 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Mon, 21 Jan 2013 21:26:43 -0500 Subject: change tar create to pthread Change-Id: I5a33d207ec6683de20da37e6f4f174c67785fc52 --- partition.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'partition.cpp') diff --git a/partition.cpp b/partition.cpp index d16ed7c74..c532fa830 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1255,7 +1255,7 @@ bool TWPartition::Backup_Tar(string backup_folder) { unsigned long long total_bsize = 0, file_size; twrpTar tar; vector files; - + if (!Mount(true)) return false; @@ -1276,7 +1276,9 @@ bool TWPartition::Backup_Tar(string backup_folder) { // This backup needs to be split into multiple archives ui_print("Breaking backup file into multiple archives...\n"); sprintf(back_name, "%s", Backup_Path.c_str()); - backup_count = tar.Split_Archive(back_name, Full_FileName); + tar.setdir(back_name); + tar.setfn(Full_FileName); + backup_count = tar.splitArchiveThread(); if (backup_count == -1) { LOGE("Error tarring split files!\n"); return false; @@ -1285,14 +1287,18 @@ bool TWPartition::Backup_Tar(string backup_folder) { } else { Full_FileName = backup_folder + "/" + Backup_FileName; if (use_compression) { - if (tar.createTGZ(Backup_Path, Full_FileName) != 0) - return false; + tar.setdir(Backup_Path); + tar.setfn(Full_FileName); + if (tar.createTarGZThread() != 0) + return -1; string gzname = Full_FileName + ".gz"; rename(gzname.c_str(), Full_FileName.c_str()); } else { - if (tar.create(Backup_Path, Full_FileName) != 0) - return false; + tar.setdir(Backup_Path); + tar.setfn(Full_FileName); + if (tar.createTarThread() != 0) + return -1; } if (TWFunc::Get_File_Size(Full_FileName) == 0) { LOGE("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str()); @@ -1381,7 +1387,9 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System) ui_print("Restoring archive %i...\n", index); LOGI("Restoring '%s'...\n", Full_FileName.c_str()); twrpTar tar; - if (tar.extract("/", Full_FileName) != 0) + tar.setdir("/"); + tar.setfn(Full_FileName); + if (tar.extractTarThread() != 0) return false; sprintf(split_index, "%03i", index); Full_FileName = restore_folder + "/" + Backup_FileName + split_index; @@ -1393,7 +1401,9 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System) } } else { twrpTar tar; - if (tar.extract(Backup_Path, Full_FileName) != 0) + tar.setdir(Backup_Path); + tar.setfn(Full_FileName); + if (tar.extractTarThread() != 0) return false; } return true; -- cgit v1.2.3