summaryrefslogtreecommitdiff
path: root/lib/comp
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-11 15:04:59 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-11 15:06:28 +0200
commita3a47476c5ceed1688e37a5af8a5a988b504832e (patch)
treee64d9f67a34d7e56d2a5b1fcf023cbec5aa29f55 /lib/comp
parentff5d648629a5076175430564dcc60da2b28d1ee1 (diff)
Cleanup dependency handling
Always try to gather all compressor libraries available, but only complain about missing a one if it has been *explicitly* selected. If a compressor has been explicityl disabled, we can still turn it off after checking. Also, rework gensquashfs to set the default compressor based on what's available. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/comp')
-rw-r--r--lib/comp/compressor.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/comp/compressor.c b/lib/comp/compressor.c
index 44b3643..6dff416 100644
--- a/lib/comp/compressor.c
+++ b/lib/comp/compressor.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
#include <string.h>
+#include <stdlib.h>
#include <stdio.h>
#include "internal.h"
@@ -127,3 +128,21 @@ void compressor_print_help(E_SQFS_COMPRESSOR id)
helpfuns[id]();
}
+
+E_SQFS_COMPRESSOR compressor_get_default(void)
+{
+#if defined(WITH_XZ)
+ return SQFS_COMP_XZ;
+#elif defined(WITH_ZSTD)
+ return SQFS_COMP_ZSTD;
+#elif defined(WITH_GZIP)
+ return SQFS_COMP_GZIP;
+#elif defined(WITH_LZO)
+ return SQFS_COMP_LZO;
+#elif defined(WITH_LZ4)
+ return SQFS_COMP_LZ4;
+#else
+ fputs("No compressor implementation available!\n", stderr);
+ exit(EXIT_FAILURE);
+#endif
+}