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 <dsterba@suse.com>
This commit is contained in:
David Sterba 2022-06-21 01:53:05 +02:00
parent 345731fff3
commit 92b57e4fd8
5 changed files with 28 additions and 27 deletions

View File

@ -96,8 +96,8 @@ CFLAGS = $(SUBST_CFLAGS) \
-I$(TOPDIR) \ -I$(TOPDIR) \
-I$(TOPDIR)/libbtrfsutil \ -I$(TOPDIR)/libbtrfsutil \
$(CRYPTO_CFLAGS) \ $(CRYPTO_CFLAGS) \
-DBTRFSRESTORE_LZO=$(BTRFSRESTORE_LZO) \ -DCOMPRESSION_LZO=$(COMPRESSION_LZO) \
-DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD) \ -DCOMPRESSION_ZSTD=$(COMPRESSION_ZSTD) \
$(DISABLE_WARNING_FLAGS) \ $(DISABLE_WARNING_FLAGS) \
$(ENABLE_WARNING_FLAGS) \ $(ENABLE_WARNING_FLAGS) \
$(EXTRAWARN_CFLAGS) \ $(EXTRAWARN_CFLAGS) \
@ -336,7 +336,7 @@ endif
btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2) btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS) btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS)
btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype 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) ifeq ($(CRYPTOPROVIDER_BUILTIN),1)
CRYPTO_OBJECTS = crypto/sha224-256.o crypto/blake2b-ref.o CRYPTO_OBJECTS = crypto/sha224-256.o crypto/blake2b-ref.o

View File

@ -16,9 +16,9 @@ BUILD_PROGRAMS = @BUILD_PROGRAMS@
BUILD_SHARED_LIBRARIES = @BUILD_SHARED_LIBRARIES@ BUILD_SHARED_LIBRARIES = @BUILD_SHARED_LIBRARIES@
BUILD_STATIC_LIBRARIES = @BUILD_STATIC_LIBRARIES@ BUILD_STATIC_LIBRARIES = @BUILD_STATIC_LIBRARIES@
BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@ BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
BTRFSRESTORE_LZO = @BTRFSRESTORE_LZO@
BTRFSCONVERT_REISERFS = @BTRFSCONVERT_REISERFS@ BTRFSCONVERT_REISERFS = @BTRFSCONVERT_REISERFS@
BTRFSRESTORE_ZSTD = @BTRFSRESTORE_ZSTD@ COMPRESSION_LZO = @COMPRESSION_LZO@
COMPRESSION_ZSTD = @COMPRESSION_ZSTD@
PYTHON_BINDINGS = @PYTHON_BINDINGS@ PYTHON_BINDINGS = @PYTHON_BINDINGS@
PYTHON = @PYTHON@ PYTHON = @PYTHON@
PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@

View File

