[PATCH] eal/unix: support ZSTD compression for firmwares
David Marchand
david.marchand at redhat.com
Mon May 13 11:46:56 CEST 2024
On Wed, May 8, 2024 at 12:50 PM Bruce Richardson
<bruce.richardson at intel.com> wrote:
>
> On Wed, May 08, 2024 at 11:52:14AM +0200, David Marchand wrote:
> > Ubuntu 24.04 started to compress firmwares with ZSTD compression.
> >
> > Bugzilla ID: 1437
> >
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
> > ---
> > lib/eal/unix/eal_firmware.c | 42 +++++++++++++++++++++++++++++--------
> > 1 file changed, 33 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c
> > index 1d47e879c8..065e251f9d 100644
> > --- a/lib/eal/unix/eal_firmware.c
> > +++ b/lib/eal/unix/eal_firmware.c
> > @@ -16,6 +16,21 @@
> > #include "eal_firmware.h"
> > #include "eal_private.h"
> >
> > +#ifndef RTE_HAS_LIBARCHIVE
> > +/* Fake definitions for the compression_algorithms array below. */
> > +struct archive;
> > +extern int archive_read_support_filter_xz(struct archive *a);
> > +extern int archive_read_support_filter_zstd(struct archive *a);
> > +#endif
> > +
>
> Do these not lead to unresolved symbols on link?
Obviously yes... sorry, I was not thinking right and did really
limited testing before sending (only compiled librte_eal.a).
I'll fix this.
>
> > +static struct {
> > + const char *suffix;
> > + int (*support_callback)(struct archive *a);
> > +} compression_algorithms[] = {
> > + { "xz", archive_read_support_filter_xz, },
> > + { "zst", archive_read_support_filter_zstd, },
> > +};
> > +
>
> Rather than defining stubs for these functions from libarchive, can you
> just have an empty list if no libarchive?
>
> struct archive; /* may need to be #ifdef'ed perhaps? */
> static struct {
> const char *suffix;
> int (*support_callback)(struct archive *a);
> } compression_algorithms[] = {
> #ifdef RTE_HAS_LIBARCHIVE
> { "xz", archive_read_support_filter_xz, },
> { "zst", archive_read_support_filter_zstd, },
> #endif
> };
That's an option, but then we lose a warning message to the user
telling that some compressed files are on the system, and linking with
libarchive could help.
I think I'll keep an array of supported extensions and put explicit
calls to archive_read_support_filter_xz/archive_read_support_filter_zstd
under #ifdef.
--
David Marchand
More information about the dev
mailing list