From 92b57e4fd8261b51eb74f9f2aa4e904ff597ce2b Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 21 Jun 2022 01:53:05 +0200 Subject: [PATCH] btrfs-progs: build: rename compression support variables Now that LZO and ZSTD are optional for not just restore, rename the build variables to a more generic name and update configure summary. Signed-off-by: David Sterba --- Makefile | 6 +++--- Makefile.inc.in | 4 ++-- cmds/receive.c | 18 +++++++++--------- cmds/restore.c | 12 ++++++------ configure.ac | 15 ++++++++------- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index beb99779..2a37d1c6 100644 --- a/Makefile +++ b/Makefile @@ -96,8 +96,8 @@ CFLAGS = $(SUBST_CFLAGS) \ -I$(TOPDIR) \ -I$(TOPDIR)/libbtrfsutil \ $(CRYPTO_CFLAGS) \ - -DBTRFSRESTORE_LZO=$(BTRFSRESTORE_LZO) \ - -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD) \ + -DCOMPRESSION_LZO=$(COMPRESSION_LZO) \ + -DCOMPRESSION_ZSTD=$(COMPRESSION_ZSTD) \ $(DISABLE_WARNING_FLAGS) \ $(ENABLE_WARNING_FLAGS) \ $(EXTRAWARN_CFLAGS) \ @@ -336,7 +336,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_LZO=$(BTRFSRESTORE_LZO) -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD) +cmds_restore_cflags = -DCOMPRESSION_LZO=$(COMPRESSION_LZO) -DCOMPRESSION_ZSTD=$(COMPRESSION_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 385b7ae1..d832c2db 100644 --- a/Makefile.inc.in +++ b/Makefile.inc.in @@ -16,9 +16,9 @@ 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@ +COMPRESSION_LZO = @COMPRESSION_LZO@ +COMPRESSION_ZSTD = @COMPRESSION_ZSTD@ PYTHON_BINDINGS = @PYTHON_BINDINGS@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ diff --git a/cmds/receive.c b/cmds/receive.c index 43fdefe3..ca5e7086 100644 --- a/cmds/receive.c +++ b/cmds/receive.c @@ -46,7 +46,7 @@ #include #include #endif -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD #include #endif @@ -88,7 +88,7 @@ struct btrfs_receive bool force_decompress; -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD /* Reuse stream objects for encoded_write decompression fallback */ ZSTD_DStream *zstd_dstream; #endif @@ -1049,7 +1049,7 @@ static int decompress_zlib(struct btrfs_receive *rctx, const char *encoded_data, return 0; } -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD static int decompress_zstd(struct btrfs_receive *rctx, const char *encoded_buf, u64 encoded_len, char *unencoded_buf, u64 unencoded_len) @@ -1090,7 +1090,7 @@ static int decompress_zstd(struct btrfs_receive *rctx, const char *encoded_buf, } #endif -#if BTRFSRESTORE_LZO +#if COMPRESSION_LZO static int decompress_lzo(const char *encoded_data, u64 encoded_len, char *unencoded_data, u64 unencoded_len, unsigned int sector_size) @@ -1179,7 +1179,7 @@ static int decompress_and_write(struct btrfs_receive *rctx, if (ret) goto out; break; -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD case BTRFS_ENCODED_IO_COMPRESSION_ZSTD: ret = decompress_zstd(rctx, encoded_data, encoded_len, unencoded_data, unencoded_len); @@ -1196,7 +1196,7 @@ static int decompress_and_write(struct btrfs_receive *rctx, case BTRFS_ENCODED_IO_COMPRESSION_LZO_16K: case BTRFS_ENCODED_IO_COMPRESSION_LZO_32K: case BTRFS_ENCODED_IO_COMPRESSION_LZO_64K: -#if BTRFSRESTORE_LZO +#if COMPRESSION_LZO sector_shift = compression - BTRFS_ENCODED_IO_COMPRESSION_LZO_4K + 12; ret = decompress_lzo(encoded_data, encoded_len, unencoded_data, @@ -1508,7 +1508,7 @@ out: close(rctx->dest_dir_fd); rctx->dest_dir_fd = -1; } -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD if (rctx->zstd_dstream) ZSTD_freeDStream(rctx->zstd_dstream); #endif @@ -1557,10 +1557,10 @@ static const char * const cmd_receive_usage[] = { HELPINFO_INSERT_QUIET, "", "Compression support: zlib" -#if BTRFSRESTORE_LZO +#if COMPRESSION_LZO ", lzo" #endif -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD ", zstd" #endif , diff --git a/cmds/restore.c b/cmds/restore.c index 885877c5..341f2be5 100644 --- a/cmds/restore.c +++ b/cmds/restore.c @@ -25,12 +25,12 @@ #include #include #include -#if BTRFSRESTORE_LZO +#if COMPRESSION_LZO #include #include #endif #include -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD #include #endif #include @@ -100,7 +100,7 @@ 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 +#if !COMPRESSION_LZO error("btrfs-restore not compiled with lzo support"); return -1; #else @@ -168,7 +168,7 @@ static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf, static int decompress_zstd(const char *inbuf, char *outbuf, u64 compress_len, u64 decompress_len) { -#if !BTRFSRESTORE_ZSTD +#if !COMPRESSION_ZSTD error("btrfs not compiled with zstd support"); return -1; #else @@ -1360,10 +1360,10 @@ static const char * const cmd_restore_usage[] = { HELPINFO_INSERT_VERBOSE, "", "Compression support: zlib" -#if BTRFSRESTORE_LZO +#if COMPRESSION_LZO ", lzo" #endif -#if BTRFSRESTORE_ZSTD +#if COMPRESSION_ZSTD ", zstd" #endif , diff --git a/configure.ac b/configure.ac index fa19015b..b0b5547c 100644 --- a/configure.ac +++ b/configure.ac @@ -313,7 +313,7 @@ PKG_CHECK_MODULES(ZLIB, [zlib]) PKG_STATIC(ZLIB_LIBS_STATIC, [zlib]) AC_ARG_ENABLE([zstd], - AS_HELP_STRING([--disable-zstd], [build without zstd support]), + AS_HELP_STRING([--disable-zstd], [build without zstd support for restore and receive (default: enabled)]), [], [enable_zstd=yes] ) @@ -322,8 +322,8 @@ if test "x$enable_zstd" = xyes; then PKG_STATIC(ZSTD_LIBS_STATIC, [libzstd]) fi -AS_IF([test "x$enable_zstd" = xyes], [BTRFSRESTORE_ZSTD=1], [BTRFSRESTORE_ZSTD=0]) -AC_SUBST(BTRFSRESTORE_ZSTD) +AS_IF([test "x$enable_zstd" = xyes], [COMPRESSION_ZSTD=1], [COMPRESSION_ZSTD=0]) +AC_SUBST(COMPRESSION_ZSTD) AC_ARG_ENABLE([libudev], AS_HELP_STRING([--disable-libudev], [build without libudev support (for multipath)]), @@ -373,7 +373,7 @@ fi AC_SUBST(UDEVDIR) AC_ARG_ENABLE([lzo], - AS_HELP_STRING([--disable-lzo], [build without lzo support (default: enabled)]), + AS_HELP_STRING([--disable-lzo], [build without lzo support for restore and receive (default: enabled)]), [], [enable_lzo=yes] ) @@ -390,8 +390,8 @@ if test "x$enable_lzo" = xyes; then AC_SUBST([LZO2_CFLAGS]) fi -AS_IF([test "x$enable_lzo" = xyes], [BTRFSRESTORE_LZO=1], [BTRFSRESTORE_LZO=0]) -AC_SUBST(BTRFSRESTORE_LZO) +AS_IF([test "x$enable_lzo" = xyes], [COMPRESSION_LZO=1], [COMPRESSION_LZO=0]) +AC_SUBST(COMPRESSION_LZO) dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please install pkgconf])]) @@ -445,7 +445,8 @@ AC_MSG_RESULT([ doc generator: ${DOC_TOOL} backtrace support: ${enable_backtrace} btrfs-convert: ${enable_convert} ${convertfs:+($convertfs)} - btrfs-restore zstd: ${enable_zstd} + zstd support: ${enable_zstd} + lzo support: ${enable_lzo} Python bindings: ${enable_python} Python interpreter: ${PYTHON} crypto provider: ${cryptoprovider} ${cryptoproviderversion}