From 90b7844d6cc30317fb6e606f0d4945130c3ba91e Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Fri, 30 Aug 2024 14:55:42 +0800 Subject: [PATCH] erofs-utils: lib: don't include and in external headers Applications don't need internal header dependencies. Signed-off-by: Gao Xiang Reviewed-by: Sandeep Dhavale Link: https://lore.kernel.org/r/20240830065542.94908-1-hsiangkao@linux.alibaba.com --- include/erofs/tar.h | 12 +----------- lib/tar.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/erofs/tar.h b/include/erofs/tar.h index 6fa72eb..42fbb00 100644 --- a/include/erofs/tar.h +++ b/include/erofs/tar.h @@ -7,9 +7,6 @@ extern "C" { #endif -#if defined(HAVE_ZLIB) -#include -#endif #include #include "internal.h" @@ -28,14 +25,7 @@ struct erofs_pax_header { #define EROFS_IOS_DECODER_GZIP 1 #define EROFS_IOS_DECODER_LIBLZMA 2 -#ifdef HAVE_LIBLZMA -#include -struct erofs_iostream_liblzma { - u8 inbuf[32768]; - lzma_stream strm; - int fd; -}; -#endif +struct erofs_iostream_liblzma; struct erofs_iostream { union { diff --git a/lib/tar.c b/lib/tar.c index a9b425e..7e89b92 100644 --- a/lib/tar.c +++ b/lib/tar.c @@ -3,9 +3,6 @@ #include #include #include -#if defined(HAVE_ZLIB) -#include -#endif #include "erofs/print.h" #include "erofs/cache.h" #include "erofs/diskbuf.h" @@ -15,6 +12,9 @@ #include "erofs/xattr.h" #include "erofs/blobchunk.h" #include "erofs/rebuild.h" +#if defined(HAVE_ZLIB) +#include +#endif /* This file is a tape/volume header. Ignore it on extraction. */ #define GNUTYPE_VOLHDR 'V' @@ -39,6 +39,15 @@ struct tar_header { char padding[12]; /* 500-512 (pad to exactly the 512 byte) */ }; +#ifdef HAVE_LIBLZMA +#include +struct erofs_iostream_liblzma { + u8 inbuf[32768]; + lzma_stream strm; + int fd; +}; +#endif + void erofs_iostream_close(struct erofs_iostream *ios) { free(ios->buffer); -- 2.34.1