if want_xz != 'false' and not skip_deps
libxz = dependency('liblzma',
required : want_xz == 'true')
- have = libxz.found()
+ have_xz = libxz.found()
else
- have = false
+ have_xz = false
libxz = []
endif
-conf.set10('HAVE_XZ', have)
+conf.set10('HAVE_XZ', have_xz)
want_lz4 = get_option('lz4')
if want_lz4 != 'false' and not skip_deps
liblz4 = dependency('liblz4',
version : '>= 1.3.0',
required : want_lz4 == 'true')
- have = liblz4.found()
+ have_lz4 = liblz4.found()
else
- have = false
+ have_lz4 = false
liblz4 = []
endif
-conf.set10('HAVE_LZ4', have)
+conf.set10('HAVE_LZ4', have_lz4)
want_zstd = get_option('zstd')
if want_zstd != 'false' and not skip_deps
libzstd = dependency('libzstd',
required : want_zstd == 'true',
version : '>= 1.4.0')
- have = libzstd.found()
+ have_zstd = libzstd.found()
else
- have = false
+ have_zstd = false
libzstd = []
endif
-conf.set10('HAVE_ZSTD', have)
+conf.set10('HAVE_ZSTD', have_zstd)
+
+conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
want_xkbcommon = get_option('xkbcommon')
if want_xkbcommon != 'false' and not skip_deps
goto fail;
}
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
/* If we will remove the coredump anyway, do not compress. */
if (arg_compress && !maybe_remove_external_coredump(NULL, st.st_size)) {
}
if (filename) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
_cleanup_close_ int fdf;
fdf = open(filename, O_RDONLY | O_CLOEXEC);
ordered_hashmap_free_free(f->chain_cache);
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
free(f->compress_buffer);
#endif
goto next;
if (o->object.flags & OBJECT_COMPRESSION_MASK) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
uint64_t l;
size_t rsize = 0;
o->data.hash = htole64(hash);
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
if (JOURNAL_FILE_COMPRESS(f) && size >= f->compress_threshold_bytes) {
size_t rsize = 0;
return -E2BIG;
if (o->object.flags & OBJECT_COMPRESSION_MASK) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
size_t rsize = 0;
r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK,
unsigned last_seen_generation;
uint64_t compress_threshold_bytes;
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
void *compress_buffer;
size_t compress_buffer_size;
#endif
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
r = decompress_startswith(compression,
o->data.payload, l,
&f->compress_buffer, &f->compress_buffer_size,
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
size_t rsize;
int r;
typedef int (decompress_t)(const void *src, uint64_t src_size,
void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max);
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
static usec_t arg_duration;
static size_t arg_start;
#endif
int main(int argc, char *argv[]) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
test_setup_logging(LOG_INFO);
if (argc >= 2) {
typedef int (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes);
typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size);
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
_unused_ static void test_compress_decompress(const char *compression,
compress_blob_t compress,
decompress_blob_t decompress,
#endif
int main(int argc, char *argv[]) {
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
_unused_ const char text[] =
"text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
(void) journal_file_close(f4);
}
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
static bool check_compressed(uint64_t compress_threshold, uint64_t data_size) {
dual_timestamp ts;
JournalFile *f;
test_non_empty();
test_empty();
-#if HAVE_XZ || HAVE_LZ4 || HAVE_ZSTD
+#if HAVE_COMPRESSION
test_min_compress_size();
#endif