1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef INTERNAL_H
#define INTERNAL_H
#include "config.h"
#include "util.h"
#include "tar.h"
#include <sys/sysmacros.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
enum {
PAX_SIZE = 0x001,
PAX_UID = 0x002,
PAX_GID = 0x004,
PAX_DEV_MAJ = 0x008,
PAX_DEV_MIN = 0x010,
PAX_NAME = 0x020,
PAX_SLINK_TARGET = 0x040,
PAX_MTIME = 0x100,
PAX_SPARSE_SIZE = 0x400,
};
enum {
ETV_UNKNOWN = 0,
ETV_V7_UNIX,
ETV_PRE_POSIX,
ETV_POSIX,
};
#define TAR_MAX_SYMLINK_LEN (65536)
#define TAR_MAX_PATH_LEN (65536)
#define TAR_MAX_PAX_LEN (65536)
int read_octal(const char *str, int digits, uint64_t *out);
int read_binary(const char *str, int digits, uint64_t *out);
int read_number(const char *str, int digits, uint64_t *out);
int pax_read_decimal(const char *str, uint64_t *out);
void update_checksum(tar_header_t *hdr);
bool is_checksum_valid(const tar_header_t *hdr);
sparse_map_t *read_sparse_map(const char *line);
sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr);
void free_sparse_list(sparse_map_t *sparse);
void free_xattr_list(tar_xattr_t *list);
void base64_decode(uint8_t *out, const char *in);
void urldecode(char *str);
#endif /* INTERNAL_H */
|