2010-03-29 01:07:08 +02:00
|
|
|
/*
|
2011-02-20 13:04:44 +01:00
|
|
|
Copyright (C) 2006-2011 Con Kolivas
|
2011-02-21 06:11:59 +01:00
|
|
|
Copyright (C) 2011 Peter Hyman
|
2010-12-15 23:45:21 +01:00
|
|
|
Copyright (C) 1998 Andrew Tridgell
|
2010-03-29 01:07:08 +02:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2010-12-15 23:45:21 +01:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-03-29 01:07:08 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-03-08 22:32:14 +01:00
|
|
|
#ifndef RZIP_H
|
|
|
|
|
#define RZIP_H
|
|
|
|
|
#include "lrzip.h" /* includes config.h */
|
|
|
|
|
#include "liblrzip.h"
|
2011-02-17 23:09:40 +01:00
|
|
|
#include "md5.h"
|
2010-03-29 01:07:08 +02:00
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <signal.h>
|
2010-11-03 03:14:46 +01:00
|
|
|
#include <bzlib.h>
|
|
|
|
|
#include <zlib.h>
|
2010-11-10 10:56:17 +01:00
|
|
|
#include <pthread.h>
|
2011-02-26 13:10:28 +01:00
|
|
|
#include <sys/statvfs.h>
|
2010-03-29 01:07:08 +02:00
|
|
|
#include <sys/resource.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
|
|
|
|
|
#include <lzo/lzoconf.h>
|
|
|
|
|
#include <lzo/lzo1x.h>
|
|
|
|
|
|
2010-11-03 03:14:46 +01:00
|
|
|
/* LZMA C Wrapper */
|
|
|
|
|
#include "lzma/C/LzmaLib.h"
|
|
|
|
|
|
2010-03-29 01:07:08 +02:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_MALLOC_H
|
|
|
|
|
#include <malloc.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CTYPE_H
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#endif
|
2011-02-26 14:17:29 +01:00
|
|
|
#ifdef HAVE_ERRNO_H
|
2010-03-29 01:07:08 +02:00
|
|
|
#include <errno.h>
|
2011-02-26 14:17:29 +01:00
|
|
|
#endif
|
2010-03-29 01:07:08 +02:00
|
|
|
#include <sys/mman.h>
|
|
|
|
|
|
|
|
|
|
/* needed for CRC routines */
|
|
|
|
|
#include "lzma/C/7zCrc.h"
|
|
|
|
|
|
2010-11-30 01:24:29 +01:00
|
|
|
void fatal(const char *format, ...);
|
2011-02-21 04:51:20 +01:00
|
|
|
void failure(const char *format, ...);
|
2010-11-30 01:24:29 +01:00
|
|
|
|
2010-03-29 01:07:08 +02:00
|
|
|
void sighandler();
|
2011-03-08 22:32:14 +01:00
|
|
|
i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 expected_size);
|
|
|
|
|
void rzip_fd(rzip_control *control, int fd_in, int fd_out);
|
|
|
|
|
void *open_stream_out(rzip_control *control, int f, int n, i64 limit, char cbytes);
|
|
|
|
|
void *open_stream_in(rzip_control *control, int f, int n);
|
|
|
|
|
int write_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len);
|
|
|
|
|
i64 read_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len);
|
|
|
|
|
int close_stream_out(rzip_control *control, void *ss);
|
2010-03-29 01:07:08 +02:00
|
|
|
int close_stream_in(void *ss);
|
2011-03-08 22:32:14 +01:00
|
|
|
void flush_buffer(rzip_control *control, struct stream_info *sinfo, int stream);
|
2010-03-29 01:07:08 +02:00
|
|
|
ssize_t write_1g(int fd, void *buf, i64 len);
|
|
|
|
|
ssize_t read_1g(int fd, void *buf, i64 len);
|
2010-11-12 22:33:30 +01:00
|
|
|
void zpipe_compress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress, long thread);
|
2010-11-16 11:25:32 +01:00
|
|
|
void zpipe_decompress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress, long thread);
|
2010-11-06 15:57:23 +01:00
|
|
|
const i64 two_gig;
|
2011-03-08 22:32:14 +01:00
|
|
|
void prepare_streamout_threads(rzip_control *control);
|
|
|
|
|
void close_streamout_threads(rzip_control *control);
|
2011-02-21 14:49:50 +01:00
|
|
|
void round_to_page(i64 *size);
|
2011-03-08 22:32:14 +01:00
|
|
|
|
|
|
|
|
void register_infile(const char *name, char delete);
|
|
|
|
|
void register_outfile(const char *name, char delete);
|
|
|
|
|
void register_outputfile(FILE *f);
|
2010-10-31 18:53:53 +01:00
|
|
|
|
|
|
|
|
#define print_err(format, args...) do {\
|
|
|
|
|
fprintf(stderr, format, ##args); \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2011-02-23 17:07:57 +01:00
|
|
|
/* Macros for testing parameters */
|
|
|
|
|
|
|
|
|
|
#define isparameter( parmstring, value ) (!strcasecmp( parmstring, value ))
|
|
|
|
|
#define iscaseparameter( parmvalue, value ) (!strcmp( parmvalue, value ))
|
|
|
|
|
|
2011-03-08 22:32:14 +01:00
|
|
|
#endif
|