summaryrefslogtreecommitdiff
path: root/include/tar.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-04 19:26:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-16 09:34:35 +0200
commit0a0cbefc6ebb6174aad3e6f0b8a6dea87aed49da (patch)
tree7b1a69382f7480e442620b6176c1673abcf81b3c /include/tar.h
parent4b994ac359757098ebc09263fff9e2290a58de71 (diff)
Remodel file extraction tools to use libfstream
This commit rewrites the libtar write paths to use libfstream insead of a FILE pointer. Also, the libcommon file extraction function is remodeled to use libfstream. In accordance, rdsquashfs, sqfs2tar and sqfsdiff have some minor adjustments made to work with the ported libtar and libcommon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/tar.h')
-rw-r--r--include/tar.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/include/tar.h b/include/tar.h
index f235d08..38ec656 100644
--- a/include/tar.h
+++ b/include/tar.h
@@ -9,6 +9,7 @@
#include "config.h"
#include "compat.h"
+#include "fstream.h"
#include <stdbool.h>
#include <stdint.h>
@@ -122,11 +123,11 @@ typedef struct {
The counter is an incremental record counter used if additional
headers need to be generated.
*/
-int write_tar_header(FILE *fp, const struct stat *sb, const char *name,
+int write_tar_header(ostream_t *fp, const struct stat *sb, const char *name,
const char *slink_target, const tar_xattr_t *xattr,
unsigned int counter);
-int write_hard_link(FILE *fp, const struct stat *sb, const char *name,
+int write_hard_link(ostream_t *fp, const struct stat *sb, const char *name,
const char *target, unsigned int counter);
/* calcuate and skip the zero padding */
@@ -145,7 +146,7 @@ void clear_header(tar_header_decoded_t *hdr);
Write zero bytes to an output file to padd it to the tar record size.
Returns 0 on success. On failure, prints error message to stderr.
*/
-int padd_file(FILE *fp, sqfs_u64 size);
+int padd_file(ostream_t *fp, sqfs_u64 size);
/*
@@ -156,12 +157,4 @@ int padd_file(FILE *fp, sqfs_u64 size);
*/
int read_retry(const char *errstr, FILE *fp, void *buffer, size_t size);
-/*
- A wrapper around the write() system call. It retries the write if it is
- interrupted by a signal or only part of the data was written. Returns 0
- on success. Writes to stderr on failure using 'errstr' as a perror style
- error prefix.
-*/
-int write_retry(const char *errstr, FILE *fp, const void *data, size_t size);
-
#endif /* TAR_H */