From 83bd483f3db1df4b69c1612030e1a1be05b303ad Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Sat, 4 May 2013 12:39:56 +0000 Subject: Support encrypted backup files Also includes features merged from: Update twrpTar by kokotas Revised function entryExists(). Added function to get archive's uncompressed size. Added option to exclude item(s) from the archive. Revised forks() http://review.teamw.in/#/c/590/ Change-Id: I01fa2c81643161984eff2625247af75990684bd9 --- twrpTar.hpp | 63 ++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 17 deletions(-) (limited to 'twrpTar.hpp') diff --git a/twrpTar.hpp b/twrpTar.hpp index 3ee6028a5..e270d90d9 100644 --- a/twrpTar.hpp +++ b/twrpTar.hpp @@ -30,24 +30,43 @@ extern "C" { using namespace std; +struct TarListStruct { + std::string fn; + unsigned thread_id; +}; + +struct thread_data_struct { + std::vector *TarList; + unsigned thread_id; +}; + class twrpTar { public: - int extract(); - int compress(string fn); - int uncompress(string fn); - int addFilesToExistingTar(vector files, string tarFile); - int createTar(); - int addFile(string fn, bool include_root); - int entryExists(string entry); - int closeTar(bool gzip); - int createTarGZFork(); + twrpTar(); + virtual ~twrpTar(); int createTarFork(); int extractTarFork(); int splitArchiveFork(); - void setfn(string fn); - void setdir(string dir); + void setexcl(string exclude); + void setfn(string fn); + void setdir(string dir); + unsigned long long uncompressedSize(); + + public: + int use_encryption; + int userdata_encryption; + int use_compression; + int split_archives; + int has_data_media; + string backup_name; + private: - int createTGZ(); + int extract(); + int addFilesToExistingTar(vector files, string tarFile); + int createTar(); + int addFile(string fn, bool include_root); + int entryExists(string entry); + int closeTar(); int create(); int Split_Archive(); int removeEOT(string tarFile); @@ -55,16 +74,26 @@ class twrpTar { int tarDirs(bool include_root); int Generate_Multiple_Archives(string Path); string Strip_Root_Dir(string Path); - int extractTGZ(); - int openTar(bool gzip); - int has_data_media; + int openTar(); int Archive_File_Count; + int Archive_Current_Type; unsigned long long Archive_Current_Size; - int getArchiveType(); // 1 for compressed - 0 for uncompressed TAR *t; - FILE* p; int fd; + pid_t pigz_pid; + pid_t oaes_pid; + string tardir; string tarfn; string basefn; + string tarexclude; + + vector split; + + int Generate_TarList(string Path, std::vector *TarList, unsigned long long *Target_Size, unsigned *thread_id); + static void* createList(void *cookie); + static void* extractMulti(void *cookie); + int tarList(bool include_root, std::vector *TarList, unsigned thread_id); + std::vector *ItemList; + int thread_id; }; -- cgit v1.2.3