Files
android_bootable_recovery/twrpTar.hpp
T
Ethan Yonker c798c9cd24 Merge up to AOSP marshmallow-release
In order to maintain compatibility with older trees, we now have
minadbd.old and minui.old. I had to use a TARGET_GLOBAL_CFLAG to
handle ifdef issues in minui/minui.d because healthd includes
minui/minui.h and there was no other alternative to make minui.h
compatible with older trees without having to modify healthd rules
which is outside of TWRP.

Note that the new minui does not currently have support for qcom
overlay graphics. Support for this graphics mode will likely be
added in a later patch set. If you are building in a 6.0 tree and
have a device that needs qcom overlay graphics, be warned, as off
mode charging may not work properly. A dead battery in this case
could potentially brick your device if it is unable to charge as
healthd handles charging duties.

Update rules for building toolbox and add rules for making toybox

Use permissive.sh in init.rc which will follow symlinks so we do
not have to worry about what binary is supplying the setenforce
functionality (toolbox, toybox, or busybox).

Fix a few warnings in the main recovery binary source code.

Fix a few includes that were missing that prevented compiling in
6.0

Change-Id: Ia67aa2107d260883da5e365475a19bea538e8b97
2015-10-09 11:15:29 -05:00

103 lines
2.8 KiB
C++

/*
Copyright 2012 bigbiff/Dees_Troy TeamWin
This file is part of TWRP/TeamWin Recovery Project.
TWRP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TWRP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TWRP. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C" {
#include "libtar/libtar.h"
}
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <fstream>
#include <string>
#include <vector>
#include "twrpDU.hpp"
using namespace std;
struct TarListStruct {
std::string fn;
unsigned thread_id;
};
struct thread_data_struct {
std::vector<TarListStruct> *TarList;
unsigned thread_id;
};
class twrpTar {
public:
twrpTar();
virtual ~twrpTar();
int createTarFork(const unsigned long long *overall_size, const unsigned long long *other_backups_size, pid_t &fork_pid);
int extractTarFork(const unsigned long long *overall_size, unsigned long long *other_backups_size);
void setfn(string fn);
void setdir(string dir);
void setsize(unsigned long long backup_size);
void setpassword(string pass);
unsigned long long get_size();
public:
int use_encryption;
int userdata_encryption;
int use_compression;
int split_archives;
int has_data_media;
string backup_name;
int progress_pipe_fd;
string partition_name;
string backup_folder;
private:
int extract();
int addFilesToExistingTar(vector <string> files, string tarFile);
int createTar();
int addFile(string fn, bool include_root);
int entryExists(string entry);
int closeTar();
int removeEOT(string tarFile);
int extractTar();
string Strip_Root_Dir(string Path);
int openTar();
int Generate_TarList(string Path, std::vector<TarListStruct> *TarList, unsigned long long *Target_Size, unsigned *thread_id);
static void* createList(void *cookie);
static void* extractMulti(void *cookie);
int tarList(std::vector<TarListStruct> *TarList, unsigned thread_id);
unsigned long long uncompressedSize(string filename, int *archive_type);
static void Signal_Kill(int signum);
int Archive_Current_Type;
unsigned long long Archive_Current_Size;
unsigned long long Total_Backup_Size;
bool include_root_dir;
TAR *t;
int fd;
pid_t pigz_pid;
pid_t oaes_pid;
unsigned long long file_count;
string tardir;
string tarfn;
string basefn;
string password;
std::vector<TarListStruct> *ItemList;
unsigned thread_id;
};