1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_COMPRESS_H
3 #define PERF_COMPRESS_H
8 #ifdef HAVE_ZSTD_SUPPORT
12 #ifdef HAVE_ZLIB_SUPPORT
13 int gzip_decompress_to_file(const char *input
, int output_fd
);
14 bool gzip_is_compressed(const char *input
);
17 #ifdef HAVE_LZMA_SUPPORT
18 int lzma_decompress_to_file(const char *input
, int output_fd
);
19 bool lzma_is_compressed(const char *input
);
23 #ifdef HAVE_ZSTD_SUPPORT
24 ZSTD_CStream
*cstream
;
25 ZSTD_DStream
*dstream
;
30 #ifdef HAVE_ZSTD_SUPPORT
32 int zstd_init(struct zstd_data
*data
, int level
);
33 int zstd_fini(struct zstd_data
*data
);
35 ssize_t
zstd_compress_stream_to_records(struct zstd_data
*data
, void *dst
, size_t dst_size
,
36 void *src
, size_t src_size
, size_t max_record_size
,
37 size_t process_header(void *record
, size_t increment
));
39 size_t zstd_decompress_stream(struct zstd_data
*data
, void *src
, size_t src_size
,
40 void *dst
, size_t dst_size
);
41 #else /* !HAVE_ZSTD_SUPPORT */
43 static inline int zstd_init(struct zstd_data
*data __maybe_unused
, int level __maybe_unused
)
48 static inline int zstd_fini(struct zstd_data
*data __maybe_unused
)
54 ssize_t
zstd_compress_stream_to_records(struct zstd_data
*data __maybe_unused
,
55 void *dst __maybe_unused
, size_t dst_size __maybe_unused
,
56 void *src __maybe_unused
, size_t src_size __maybe_unused
,
57 size_t max_record_size __maybe_unused
,
58 size_t process_header(void *record
, size_t increment
) __maybe_unused
)
63 static inline size_t zstd_decompress_stream(struct zstd_data
*data __maybe_unused
, void *src __maybe_unused
,
64 size_t src_size __maybe_unused
, void *dst __maybe_unused
,
65 size_t dst_size __maybe_unused
)
71 #endif /* PERF_COMPRESS_H */