summaryrefslogtreecommitdiff
path: root/tar/tar.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-19 15:04:17 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-19 15:18:01 +0200
commit2f172ede7115d0a2730a3b689131042ba559e272 (patch)
tree4b25a22ac49eefd2eb7a5df557a2b716b90e6076 /tar/tar.h
parent0135734e41046c051a018d6c5d97e1b6ea7638b5 (diff)
Split generic tar code off to static library
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar.h')
-rw-r--r--tar/tar.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/tar/tar.h b/tar/tar.h
deleted file mode 100644
index 7862235..0000000
--- a/tar/tar.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-#ifndef TAR_H
-#define TAR_H
-
-#include <sys/stat.h>
-#include <stdbool.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;
-
-typedef struct {
- struct stat sb;
- 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'
-#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 struct stat *sb, const char *name,
- const char *slink_target);
-
-/* 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 */