mirror of
https://github.com/facebook/zstd.git
synced 2025-07-28 00:01:53 +03:00
[linux] Expose ZSTD_compressSequencesAndLiterals() in the kernel
Make the function ZSTD_compressSequencesAndLiterals() available in kernel space. This will be used by Intel QAT driver. Additionally, (1) expose the function ZSTD_CCtx_setParameter(), which is required to set parameters before calling ZSTD_compressSequencesAndLiterals(), (2) update the build process to include `compress/zstd_preSplit.o` and (3) replace `asm/unaligned.h` with `linux/unaligned.h`. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
This commit is contained in:
@ -136,9 +136,20 @@ typedef ZSTD_parameters zstd_parameters;
|
||||
zstd_parameters zstd_get_params(int level,
|
||||
unsigned long long estimated_src_size);
|
||||
|
||||
/* ====== Single-pass Compression ====== */
|
||||
|
||||
typedef ZSTD_CCtx zstd_cctx;
|
||||
typedef ZSTD_cParameter zstd_cparameter;
|
||||
|
||||
/**
|
||||
* zstd_cctx_set_param() - sets a compression parameter
|
||||
* @cctx: The context. Must have been initialized with zstd_init_cctx().
|
||||
* @param: The parameter to set.
|
||||
* @value: The value to set the parameter to.
|
||||
*
|
||||
* Return: Zero or an error, which can be checked using zstd_is_error().
|
||||
*/
|
||||
size_t zstd_cctx_set_param(zstd_cctx *cctx, zstd_cparameter param, int value);
|
||||
|
||||
/* ====== Single-pass Compression ====== */
|
||||
|
||||
/**
|
||||
* zstd_cctx_workspace_bound() - max memory needed to initialize a zstd_cctx
|
||||
@ -480,4 +491,35 @@ typedef ZSTD_FrameHeader zstd_frame_header;
|
||||
size_t zstd_get_frame_header(zstd_frame_header *params, const void *src,
|
||||
size_t src_size);
|
||||
|
||||
/**
|
||||
* struct zstd_sequence - a sequence of literals or a match
|
||||
*
|
||||
* @offset: The offset of the match
|
||||
* @litLength: The literal length of the sequence
|
||||
* @matchLength: The match length of the sequence
|
||||
* @rep: Represents which repeat offset is used
|
||||
*/
|
||||
typedef ZSTD_Sequence zstd_sequence;
|
||||
|
||||
/**
|
||||
* zstd_compress_sequences_and_literals() - compress an array of zstd_sequence and literals
|
||||
*
|
||||
* @cctx: The zstd compression context.
|
||||
* @dst: The buffer to compress the data into.
|
||||
* @dst_capacity: The size of the destination buffer.
|
||||
* @in_seqs: The array of zstd_sequence to compress.
|
||||
* @in_seqs_size: The number of sequences in in_seqs.
|
||||
* @literals: The literals associated to the sequences to be compressed.
|
||||
* @lit_size: The size of the literals in the literals buffer.
|
||||
* @lit_capacity: The size of the literals buffer.
|
||||
* @decompressed_size: The size of the input data
|
||||
*
|
||||
* Return: The compressed size or an error, which can be checked using
|
||||
* zstd_is_error().
|
||||
*/
|
||||
size_t zstd_compress_sequences_and_literals(zstd_cctx *cctx, void* dst, size_t dst_capacity,
|
||||
const zstd_sequence *in_seqs, size_t in_seqs_size,
|
||||
const void* literals, size_t lit_size, size_t lit_capacity,
|
||||
size_t decompressed_size);
|
||||
|
||||
#endif /* LINUX_ZSTD_H */
|
||||
|
Reference in New Issue
Block a user