mirror of
https://github.com/systemd/systemd
synced 2026-04-26 08:54:50 +02:00
Compare commits
4 Commits
8ac6b05b7c
...
23ce0271dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23ce0271dc | ||
|
|
cca3050b9e | ||
|
|
ee00684c50 | ||
|
|
1d997b8114 |
11
meson.build
11
meson.build
@ -1470,14 +1470,9 @@ elif compression == 'lz4' and not have_lz4
|
|||||||
elif compression == 'xz' and not have_xz
|
elif compression == 'xz' and not have_xz
|
||||||
error('default-compression=xz requires xz')
|
error('default-compression=xz requires xz')
|
||||||
endif
|
endif
|
||||||
# These values are defined here so that config.h is self-contained, but they are also
|
conf.set('DEFAULT_COMPRESSION',
|
||||||
# re-defined (with different names to avoid conflits) in src/libsystemd/sd-journal/journal-def.h
|
compression == 'none' ? 0 :
|
||||||
# as that source file represents the journal object ABI, and we want that to be self-contained too.
|
'OBJECT_COMPRESSED_@0@'.format(compression.to_upper()))
|
||||||
conf.set('COMPRESSION_NONE', 0)
|
|
||||||
conf.set('COMPRESSION_XZ', 1)
|
|
||||||
conf.set('COMPRESSION_LZ4', 2)
|
|
||||||
conf.set('COMPRESSION_ZSTD', 4)
|
|
||||||
conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
|
|
||||||
|
|
||||||
want_xkbcommon = get_option('xkbcommon')
|
want_xkbcommon = get_option('xkbcommon')
|
||||||
if want_xkbcommon != 'false' and not skip_deps
|
if want_xkbcommon != 'false' and not skip_deps
|
||||||
|
|||||||
@ -462,7 +462,7 @@ static int save_external_coredump(
|
|||||||
if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
|
if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
|
||||||
return log_error_errno(errno, "Failed to seek on coredump %s: %m", fn);
|
return log_error_errno(errno, "Failed to seek on coredump %s: %m", fn);
|
||||||
|
|
||||||
fn_compressed = strjoin(fn, COMPRESSED_EXT);
|
fn_compressed = strjoin(fn, default_compression_extension());
|
||||||
if (!fn_compressed)
|
if (!fn_compressed)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ int compress_blob_xz(const void *src, uint64_t src_size,
|
|||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
*dst_size = out_pos;
|
*dst_size = out_pos;
|
||||||
return 0;
|
return OBJECT_COMPRESSED_XZ;
|
||||||
#else
|
#else
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#endif
|
#endif
|
||||||
@ -130,7 +130,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size,
|
|||||||
unaligned_write_le64(dst, src_size);
|
unaligned_write_le64(dst, src_size);
|
||||||
*dst_size = r + 8;
|
*dst_size = r + 8;
|
||||||
|
|
||||||
return 0;
|
return OBJECT_COMPRESSED_LZ4;
|
||||||
#else
|
#else
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#endif
|
#endif
|
||||||
@ -153,7 +153,7 @@ int compress_blob_zstd(
|
|||||||
return zstd_ret_to_errno(k);
|
return zstd_ret_to_errno(k);
|
||||||
|
|
||||||
*dst_size = k;
|
*dst_size = k;
|
||||||
return 0;
|
return OBJECT_COMPRESSED_ZSTD;
|
||||||
#else
|
#else
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#endif
|
#endif
|
||||||
@ -619,7 +619,7 @@ int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_uncom
|
|||||||
s.total_in, s.total_out,
|
s.total_in, s.total_out,
|
||||||
(double) s.total_out / s.total_in * 100);
|
(double) s.total_out / s.total_in * 100);
|
||||||
|
|
||||||
return 0;
|
return OBJECT_COMPRESSED_XZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,7 +710,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_unco
|
|||||||
total_in, total_out,
|
total_in, total_out,
|
||||||
(double) total_out / total_in * 100);
|
(double) total_out / total_in * 100);
|
||||||
|
|
||||||
return 0;
|
return OBJECT_COMPRESSED_LZ4;
|
||||||
#else
|
#else
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#endif
|
#endif
|
||||||
@ -954,7 +954,7 @@ int compress_stream_zstd(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_unc
|
|||||||
log_debug("ZSTD compression finished (%" PRIu64 " -> %" PRIu64 " bytes)",
|
log_debug("ZSTD compression finished (%" PRIu64 " -> %" PRIu64 " bytes)",
|
||||||
in_bytes, max_bytes - left);
|
in_bytes, max_bytes - left);
|
||||||
|
|
||||||
return 0;
|
return OBJECT_COMPRESSED_ZSTD;
|
||||||
#else
|
#else
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -15,27 +15,6 @@ int compress_blob_lz4(const void *src, uint64_t src_size,
|
|||||||
int compress_blob_zstd(const void *src, uint64_t src_size,
|
int compress_blob_zstd(const void *src, uint64_t src_size,
|
||||||
void *dst, size_t dst_alloc_size, size_t *dst_size);
|
void *dst, size_t dst_alloc_size, size_t *dst_size);
|
||||||
|
|
||||||
static inline int compress_blob(const void *src, uint64_t src_size,
|
|
||||||
void *dst, size_t dst_alloc_size, size_t *dst_size) {
|
|
||||||
int r;
|
|
||||||
#if DEFAULT_COMPRESSION == COMPRESSION_ZSTD
|
|
||||||
r = compress_blob_zstd(src, src_size, dst, dst_alloc_size, dst_size);
|
|
||||||
if (r == 0)
|
|
||||||
return COMPRESSION_ZSTD;
|
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_LZ4
|
|
||||||
r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size);
|
|
||||||
if (r == 0)
|
|
||||||
return COMPRESSION_LZ4;
|
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_XZ
|
|
||||||
r = compress_blob_xz(src, src_size, dst, dst_alloc_size, dst_size);
|
|
||||||
if (r == 0)
|
|
||||||
return COMPRESSION_XZ;
|
|
||||||
#else
|
|
||||||
r = -EOPNOTSUPP;
|
|
||||||
#endif
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
int decompress_blob_xz(const void *src, uint64_t src_size,
|
int decompress_blob_xz(const void *src, uint64_t src_size,
|
||||||
void **dst, size_t* dst_size, size_t dst_max);
|
void **dst, size_t* dst_size, size_t dst_max);
|
||||||
int decompress_blob_lz4(const void *src, uint64_t src_size,
|
int decompress_blob_lz4(const void *src, uint64_t src_size,
|
||||||
@ -72,20 +51,44 @@ int decompress_stream_xz(int fdf, int fdt, uint64_t max_size);
|
|||||||
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_size);
|
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_size);
|
||||||
int decompress_stream_zstd(int fdf, int fdt, uint64_t max_size);
|
int decompress_stream_zstd(int fdf, int fdt, uint64_t max_size);
|
||||||
|
|
||||||
#if DEFAULT_COMPRESSION == COMPRESSION_ZSTD
|
static inline int compress_blob(const void *src, uint64_t src_size,
|
||||||
# define compress_stream compress_stream_zstd
|
void *dst, size_t dst_alloc_size, size_t *dst_size) {
|
||||||
# define COMPRESSED_EXT ".zst"
|
switch (DEFAULT_COMPRESSION) {
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_LZ4
|
case OBJECT_COMPRESSED_ZSTD:
|
||||||
# define compress_stream compress_stream_lz4
|
return compress_blob_zstd(src, src_size, dst, dst_alloc_size, dst_size);
|
||||||
# define COMPRESSED_EXT ".lz4"
|
case OBJECT_COMPRESSED_LZ4:
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_XZ
|
return compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size);
|
||||||
# define compress_stream compress_stream_xz
|
case OBJECT_COMPRESSED_XZ:
|
||||||
# define COMPRESSED_EXT ".xz"
|
return compress_blob_xz(src, src_size, dst, dst_alloc_size, dst_size);
|
||||||
#else
|
default:
|
||||||
static inline int compress_stream(int fdf, int fdt, uint64_t max_size, uint64_t *ret_uncompressed_size) {
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
# define COMPRESSED_EXT ""
|
}
|
||||||
#endif
|
|
||||||
|
static inline int compress_stream(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_uncompressed_size) {
|
||||||
|
switch (DEFAULT_COMPRESSION) {
|
||||||
|
case OBJECT_COMPRESSED_ZSTD:
|
||||||
|
return compress_stream_zstd(fdf, fdt, max_bytes, ret_uncompressed_size);
|
||||||
|
case OBJECT_COMPRESSED_LZ4:
|
||||||
|
return compress_stream_lz4(fdf, fdt, max_bytes, ret_uncompressed_size);
|
||||||
|
case OBJECT_COMPRESSED_XZ:
|
||||||
|
return compress_stream_xz(fdf, fdt, max_bytes, ret_uncompressed_size);
|
||||||
|
default:
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline const char* default_compression_extension(void) {
|
||||||
|
switch (DEFAULT_COMPRESSION) {
|
||||||
|
case OBJECT_COMPRESSED_ZSTD:
|
||||||
|
return ".zst";
|
||||||
|
case OBJECT_COMPRESSED_LZ4:
|
||||||
|
return ".lz4";
|
||||||
|
case OBJECT_COMPRESSED_XZ:
|
||||||
|
return ".xz";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int decompress_stream(const char *filename, int fdf, int fdt, uint64_t max_bytes);
|
int decompress_stream(const char *filename, int fdf, int fdt, uint64_t max_bytes);
|
||||||
|
|||||||
@ -48,16 +48,10 @@ enum {
|
|||||||
OBJECT_COMPRESSED_XZ = 1 << 0,
|
OBJECT_COMPRESSED_XZ = 1 << 0,
|
||||||
OBJECT_COMPRESSED_LZ4 = 1 << 1,
|
OBJECT_COMPRESSED_LZ4 = 1 << 1,
|
||||||
OBJECT_COMPRESSED_ZSTD = 1 << 2,
|
OBJECT_COMPRESSED_ZSTD = 1 << 2,
|
||||||
OBJECT_COMPRESSION_MASK = (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4 | OBJECT_COMPRESSED_ZSTD),
|
OBJECT_COMPRESSION_MASK = OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4 | OBJECT_COMPRESSED_ZSTD,
|
||||||
_OBJECT_COMPRESSED_MAX = OBJECT_COMPRESSION_MASK,
|
_OBJECT_COMPRESSED_MAX = OBJECT_COMPRESSION_MASK,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef COMPRESSION_XZ
|
|
||||||
assert_cc(OBJECT_COMPRESSED_XZ == COMPRESSION_XZ);
|
|
||||||
assert_cc(OBJECT_COMPRESSED_LZ4 == COMPRESSION_LZ4);
|
|
||||||
assert_cc(OBJECT_COMPRESSED_ZSTD == COMPRESSION_ZSTD);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct ObjectHeader {
|
struct ObjectHeader {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
|
|||||||
@ -3359,13 +3359,6 @@ int journal_file_open(
|
|||||||
.open_flags = open_flags,
|
.open_flags = open_flags,
|
||||||
.writable = (open_flags & O_ACCMODE) != O_RDONLY,
|
.writable = (open_flags & O_ACCMODE) != O_RDONLY,
|
||||||
|
|
||||||
#if DEFAULT_COMPRESSION == COMPRESSION_ZSTD
|
|
||||||
.compress_zstd = FLAGS_SET(file_flags, JOURNAL_COMPRESS),
|
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_LZ4
|
|
||||||
.compress_lz4 = FLAGS_SET(file_flags, JOURNAL_COMPRESS),
|
|
||||||
#elif DEFAULT_COMPRESSION == COMPRESSION_XZ
|
|
||||||
.compress_xz = FLAGS_SET(file_flags, JOURNAL_COMPRESS),
|
|
||||||
#endif
|
|
||||||
.compress_threshold_bytes = compress_threshold_bytes == UINT64_MAX ?
|
.compress_threshold_bytes = compress_threshold_bytes == UINT64_MAX ?
|
||||||
DEFAULT_COMPRESS_THRESHOLD :
|
DEFAULT_COMPRESS_THRESHOLD :
|
||||||
MAX(MIN_COMPRESS_THRESHOLD, compress_threshold_bytes),
|
MAX(MIN_COMPRESS_THRESHOLD, compress_threshold_bytes),
|
||||||
@ -3374,6 +3367,13 @@ int journal_file_open(
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (DEFAULT_COMPRESSION == OBJECT_COMPRESSED_ZSTD)
|
||||||
|
f->compress_zstd = FLAGS_SET(file_flags, JOURNAL_COMPRESS);
|
||||||
|
else if (DEFAULT_COMPRESSION == OBJECT_COMPRESSED_LZ4)
|
||||||
|
f->compress_lz4 = FLAGS_SET(file_flags, JOURNAL_COMPRESS);
|
||||||
|
else if (DEFAULT_COMPRESSION == OBJECT_COMPRESSED_XZ)
|
||||||
|
f->compress_xz = FLAGS_SET(file_flags, JOURNAL_COMPRESS);
|
||||||
|
|
||||||
/* We turn on keyed hashes by default, but provide an environment variable to turn them off, if
|
/* We turn on keyed hashes by default, but provide an environment variable to turn them off, if
|
||||||
* people really want that */
|
* people really want that */
|
||||||
r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
r = getenv_bool("SYSTEMD_JOURNAL_KEYED_HASH");
|
||||||
|
|||||||
@ -102,11 +102,11 @@ static void test_compress_decompress(const char* label, const char* type,
|
|||||||
|
|
||||||
r = compress(text, size, buf, size, &j);
|
r = compress(text, size, buf, size, &j);
|
||||||
/* assume compression must be successful except for small or random inputs */
|
/* assume compression must be successful except for small or random inputs */
|
||||||
assert_se(r == 0 || (size < 2048 && r == -ENOBUFS) || streq(type, "random"));
|
assert_se(r > 0 || (size < 2048 && r == -ENOBUFS) || streq(type, "random"));
|
||||||
|
|
||||||
/* check for overwrites */
|
/* check for overwrites */
|
||||||
assert_se(buf[size] == 0);
|
assert_se(buf[size] == 0);
|
||||||
if (r != 0) {
|
if (r < 0) {
|
||||||
skipped += size;
|
skipped += size;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,7 @@ typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size);
|
|||||||
|
|
||||||
#if HAVE_COMPRESSION
|
#if HAVE_COMPRESSION
|
||||||
_unused_ static void test_compress_decompress(
|
_unused_ static void test_compress_decompress(
|
||||||
|
int flag,
|
||||||
const char *compression,
|
const char *compression,
|
||||||
compress_blob_t compress,
|
compress_blob_t compress,
|
||||||
decompress_blob_t decompress,
|
decompress_blob_t decompress,
|
||||||
@ -66,7 +67,7 @@ _unused_ static void test_compress_decompress(
|
|||||||
log_info_errno(r, "compression failed: %m");
|
log_info_errno(r, "compression failed: %m");
|
||||||
assert_se(may_fail);
|
assert_se(may_fail);
|
||||||
} else {
|
} else {
|
||||||
assert_se(r == 0);
|
assert_se(r == flag);
|
||||||
r = decompress(compressed, csize,
|
r = decompress(compressed, csize,
|
||||||
(void **) &decompressed, &csize, 0);
|
(void **) &decompressed, &csize, 0);
|
||||||
assert_se(r == 0);
|
assert_se(r == 0);
|
||||||
@ -118,9 +119,8 @@ _unused_ static void test_decompress_startswith(const char *compression,
|
|||||||
compressed = compressed2 = malloc(BUFSIZE_2);
|
compressed = compressed2 = malloc(BUFSIZE_2);
|
||||||
assert_se(compressed2);
|
assert_se(compressed2);
|
||||||
r = compress(data, data_len, compressed, BUFSIZE_2, &csize);
|
r = compress(data, data_len, compressed, BUFSIZE_2, &csize);
|
||||||
assert_se(r == 0);
|
|
||||||
}
|
}
|
||||||
assert_se(r == 0);
|
assert_se(r > 0);
|
||||||
|
|
||||||
len = strlen(data);
|
len = strlen(data);
|
||||||
|
|
||||||
@ -145,15 +145,15 @@ _unused_ static void test_decompress_startswith_short(const char *compression,
|
|||||||
#define TEXT "HUGE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
#define TEXT "HUGE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
size_t i, csize;
|
size_t csize;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
log_info("/* %s with %s */", __func__, compression);
|
log_info("/* %s with %s */", __func__, compression);
|
||||||
|
|
||||||
r = compress(TEXT, sizeof TEXT, buf, sizeof buf, &csize);
|
r = compress(TEXT, sizeof TEXT, buf, sizeof buf, &csize);
|
||||||
assert_se(r == 0);
|
assert_se(r > 0);
|
||||||
|
|
||||||
for (i = 1; i < strlen(TEXT); i++) {
|
for (size_t i = 1; i < strlen(TEXT); i++) {
|
||||||
_cleanup_free_ void *buf2 = NULL;
|
_cleanup_free_ void *buf2 = NULL;
|
||||||
|
|
||||||
assert_se(buf2 = malloc(i));
|
assert_se(buf2 = malloc(i));
|
||||||
@ -163,7 +163,8 @@ _unused_ static void test_decompress_startswith_short(const char *compression,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused_ static void test_compress_stream(const char *compression,
|
_unused_ static void test_compress_stream(int flag,
|
||||||
|
const char *compression,
|
||||||
const char *cat,
|
const char *cat,
|
||||||
compress_stream_t compress,
|
compress_stream_t compress,
|
||||||
decompress_stream_t decompress,
|
decompress_stream_t decompress,
|
||||||
@ -194,7 +195,7 @@ _unused_ static void test_compress_stream(const char *compression,
|
|||||||
|
|
||||||
assert_se((dst = mkostemp_safe(pattern)) >= 0);
|
assert_se((dst = mkostemp_safe(pattern)) >= 0);
|
||||||
|
|
||||||
assert_se(compress(src, dst, -1, &uncompressed_size) == 0);
|
assert_se(compress(src, dst, -1, &uncompressed_size) == flag);
|
||||||
|
|
||||||
if (cat) {
|
if (cat) {
|
||||||
assert_se(asprintf(&cmd, "%s %s | diff %s -", cat, pattern, srcfile) > 0);
|
assert_se(asprintf(&cmd, "%s %s | diff %s -", cat, pattern, srcfile) > 0);
|
||||||
@ -292,9 +293,11 @@ int main(int argc, char *argv[]) {
|
|||||||
random_bytes(data + 7, sizeof(data) - 7);
|
random_bytes(data + 7, sizeof(data) - 7);
|
||||||
|
|
||||||
#if HAVE_XZ
|
#if HAVE_XZ
|
||||||
test_compress_decompress("XZ", compress_blob_xz, decompress_blob_xz,
|
test_compress_decompress(OBJECT_COMPRESSED_XZ, "XZ",
|
||||||
|
compress_blob_xz, decompress_blob_xz,
|
||||||
text, sizeof(text), false);
|
text, sizeof(text), false);
|
||||||
test_compress_decompress("XZ", compress_blob_xz, decompress_blob_xz,
|
test_compress_decompress(OBJECT_COMPRESSED_XZ, "XZ",
|
||||||
|
compress_blob_xz, decompress_blob_xz,
|
||||||
data, sizeof(data), true);
|
data, sizeof(data), true);
|
||||||
|
|
||||||
test_decompress_startswith("XZ",
|
test_decompress_startswith("XZ",
|
||||||
@ -307,7 +310,7 @@ int main(int argc, char *argv[]) {
|
|||||||
compress_blob_xz, decompress_startswith_xz,
|
compress_blob_xz, decompress_startswith_xz,
|
||||||
huge, HUGE_SIZE, true);
|
huge, HUGE_SIZE, true);
|
||||||
|
|
||||||
test_compress_stream("XZ", "xzcat",
|
test_compress_stream(OBJECT_COMPRESSED_XZ, "XZ", "xzcat",
|
||||||
compress_stream_xz, decompress_stream_xz, srcfile);
|
compress_stream_xz, decompress_stream_xz, srcfile);
|
||||||
|
|
||||||
test_decompress_startswith_short("XZ", compress_blob_xz, decompress_startswith_xz);
|
test_decompress_startswith_short("XZ", compress_blob_xz, decompress_startswith_xz);
|
||||||
@ -317,9 +320,11 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_LZ4
|
#if HAVE_LZ4
|
||||||
test_compress_decompress("LZ4", compress_blob_lz4, decompress_blob_lz4,
|
test_compress_decompress(OBJECT_COMPRESSED_LZ4, "LZ4",
|
||||||
|
compress_blob_lz4, decompress_blob_lz4,
|
||||||
text, sizeof(text), false);
|
text, sizeof(text), false);
|
||||||
test_compress_decompress("LZ4", compress_blob_lz4, decompress_blob_lz4,
|
test_compress_decompress(OBJECT_COMPRESSED_LZ4, "LZ4",
|
||||||
|
compress_blob_lz4, decompress_blob_lz4,
|
||||||
data, sizeof(data), true);
|
data, sizeof(data), true);
|
||||||
|
|
||||||
test_decompress_startswith("LZ4",
|
test_decompress_startswith("LZ4",
|
||||||
@ -332,7 +337,7 @@ int main(int argc, char *argv[]) {
|
|||||||
compress_blob_lz4, decompress_startswith_lz4,
|
compress_blob_lz4, decompress_startswith_lz4,
|
||||||
huge, HUGE_SIZE, true);
|
huge, HUGE_SIZE, true);
|
||||||
|
|
||||||
test_compress_stream("LZ4", "lz4cat",
|
test_compress_stream(OBJECT_COMPRESSED_LZ4, "LZ4", "lz4cat",
|
||||||
compress_stream_lz4, decompress_stream_lz4, srcfile);
|
compress_stream_lz4, decompress_stream_lz4, srcfile);
|
||||||
|
|
||||||
test_lz4_decompress_partial();
|
test_lz4_decompress_partial();
|
||||||
@ -344,9 +349,11 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_ZSTD
|
#if HAVE_ZSTD
|
||||||
test_compress_decompress("ZSTD", compress_blob_zstd, decompress_blob_zstd,
|
test_compress_decompress(OBJECT_COMPRESSED_ZSTD, "ZSTD",
|
||||||
|
compress_blob_zstd, decompress_blob_zstd,
|
||||||
text, sizeof(text), false);
|
text, sizeof(text), false);
|
||||||
test_compress_decompress("ZSTD", compress_blob_zstd, decompress_blob_zstd,
|
test_compress_decompress(OBJECT_COMPRESSED_ZSTD, "ZSTD",
|
||||||
|
compress_blob_zstd, decompress_blob_zstd,
|
||||||
data, sizeof(data), true);
|
data, sizeof(data), true);
|
||||||
|
|
||||||
test_decompress_startswith("ZSTD",
|
test_decompress_startswith("ZSTD",
|
||||||
@ -359,7 +366,7 @@ int main(int argc, char *argv[]) {
|
|||||||
compress_blob_zstd, decompress_startswith_zstd,
|
compress_blob_zstd, decompress_startswith_zstd,
|
||||||
huge, HUGE_SIZE, true);
|
huge, HUGE_SIZE, true);
|
||||||
|
|
||||||
test_compress_stream("ZSTD", "zstdcat",
|
test_compress_stream(OBJECT_COMPRESSED_ZSTD, "ZSTD", "zstdcat",
|
||||||
compress_stream_zstd, decompress_stream_zstd, srcfile);
|
compress_stream_zstd, decompress_stream_zstd, srcfile);
|
||||||
|
|
||||||
test_decompress_startswith_short("ZSTD", compress_blob_zstd, decompress_startswith_zstd);
|
test_decompress_startswith_short("ZSTD", compress_blob_zstd, decompress_startswith_zstd);
|
||||||
|
|||||||
@ -94,7 +94,7 @@ fi
|
|||||||
|
|
||||||
PATH_TO_INIT="$ROOTLIBDIR/systemd"
|
PATH_TO_INIT="$ROOTLIBDIR/systemd"
|
||||||
SYSTEMD_JOURNALD="${SYSTEMD_JOURNALD:-$(command -v "$BUILD_DIR/systemd-journald" || command -v "$ROOTLIBDIR/systemd-journald")}"
|
SYSTEMD_JOURNALD="${SYSTEMD_JOURNALD:-$(command -v "$BUILD_DIR/systemd-journald" || command -v "$ROOTLIBDIR/systemd-journald")}"
|
||||||
SYSTEMD_JOURNAL_REMOTE="${SYSTEMD_JOURNAL_REMOTE:-$(command -v "$BUILD_DIR/systemd-journal-remote" || command -v "$ROOTLIBDIR/systemd-journal-remote")}"
|
SYSTEMD_JOURNAL_REMOTE="${SYSTEMD_JOURNAL_REMOTE:-$(command -v "$BUILD_DIR/systemd-journal-remote" || command -v "$ROOTLIBDIR/systemd-journal-remote" || echo "")}"
|
||||||
SYSTEMD="${SYSTEMD:-$(command -v "$BUILD_DIR/systemd" || command -v "$ROOTLIBDIR/systemd")}"
|
SYSTEMD="${SYSTEMD:-$(command -v "$BUILD_DIR/systemd" || command -v "$ROOTLIBDIR/systemd")}"
|
||||||
SYSTEMD_NSPAWN="${SYSTEMD_NSPAWN:-$(command -v "$BUILD_DIR/systemd-nspawn" || command -v systemd-nspawn)}"
|
SYSTEMD_NSPAWN="${SYSTEMD_NSPAWN:-$(command -v "$BUILD_DIR/systemd-nspawn" || command -v systemd-nspawn)}"
|
||||||
JOURNALCTL="${JOURNALCTL:-$(command -v "$BUILD_DIR/journalctl" || command -v journalctl)}"
|
JOURNALCTL="${JOURNALCTL:-$(command -v "$BUILD_DIR/journalctl" || command -v journalctl)}"
|
||||||
@ -1456,8 +1456,12 @@ save_journal() {
|
|||||||
|
|
||||||
for j in "${1:?}"/*; do
|
for j in "${1:?}"/*; do
|
||||||
if get_bool "$save"; then
|
if get_bool "$save"; then
|
||||||
|
if [ "$SYSTEMD_JOURNAL_REMOTE" = "" ]; then
|
||||||
|
cp -a "$j" "$dest"
|
||||||
|
else
|
||||||
"$SYSTEMD_JOURNAL_REMOTE" -o "$dest" --getter="$JOURNALCTL -o export -D $j"
|
"$SYSTEMD_JOURNAL_REMOTE" -o "$dest" --getter="$JOURNALCTL -o export -D $j"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${TEST_SHOW_JOURNAL}" ]; then
|
if [ -n "${TEST_SHOW_JOURNAL}" ]; then
|
||||||
echo "---- $j ----"
|
echo "---- $j ----"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user