summaryrefslogtreecommitdiff
path: root/src/journal/journal-def.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-03 22:42:22 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-06 19:06:03 -0400
commitd89c8fdf48c7bad5816b9f2e77e8361721f22517 (patch)
tree12d384fffafa1789079b7ed51c4d33d5d10116c0 /src/journal/journal-def.h
parent5e592c66bdf76dfc8445b332f7a5088ca504ee90 (diff)
journal: add LZ4 as optional compressor
Add liblz4 as an optional dependency when requested with --enable-lz4, and use it in preference to liblzma for journal blob and coredump compression. To retain backwards compatibility, XZ is used to decompress old blobs. Things will function correctly only with lz4-119. Based on the benchmarks found on the web, lz4 seems to be the best choice for "quick" compressors atm. For pkg-config status, see http://code.google.com/p/lz4/issues/detail?id=135.
Diffstat (limited to 'src/journal/journal-def.h')
-rw-r--r--src/journal/journal-def.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index 7e407a416c..ecfa9a2b16 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -66,9 +66,13 @@ enum {
/* Object flags */
enum {
- OBJECT_COMPRESSED = 1
+ OBJECT_COMPRESSED_XZ = 1 << 0,
+ OBJECT_COMPRESSED_LZ4 = 1 << 1,
+ _OBJECT_COMPRESSED_MAX
};
+#define OBJECT_COMPRESSION_MASK (OBJECT_COMPRESSED_XZ | OBJECT_COMPRESSED_LZ4)
+
struct ObjectHeader {
uint8_t type;
uint8_t flags;
@@ -155,13 +159,33 @@ enum {
/* Header flags */
enum {
- HEADER_INCOMPATIBLE_COMPRESSED = 1
+ HEADER_INCOMPATIBLE_COMPRESSED_XZ = 1 << 0,
+ HEADER_INCOMPATIBLE_COMPRESSED_LZ4 = 1 << 1,
};
+#define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
+
+#if defined(HAVE_XZ) && defined(HAVE_LZ4)
+# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
+#elif defined(HAVE_XZ)
+# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
+#elif defined(HAVE_LZ4)
+# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
+#else
+# define HEADER_INCOMPATIBLE_SUPPORTED 0
+#endif
+
enum {
HEADER_COMPATIBLE_SEALED = 1
};
+#define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
+#if HAVE_GCRYPT
+# define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
+#else
+# define HEADER_COMPATIBLE_SUPPORTED 0
+#endif
+
#define HEADER_SIGNATURE ((char[]) { 'L', 'P', 'K', 'S', 'H', 'H', 'R', 'H' })
struct Header {