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 #if defined(HAVE_ZLIB) 11 #include <zlib.h> 12 #endif 13 #include <sys/stat.h> 14 15 #include "internal.h" 16 17 struct erofs_pax_header { 18 struct stat st; 19 struct list_head xattrs; 20 bool use_mtime; 21 bool use_size; 22 bool use_uid; 23 bool use_gid; 24 char *path, *link; 25 }; 26 27 #define EROFS_IOS_DECODER_NONE 0 28 #define EROFS_IOS_DECODER_GZIP 1 29 30 struct erofs_iostream { 31 union { 32 int fd; /* original fd */ 33 void *handler; 34 }; 35 u64 sz; 36 char *buffer; 37 unsigned int head, tail, bufsize; 38 int decoder; 39 bool feof; 40 }; 41 42 struct erofs_tarfile { 43 struct erofs_pax_header global; 44 struct erofs_iostream ios; 45 char *mapfile; 46 47 int fd; 48 u64 offset; 49 bool index_mode, aufs; 50 }; 51 52 void erofs_iostream_close(struct erofs_iostream *ios); 53 int erofs_iostream_open(struct erofs_iostream *ios, int fd, int decoder); 54 int tarerofs_parse_tar(struct erofs_inode *root, struct erofs_tarfile *tar); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif 61