From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7D7DC433FE for ; Tue, 24 May 2022 15:24:07 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.10855.1653405846659825806 for ; Tue, 24 May 2022 08:24:06 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AEBD0ED1; Tue, 24 May 2022 08:24:05 -0700 (PDT) Received: from oss-tx204.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 432823F70D; Tue, 24 May 2022 08:24:05 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Cc: nd@arm.com Subject: [PATCH 2/9] btrfs-tools: add a PACKAGECONFIG for lzo Date: Tue, 24 May 2022 16:23:54 +0100 Message-Id: <20220524152401.1663317-2-ross.burton@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220524152401.1663317-1-ross.burton@arm.com> References: <20220524152401.1663317-1-ross.burton@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 24 May 2022 15:24:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/166072 LZO is a fairly obsolete compression format these days, so add an option to enable/disable LZO to btrfs-progs and disable it by default. Signed-off-by: Ross Burton --- .../btrfs-tools/btrfs-tools/lzo-option.patch | 126 ++++++++++++++++++ .../btrfs-tools/btrfs-tools_5.16.2.bb | 4 +- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-opt= ion.patch diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.pat= ch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch new file mode 100644 index 00000000000..e6e85562d7c --- /dev/null +++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch @@ -0,0 +1,126 @@ +Upstream-Status: Submitted [https://github.com/kdave/btrfs-progs/pull/47= 4] +Signed-off-by: Ross Burton + +From 4f4eafe8ebcc86f84f6c85a5c5814c430d8f190c Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 24 May 2022 13:44:29 +0100 +Subject: [PATCH] btrfs-progs: add option to disable LZO support + +LZO as a compression format is pretty archaic these days, there are +better algorithsm in all metrics for compression and decompression, and +lzo hasn't had a new release since 2017. + +Add an option to disable LZO (defaulting to enabled), and respect it in +cmds/restore.c. + +Signed-off-by: Ross Burton +--- + Makefile | 2 +- + Makefile.inc.in | 1 + + cmds/restore.c | 7 +++++++ + configure.ac | 30 ++++++++++++++++++++---------- + 4 files changed, 29 insertions(+), 11 deletions(-) + +diff --git a/Makefile b/Makefile +index af4908f9..0e8e05f3 100644 +--- a/Makefile ++++ b/Makefile +@@ -335,7 +335,7 @@ endif + btrfs_convert_cflags =3D -DBTRFSCONVERT_EXT2=3D$(BTRFSCONVERT_EXT2) + btrfs_convert_cflags +=3D -DBTRFSCONVERT_REISERFS=3D$(BTRFSCONVERT_REIS= ERFS) + btrfs_fragments_libs =3D -lgd -lpng -ljpeg -lfreetype +-cmds_restore_cflags =3D -DBTRFSRESTORE_ZSTD=3D$(BTRFSRESTORE_ZSTD) ++cmds_restore_cflags =3D -DBTRFSRESTORE_LZO=3D$(BTRFSRESTORE_LZO) -DBTRF= SRESTORE_ZSTD=3D$(BTRFSRESTORE_ZSTD) +=20 + ifeq ($(CRYPTOPROVIDER_BUILTIN),1) + CRYPTO_OBJECTS =3D crypto/sha224-256.o crypto/blake2b-ref.o +diff --git a/Makefile.inc.in b/Makefile.inc.in +index c995aef9..385b7ae1 100644 +--- a/Makefile.inc.in ++++ b/Makefile.inc.in +@@ -16,6 +16,7 @@ BUILD_PROGRAMS =3D @BUILD_PROGRAMS@ + BUILD_SHARED_LIBRARIES =3D @BUILD_SHARED_LIBRARIES@ + BUILD_STATIC_LIBRARIES =3D @BUILD_STATIC_LIBRARIES@ + BTRFSCONVERT_EXT2 =3D @BTRFSCONVERT_EXT2@ ++BTRFSRESTORE_LZO =3D @BTRFSRESTORE_LZO@ + BTRFSCONVERT_REISERFS =3D @BTRFSCONVERT_REISERFS@ + BTRFSRESTORE_ZSTD =3D @BTRFSRESTORE_ZSTD@ + PYTHON_BINDINGS =3D @PYTHON_BINDINGS@ +diff --git a/cmds/restore.c b/cmds/restore.c +index 5923d571..4dd79fce 100644 +--- a/cmds/restore.c ++++ b/cmds/restore.c +@@ -25,8 +25,10 @@ + #include + #include + #include ++#if BTRFSRESTORE_LZO + #include + #include ++#endif + #include + #if BTRFSRESTORE_ZSTD + #include +@@ -98,6 +100,10 @@ static inline size_t read_compress_length(unsigned c= har *buf) + static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf= , + char *outbuf, u64 compress_len, u64 *decompress_len) + { ++#if !BTRFSRESTORE_LZO ++ error("btrfs not compiled with lzo support"); ++ return -1; ++#else + size_t new_len; + size_t in_len; + size_t out_len =3D 0; +@@ -156,6 +162,7 @@ static int decompress_lzo(struct btrfs_root *root, u= nsigned char *inbuf, + *decompress_len =3D out_len; +=20 + return 0; ++#endif + } +=20 + static int decompress_zstd(const char *inbuf, char *outbuf, u64 compres= s_len, +diff --git a/configure.ac b/configure.ac +index d907636b..c1ad2c22 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -372,16 +372,26 @@ if ${PKG_CONFIG} udev --atleast-version 190; then + fi + AC_SUBST(UDEVDIR) +=20 +-dnl lzo library does not provide pkg-config, let use classic way +-AC_CHECK_LIB([lzo2], [lzo_version], [ +- LZO2_LIBS=3D"-llzo2" +- LZO2_CFLAGS=3D"" +- LZO2_LIBS_STATIC=3D"-llzo2"],[ +- AC_MSG_ERROR([cannot find lzo2 library]) +-]) +-AC_SUBST([LZO2_LIBS]) +-AC_SUBST([LZO2_LIBS_STATIC]) +-AC_SUBST([LZO2_CFLAGS]) ++AC_ARG_ENABLE([lzo], ++ AS_HELP_STRING([--disable-lzo], [build without lzo support]), ++ [], [enable_lzo=3Dyes] ++) ++ ++if test "x$enable_lzo" =3D xyes; then ++ dnl lzo library does not provide pkg-config, let use classic way ++ AC_CHECK_LIB([lzo2], [lzo_version], [ ++ LZO2_LIBS=3D"-llzo2" ++ LZO2_CFLAGS=3D"" ++ LZO2_LIBS_STATIC=3D"-llzo2"],[ ++ AC_MSG_ERROR([cannot find lzo2 library]) ++ ]) ++ AC_SUBST([LZO2_LIBS]) ++ AC_SUBST([LZO2_LIBS_STATIC]) ++ AC_SUBST([LZO2_CFLAGS]) ++fi ++ ++AS_IF([test "x$enable_lzo" =3D xyes], [BTRFSRESTORE_LZO=3D1], [BTRFSRES= TORE_LZO=3D0]) ++AC_SUBST(BTRFSRESTORE_LZO) +=20 + dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir + m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please inst= all pkgconf])]) +--=20 +2.25.1 + diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb b/me= ta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb index 4ab486c465c..88b5c6259cf 100644 --- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb +++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb @@ -13,10 +13,11 @@ LIC_FILES_CHKSUM =3D " \ file://libbtrfsutil/COPYING;md5=3D4fbd65380cdd255951079008b364516c \ " SECTION =3D "base" -DEPENDS =3D "lzo util-linux zlib" +DEPENDS =3D "util-linux zlib" =20 SRC_URI =3D "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-p= rogs.git;branch=3Dmaster \ file://0001-Add-a-possibility-to-specify-where-python-modules= -ar.patch \ + file://lzo-option.patch \ " SRCREV =3D "31458c9c81935abbed010221261897273a98d2c1" S =3D "${WORKDIR}/git" @@ -32,6 +33,7 @@ PACKAGECONFIG[programs] =3D "--enable-programs,--disabl= e-programs" PACKAGECONFIG[convert] =3D "--enable-convert --with-convert=3Dext2,--dis= able-convert --without-convert,e2fsprogs" PACKAGECONFIG[zoned] =3D "--enable-zoned,--disable-zoned" PACKAGECONFIG[python] =3D "--enable-python,--disable-python,python3-setu= ptools-native" +PACKAGECONFIG[lzo] =3D "--enable-lzo,--disable-lzo,lzo" PACKAGECONFIG[zstd] =3D "--enable-zstd,--disable-zstd,zstd" PACKAGECONFIG[udev] =3D "--enable-libudev,--disable-libudev,udev" =20 --=20 2.25.1