diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-13 17:16:06 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-15 17:43:42 +0200 |
commit | e1a47443ad2ee424b2be9c2d4f2761dfe85ded1a (patch) | |
tree | 1c8aec5af456820f2fa236355ffa2d5ffc31f04e /tar/tar.h | |
parent | 46b30ac7559ca26f5446b05d852eaaefe432a290 (diff) |
Add utility to turn a POSIX/PAX tar archive into a squashfs image
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar.h')
-rw-r--r-- | tar/tar.h | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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 */ |