[PATCH] libdwfl: Add ZSTD support.
Mark Wielaard
mark@klomp.org
Mon Sep 21 13:18:02 GMT 2020
Hi,
On Fri, 2020-09-18 at 15:17 +0200, Mark Wielaard wrote:
> Newer kernels might be compressed using ZSTD add support to libdwfl
> open so we can can automatically read ZSTD compressed files and
> kernel images.
>
> The support is very similar to the bzip2 and lzma support, but
> slightly different. With a bit more macros it could maybe have used
> the gzip.c USE_INFLATE code path. But I felt that the many macros
> didn't really help understand the code. So the unzip routine has a
> slightly different code path for ZSTD.
This seems to work as intended. I pushed it with one small tweak we
discussed on irc:
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 253ae069..344db7c1 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -8,6 +8,7 @@
(unzip): Change pread_retry failure from zlib_fail to fail.
Add ZSTD support.
* open.c (decompress): Also try __libdw_unzstd.
+ * linux-kernel-modules.c (check_suffix): Also TRY ".ko.zst".
2020-08-20 Dmitry V. Levin <ldv@altlinux.org>
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 548cb56f..6edb27f2 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -357,6 +357,9 @@ check_suffix (const FTSENT *f, size_t namelen)
#if USE_LZMA
TRY (".ko.xz");
#endif
+#if USE_ZSTD
+ TRY (".ko.zst");
+#endif
return 0;
This makes sure that once kernel modules are also zstd compressed we'll
pick them up automagically (they currently aren't but the check is a
simple memcmp and the extension is standard).
Cheers,
Mark
More information about the Elfutils-devel
mailing list