@ -46,7 +46,7 @@
#include <lzo/lzoconf.h> #include <lzo/lzoconf.h>
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
#endif #endif
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
#include <zstd.h> #include <zstd.h>
#endif #endif
@ -88,7 +88,7 @@ struct btrfs_receive
bool force_decompress; bool force_decompress;
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
/* Reuse stream objects for encoded_write decompression fallback */ /* Reuse stream objects for encoded_write decompression fallback */
ZSTD_DStream *zstd_dstream; ZSTD_DStream *zstd_dstream;
#endif #endif
@ -1049,7 +1049,7 @@ static int decompress_zlib(struct btrfs_receive *rctx, const char *encoded_data,
return 0; return 0;
} }
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
static int decompress_zstd(struct btrfs_receive *rctx, const char *encoded_buf, static int decompress_zstd(struct btrfs_receive *rctx, const char *encoded_buf,
u64 encoded_len, char *unencoded_buf, u64 encoded_len, char *unencoded_buf,
u64 unencoded_len) u64 unencoded_len)
@ -1090,7 +1090,7 @@ static int decompress_zstd(struct btrfs_receive *rctx, const char *encoded_buf,
} }
#endif #endif
#if BTRFSRESTORE_LZO #if COMPRESSION_LZO
static int decompress_lzo(const char *encoded_data, u64 encoded_len, static int decompress_lzo(const char *encoded_data, u64 encoded_len,
char *unencoded_data, u64 unencoded_len, char *unencoded_data, u64 unencoded_len,
unsigned int sector_size) unsigned int sector_size)
@ -1179,7 +1179,7 @@ static int decompress_and_write(struct btrfs_receive *rctx,
if (ret) if (ret)
goto out; goto out;
break; break;
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
case BTRFS_ENCODED_IO_COMPRESSION_ZSTD: case BTRFS_ENCODED_IO_COMPRESSION_ZSTD:
ret = decompress_zstd(rctx, encoded_data, encoded_len, ret = decompress_zstd(rctx, encoded_data, encoded_len,
unencoded_data, unencoded_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_16K:
case BTRFS_ENCODED_IO_COMPRESSION_LZO_32K: case BTRFS_ENCODED_IO_COMPRESSION_LZO_32K:
case BTRFS_ENCODED_IO_COMPRESSION_LZO_64K: case BTRFS_ENCODED_IO_COMPRESSION_LZO_64K:
#if BTRFSRESTORE_LZO #if COMPRESSION_LZO
sector_shift = sector_shift =
compression - BTRFS_ENCODED_IO_COMPRESSION_LZO_4K + 12; compression - BTRFS_ENCODED_IO_COMPRESSION_LZO_4K + 12;
ret = decompress_lzo(encoded_data, encoded_len, unencoded_data, ret = decompress_lzo(encoded_data, encoded_len, unencoded_data,
@ -1508,7 +1508,7 @@ out:
close(rctx->dest_dir_fd); close(rctx->dest_dir_fd);
rctx->dest_dir_fd = -1; rctx->dest_dir_fd = -1;
} }
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
if (rctx->zstd_dstream) if (rctx->zstd_dstream)
ZSTD_freeDStream(rctx->zstd_dstream); ZSTD_freeDStream(rctx->zstd_dstream);
#endif #endif
@ -1557,10 +1557,10 @@ static const char * const cmd_receive_usage[] = {
HELPINFO_INSERT_QUIET, HELPINFO_INSERT_QUIET,
"", "",
"Compression support: zlib" "Compression support: zlib"
#if BTRFSRESTORE_LZO #if COMPRESSION_LZO
", lzo" ", lzo"
#endif #endif
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
", zstd" ", zstd"
#endif #endif
, ,

View File

@ -25,12 +25,12 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#if BTRFSRESTORE_LZO #if COMPRESSION_LZO
#include <lzo/lzoconf.h> #include <lzo/lzoconf.h>
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
#endif #endif
#include <zlib.h> #include <zlib.h>
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
#include <zstd.h> #include <zstd.h>
#endif #endif
#include <regex.h> #include <regex.h>
@ -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, static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf,
char *outbuf, u64 compress_len, u64 *decompress_len) char *outbuf, u64 compress_len, u64 *decompress_len)
{ {
#if !BTRFSRESTORE_LZO #if !COMPRESSION_LZO
error("btrfs-restore not compiled with lzo support"); error("btrfs-restore not compiled with lzo support");
return -1; return -1;
#else #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, static int decompress_zstd(const char *inbuf, char *outbuf, u64 compress_len,
u64 decompress_len) u64 decompress_len)
{ {
#if !BTRFSRESTORE_ZSTD #if !COMPRESSION_ZSTD
error("btrfs not compiled with zstd support"); error("btrfs not compiled with zstd support");
return -1; return -1;
#else #else
@ -1360,10 +1360,10 @@ static const char * const cmd_restore_usage[] = {
HELPINFO_INSERT_VERBOSE, HELPINFO_INSERT_VERBOSE,
"", "",
"Compression support: zlib" "Compression support: zlib"
#if BTRFSRESTORE_LZO #if COMPRESSION_LZO
", lzo" ", lzo"
#endif #endif
#if BTRFSRESTORE_ZSTD #if COMPRESSION_ZSTD
", zstd" ", zstd"
#endif #endif
, ,

View File

@ -313,7 +313,7 @@ PKG_CHECK_MODULES(ZLIB, [zlib])
PKG_STATIC(ZLIB_LIBS_STATIC, [zlib]) PKG_STATIC(ZLIB_LIBS_STATIC, [zlib])
AC_ARG_ENABLE([zstd], 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] [], [enable_zstd=yes]
) )
@ -322,8 +322,8 @@ if test "x$enable_zstd" = xyes; then
PKG_STATIC(ZSTD_LIBS_STATIC, [libzstd]) PKG_STATIC(ZSTD_LIBS_STATIC, [libzstd])
fi fi
AS_IF([test "x$enable_zstd" = xyes], [BTRFSRESTORE_ZSTD=1], [BTRFSRESTORE_ZSTD=0]) AS_IF([test "x$enable_zstd" = xyes], [COMPRESSION_ZSTD=1], [COMPRESSION_ZSTD=0])
AC_SUBST(BTRFSRESTORE_ZSTD) AC_SUBST(COMPRESSION_ZSTD)
AC_ARG_ENABLE([libudev], AC_ARG_ENABLE([libudev],
AS_HELP_STRING([--disable-libudev], [build without libudev support (for multipath)]), AS_HELP_STRING([--disable-libudev], [build without libudev support (for multipath)]),
@ -373,7 +373,7 @@ fi
AC_SUBST(UDEVDIR) AC_SUBST(UDEVDIR)
AC_ARG_ENABLE([lzo], 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] [], [enable_lzo=yes]
) )
@ -390,8 +390,8 @@ if test "x$enable_lzo" = xyes; then
AC_SUBST([LZO2_CFLAGS]) AC_SUBST([LZO2_CFLAGS])
fi fi
AS_IF([test "x$enable_lzo" = xyes], [BTRFSRESTORE_LZO=1], [BTRFSRESTORE_LZO=0]) AS_IF([test "x$enable_lzo" = xyes], [COMPRESSION_LZO=1], [COMPRESSION_LZO=0])
AC_SUBST(BTRFSRESTORE_LZO) AC_SUBST(COMPRESSION_LZO)
dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please install pkgconf])]) m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please install pkgconf])])
@ -445,7 +445,8 @@ AC_MSG_RESULT([
doc generator: ${DOC_TOOL} doc generator: ${DOC_TOOL}
backtrace support: ${enable_backtrace} backtrace support: ${enable_backtrace}
btrfs-convert: ${enable_convert} ${convertfs:+($convertfs)} btrfs-convert: ${enable_convert} ${convertfs:+($convertfs)}
btrfs-restore zstd: ${enable_zstd} zstd support: ${enable_zstd}
lzo support: ${enable_lzo}
Python bindings: ${enable_python} Python bindings: ${enable_python}
Python interpreter: ${PYTHON} Python interpreter: ${PYTHON}
crypto provider: ${cryptoprovider} ${cryptoproviderversion} crypto provider: ${cryptoprovider} ${cryptoproviderversion}