bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 1 | /* |
| 2 | ** Copyright 1998-2003 University of Illinois Board of Trustees |
| 3 | ** Copyright 1998-2003 Mark D. Roth |
| 4 | ** All rights reserved. |
| 5 | ** |
| 6 | ** libtar.h - header file for libtar library |
| 7 | ** |
| 8 | ** Mark D. Roth <roth@uiuc.edu> |
| 9 | ** Campus Information Technologies and Educational Services |
| 10 | ** University of Illinois at Urbana-Champaign |
| 11 | */ |
| 12 | |
| 13 | #ifndef LIBTAR_H |
| 14 | #define LIBTAR_H |
| 15 | |
| 16 | #include <sys/types.h> |
| 17 | #include <sys/stat.h> |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 18 | #include <linux/capability.h> |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 19 | #include "tar.h" |
| 20 | |
| 21 | #include "libtar_listhash.h" |
| 22 | |
Ethan Yonker | 79f88bd | 2016-12-09 14:52:12 -0600 | [diff] [blame] | 23 | #ifdef HAVE_EXT4_CRYPT |
| 24 | #define EXT4_KEY_DESCRIPTOR_SIZE 8 |
| 25 | #define EXT4_KEY_DESCRIPTOR_HEX 17 |
| 26 | #endif |
| 27 | |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 28 | #ifdef __cplusplus |
| 29 | extern "C" |
| 30 | { |
| 31 | #endif |
| 32 | |
| 33 | |
| 34 | /* useful constants */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 35 | /* see FIXME note in block.c regarding T_BLOCKSIZE */ |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 36 | #define T_BLOCKSIZE 512 |
| 37 | #define T_NAMELEN 100 |
| 38 | #define T_PREFIXLEN 155 |
| 39 | #define T_MAXPATHLEN (T_NAMELEN + T_PREFIXLEN) |
| 40 | |
| 41 | /* GNU extensions for typeflag */ |
| 42 | #define GNU_LONGNAME_TYPE 'L' |
| 43 | #define GNU_LONGLINK_TYPE 'K' |
| 44 | |
Vojtech Bocek | 25fd68d | 2013-08-27 03:10:10 +0200 | [diff] [blame] | 45 | /* extended metadata for next file - used to store selinux_context */ |
| 46 | #define TH_EXT_TYPE 'x' |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 47 | #define TH_POL_TYPE_DO_NOT_USE 'p' |
Vojtech Bocek | 25fd68d | 2013-08-27 03:10:10 +0200 | [diff] [blame] | 48 | |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 49 | /* our version of the tar header structure */ |
| 50 | struct tar_header |
| 51 | { |
| 52 | char name[100]; |
| 53 | char mode[8]; |
| 54 | char uid[8]; |
| 55 | char gid[8]; |
| 56 | char size[12]; |
| 57 | char mtime[12]; |
| 58 | char chksum[8]; |
| 59 | char typeflag; |
| 60 | char linkname[100]; |
| 61 | char magic[6]; |
| 62 | char version[2]; |
| 63 | char uname[32]; |
| 64 | char gname[32]; |
| 65 | char devmajor[8]; |
| 66 | char devminor[8]; |
| 67 | char prefix[155]; |
| 68 | char padding[12]; |
| 69 | char *gnu_longname; |
| 70 | char *gnu_longlink; |
Vojtech Bocek | 25fd68d | 2013-08-27 03:10:10 +0200 | [diff] [blame] | 71 | char *selinux_context; |
Ethan Yonker | 79f88bd | 2016-12-09 14:52:12 -0600 | [diff] [blame] | 72 | #ifdef HAVE_EXT4_CRYPT |
| 73 | char *e4crypt_policy; |
| 74 | #endif |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 75 | int has_cap_data; |
| 76 | struct vfs_cap_data cap_data; |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | |
| 80 | /***** handle.c ************************************************************/ |
| 81 | |
| 82 | typedef int (*openfunc_t)(const char *, int, ...); |
| 83 | typedef int (*closefunc_t)(int); |
| 84 | typedef ssize_t (*readfunc_t)(int, void *, size_t); |
| 85 | typedef ssize_t (*writefunc_t)(int, const void *, size_t); |
| 86 | |
| 87 | typedef struct |
| 88 | { |
| 89 | openfunc_t openfunc; |
| 90 | closefunc_t closefunc; |
| 91 | readfunc_t readfunc; |
| 92 | writefunc_t writefunc; |
| 93 | } |
| 94 | tartype_t; |
| 95 | |
| 96 | typedef struct |
| 97 | { |
| 98 | tartype_t *type; |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 99 | const char *pathname; |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 100 | long fd; |
| 101 | int oflags; |
| 102 | int options; |
| 103 | struct tar_header th_buf; |
| 104 | libtar_hash_t *h; |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 105 | |
| 106 | /* introduced in libtar 1.2.21 */ |
| 107 | char *th_pathname; |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 108 | } |
| 109 | TAR; |
| 110 | |
| 111 | /* constant values for the TAR options field */ |
| 112 | #define TAR_GNU 1 /* use GNU extensions */ |
| 113 | #define TAR_VERBOSE 2 /* output file info to stdout */ |
| 114 | #define TAR_NOOVERWRITE 4 /* don't overwrite existing files */ |
| 115 | #define TAR_IGNORE_EOT 8 /* ignore double zero blocks as EOF */ |
| 116 | #define TAR_CHECK_MAGIC 16 /* check magic in file header */ |
| 117 | #define TAR_CHECK_VERSION 32 /* check version in file header */ |
| 118 | #define TAR_IGNORE_CRC 64 /* ignore CRC in file header */ |
Vojtech Bocek | 25fd68d | 2013-08-27 03:10:10 +0200 | [diff] [blame] | 119 | #define TAR_STORE_SELINUX 128 /* store selinux context */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 120 | #define TAR_USE_NUMERIC_ID 256 /* favor numeric owner over names */ |
Ethan Yonker | 79f88bd | 2016-12-09 14:52:12 -0600 | [diff] [blame] | 121 | #define TAR_STORE_EXT4_POL 512 /* store ext4 crypto policy */ |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 122 | #define TAR_STORE_POSIX_CAP 1024 /* store posix file capabilities */ |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 123 | |
| 124 | /* this is obsolete - it's here for backwards-compatibility only */ |
| 125 | #define TAR_IGNORE_MAGIC 0 |
| 126 | |
| 127 | extern const char libtar_version[]; |
| 128 | |
| 129 | |
| 130 | /* open a new tarfile handle */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 131 | int tar_open(TAR **t, const char *pathname, tartype_t *type, |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 132 | int oflags, int mode, int options); |
| 133 | |
| 134 | /* make a tarfile handle out of a previously-opened descriptor */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 135 | int tar_fdopen(TAR **t, int fd, const char *pathname, tartype_t *type, |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 136 | int oflags, int mode, int options); |
| 137 | |
| 138 | /* returns the descriptor associated with t */ |
| 139 | int tar_fd(TAR *t); |
| 140 | |
| 141 | /* close tarfile handle */ |
| 142 | int tar_close(TAR *t); |
| 143 | |
| 144 | |
| 145 | /***** append.c ************************************************************/ |
| 146 | |
| 147 | /* forward declaration to appease the compiler */ |
| 148 | struct tar_dev; |
| 149 | |
| 150 | /* cleanup function */ |
| 151 | void tar_dev_free(struct tar_dev *tdp); |
| 152 | |
| 153 | /* Appends a file to the tar archive. |
| 154 | * Arguments: |
| 155 | * t = TAR handle to append to |
| 156 | * realname = path of file to append |
| 157 | * savename = name to save the file under in the archive |
| 158 | */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 159 | int tar_append_file(TAR *t, const char *realname, const char *savename); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 160 | |
| 161 | /* write EOF indicator */ |
| 162 | int tar_append_eof(TAR *t); |
| 163 | |
| 164 | /* add file contents to a tarchive */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 165 | int tar_append_regfile(TAR *t, const char *realname); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 166 | |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 167 | /* Appends in-memory file contents to a tarchive. |
| 168 | * Arguments: |
| 169 | * t = TAR handle to append to |
| 170 | * savename = name to save the file under in the archive |
| 171 | * mode = mode |
| 172 | * uid, gid = owner |
| 173 | * buf, len = in-memory buffer |
| 174 | */ |
| 175 | int tar_append_file_contents(TAR *t, const char *savename, mode_t mode, |
| 176 | uid_t uid, gid_t gid, void *buf, size_t len); |
| 177 | |
| 178 | /* add buffer to a tarchive */ |
| 179 | int tar_append_buffer(TAR *t, void *buf, size_t len); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 180 | |
| 181 | /***** block.c *************************************************************/ |
| 182 | |
| 183 | /* macros for reading/writing tarchive blocks */ |
| 184 | #define tar_block_read(t, buf) \ |
| 185 | (*((t)->type->readfunc))((t)->fd, (char *)(buf), T_BLOCKSIZE) |
| 186 | #define tar_block_write(t, buf) \ |
| 187 | (*((t)->type->writefunc))((t)->fd, (char *)(buf), T_BLOCKSIZE) |
| 188 | |
| 189 | /* read/write a header block */ |
| 190 | int th_read(TAR *t); |
| 191 | int th_write(TAR *t); |
| 192 | |
| 193 | |
| 194 | /***** decode.c ************************************************************/ |
| 195 | |
| 196 | /* determine file type */ |
| 197 | #define TH_ISREG(t) ((t)->th_buf.typeflag == REGTYPE \ |
| 198 | || (t)->th_buf.typeflag == AREGTYPE \ |
| 199 | || (t)->th_buf.typeflag == CONTTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 200 | || (S_ISREG((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode))) \ |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 201 | && (t)->th_buf.typeflag != LNKTYPE)) |
| 202 | #define TH_ISLNK(t) ((t)->th_buf.typeflag == LNKTYPE) |
| 203 | #define TH_ISSYM(t) ((t)->th_buf.typeflag == SYMTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 204 | || S_ISLNK((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode)))) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 205 | #define TH_ISCHR(t) ((t)->th_buf.typeflag == CHRTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 206 | || S_ISCHR((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode)))) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 207 | #define TH_ISBLK(t) ((t)->th_buf.typeflag == BLKTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 208 | || S_ISBLK((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode)))) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 209 | #define TH_ISDIR(t) ((t)->th_buf.typeflag == DIRTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 210 | || S_ISDIR((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode))) \ |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 211 | || ((t)->th_buf.typeflag == AREGTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 212 | && strnlen((t)->th_buf.name, T_NAMELEN) \ |
| 213 | && ((t)->th_buf.name[strnlen((t)->th_buf.name, T_NAMELEN) - 1] == '/'))) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 214 | #define TH_ISFIFO(t) ((t)->th_buf.typeflag == FIFOTYPE \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 215 | || S_ISFIFO((mode_t)oct_to_int((t)->th_buf.mode, sizeof((t)->th_buf.mode)))) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 216 | #define TH_ISLONGNAME(t) ((t)->th_buf.typeflag == GNU_LONGNAME_TYPE) |
| 217 | #define TH_ISLONGLINK(t) ((t)->th_buf.typeflag == GNU_LONGLINK_TYPE) |
Vojtech Bocek | 25fd68d | 2013-08-27 03:10:10 +0200 | [diff] [blame] | 218 | #define TH_ISEXTHEADER(t) ((t)->th_buf.typeflag == TH_EXT_TYPE) |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 219 | #define TH_ISPOLHEADER(t) ((t)->th_buf.typeflag == TH_POL_TYPE_DO_NOT_USE) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 220 | |
| 221 | /* decode tar header info */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 222 | #define th_get_crc(t) oct_to_int((t)->th_buf.chksum, sizeof((t)->th_buf.chksum)) |
| 223 | #define th_get_size(t) oct_to_int_ex((t)->th_buf.size, sizeof((t)->th_buf.size)) |
| 224 | #define th_get_mtime(t) oct_to_int_ex((t)->th_buf.mtime, sizeof((t)->th_buf.mtime)) |
| 225 | #define th_get_devmajor(t) oct_to_int((t)->th_buf.devmajor, sizeof((t)->th_buf.devmajor)) |
| 226 | #define th_get_devminor(t) oct_to_int((t)->th_buf.devminor, sizeof((t)->th_buf.devminor)) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 227 | #define th_get_linkname(t) ((t)->th_buf.gnu_longlink \ |
| 228 | ? (t)->th_buf.gnu_longlink \ |
| 229 | : (t)->th_buf.linkname) |
| 230 | char *th_get_pathname(TAR *t); |
| 231 | mode_t th_get_mode(TAR *t); |
| 232 | uid_t th_get_uid(TAR *t); |
| 233 | gid_t th_get_gid(TAR *t); |
| 234 | |
| 235 | |
| 236 | /***** encode.c ************************************************************/ |
| 237 | |
| 238 | /* encode file info in th_header */ |
| 239 | void th_set_type(TAR *t, mode_t mode); |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 240 | void th_set_path(TAR *t, const char *pathname); |
| 241 | void th_set_link(TAR *t, const char *linkname); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 242 | void th_set_device(TAR *t, dev_t device); |
| 243 | void th_set_user(TAR *t, uid_t uid); |
| 244 | void th_set_group(TAR *t, gid_t gid); |
| 245 | void th_set_mode(TAR *t, mode_t fmode); |
| 246 | #define th_set_mtime(t, fmtime) \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 247 | int_to_oct_ex((fmtime), (t)->th_buf.mtime, sizeof((t)->th_buf.mtime)) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 248 | #define th_set_size(t, fsize) \ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 249 | int_to_oct_ex((fsize), (t)->th_buf.size, sizeof((t)->th_buf.size)) |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 250 | |
| 251 | /* encode everything at once (except the pathname and linkname) */ |
| 252 | void th_set_from_stat(TAR *t, struct stat *s); |
| 253 | |
| 254 | /* encode magic, version, and crc - must be done after everything else is set */ |
| 255 | void th_finish(TAR *t); |
| 256 | |
| 257 | |
| 258 | /***** extract.c ***********************************************************/ |
| 259 | |
| 260 | /* sequentially extract next file from t */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 261 | int tar_extract_file(TAR *t, const char *realname, const char *prefix, const int *progress_fd); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 262 | |
| 263 | /* extract different file types */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 264 | int tar_extract_dir(TAR *t, const char *realname); |
| 265 | int tar_extract_hardlink(TAR *t, const char *realname, const char *prefix); |
| 266 | int tar_extract_symlink(TAR *t, const char *realname); |
| 267 | int tar_extract_chardev(TAR *t, const char *realname); |
| 268 | int tar_extract_blockdev(TAR *t, const char *realname); |
| 269 | int tar_extract_fifo(TAR *t, const char *realname); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 270 | |
| 271 | /* for regfiles, we need to extract the content blocks as well */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 272 | int tar_extract_regfile(TAR *t, const char *realname, const int *progress_fd); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 273 | int tar_skip_regfile(TAR *t); |
| 274 | |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 275 | /* extract regfile to buffer */ |
| 276 | int tar_extract_file_contents(TAR *t, void *buf, size_t *lenp); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 277 | |
| 278 | /***** output.c ************************************************************/ |
| 279 | |
| 280 | /* print the tar header */ |
| 281 | void th_print(TAR *t); |
| 282 | |
| 283 | /* print "ls -l"-like output for the file described by th */ |
| 284 | void th_print_long_ls(TAR *t); |
| 285 | |
| 286 | |
| 287 | /***** util.c *************************************************************/ |
| 288 | |
| 289 | /* hashing function for pathnames */ |
| 290 | int path_hashfunc(char *key, int numbuckets); |
| 291 | |
| 292 | /* matching function for dev_t's */ |
| 293 | int dev_match(dev_t *dev1, dev_t *dev2); |
| 294 | |
| 295 | /* matching function for ino_t's */ |
| 296 | int ino_match(ino_t *ino1, ino_t *ino2); |
| 297 | |
| 298 | /* hashing function for dev_t's */ |
| 299 | int dev_hash(dev_t *dev); |
| 300 | |
| 301 | /* hashing function for ino_t's */ |
| 302 | int ino_hash(ino_t *inode); |
| 303 | |
| 304 | /* create any necessary dirs */ |
| 305 | int mkdirhier(char *path); |
| 306 | |
| 307 | /* calculate header checksum */ |
| 308 | int th_crc_calc(TAR *t); |
| 309 | |
| 310 | /* calculate a signed header checksum */ |
| 311 | int th_signed_crc_calc(TAR *t); |
| 312 | |
| 313 | /* compare checksums in a forgiving way */ |
| 314 | #define th_crc_ok(t) (th_get_crc(t) == th_crc_calc(t) || th_get_crc(t) == th_signed_crc_calc(t)) |
| 315 | |
| 316 | /* string-octal to integer conversion */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 317 | int64_t oct_to_int(char *oct, size_t len); |
| 318 | |
| 319 | /* string-octal or binary to integer conversion */ |
| 320 | int64_t oct_to_int_ex(char *oct, size_t len); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 321 | |
| 322 | /* integer to NULL-terminated string-octal conversion */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 323 | void int_to_oct(int64_t num, char *oct, size_t octlen); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 324 | |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 325 | /* integer to string-octal conversion, or binary as necessary */ |
| 326 | void int_to_oct_ex(int64_t num, char *oct, size_t octlen); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 327 | |
Ethan Yonker | 7118774 | 2017-01-13 13:30:10 -0600 | [diff] [blame] | 328 | /* prints posix file capabilities */ |
| 329 | void print_caps(struct vfs_cap_data *cap_data); |
| 330 | |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 331 | |
| 332 | /***** wrapper.c **********************************************************/ |
| 333 | |
| 334 | /* extract groups of files */ |
| 335 | int tar_extract_glob(TAR *t, char *globname, char *prefix); |
Ethan Yonker | 1b7a31b | 2014-07-03 15:09:22 -0500 | [diff] [blame] | 336 | int tar_extract_all(TAR *t, char *prefix, const int *progress_fd); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 337 | |
| 338 | /* add a whole tree of files */ |
James Christopher Adduono | 6f57f7c | 2016-03-01 16:01:53 -0500 | [diff] [blame] | 339 | int tar_append_tree(TAR *t, char *realdir, char *savedir); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 340 | |
n0d3 | 3b51163 | 2013-03-06 21:14:15 +0200 | [diff] [blame] | 341 | /* find an entry */ |
| 342 | int tar_find(TAR *t, char *searchstr); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 343 | |
| 344 | #ifdef __cplusplus |
| 345 | } |
| 346 | #endif |
| 347 | |
| 348 | #endif /* ! LIBTAR_H */ |
| 349 | |