From e1a47443ad2ee424b2be9c2d4f2761dfe85ded1a Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 13 Jun 2019 17:16:06 +0200 Subject: Add utility to turn a POSIX/PAX tar archive into a squashfs image Signed-off-by: David Oberhollenzer --- tar/tar.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tar/tar.h') diff --git a/tar/tar.h b/tar/tar.h index 62c612a..11af6ee 100644 --- a/tar/tar.h +++ b/tar/tar.h @@ -24,6 +24,18 @@ typedef struct { char padding[12]; } tar_header_t; +typedef struct { + uint64_t size; + uint64_t mode; + uint64_t uid; + uint64_t gid; + uint64_t dev_maj; + uint64_t dev_min; + char *name; + char *link_target; + bool unknown_record; +} tar_header_decoded_t; + #define TAR_TYPE_FILE '0' #define TAR_TYPE_LINK '1' #define TAR_TYPE_SLINK '2' @@ -44,4 +56,14 @@ typedef struct { int write_tar_header(int fd, const fstree_t *fs, const tree_node_t *n, const char *name); +/* calcuate and skip the zero padding */ +int skip_padding(int fd, uint64_t size); + +/* round up to block size and skip the entire entry */ +int skip_entry(int fd, uint64_t size); + +int read_header(int fd, tar_header_decoded_t *out); + +void clear_header(tar_header_decoded_t *hdr); + #endif /* TAR_H */ -- cgit v1.2.3