2012-05-28 14:49:29 +00:00
|
|
|
/*
|
|
|
|
* This file is a part of Pcompress, a chunked parallel multi-
|
|
|
|
* algorithm lossless compression and decompression program.
|
|
|
|
*
|
2013-03-07 14:56:48 +00:00
|
|
|
* Copyright (C) 2012-2013 Moinak Ghosh. All rights reserved.
|
2012-05-28 14:49:29 +00:00
|
|
|
* Use is subject to license terms.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2012-07-07 16:48:29 +00:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2012-05-28 14:49:29 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
2013-03-07 14:56:48 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2012-05-28 14:49:29 +00:00
|
|
|
* moinakg@belenix.org, http://moinakg.wordpress.com/
|
2014-07-24 16:50:30 +00:00
|
|
|
*
|
2012-05-28 14:49:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PCOMPRESS_H
|
|
|
|
#define _PCOMPRESS_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <semaphore.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-09-02 15:10:32 +00:00
|
|
|
#include <rabin_dedup.h>
|
2012-10-17 18:02:35 +00:00
|
|
|
#include <crypto_utils.h>
|
2014-11-06 16:53:33 +00:00
|
|
|
#include <filters/analyzer/analyzer.h>
|
|
|
|
#include <meta_stream.h>
|
2012-06-29 12:53:55 +00:00
|
|
|
|
2012-08-31 17:06:06 +00:00
|
|
|
#define CHUNK_FLAG_SZ 1
|
2012-05-28 14:49:29 +00:00
|
|
|
#define ALGO_SZ 8
|
|
|
|
#define MIN_CHUNK 2048
|
2014-10-24 18:00:40 +00:00
|
|
|
#define VERSION 10
|
2012-06-29 12:53:55 +00:00
|
|
|
#define FLAG_DEDUP 1
|
2012-10-15 06:40:00 +00:00
|
|
|
#define FLAG_DEDUP_FIXED 2
|
|
|
|
#define FLAG_SINGLE_CHUNK 4
|
2014-10-25 17:27:31 +00:00
|
|
|
#define FLAG_META_STREAM 4096
|
2013-10-30 18:45:17 +00:00
|
|
|
#define FLAG_ARCHIVE 2048
|
2014-03-02 13:16:03 +00:00
|
|
|
#define UTILITY_VERSION "3.1"
|
2012-10-15 06:40:00 +00:00
|
|
|
#define MASK_CRYPTO_ALG 0x30
|
2012-10-17 18:02:35 +00:00
|
|
|
#define MAX_LEVEL 14
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2014-07-24 16:50:30 +00:00
|
|
|
#ifndef _MPLV2_LICENSE_
|
|
|
|
#define LICENSE_STRING "LGPLv3"
|
|
|
|
#else
|
|
|
|
#define LICENSE_STRING "MPLv2"
|
|
|
|
#endif
|
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
#define COMPRESSED 1
|
|
|
|
#define UNCOMPRESSED 0
|
|
|
|
#define CHSIZE_MASK 0x80
|
|
|
|
#define BZIP2_A_NUM 16
|
|
|
|
#define LZMA_A_NUM 32
|
2014-09-20 07:19:00 +00:00
|
|
|
#define CHUNK_FLAG_DEDUP 2
|
2012-08-23 17:28:44 +00:00
|
|
|
#define CHUNK_FLAG_PREPROC 4
|
2012-08-10 05:17:11 +00:00
|
|
|
#define COMP_EXTN ".pz"
|
|
|
|
|
2014-09-20 07:19:00 +00:00
|
|
|
#define PREPROC_TYPE_LZP 1
|
2012-12-04 18:39:47 +00:00
|
|
|
#define PREPROC_TYPE_DELTA2 2
|
2013-11-24 14:15:58 +00:00
|
|
|
#define PREPROC_TYPE_DISPACK 4
|
2014-09-20 07:19:00 +00:00
|
|
|
#define PREPROC_TYPE_DICT 8
|
2014-12-11 13:45:36 +00:00
|
|
|
#define PREPROC_TYPE_E8E9 16
|
2012-08-23 17:28:44 +00:00
|
|
|
#define PREPROC_COMPRESSED 128
|
|
|
|
|
2012-08-10 05:17:11 +00:00
|
|
|
/*
|
2012-08-31 17:06:06 +00:00
|
|
|
* Sizes of chunk header components.
|
|
|
|
*/
|
|
|
|
#define COMPRESSED_CHUNKSZ (sizeof (uint64_t))
|
|
|
|
#define ORIGINAL_CHUNKSZ (sizeof (uint64_t))
|
2013-06-02 15:24:33 +00:00
|
|
|
#define CHUNK_HDR_SZ (COMPRESSED_CHUNKSZ + pctx->cksum_bytes + ORIGINAL_CHUNKSZ + CHUNK_FLAG_SZ)
|
2012-08-31 17:06:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* lower 3 bits in higher nibble indicate chunk compression algorithm
|
|
|
|
* in adaptive modes.
|
2012-08-10 05:17:11 +00:00
|
|
|
*/
|
2013-02-17 15:35:40 +00:00
|
|
|
#define ADAPT_COMPRESS_NONE 0
|
|
|
|
#define ADAPT_COMPRESS_LZMA 1
|
|
|
|
#define ADAPT_COMPRESS_BZIP2 2
|
|
|
|
#define ADAPT_COMPRESS_PPMD 3
|
|
|
|
#define ADAPT_COMPRESS_BSC 4
|
2013-11-15 15:36:23 +00:00
|
|
|
/*
|
|
|
|
* This is used in adaptive modes in cases where the data is deemed totally incompressible.
|
|
|
|
* We can still have zero padding and archive headers that can be compressed. So we use the
|
|
|
|
* fastest algo at our disposal for these cases.
|
|
|
|
*/
|
|
|
|
#define ADAPT_COMPRESS_LZ4 5
|
2012-08-10 05:17:11 +00:00
|
|
|
#define CHDR_ALGO_MASK 7
|
2013-11-15 15:36:23 +00:00
|
|
|
#define CHDR_ALGO(x) (((x)>>4) & CHDR_ALGO_MASK)
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-12-27 17:36:48 +00:00
|
|
|
extern uint32_t zlib_buf_extra(uint64_t buflen);
|
|
|
|
extern int lz4_buf_extra(uint64_t buflen);
|
2012-12-09 04:45:06 +00:00
|
|
|
|
|
|
|
extern int zlib_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *destlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lzma_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *destlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int bzip2_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *destlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int adapt_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int ppmd_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lz_fx_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lz4_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int none_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
|
|
|
|
extern int zlib_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lzma_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int bzip2_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int adapt_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int ppmd_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lz_fx_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int lz4_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int none_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int adapt_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int adapt2_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int lzma_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int ppmd_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int bzip2_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int zlib_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int lz_fx_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int lz4_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int none_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2014-11-06 16:53:33 +00:00
|
|
|
extern void adapt_set_analyzer_ctx(void *data, analyzer_ctx_t *actx);
|
2012-08-18 04:50:52 +00:00
|
|
|
|
2012-12-27 17:36:48 +00:00
|
|
|
extern void lzma_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void lzma_mt_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void lz4_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void zlib_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void ppmd_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void lz_fx_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void bzip2_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void adapt_props(algo_props_t *data, int level, uint64_t chunksize);
|
|
|
|
extern void none_props(algo_props_t *data, int level, uint64_t chunksize);
|
2012-05-31 16:06:33 +00:00
|
|
|
|
2012-08-08 17:10:58 +00:00
|
|
|
extern int zlib_deinit(void **data);
|
2012-05-28 14:49:29 +00:00
|
|
|
extern int adapt_deinit(void **data);
|
|
|
|
extern int lzma_deinit(void **data);
|
|
|
|
extern int ppmd_deinit(void **data);
|
2012-07-23 16:13:12 +00:00
|
|
|
extern int lz_fx_deinit(void **data);
|
2012-07-25 15:37:36 +00:00
|
|
|
extern int lz4_deinit(void **data);
|
2012-08-05 17:05:51 +00:00
|
|
|
extern int none_deinit(void **data);
|
2012-05-28 14:49:29 +00:00
|
|
|
|
2012-05-31 16:06:33 +00:00
|
|
|
extern void adapt_stats(int show);
|
|
|
|
extern void ppmd_stats(int show);
|
|
|
|
extern void lzma_stats(int show);
|
|
|
|
extern void bzip2_stats(int show);
|
|
|
|
extern void zlib_stats(int show);
|
2012-07-22 18:45:08 +00:00
|
|
|
extern void lz_fx_stats(int show);
|
2012-07-25 15:37:36 +00:00
|
|
|
extern void lz4_stats(int show);
|
2012-08-05 17:05:51 +00:00
|
|
|
extern void none_stats(int show);
|
2012-05-31 16:06:33 +00:00
|
|
|
|
2012-08-27 16:21:55 +00:00
|
|
|
#ifdef ENABLE_PC_LIBBSC
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int libbsc_compress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-09 04:45:06 +00:00
|
|
|
extern int libbsc_decompress(void *src, uint64_t srclen, void *dst,
|
2013-11-08 18:20:28 +00:00
|
|
|
uint64_t *dstlen, int level, uchar_t chdr, int btype, void *data);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern int libbsc_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
2012-11-22 15:32:50 +00:00
|
|
|
int file_version, compress_op_t op);
|
2012-12-27 17:36:48 +00:00
|
|
|
extern void libbsc_props(algo_props_t *data, int level, uint64_t chunksize);
|
2012-08-27 16:21:55 +00:00
|
|
|
extern int libbsc_deinit(void **data);
|
|
|
|
extern void libbsc_stats(int show);
|
|
|
|
#endif
|
|
|
|
|
2013-06-02 15:24:33 +00:00
|
|
|
typedef struct pc_ctx {
|
|
|
|
compress_func_ptr _compress_func;
|
|
|
|
compress_func_ptr _decompress_func;
|
|
|
|
init_func_ptr _init_func;
|
|
|
|
deinit_func_ptr _deinit_func;
|
|
|
|
stats_func_ptr _stats_func;
|
|
|
|
props_func_ptr _props_func;
|
|
|
|
|
|
|
|
int inited;
|
|
|
|
int main_cancel;
|
|
|
|
int adapt_mode;
|
|
|
|
int pipe_mode, pipe_out;
|
|
|
|
int nthreads;
|
|
|
|
int hide_mem_stats;
|
|
|
|
int hide_cmp_stats;
|
2014-03-30 12:05:21 +00:00
|
|
|
int show_chunks;
|
2013-06-02 15:24:33 +00:00
|
|
|
int enable_rabin_scan;
|
|
|
|
int enable_rabin_global;
|
|
|
|
int enable_delta_encode;
|
|
|
|
int enable_delta2_encode;
|
2013-12-13 14:23:14 +00:00
|
|
|
int delta2_nstrides;
|
2013-06-02 15:24:33 +00:00
|
|
|
int enable_rabin_split;
|
|
|
|
int enable_fixed_scan;
|
2014-09-20 07:19:00 +00:00
|
|
|
int enable_analyzer;
|
2013-11-22 15:14:26 +00:00
|
|
|
int preprocess_mode;
|
2013-06-02 15:24:33 +00:00
|
|
|
int lzp_preprocess;
|
2014-12-11 13:45:36 +00:00
|
|
|
int exe_preprocess;
|
2013-06-02 15:24:33 +00:00
|
|
|
int encrypt_type;
|
2013-10-20 18:24:27 +00:00
|
|
|
int archive_mode;
|
2013-11-01 17:45:40 +00:00
|
|
|
int enable_archive_sort;
|
2014-10-24 18:00:40 +00:00
|
|
|
long pagesize;
|
2013-11-03 17:45:55 +00:00
|
|
|
int force_archive_perms;
|
|
|
|
int no_overwrite_newer;
|
2013-12-17 18:39:32 +00:00
|
|
|
int advanced_opts;
|
2014-10-24 18:00:40 +00:00
|
|
|
int meta_stream;
|
2013-11-02 18:13:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Archiving related context data.
|
|
|
|
*/
|
2013-10-20 18:24:27 +00:00
|
|
|
char archive_members_file[MAXPATHLEN];
|
2013-11-03 17:45:55 +00:00
|
|
|
int archive_members_fd;
|
2013-11-01 17:45:40 +00:00
|
|
|
uint32_t archive_members_count;
|
|
|
|
void *archive_ctx, *archive_sort_buf;
|
2013-10-23 18:46:04 +00:00
|
|
|
pthread_t archive_thread;
|
2013-10-30 18:45:17 +00:00
|
|
|
char archive_temp_file[MAXPATHLEN];
|
|
|
|
int archive_temp_fd;
|
2013-11-02 18:13:59 +00:00
|
|
|
uint64_t archive_temp_size, archive_size;
|
2013-11-02 06:44:46 +00:00
|
|
|
uchar_t *temp_mmap_buf;
|
|
|
|
uint64_t temp_mmap_pos, temp_file_pos;
|
|
|
|
uint64_t temp_mmap_len;
|
2013-11-02 18:13:59 +00:00
|
|
|
struct fn_list *fn;
|
2014-05-04 15:41:31 +00:00
|
|
|
Sem_t read_sem, write_sem;
|
2014-10-24 18:00:40 +00:00
|
|
|
pthread_mutex_t write_mutex;
|
2013-11-02 18:13:59 +00:00
|
|
|
uchar_t *arc_buf;
|
|
|
|
uint64_t arc_buf_size, arc_buf_pos;
|
|
|
|
int arc_closed, arc_writing;
|
2013-12-30 17:54:37 +00:00
|
|
|
int btype, ctype;
|
2014-09-20 16:19:06 +00:00
|
|
|
int interesting;
|
2013-11-07 16:18:54 +00:00
|
|
|
int min_chunk;
|
2013-11-15 15:36:23 +00:00
|
|
|
int enable_packjpg;
|
2014-09-17 15:04:38 +00:00
|
|
|
int enable_wavpack;
|
2014-01-12 15:08:20 +00:00
|
|
|
int list_mode;
|
2014-09-17 15:04:38 +00:00
|
|
|
FILE *err_paths_fd;
|
|
|
|
uint32_t errored_count;
|
2013-11-02 18:13:59 +00:00
|
|
|
|
2013-06-02 15:24:33 +00:00
|
|
|
unsigned int chunk_num;
|
|
|
|
uint64_t largest_chunk, smallest_chunk, avg_chunk;
|
2013-11-02 18:13:59 +00:00
|
|
|
uint64_t chunksize;
|
2013-10-30 18:45:17 +00:00
|
|
|
const char *algo, *filename;
|
|
|
|
char *to_filename;
|
2013-08-07 16:33:52 +00:00
|
|
|
char *exec_name;
|
2013-06-02 15:24:33 +00:00
|
|
|
int do_compress, level;
|
|
|
|
int do_uncompress;
|
|
|
|
int cksum_bytes, mac_bytes;
|
|
|
|
int cksum, t_errored;
|
|
|
|
int rab_blk_size, keylen;
|
|
|
|
crypto_ctx_t crypto_ctx;
|
|
|
|
unsigned char *user_pw;
|
|
|
|
int user_pw_len;
|
|
|
|
char *pwd_file, *f_name;
|
2014-10-24 18:00:40 +00:00
|
|
|
meta_ctx_t *meta_ctx;
|
2013-06-02 15:24:33 +00:00
|
|
|
} pc_ctx_t;
|
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
/*
|
|
|
|
* Per-thread data structure for compression and decompression threads.
|
|
|
|
*/
|
|
|
|
struct cmp_data {
|
|
|
|
uchar_t *cmp_seg;
|
|
|
|
uchar_t *compressed_chunk;
|
|
|
|
uchar_t *uncompressed_chunk;
|
2012-09-16 05:42:58 +00:00
|
|
|
dedupe_context_t *rctx;
|
2014-09-20 07:19:00 +00:00
|
|
|
int64_t rbytes;
|
2012-12-27 17:36:48 +00:00
|
|
|
uint64_t chunksize;
|
|
|
|
uint64_t len_cmp, len_cmp_be;
|
2012-08-31 17:06:06 +00:00
|
|
|
uchar_t checksum[CKSUM_MAX_BYTES];
|
2013-03-19 14:43:44 +00:00
|
|
|
int level, cksum_mt, out_fd;
|
2012-05-28 14:49:29 +00:00
|
|
|
unsigned int id;
|
|
|
|
compress_func_ptr compress;
|
|
|
|
compress_func_ptr decompress;
|
|
|
|
int cancel;
|
2014-09-20 16:19:06 +00:00
|
|
|
int interesting;
|
2014-05-04 15:41:31 +00:00
|
|
|
Sem_t start_sem;
|
|
|
|
Sem_t cmp_done_sem;
|
|
|
|
Sem_t write_done_sem;
|
|
|
|
Sem_t index_sem;
|
2012-05-28 14:49:29 +00:00
|
|
|
void *data;
|
|
|
|
pthread_t thr;
|
2012-10-18 17:25:41 +00:00
|
|
|
mac_ctx_t chunk_hmac;
|
2012-12-04 18:39:47 +00:00
|
|
|
algo_props_t *props;
|
2013-03-24 17:51:17 +00:00
|
|
|
int decompressing;
|
2014-12-21 08:43:58 +00:00
|
|
|
int btype;
|
2013-06-02 15:24:33 +00:00
|
|
|
pc_ctx_t *pctx;
|
2012-05-28 14:49:29 +00:00
|
|
|
};
|
|
|
|
|
2013-06-02 15:24:33 +00:00
|
|
|
void usage(pc_ctx_t *pctx);
|
|
|
|
pc_ctx_t *create_pc_context(void);
|
|
|
|
int init_pc_context_argstr(pc_ctx_t *pctx, char *args);
|
|
|
|
int init_pc_context(pc_ctx_t *pctx, int argc, char *argv[]);
|
|
|
|
void destroy_pc_context(pc_ctx_t *pctx);
|
|
|
|
void pc_set_userpw(pc_ctx_t *pctx, unsigned char *pwdata, int pwlen);
|
|
|
|
|
|
|
|
int start_pcompress(pc_ctx_t *pctx);
|
|
|
|
int start_compress(pc_ctx_t *pctx, const char *filename, uint64_t chunksize, int level);
|
2013-10-30 18:45:17 +00:00
|
|
|
int start_decompress(pc_ctx_t *pctx, const char *filename, char *to_filename);
|
2013-06-02 15:24:33 +00:00
|
|
|
|
2012-05-28 14:49:29 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|