chiark / gitweb /
coredump: don't expose the compression level as configuration option
authorLennart Poettering <lennart@poettering.net>
Fri, 27 Jun 2014 17:04:31 +0000 (19:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 27 Jun 2014 17:35:57 +0000 (19:35 +0200)
This sounds overly low-level and implementation-detaily. Let's just
use the default level XZ suggests. This gives us more room to possibly
swap out the compression algorithm used, as the compression level range
will not leak into user configuration.

man/coredump.conf.xml
src/journal/coredump.c
src/journal/coredump.conf

index e24d958..cc54466 100644 (file)
       </varlistentry>
 
       <varlistentry>
-        <term><varname>CompressionLevel=</varname></term>
-
-        <listitem><para>Controls the level of compression for external
-        storage. An integer between 0 and 9. See
-        <citerefentry><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-        for more details.</para></listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><varname>ProcessSizeMax=</varname></term>
 
         <listitem><para>The maximum size in bytes of a core
index 6499fbd..28cde66 100644 (file)
@@ -121,7 +121,6 @@ static DEFINE_CONFIG_PARSE_ENUM(config_parse_coredump_compression, coredump_comp
 
 static CoredumpStorage arg_storage = COREDUMP_STORAGE_EXTERNAL;
 static CoredumpCompression arg_compression = COREDUMP_COMPRESSION_XZ;
-static unsigned arg_compression_level = LZMA_PRESET_DEFAULT;
 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,12 +128,9 @@ static off_t arg_keep_free = (off_t) -1;
 static off_t arg_max_use = (off_t) -1;
 
 static int parse_config(void) {
-        int r;
-
         static const ConfigTableItem items[] = {
                 { "Coredump", "Storage",          config_parse_coredump_storage,     0, &arg_storage           },
                 { "Coredump", "Compression",      config_parse_coredump_compression, 0, &arg_compression       },
-                { "Coredump", "CompressionLevel", config_parse_unsigned,             0, &arg_compression_level },
                 { "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  },
@@ -143,7 +139,7 @@ static int parse_config(void) {
                 {}
         };
 
-        r = config_parse(
+        return config_parse(
                         NULL,
                         "/etc/systemd/coredump.conf",
                         NULL,
@@ -153,15 +149,6 @@ static int parse_config(void) {
                         false,
                         false,
                         NULL);
-
-#ifdef HAVE_XZ
-        if (arg_compression_level > 9) {
-                log_warning("Invalid CompressionLevel %u, ignoring.", arg_compression_level);
-                arg_compression_level = LZMA_PRESET_DEFAULT;
-        }
-#endif
-
-        return r;
 }
 
 static int fix_acl(int fd, uid_t uid) {
@@ -380,7 +367,7 @@ static int save_external_coredump(
                         goto uncompressed;
                 }
 
-                r = compress_stream(fd, fd2, arg_compression_level, -1);
+                r = compress_stream(fd, fd2, LZMA_PRESET_DEFAULT, -1);
                 if (r < 0) {
                         log_error("Failed to compress %s: %s", tmp2, strerror(-r));
                         unlink_noerrno(tmp2);
@@ -508,9 +495,8 @@ int main(int argc, char* argv[]) {
         parse_config();
         log_debug("Selected storage '%s'.",
                   coredump_storage_to_string(arg_storage));
-        log_debug("Selected compression %s:%u.",
-                  coredump_compression_to_string(arg_compression),
-                  arg_compression_level);
+        log_debug("Selected compression %s.",
+                  coredump_compression_to_string(arg_compression));
 
         r = parse_uid(argv[INFO_UID + 1], &uid);
         if (r < 0) {
index 050bde6..20424f2 100644 (file)
@@ -10,8 +10,6 @@
 [Coredump]
 #Storage=external
 #Compression=xz
-#CompressionLevel=6
-
 #ProcessSizeMax=2G
 #ExternalSizeMax=2G
 #JournalSizeMax=767M