| 1 | /* |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * All rights reserved. |
| 4 | * |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #ifndef FILEIO_TYPES_HEADER |
| 12 | #define FILEIO_TYPES_HEADER |
| 13 | |
| 14 | #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */ |
| 15 | #include "../lib/zstd.h" /* ZSTD_* */ |
| 16 | |
| 17 | /*-************************************* |
| 18 | * Parameters: FIO_prefs_t |
| 19 | ***************************************/ |
| 20 | |
| 21 | typedef struct FIO_display_prefs_s FIO_display_prefs_t; |
| 22 | |
| 23 | typedef enum { FIO_ps_auto, FIO_ps_never, FIO_ps_always } FIO_progressSetting_e; |
| 24 | |
| 25 | struct FIO_display_prefs_s { |
| 26 | int displayLevel; /* 0 : no display; 1: errors; 2: + result + interaction + warnings; 3: + progression; 4: + information */ |
| 27 | FIO_progressSetting_e progressSetting; |
| 28 | }; |
| 29 | |
| 30 | |
| 31 | typedef enum { FIO_zstdCompression, FIO_gzipCompression, FIO_xzCompression, FIO_lzmaCompression, FIO_lz4Compression } FIO_compressionType_t; |
| 32 | |
| 33 | typedef struct FIO_prefs_s { |
| 34 | |
| 35 | /* Algorithm preferences */ |
| 36 | FIO_compressionType_t compressionType; |
| 37 | int sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */ |
| 38 | int dictIDFlag; |
| 39 | int checksumFlag; |
| 40 | int blockSize; |
| 41 | int overlapLog; |
| 42 | int adaptiveMode; |
| 43 | int useRowMatchFinder; |
| 44 | int rsyncable; |
| 45 | int minAdaptLevel; |
| 46 | int maxAdaptLevel; |
| 47 | int ldmFlag; |
| 48 | int ldmHashLog; |
| 49 | int ldmMinMatch; |
| 50 | int ldmBucketSizeLog; |
| 51 | int ldmHashRateLog; |
| 52 | size_t streamSrcSize; |
| 53 | size_t targetCBlockSize; |
| 54 | int srcSizeHint; |
| 55 | int testMode; |
| 56 | ZSTD_paramSwitch_e literalCompressionMode; |
| 57 | |
| 58 | /* IO preferences */ |
| 59 | int removeSrcFile; |
| 60 | int overwrite; |
| 61 | int asyncIO; |
| 62 | |
| 63 | /* Computation resources preferences */ |
| 64 | unsigned memLimit; |
| 65 | int nbWorkers; |
| 66 | |
| 67 | int excludeCompressedFiles; |
| 68 | int patchFromMode; |
| 69 | int contentSize; |
| 70 | int allowBlockDevices; |
| 71 | int passThrough; |
| 72 | ZSTD_paramSwitch_e mmapDict; |
| 73 | } FIO_prefs_t; |
| 74 | |
| 75 | typedef enum {FIO_mallocDict, FIO_mmapDict} FIO_dictBufferType_t; |
| 76 | |
| 77 | typedef struct { |
| 78 | void* dictBuffer; |
| 79 | size_t dictBufferSize; |
| 80 | FIO_dictBufferType_t dictBufferType; |
| 81 | #if defined(_MSC_VER) || defined(_WIN32) |
| 82 | HANDLE dictHandle; |
| 83 | #endif |
| 84 | } FIO_Dict_t; |
| 85 | |
| 86 | #endif /* FILEIO_TYPES_HEADER */ |