Track backup and restore progress
Track backup and restore progress based on the sizes of the files
as they are being added to the tar backup file. Update the
progress bar based on the sizes of the files.
Change-Id: Idf649efa1db3e91830b4b2add86203a3f30042ff
diff --git a/libtar/wrapper.c b/libtar/wrapper.c
index 708c845..82f045f 100644
--- a/libtar/wrapper.c
+++ b/libtar/wrapper.c
@@ -27,7 +27,7 @@
{
char *filename;
char buf[MAXPATHLEN];
- int i;
+ int i, fd = 0;
while ((i = th_read(t)) == 0)
{
@@ -44,7 +44,7 @@
snprintf(buf, sizeof(buf), "%s/%s", prefix, filename);
else
strlcpy(buf, filename, sizeof(buf));
- if (tar_extract_file(t, filename, prefix) != 0)
+ if (tar_extract_file(t, filename, prefix, &fd) != 0)
return -1;
}
@@ -53,7 +53,7 @@
int
-tar_extract_all(TAR *t, char *prefix)
+tar_extract_all(TAR *t, char *prefix, const int *progress_fd)
{
char *filename;
char buf[MAXPATHLEN];
@@ -80,7 +80,7 @@
"\"%s\")\n", buf);
#endif
printf("item name: '%s'\n", filename);
- if (tar_extract_file(t, buf, prefix) != 0)
+ if (tar_extract_file(t, buf, prefix, progress_fd) != 0)
return -1;
}
return (i == 1 ? 0 : -1);