All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
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	[thread overview]
Message-ID: <20220524152401.1663317-2-ross.burton@arm.com> (raw)
In-Reply-To: <20220524152401.1663317-1-ross.burton@arm.com>

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 <ross.burton@arm.com>
---
 .../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-option.patch

diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch 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/474]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 4f4eafe8ebcc86f84f6c85a5c5814c430d8f190c Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+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 <ross.burton@arm.com>
+---
+ 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 = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
+ btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS)
+ btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
+-cmds_restore_cflags = -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
++cmds_restore_cflags = -DBTRFSRESTORE_LZO=$(BTRFSRESTORE_LZO) -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
+ 
+ ifeq ($(CRYPTOPROVIDER_BUILTIN),1)
+ CRYPTO_OBJECTS = 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 = @BUILD_PROGRAMS@
+ BUILD_SHARED_LIBRARIES = @BUILD_SHARED_LIBRARIES@
+ BUILD_STATIC_LIBRARIES = @BUILD_STATIC_LIBRARIES@
+ BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
++BTRFSRESTORE_LZO = @BTRFSRESTORE_LZO@
+ BTRFSCONVERT_REISERFS = @BTRFSCONVERT_REISERFS@
+ BTRFSRESTORE_ZSTD = @BTRFSRESTORE_ZSTD@
+ PYTHON_BINDINGS = @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 <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#if BTRFSRESTORE_LZO
+ #include <lzo/lzoconf.h>
+ #include <lzo/lzo1x.h>
++#endif
+ #include <zlib.h>
+ #if BTRFSRESTORE_ZSTD
+ #include <zstd.h>
+@@ -98,6 +100,10 @@ static inline size_t read_compress_length(unsigned char *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 = 0;
+@@ -156,6 +162,7 @@ static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf,
+ 	*decompress_len = out_len;
+ 
+ 	return 0;
++#endif
+ }
+ 
+ static int decompress_zstd(const char *inbuf, char *outbuf, u64 compress_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)
+ 
+-dnl lzo library does not provide pkg-config, let use classic way
+-AC_CHECK_LIB([lzo2], [lzo_version], [
+-	LZO2_LIBS="-llzo2"
+-	LZO2_CFLAGS=""
+-	LZO2_LIBS_STATIC="-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=yes]
++)
++
++if test "x$enable_lzo" = xyes; then
++	dnl lzo library does not provide pkg-config, let use classic way
++	AC_CHECK_LIB([lzo2], [lzo_version], [
++		LZO2_LIBS="-llzo2"
++		LZO2_CFLAGS=""
++		LZO2_LIBS_STATIC="-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" = xyes], [BTRFSRESTORE_LZO=1], [BTRFSRESTORE_LZO=0])
++AC_SUBST(BTRFSRESTORE_LZO)
+ 
+ dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir
+ m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please install pkgconf])])
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb b/meta/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 = " \
     file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \
 "
 SECTION = "base"
-DEPENDS = "lzo util-linux zlib"
+DEPENDS = "util-linux zlib"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \
            file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
+           file://lzo-option.patch \
            "
 SRCREV = "31458c9c81935abbed010221261897273a98d2c1"
 S = "${WORKDIR}/git"
@@ -32,6 +33,7 @@ PACKAGECONFIG[programs] = "--enable-programs,--disable-programs"
 PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs"
 PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned"
 PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native"
+PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
 PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd"
 PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev"
 
-- 
2.25.1



  reply	other threads:[~2022-05-24 15:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 15:23 [PATCH 1/9] lzo: Add further info to a patch Ross Burton
2022-05-24 15:23 ` Ross Burton [this message]
2022-05-24 15:23 ` [PATCH 3/9] mtd-utils: disable LZO by default Ross Burton
2022-05-25  9:33   ` [OE-core] " richard.purdie
2022-05-25 10:34     ` Ross Burton
2022-05-25 11:38       ` richard.purdie
2022-05-24 15:23 ` [PATCH 4/9] squashfs-tools: " Ross Burton
2022-05-24 15:23 ` [PATCH 5/9] libarchive: " Ross Burton
2022-05-24 15:23 ` [PATCH 6/9] lzop: remove recipe from oe-core Ross Burton
2022-05-24 15:23 ` [PATCH 7/9] oeqa/selftest/imagefeatures: don't exercise lzo compression Ross Burton
2022-05-24 15:24 ` [PATCH 8/9] packagegroup-self-hosted: remove lzo Ross Burton
2022-05-24 15:24 ` [PATCH 9/9] lzo: remove recipe from oe-core Ross Burton
2022-05-25  8:03   ` [OE-core] " Luca Ceresoli
2022-05-25 11:26     ` Ross Burton
2022-05-25 12:59       ` Bruce Ashfield
2022-05-25 13:45         ` Ross Burton
2022-05-25 13:55           ` Bruce Ashfield
2022-05-25  8:00 ` [OE-core] [PATCH 1/9] lzo: Add further info to a patch Luca Ceresoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220524152401.1663317-2-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=nd@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.