2 * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
12 #ifndef FILEIO_H_23981798732
13 #define FILEIO_H_23981798732
15 #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
16 #include "zstd.h" /* ZSTD_* */
18 #if defined (__cplusplus)
23 /* *************************************
24 * Special i/o constants
25 **************************************/
26 #define stdinmark "/*stdin*\\"
27 #define stdoutmark "/*stdout*\\"
29 # define nulmark "nul"
31 # define nulmark "/dev/null"
33 #define LZMA_EXTENSION ".lzma"
34 #define XZ_EXTENSION ".xz"
35 #define GZ_EXTENSION ".gz"
36 #define ZSTD_EXTENSION ".zst"
37 #define LZ4_EXTENSION ".lz4"
40 /*-*************************************
42 ***************************************/
43 typedef enum { FIO_zstdCompression, FIO_gzipCompression, FIO_xzCompression, FIO_lzmaCompression, FIO_lz4Compression } FIO_compressionType_t;
46 /*-*************************************
48 ***************************************/
49 void FIO_setCompressionType(FIO_compressionType_t compressionType);
50 void FIO_overwriteMode(void);
51 void FIO_setNotificationLevel(unsigned level);
52 void FIO_setSparseWrite(unsigned sparse); /**< 0: no sparse; 1: disable on stdout; 2: always enabled */
53 void FIO_setDictIDFlag(unsigned dictIDFlag);
54 void FIO_setChecksumFlag(unsigned checksumFlag);
55 void FIO_setRemoveSrcFile(unsigned flag);
56 void FIO_setMemLimit(unsigned memLimit);
57 void FIO_setNbWorkers(unsigned nbWorkers);
58 void FIO_setBlockSize(unsigned blockSize);
59 void FIO_setOverlapLog(unsigned overlapLog);
60 void FIO_setLdmFlag(unsigned ldmFlag);
61 void FIO_setLdmHashLog(unsigned ldmHashLog);
62 void FIO_setLdmMinMatch(unsigned ldmMinMatch);
63 void FIO_setLdmBucketSizeLog(unsigned ldmBucketSizeLog);
64 void FIO_setLdmHashEveryLog(unsigned ldmHashEveryLog);
67 /*-*************************************
68 * Single File functions
69 ***************************************/
70 /** FIO_compressFilename() :
71 @return : 0 == ok; 1 == pb with src file. */
72 int FIO_compressFilename (const char* outfilename, const char* infilename, const char* dictFileName,
73 int compressionLevel, ZSTD_compressionParameters* comprParams);
75 /** FIO_decompressFilename() :
76 @return : 0 == ok; 1 == pb with src file. */
77 int FIO_decompressFilename (const char* outfilename, const char* infilename, const char* dictFileName);
79 int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel);
81 /*-*************************************
82 * Multiple File functions
83 ***************************************/
84 /** FIO_compressMultipleFilenames() :
85 @return : nb of missing files */
86 int FIO_compressMultipleFilenames(const char** srcNamesTable, unsigned nbFiles,
87 const char* outFileName, const char* suffix,
88 const char* dictFileName, int compressionLevel,
89 ZSTD_compressionParameters* comprParams);
91 /** FIO_decompressMultipleFilenames() :
92 @return : nb of missing or skipped files */
93 int FIO_decompressMultipleFilenames(const char** srcNamesTable, unsigned nbFiles,
94 const char* outFileName,
95 const char* dictFileName);
98 #if defined (__cplusplus)
102 #endif /* FILEIO_H_23981798732 */