diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-12 17:11:08 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-15 15:44:30 +0200 |
commit | e2f9334cd84ff8dd4c65c850825e089a6c747601 (patch) | |
tree | 567e17e2bae6d02f6828f47daf2764fc4bc2bd1a /tar/tar.h | |
parent | 5d609f7d539d8e277972c0337630b375f55d81c4 (diff) |
Add utility to turn a squashfs image into a POSIX tar archvie
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar.h')
-rw-r--r-- | tar/tar.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tar/tar.h b/tar/tar.h new file mode 100644 index 0000000..62c612a --- /dev/null +++ b/tar/tar.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +#ifndef TAR_H +#define TAR_H + +#include "fstree.h" + +typedef struct { + char name[100]; + char mode[8]; + char uid[8]; + char gid[8]; + char size[12]; + char mtime[12]; + char chksum[8]; + char typeflag; + char linkname[100]; + char magic[6]; + char version[2]; + char uname[32]; + char gname[32]; + char devmajor[8]; + char devminor[8]; + char prefix[155]; + char padding[12]; +} tar_header_t; + +#define TAR_TYPE_FILE '0' +#define TAR_TYPE_LINK '1' +#define TAR_TYPE_SLINK '2' +#define TAR_TYPE_CHARDEV '3' +#define TAR_TYPE_BLOCKDEV '4' +#define TAR_TYPE_DIR '5' +#define TAR_TYPE_FIFO '6' + +#define TAR_TYPE_PAX 'x' + +#define TAR_MAGIC "ustar" +#define TAR_VERSION "00" + +/* + Returns < 0 on failure, > 0 if cannot encode, 0 on success. + Prints error/warning messages to stderr. +*/ +int write_tar_header(int fd, const fstree_t *fs, const tree_node_t *n, + const char *name); + +#endif /* TAR_H */ |