diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bb_archive.h | 56 | ||||
-rw-r--r-- | include/libbb.h | 14 |
2 files changed, 34 insertions, 36 deletions
diff --git a/include/bb_archive.h b/include/bb_archive.h index 4987de6cf..bd08115da 100644 --- a/include/bb_archive.h +++ b/include/bb_archive.h | |||
@@ -156,12 +156,6 @@ struct BUG_tar_header { | |||
156 | 156 | ||
157 | 157 | ||
158 | 158 | ||
159 | /* Info struct unpackers can fill out to inform users of thing like | ||
160 | * timestamps of unpacked files */ | ||
161 | typedef struct unpack_info_t { | ||
162 | time_t mtime; | ||
163 | } unpack_info_t; | ||
164 | |||
165 | archive_handle_t *init_handle(void) FAST_FUNC; | 159 | archive_handle_t *init_handle(void) FAST_FUNC; |
166 | 160 | ||
167 | char filter_accept_all(archive_handle_t *archive_handle) FAST_FUNC; | 161 | char filter_accept_all(archive_handle_t *archive_handle) FAST_FUNC; |
@@ -204,40 +198,46 @@ int start_bunzip(bunzip_data **bdp, int in_fd, const void *inbuf, int len) FAST_ | |||
204 | int read_bunzip(bunzip_data *bd, char *outbuf, int len) FAST_FUNC; | 198 | int read_bunzip(bunzip_data *bd, char *outbuf, int len) FAST_FUNC; |
205 | void dealloc_bunzip(bunzip_data *bd) FAST_FUNC; | 199 | void dealloc_bunzip(bunzip_data *bd) FAST_FUNC; |
206 | 200 | ||
207 | typedef struct inflate_unzip_result { | 201 | /* Meaning and direction (input/output) of the fields are transformer-specific */ |
208 | off_t bytes_out; | 202 | typedef struct transformer_aux_data_t { |
209 | uint32_t crc; | 203 | smallint check_signature; /* most often referenced member */ |
210 | } inflate_unzip_result; | 204 | off_t bytes_out; |
211 | 205 | off_t bytes_in; /* used in unzip code only: needs to know packed size */ | |
212 | IF_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; | 206 | uint32_t crc32; |
213 | /* xz unpacker takes .xz stream from offset 6 */ | 207 | time_t mtime; /* gunzip code may set this on exit */ |
214 | IF_DESKTOP(long long) int unpack_xz_stream(int src_fd, int dst_fd) FAST_FUNC; | 208 | } transformer_aux_data_t; |
215 | /* lzma unpacker takes .lzma stream from offset 0 */ | 209 | |
216 | IF_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC; | 210 | void init_transformer_aux_data(transformer_aux_data_t *aux) FAST_FUNC; |
217 | /* the rest wants 2 first bytes already skipped by the caller */ | 211 | int FAST_FUNC check_signature16(transformer_aux_data_t *aux, int src_fd, unsigned magic16) FAST_FUNC; |
218 | IF_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC; | 212 | |
219 | IF_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC; | 213 | IF_DESKTOP(long long) int inflate_unzip(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; |
220 | IF_DESKTOP(long long) int unpack_gz_stream_with_info(int src_fd, int dst_fd, unpack_info_t *info) FAST_FUNC; | 214 | IF_DESKTOP(long long) int unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; |
221 | IF_DESKTOP(long long) int unpack_Z_stream(int src_fd, int dst_fd) FAST_FUNC; | 215 | IF_DESKTOP(long long) int unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; |
222 | /* wrapper which checks first two bytes to be "BZ" */ | 216 | IF_DESKTOP(long long) int unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; |
223 | IF_DESKTOP(long long) int unpack_bz2_stream_prime(int src_fd, int dst_fd) FAST_FUNC; | 217 | IF_DESKTOP(long long) int unpack_lzma_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; |
218 | IF_DESKTOP(long long) int unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) FAST_FUNC; | ||
224 | 219 | ||
225 | char* append_ext(char *filename, const char *expected_ext) FAST_FUNC; | 220 | char* append_ext(char *filename, const char *expected_ext) FAST_FUNC; |
226 | int bbunpack(char **argv, | 221 | int bbunpack(char **argv, |
227 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(unpack_info_t *info), | 222 | IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux), |
228 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), | 223 | char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), |
229 | const char *expected_ext | 224 | const char *expected_ext |
230 | ) FAST_FUNC; | 225 | ) FAST_FUNC; |
231 | 226 | ||
232 | #if BB_MMU | 227 | #if BB_MMU |
233 | void open_transformer(int fd, | 228 | void open_transformer(int fd, |
234 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC; | 229 | int check_signature, |
235 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transformer) | 230 | IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd) |
231 | ) FAST_FUNC; | ||
232 | #define open_transformer_with_sig(fd, transformer, transform_prog) open_transformer((fd), 1, (transformer)) | ||
233 | #define open_transformer_with_no_sig(fd, transformer) open_transformer((fd), 0, (transformer)) | ||
236 | #else | 234 | #else |
237 | void open_transformer(int src_fd, const char *transform_prog) FAST_FUNC; | 235 | void open_transformer(int fd, const char *transform_prog) FAST_FUNC; |
238 | #define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transform_prog) | 236 | #define open_transformer_with_sig(fd, transformer, transform_prog) open_transformer((fd), (transform_prog)) |
237 | /* open_transformer_with_no_sig() does not exist on NOMMU */ | ||
239 | #endif | 238 | #endif |
240 | 239 | ||
240 | |||
241 | POP_SAVED_FUNCTION_VISIBILITY | 241 | POP_SAVED_FUNCTION_VISIBILITY |
242 | 242 | ||
243 | #endif | 243 | #endif |
diff --git a/include/libbb.h b/include/libbb.h index c896e5484..2cc146631 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -721,17 +721,15 @@ extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAS | |||
721 | || ENABLE_FEATURE_SEAMLESS_GZ \ | 721 | || ENABLE_FEATURE_SEAMLESS_GZ \ |
722 | || ENABLE_FEATURE_SEAMLESS_Z) | 722 | || ENABLE_FEATURE_SEAMLESS_Z) |
723 | 723 | ||
724 | #if SEAMLESS_COMPRESSION | ||
724 | /* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */ | 725 | /* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */ |
725 | #if ENABLE_FEATURE_SEAMLESS_LZMA \ | 726 | extern int setup_unzip_on_fd(int fd, int fail_if_not_detected) FAST_FUNC; |
726 | || ENABLE_FEATURE_SEAMLESS_BZ2 \ | ||
727 | || ENABLE_FEATURE_SEAMLESS_GZ \ | ||
728 | /* || ENABLE_FEATURE_SEAMLESS_Z */ | ||
729 | extern void setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/) FAST_FUNC; | ||
730 | #else | ||
731 | # define setup_unzip_on_fd(...) ((void)0) | ||
732 | #endif | ||
733 | /* Autodetects .gz etc */ | 727 | /* Autodetects .gz etc */ |
734 | extern int open_zipped(const char *fname) FAST_FUNC; | 728 | extern int open_zipped(const char *fname) FAST_FUNC; |
729 | #else | ||
730 | # define setup_unzip_on_fd(...) (0) | ||
731 | # define open_zipped(fname) open((fname), O_RDONLY); | ||
732 | #endif | ||
735 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 733 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
736 | 734 | ||
737 | extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC; | 735 | extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC; |