2022-01-24 14:43:02 -08:00
|
|
|
/*
|
2023-02-09 07:37:37 -08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2022-01-24 14:43:02 -08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under both the BSD-style license (found in the
|
|
|
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
* in the COPYING file in the root directory of this source tree).
|
|
|
|
* You may select, at your option, one of the above-listed licenses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FILEIO_TYPES_HEADER
|
|
|
|
#define FILEIO_TYPES_HEADER
|
|
|
|
|
|
|
|
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
|
|
|
|
#include "../lib/zstd.h" /* ZSTD_* */
|
|
|
|
|
|
|
|
/*-*************************************
|
|
|
|
* Parameters: FIO_prefs_t
|
|
|
|
***************************************/
|
|
|
|
|
|
|
|
typedef struct FIO_display_prefs_s FIO_display_prefs_t;
|
|
|
|
|
|
|
|
typedef enum { FIO_ps_auto, FIO_ps_never, FIO_ps_always } FIO_progressSetting_e;
|
|
|
|
|
|
|
|
struct FIO_display_prefs_s {
|
|
|
|
int displayLevel; /* 0 : no display; 1: errors; 2: + result + interaction + warnings; 3: + progression; 4: + information */
|
|
|
|
FIO_progressSetting_e progressSetting;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum { FIO_zstdCompression, FIO_gzipCompression, FIO_xzCompression, FIO_lzmaCompression, FIO_lz4Compression } FIO_compressionType_t;
|
|
|
|
|
|
|
|
typedef struct FIO_prefs_s {
|
|
|
|
|
|
|
|
/* Algorithm preferences */
|
|
|
|
FIO_compressionType_t compressionType;
|
fileio_types.h : avoid dependency on mem.h
fileio_types.h cannot be parsed by itself
because it relies on basic types defined in `lib/common/mem.h`.
As for #3231, it likely wasn't detected because `mem.h` was probably included before within target files.
But this is not proper.
A "easy" solution would be to add the missing include,
but each dependency should be considered "bad" by default,
and only allowed if it brings some tangible value.
In this case, since these types are only used to declare internal structure variables
which are effectively only flags,
I believe it's really not valuable to add a dependency on `mem.h` for this purpose
while the standard `int` type can do the same job.
I was expecting some compiler warnings following this change,
but it turns out we don't use `-Wconversion` by default on `zstd` source code,
so there is none.
Nevertheless, I enabled `-Wconversion` locally and proceeded to fix a few conversion warnings in the process.
Adding `-Wconversion` to the list of flags used for `zstd` is something I would be favorable over the long term,
but it cannot be done overnight,
because the nb of places where this warning is triggered is daunting.
Better progressively reduce the nb of triggered `-Wconversion` warnings before enabling this flag by default.
2022-08-03 21:39:35 +02:00
|
|
|
int sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */
|
2022-01-24 14:43:02 -08:00
|
|
|
int dictIDFlag;
|
|
|
|
int checksumFlag;
|
|
|
|
int blockSize;
|
|
|
|
int overlapLog;
|
fileio_types.h : avoid dependency on mem.h
fileio_types.h cannot be parsed by itself
because it relies on basic types defined in `lib/common/mem.h`.
As for #3231, it likely wasn't detected because `mem.h` was probably included before within target files.
But this is not proper.
A "easy" solution would be to add the missing include,
but each dependency should be considered "bad" by default,
and only allowed if it brings some tangible value.
In this case, since these types are only used to declare internal structure variables
which are effectively only flags,
I believe it's really not valuable to add a dependency on `mem.h` for this purpose
while the standard `int` type can do the same job.
I was expecting some compiler warnings following this change,
but it turns out we don't use `-Wconversion` by default on `zstd` source code,
so there is none.
Nevertheless, I enabled `-Wconversion` locally and proceeded to fix a few conversion warnings in the process.
Adding `-Wconversion` to the list of flags used for `zstd` is something I would be favorable over the long term,
but it cannot be done overnight,
because the nb of places where this warning is triggered is daunting.
Better progressively reduce the nb of triggered `-Wconversion` warnings before enabling this flag by default.
2022-08-03 21:39:35 +02:00
|
|
|
int adaptiveMode;
|
|
|
|
int useRowMatchFinder;
|
2022-01-24 14:43:02 -08:00
|
|
|
int rsyncable;
|
|
|
|
int minAdaptLevel;
|
|
|
|
int maxAdaptLevel;
|
|
|
|
int ldmFlag;
|
|
|
|
int ldmHashLog;
|
|
|
|
int ldmMinMatch;
|
|
|
|
int ldmBucketSizeLog;
|
|
|
|
int ldmHashRateLog;
|
|
|
|
size_t streamSrcSize;
|
|
|
|
size_t targetCBlockSize;
|
|
|
|
int srcSizeHint;
|
|
|
|
int testMode;
|
|
|
|
ZSTD_paramSwitch_e literalCompressionMode;
|
|
|
|
|
|
|
|
/* IO preferences */
|
fileio_types.h : avoid dependency on mem.h
fileio_types.h cannot be parsed by itself
because it relies on basic types defined in `lib/common/mem.h`.
As for #3231, it likely wasn't detected because `mem.h` was probably included before within target files.
But this is not proper.
A "easy" solution would be to add the missing include,
but each dependency should be considered "bad" by default,
and only allowed if it brings some tangible value.
In this case, since these types are only used to declare internal structure variables
which are effectively only flags,
I believe it's really not valuable to add a dependency on `mem.h` for this purpose
while the standard `int` type can do the same job.
I was expecting some compiler warnings following this change,
but it turns out we don't use `-Wconversion` by default on `zstd` source code,
so there is none.
Nevertheless, I enabled `-Wconversion` locally and proceeded to fix a few conversion warnings in the process.
Adding `-Wconversion` to the list of flags used for `zstd` is something I would be favorable over the long term,
but it cannot be done overnight,
because the nb of places where this warning is triggered is daunting.
Better progressively reduce the nb of triggered `-Wconversion` warnings before enabling this flag by default.
2022-08-03 21:39:35 +02:00
|
|
|
int removeSrcFile;
|
|
|
|
int overwrite;
|
|
|
|
int asyncIO;
|
2022-01-24 14:43:02 -08:00
|
|
|
|
|
|
|
/* Computation resources preferences */
|
|
|
|
unsigned memLimit;
|
|
|
|
int nbWorkers;
|
|
|
|
|
|
|
|
int excludeCompressedFiles;
|
|
|
|
int patchFromMode;
|
|
|
|
int contentSize;
|
|
|
|
int allowBlockDevices;
|
2022-08-04 17:15:59 -07:00
|
|
|
int passThrough;
|
2023-03-08 08:06:10 -08:00
|
|
|
ZSTD_paramSwitch_e mmapDict;
|
2022-01-24 14:43:02 -08:00
|
|
|
} FIO_prefs_t;
|
|
|
|
|
2023-03-08 08:06:10 -08:00
|
|
|
typedef enum {FIO_mallocDict, FIO_mmapDict} FIO_dictBufferType_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
void* dictBuffer;
|
|
|
|
size_t dictBufferSize;
|
|
|
|
FIO_dictBufferType_t dictBufferType;
|
2023-03-28 19:44:53 -04:00
|
|
|
#if defined(_MSC_VER) || defined(_WIN32)
|
|
|
|
HANDLE dictHandle;
|
|
|
|
#endif
|
2023-03-08 08:06:10 -08:00
|
|
|
} FIO_Dict_t;
|
|
|
|
|
2022-01-31 15:43:41 -08:00
|
|
|
#endif /* FILEIO_TYPES_HEADER */
|