summaryrefslogtreecommitdiff
path: root/tar/tar.h
diff options
context:
space:
mode:
Diffstat (limited to 'tar/tar.h')
-rw-r--r--tar/tar.h22
1 files changed, 22 insertions, 0 deletions
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 */