1 /* SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0 */ 2 #ifndef __EROFS_TAR_H 3 #define __EROFS_TAR_H 4 5 #ifdef __cplusplus 6 extern "C" 7 { 8 #endif 9 10 #include <sys/stat.h> 11 12 #include "internal.h" 13 14 struct erofs_pax_header { 15 struct stat st; 16 struct list_head xattrs; 17 bool use_mtime; 18 bool use_size; 19 bool use_uid; 20 bool use_gid; 21 char *path, *link; 22 }; 23 24 #define EROFS_IOS_DECODER_NONE 0 25 #define EROFS_IOS_DECODER_GZIP 1 26 #define EROFS_IOS_DECODER_LIBLZMA 2 27 28 struct erofs_iostream_liblzma; 29 30 struct erofs_iostream { 31 union { 32 struct erofs_vfile vf; 33 void *handler; 34 #ifdef HAVE_LIBLZMA 35 struct erofs_iostream_liblzma *lzma; 36 #endif 37 }; 38 u64 sz; 39 char *buffer; 40 unsigned int head, tail, bufsize; 41 int decoder, dumpfd; 42 bool feof; 43 }; 44 45 struct erofs_tarfile { 46 struct erofs_pax_header global; 47 struct erofs_iostream ios; 48 char *mapfile, *dumpfile; 49 50 u32 dev; 51 int fd; 52 u64 offset; 53 bool index_mode, headeronly_mode, rvsp_mode, aufs; 54 bool ddtaridx_mode; 55 bool try_no_reorder; 56 }; 57 58 void erofs_iostream_close(struct erofs_iostream *ios); 59 int erofs_iostream_open(struct erofs_iostream *ios, int fd, int decoder); 60 int tarerofs_parse_tar(struct erofs_inode *root, struct erofs_tarfile *tar); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif 67