From 70dcf39f5926a66d76eb9fde2cbaef4b6a23a9e1 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 3 Jul 2019 15:08:15 +0200 Subject: tar writer: replace PAX headers with GNU extensions Some experiments seem to indicate that the various GNU extensions are more widely supported than their POSIX equivalents[1]. Possibly because they are easier to implement and possibly because of the wide spread use of GNU tar. This commit replaces the PAX writer in the write_tar_header implementation with a GNU extension based writer. The writer is also cleaned up by removing all global state. The record counter is moved outside into the tar2sqfs program and passed in as function argument. [1] https://dev.gentoo.org/~mgorny/articles/portability-of-tar-features.html Signed-off-by: David Oberhollenzer --- include/tar.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/tar.h b/include/tar.h index ef4fdec..fd701d9 100644 --- a/include/tar.h +++ b/include/tar.h @@ -89,9 +89,12 @@ typedef struct { /* Returns < 0 on failure, > 0 if cannot encode, 0 on success. Prints error/warning messages to stderr. + + The counter is an incremental record counter used if additional + headers need to be generated. */ int write_tar_header(int fd, const struct stat *sb, const char *name, - const char *slink_target); + const char *slink_target, unsigned int counter); /* calcuate and skip the zero padding */ int skip_padding(int fd, uint64_t size); -- cgit v1.2.3