Make it backwards compatible with 4.4

Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
diff --git a/twrpTar.cpp b/twrpTar.cpp
index dcbb282..d192f2c 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -21,7 +21,6 @@
 	#include "libtar/libtar.h"
 	#include "twrpTar.h"
 	#include "tarWrite.h"
-	#include "set_metadata.h"
 }
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -51,9 +50,7 @@
 #ifndef BUILD_TWRPTAR_MAIN
 #include "data.hpp"
 #include "infomanager.hpp"
-extern "C" {
-	#include "set_metadata.h"
-}
+#include "set_metadata.h"
 #endif //ndef BUILD_TWRPTAR_MAIN
 
 using namespace std;
@@ -69,6 +66,9 @@
 	Total_Backup_Size = 0;
 	Archive_Current_Size = 0;
 	include_root_dir = true;
+	tar_type.openfunc = open;
+	tar_type.closefunc = close;
+	tar_type.readfunc = read;
 }
 
 twrpTar::~twrpTar(void) {
@@ -961,7 +961,7 @@
 				close(pipes[3]);
 				fd = pipes[1];
 				init_libtar_no_buffer(progress_pipe_fd);
-				tar_type = { open, close, read, write_tar_no_buffer };
+				tar_type.writefunc = write_tar_no_buffer;
 				if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) {
 					close(fd);
 					LOGINFO("tar_fdopen failed\n");
@@ -1021,7 +1021,7 @@
 			close(pigzfd[0]); // close parent input
 			fd = pigzfd[1];   // copy parent output
 			init_libtar_no_buffer(progress_pipe_fd);
-			tar_type = { open, close, read, write_tar_no_buffer };
+			tar_type.writefunc = write_tar_no_buffer;
 			if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) {
 				close(fd);
 				LOGINFO("tar_fdopen failed\n");
@@ -1071,7 +1071,7 @@
 			close(oaesfd[0]); // close parent input
 			fd = oaesfd[1];   // copy parent output
 			init_libtar_no_buffer(progress_pipe_fd);
-			tar_type = { open, close, read, write_tar_no_buffer };
+			tar_type.writefunc = write_tar_no_buffer;
 			if(tar_fdopen(&t, fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) {
 				close(fd);
 				LOGINFO("tar_fdopen failed\n");
@@ -1083,10 +1083,9 @@
 	} else {
 		// Not compressed or encrypted
 		init_libtar_buffer(0, progress_pipe_fd);
-		tar_type = { open, close, read, write_tar };
 		if (part_settings->adbbackup) {
 			LOGINFO("Opening TW_ADB_BACKUP uncompressed stream\n");
-			tar_type = { open, close, read, write_tar_no_buffer };
+			tar_type.writefunc = write_tar_no_buffer;
 			output_fd = open(TW_ADB_BACKUP, O_WRONLY);
 			if(tar_fdopen(&t, output_fd, charRootDir, &tar_type, O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) != 0) {
 				close(output_fd);
@@ -1095,6 +1094,7 @@
 			}
 		}
 		else {
+			tar_type.writefunc = write_tar;
 			if (tar_open(&t, charTarFile, &tar_type, O_WRONLY | O_CREAT | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, TAR_GNU | TAR_STORE_SELINUX) == -1) {
 				LOGERR("tar_open error opening '%s'\n", tarfn.c_str());
 				gui_err("backup_error=Error creating backup.");