summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-27 19:09:22 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-27 19:35:57 +0200
commit8c9571d0ae50656f730a5e37378d5c3dcf3b9789 (patch)
tree70bbcb326d57d11a748522bb25b37dd65d093ed1 /src/journal
parentcf677ac1b7ae1e46c593d055df27f36528be548a (diff)
coredump: replace Compression= setting by simpler Compress= boolean setting
Let's move things closer to journald's configuration settings, which knows Compress= already, as a boolean. This makes things more uniform, but also gives us more freedom to possibly swap out the used compression algorithm one day.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/coredump.c46
-rw-r--r--src/journal/coredump.conf2
2 files changed, 14 insertions, 34 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 28cde66954..0dae0afe01 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -98,29 +98,10 @@ static const char* const coredump_storage_table[_COREDUMP_STORAGE_MAX] = {
};
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(coredump_storage, CoredumpStorage);
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_storage, coredump_storage,
- CoredumpStorage,
- "Failed to parse storage setting");
-
-typedef enum CoredumpCompression {
- COREDUMP_COMPRESSION_NONE,
- COREDUMP_COMPRESSION_XZ,
- _COREDUMP_COMPRESSION_MAX,
- _COREDUMP_COMPRESSION_INVALID = -1
-} CoredumpCompression;
-
-static const char* const coredump_compression_table[_COREDUMP_COMPRESSION_MAX] = {
- [COREDUMP_COMPRESSION_NONE] = "none",
- [COREDUMP_COMPRESSION_XZ] = "xz",
-};
-
-DEFINE_PRIVATE_STRING_TABLE_LOOKUP(coredump_compression, CoredumpCompression);
-static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_compression, coredump_compression,
- CoredumpCompression,
- "Failed to parse compression setting");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_storage, coredump_storage, CoredumpStorage, "Failed to parse storage setting");
static CoredumpStorage arg_storage = COREDUMP_STORAGE_EXTERNAL;
-static CoredumpCompression arg_compression = COREDUMP_COMPRESSION_XZ;
+static bool arg_compress = true;
static off_t arg_process_size_max = PROCESS_SIZE_MAX;
static off_t arg_external_size_max = EXTERNAL_SIZE_MAX;
static size_t arg_journal_size_max = JOURNAL_SIZE_MAX;
@@ -129,13 +110,13 @@ static off_t arg_max_use = (off_t) -1;
static int parse_config(void) {
static const ConfigTableItem items[] = {
- { "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage },
- { "Coredump", "Compression", config_parse_coredump_compression, 0, &arg_compression },
- { "Coredump", "ProcessSizeMax", config_parse_iec_off, 0, &arg_process_size_max },
- { "Coredump", "ExternalSizeMax", config_parse_iec_off, 0, &arg_external_size_max },
- { "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max },
- { "Coredump", "KeepFree", config_parse_iec_off, 0, &arg_keep_free },
- { "Coredump", "MaxUse", config_parse_iec_off, 0, &arg_max_use },
+ { "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage },
+ { "Coredump", "Compress", config_parse_bool, 0, &arg_compress },
+ { "Coredump", "ProcessSizeMax", config_parse_iec_off, 0, &arg_process_size_max },
+ { "Coredump", "ExternalSizeMax", config_parse_iec_off, 0, &arg_external_size_max },
+ { "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max },
+ { "Coredump", "KeepFree", config_parse_iec_off, 0, &arg_keep_free },
+ { "Coredump", "MaxUse", config_parse_iec_off, 0, &arg_max_use },
{}
};
@@ -354,7 +335,7 @@ static int save_external_coredump(
#ifdef HAVE_XZ
/* If we will remove the coredump anyway, do not compress. */
if (maybe_remove_external_coredump(NULL, st.st_size) == 0
- && arg_compression == COREDUMP_COMPRESSION_XZ) {
+ && arg_compress) {
_cleanup_free_ char *fn2 = NULL;
char *tmp2;
@@ -493,10 +474,9 @@ int main(int argc, char* argv[]) {
/* Ignore all parse errors */
parse_config();
- log_debug("Selected storage '%s'.",
- coredump_storage_to_string(arg_storage));
- log_debug("Selected compression %s.",
- coredump_compression_to_string(arg_compression));
+
+ log_debug("Selected storage '%s'.", coredump_storage_to_string(arg_storage));
+ log_debug("Selected compression %s.", yes_no(arg_compress));
r = parse_uid(argv[INFO_UID + 1], &uid);
if (r < 0) {
diff --git a/src/journal/coredump.conf b/src/journal/coredump.conf
index 20424f2138..0cc328f549 100644
--- a/src/journal/coredump.conf
+++ b/src/journal/coredump.conf
@@ -9,7 +9,7 @@
[Coredump]
#Storage=external
-#Compression=xz
+#Compress=yes
#ProcessSizeMax=2G
#ExternalSizeMax=2G
#JournalSizeMax=767M