diff --git a/Makefile.am b/Makefile.am index 141973ef..771deaf7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,6 @@ TESTS = include lib/sqfs/Makemodule.am include lib/util/Makemodule.am include lib/xfrm/Makemodule.am -include lib/io/Makemodule.am include lib/fstree/Makemodule.am include lib/common/Makemodule.am diff --git a/bin/gensquashfs/Makemodule.am b/bin/gensquashfs/Makemodule.am index 81a88a13..6410b1a1 100644 --- a/bin/gensquashfs/Makemodule.am +++ b/bin/gensquashfs/Makemodule.am @@ -3,7 +3,7 @@ gensquashfs_SOURCES = bin/gensquashfs/src/mkfs.c bin/gensquashfs/src/mkfs.h \ bin/gensquashfs/src/apply_xattr.c bin/gensquashfs/src/filemap_xattr.c\ bin/gensquashfs/src/fstree_from_file.c \ bin/gensquashfs/src/sort_by_file.c bin/gensquashfs/src/glob.c -gensquashfs_LDADD = libcommon.a libsquashfs.la libio.a libfstree.a +gensquashfs_LDADD = libcommon.a libsquashfs.la libfstree.a gensquashfs_LDADD += libutil.a libcompat.a $(LZO_LIBS) $(PTHREAD_LIBS) gensquashfs_CPPFLAGS = $(AM_CPPFLAGS) gensquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) @@ -33,7 +33,7 @@ test_fstree_from_file_SOURCES = bin/gensquashfs/test/fstree_from_file.c \ bin/gensquashfs/src/mkfs.h test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS) test_fstree_from_file_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src -test_fstree_from_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \ +test_fstree_from_file_LDADD = libsquashfs.la libcommon.a libfstree.a \ libutil.a libcompat.a test_fstree_from_file2_SOURCES = bin/gensquashfs/test/fstree_from_file2.c \ @@ -42,7 +42,7 @@ test_fstree_from_file2_SOURCES = bin/gensquashfs/test/fstree_from_file2.c \ bin/gensquashfs/src/mkfs.h test_fstree_from_file2_CPPFLAGS = $(AM_CPPFLAGS) test_fstree_from_file2_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src -test_fstree_from_file2_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \ +test_fstree_from_file2_LDADD = libsquashfs.la libcommon.a libfstree.a \ libutil.a libcompat.a test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \ @@ -51,7 +51,7 @@ test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \ bin/gensquashfs/src/mkfs.h test_fstree_glob1_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src test_fstree_glob1_CPPFLAGS += -DTESTPATH=$(GENDATADIR) -test_fstree_glob1_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \ +test_fstree_glob1_LDADD = libsquashfs.la libcommon.a libfstree.a \ libutil.a libcompat.a test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \ @@ -60,7 +60,7 @@ test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \ bin/gensquashfs/src/glob.c \ bin/gensquashfs/src/mkfs.h test_sort_file_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src -test_sort_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \ +test_sort_file_LDADD = libsquashfs.la libcommon.a libfstree.a \ libutil.a libcompat.a fstree_fuzz_SOURCES = bin/gensquashfs/test/fstree_fuzz.c \ @@ -68,7 +68,7 @@ fstree_fuzz_SOURCES = bin/gensquashfs/test/fstree_fuzz.c \ bin/gensquashfs/src/glob.c \ bin/gensquashfs/src/mkfs.h fstree_fuzz_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src -fstree_fuzz_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \ +fstree_fuzz_LDADD = libsquashfs.la libcommon.a libfstree.a \ libutil.a libcompat.a GENSQUASHFS_TESTS = \ diff --git a/bin/gensquashfs/src/mkfs.h b/bin/gensquashfs/src/mkfs.h index 06774df2..8e69fc1b 100644 --- a/bin/gensquashfs/src/mkfs.h +++ b/bin/gensquashfs/src/mkfs.h @@ -11,7 +11,7 @@ #include "config.h" #include "common.h" -#include "io/dir_iterator.h" +#include "dir_tree_iterator.h" #include "util/util.h" #include "util/parse.h" diff --git a/include/io/dir_iterator.h b/include/dir_tree_iterator.h similarity index 99% rename from include/io/dir_iterator.h rename to include/dir_tree_iterator.h index 7154b08d..e9a4a791 100644 --- a/include/io/dir_iterator.h +++ b/include/dir_tree_iterator.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-3.0-or-later */ /* - * dir_iterator.h + * dir_tree_iterator.h * * Copyright (C) 2023 David Oberhollenzer */ diff --git a/include/tar/tar.h b/include/tar/tar.h index 84cffb55..6b1bed88 100644 --- a/include/tar/tar.h +++ b/include/tar/tar.h @@ -9,7 +9,6 @@ #include "config.h" #include "compat.h" -#include "io/dir_iterator.h" #include "sqfs/io.h" #include diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am index 9438d3a8..5230fcf8 100644 --- a/lib/common/Makemodule.am +++ b/lib/common/Makemodule.am @@ -7,7 +7,8 @@ libcommon_a_SOURCES = include/common.h include/simple_writer.h \ lib/common/src/writer/serialize_fstree.c lib/common/src/writer/finish.c\ lib/common/src/fstree_cli.c lib/common/src/perror.c \ lib/common/src/dir_tree.c lib/common/src/read_tree.c \ - lib/common/src/stream.c + lib/common/src/stream.c lib/common/src/dir_tree_iterator.c \ + include/dir_tree_iterator.h lib/common/src/dir_tree_iterator.c libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS) if WITH_LZO @@ -26,8 +27,24 @@ test_fstree_cli_LDADD = libcommon.a libutil.a libcompat.a test_get_node_path_SOURCES = lib/common/test/get_node_path.c test_get_node_path_LDADD = libcommon.a libsquashfs.la libcompat.a +test_dir_tree_iterator_SOURCES = lib/common/test/dir_tree_iterator.c +test_dir_tree_iterator_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a +test_dir_tree_iterator_CPPFLAGS = $(AM_CPPFLAGS) +test_dir_tree_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir + +test_dir_tree_iterator2_SOURCES = lib/common/test/dir_tree_iterator2.c +test_dir_tree_iterator2_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a +test_dir_tree_iterator2_CPPFLAGS = $(AM_CPPFLAGS) +test_dir_tree_iterator2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir + +test_dir_tree_iterator3_SOURCES = lib/common/test/dir_tree_iterator3.c +test_dir_tree_iterator3_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a +test_dir_tree_iterator3_CPPFLAGS = $(AM_CPPFLAGS) +test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir + LIBCOMMON_TESTS = \ - test_istream_mem test_fstree_cli test_get_node_path + test_istream_mem test_fstree_cli test_get_node_path \ + test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3 check_PROGRAMS += $(LIBCOMMON_TESTS) TESTS += $(LIBCOMMON_TESTS) diff --git a/lib/io/src/dir_tree_iterator.c b/lib/common/src/dir_tree_iterator.c similarity index 99% rename from lib/io/src/dir_tree_iterator.c rename to lib/common/src/dir_tree_iterator.c index 56884898..f1615078 100644 --- a/lib/io/src/dir_tree_iterator.c +++ b/lib/common/src/dir_tree_iterator.c @@ -5,7 +5,7 @@ * Copyright (C) 2023 David Oberhollenzer */ #include "config.h" -#include "io/dir_iterator.h" +#include "dir_tree_iterator.h" #include "util/util.h" #include "sqfs/error.h" #include "sqfs/io.h" diff --git a/lib/io/test/dir_tree_iterator.c b/lib/common/test/dir_tree_iterator.c similarity index 99% rename from lib/io/test/dir_tree_iterator.c rename to lib/common/test/dir_tree_iterator.c index 6c7f1bfd..2a065d89 100644 --- a/lib/io/test/dir_tree_iterator.c +++ b/lib/common/test/dir_tree_iterator.c @@ -6,11 +6,12 @@ */ #include "config.h" -#include "io/dir_iterator.h" +#include "dir_tree_iterator.h" #include "sqfs/error.h" #include "util/test.h" #include "sqfs/io.h" #include "compat.h" +#include "common.h" static int compare_entries(const void *a, const void *b) { diff --git a/lib/io/test/dir_tree_iterator2.c b/lib/common/test/dir_tree_iterator2.c similarity index 99% rename from lib/io/test/dir_tree_iterator2.c rename to lib/common/test/dir_tree_iterator2.c index 91849578..4d922606 100644 --- a/lib/io/test/dir_tree_iterator2.c +++ b/lib/common/test/dir_tree_iterator2.c @@ -6,11 +6,12 @@ */ #include "config.h" -#include "io/dir_iterator.h" +#include "dir_tree_iterator.h" #include "sqfs/error.h" #include "util/test.h" #include "sqfs/io.h" #include "compat.h" +#include "common.h" static int compare_entries(const void *a, const void *b) { diff --git a/lib/io/test/dir_tree_iterator3.c b/lib/common/test/dir_tree_iterator3.c similarity index 97% rename from lib/io/test/dir_tree_iterator3.c rename to lib/common/test/dir_tree_iterator3.c index ccb6bdb4..612a7eb1 100644 --- a/lib/io/test/dir_tree_iterator3.c +++ b/lib/common/test/dir_tree_iterator3.c @@ -6,11 +6,12 @@ */ #include "config.h" -#include "io/dir_iterator.h" +#include "dir_tree_iterator.h" #include "sqfs/error.h" #include "util/test.h" #include "sqfs/io.h" #include "compat.h" +#include "common.h" static int compare_entries(const void *a, const void *b) { diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am deleted file mode 100644 index 75a3e59d..00000000 --- a/lib/io/Makemodule.am +++ /dev/null @@ -1,34 +0,0 @@ -libio_a_SOURCES = include/io/dir_iterator.h \ - lib/io/src/dir_tree_iterator.c -libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS) -libio_a_CFLAGS += $(ZSTD_CFLAGS) $(BZIP2_CFLAGS) - -noinst_LIBRARIES += libio.a - -LIBIO_TESTS = test_dir_iterator \ - test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3 - -test_dir_iterator_SOURCES = lib/io/test/dir_iterator.c -test_dir_iterator_LDADD = libio.a libsquashfs.la libutil.a libcompat.a -test_dir_iterator_CPPFLAGS = $(AM_CPPFLAGS) -test_dir_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir - -test_dir_tree_iterator_SOURCES = lib/io/test/dir_tree_iterator.c -test_dir_tree_iterator_LDADD = libio.a libsquashfs.la libutil.a libcompat.a -test_dir_tree_iterator_CPPFLAGS = $(AM_CPPFLAGS) -test_dir_tree_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir - -test_dir_tree_iterator2_SOURCES = lib/io/test/dir_tree_iterator2.c -test_dir_tree_iterator2_LDADD = libio.a libsquashfs.la libutil.a libcompat.a -test_dir_tree_iterator2_CPPFLAGS = $(AM_CPPFLAGS) -test_dir_tree_iterator2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir - -test_dir_tree_iterator3_SOURCES = lib/io/test/dir_tree_iterator3.c -test_dir_tree_iterator3_LDADD = libio.a libsquashfs.la libutil.a libcompat.a -test_dir_tree_iterator3_CPPFLAGS = $(AM_CPPFLAGS) -test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir - -check_PROGRAMS += $(LIBIO_TESTS) -TESTS += $(LIBIO_TESTS) - -EXTRA_DIST += $(top_srcdir)/lib/io/test/testdir diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am index 41ea6081..df0b21a9 100644 --- a/lib/sqfs/Makemodule.am +++ b/lib/sqfs/Makemodule.am @@ -139,11 +139,18 @@ test_rec_dir_LDADD = libsquashfs.la libutil.a libcompat.a test_hl_dir_SOURCES = lib/sqfs/test/hl_dir.c test_hl_dir_LDADD = libsquashfs.la libutil.a libcompat.a +test_dir_iterator_SOURCES = lib/sqfs/test/dir_iterator.c +test_dir_iterator_LDADD = libsquashfs.la libutil.a libcompat.a +test_dir_iterator_CPPFLAGS = $(AM_CPPFLAGS) +test_dir_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir + LIBSQFS_TESTS = \ test_abi test_xattr test_table test_xattr_writer \ test_istream_read test_istream_skip test_stream_splice test_rec_dir \ - test_hl_dir + test_hl_dir test_dir_iterator noinst_PROGRAMS += xattr_benchmark check_PROGRAMS += $(LIBSQFS_TESTS) TESTS += $(LIBSQFS_TESTS) + +EXTRA_DIST += $(top_srcdir)/lib/sqfs/test/testdir diff --git a/lib/io/test/dir_iterator.c b/lib/sqfs/test/dir_iterator.c similarity index 99% rename from lib/io/test/dir_iterator.c rename to lib/sqfs/test/dir_iterator.c index 56610b68..701b8f08 100644 --- a/lib/io/test/dir_iterator.c +++ b/lib/sqfs/test/dir_iterator.c @@ -6,7 +6,7 @@ */ #include "config.h" -#include "io/dir_iterator.h" +#include "sqfs/dir_entry.h" #include "sqfs/error.h" #include "util/test.h" #include "sqfs/io.h" diff --git a/lib/io/test/testdir/dira/file_a0 b/lib/sqfs/test/testdir/dira/file_a0 similarity index 100% rename from lib/io/test/testdir/dira/file_a0 rename to lib/sqfs/test/testdir/dira/file_a0 diff --git a/lib/io/test/testdir/dira/file_a1 b/lib/sqfs/test/testdir/dira/file_a1 similarity index 100% rename from lib/io/test/testdir/dira/file_a1 rename to lib/sqfs/test/testdir/dira/file_a1 diff --git a/lib/io/test/testdir/dira/file_a2 b/lib/sqfs/test/testdir/dira/file_a2 similarity index 100% rename from lib/io/test/testdir/dira/file_a2 rename to lib/sqfs/test/testdir/dira/file_a2 diff --git a/lib/io/test/testdir/dirb/dirx/file_x0 b/lib/sqfs/test/testdir/dirb/dirx/file_x0 similarity index 100% rename from lib/io/test/testdir/dirb/dirx/file_x0 rename to lib/sqfs/test/testdir/dirb/dirx/file_x0 diff --git a/lib/io/test/testdir/dirb/dirx/file_x1 b/lib/sqfs/test/testdir/dirb/dirx/file_x1 similarity index 100% rename from lib/io/test/testdir/dirb/dirx/file_x1 rename to lib/sqfs/test/testdir/dirb/dirx/file_x1 diff --git a/lib/io/test/testdir/dirb/dirx/file_x2 b/lib/sqfs/test/testdir/dirb/dirx/file_x2 similarity index 100% rename from lib/io/test/testdir/dirb/dirx/file_x2 rename to lib/sqfs/test/testdir/dirb/dirx/file_x2 diff --git a/lib/io/test/testdir/dirb/file_b0 b/lib/sqfs/test/testdir/dirb/file_b0 similarity index 100% rename from lib/io/test/testdir/dirb/file_b0 rename to lib/sqfs/test/testdir/dirb/file_b0 diff --git a/lib/io/test/testdir/dirb/file_b1 b/lib/sqfs/test/testdir/dirb/file_b1 similarity index 100% rename from lib/io/test/testdir/dirb/file_b1 rename to lib/sqfs/test/testdir/dirb/file_b1 diff --git a/lib/io/test/testdir/dirb/file_b2 b/lib/sqfs/test/testdir/dirb/file_b2 similarity index 100% rename from lib/io/test/testdir/dirb/file_b2 rename to lib/sqfs/test/testdir/dirb/file_b2 diff --git a/lib/io/test/testdir/dirc/file_c0 b/lib/sqfs/test/testdir/dirc/file_c0 similarity index 100% rename from lib/io/test/testdir/dirc/file_c0 rename to lib/sqfs/test/testdir/dirc/file_c0 diff --git a/lib/io/test/testdir/dirc/file_c1 b/lib/sqfs/test/testdir/dirc/file_c1 similarity index 100% rename from lib/io/test/testdir/dirc/file_c1 rename to lib/sqfs/test/testdir/dirc/file_c1 diff --git a/lib/io/test/testdir/dirc/file_c2 b/lib/sqfs/test/testdir/dirc/file_c2 similarity index 100% rename from lib/io/test/testdir/dirc/file_c2 rename to lib/sqfs/test/testdir/dirc/file_c2 diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c index 8f3353ea..570f687e 100644 --- a/lib/tar/src/iterator.c +++ b/lib/tar/src/iterator.c @@ -12,6 +12,7 @@ #include "util/util.h" #include "xfrm/wrap.h" #include "compat.h" +#include "sqfs/dir_entry.h" #include #include diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c index b90d5ca2..4e893802 100644 --- a/lib/tar/test/tar_iterator.c +++ b/lib/tar/test/tar_iterator.c @@ -9,6 +9,7 @@ #include "util/test.h" #include "sqfs/error.h" #include "sqfs/io.h" +#include "sqfs/dir_entry.h" #ifndef TESTUID #define TESTUID 1000 diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c index 630f5790..e983c27f 100644 --- a/lib/tar/test/tar_iterator2.c +++ b/lib/tar/test/tar_iterator2.c @@ -8,6 +8,7 @@ #include "tar/tar.h" #include "util/test.h" #include "sqfs/io.h" +#include "sqfs/dir_entry.h" static const struct { uint64_t offset; diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c index 05940a25..e9bb472f 100644 --- a/lib/tar/test/tar_iterator3.c +++ b/lib/tar/test/tar_iterator3.c @@ -10,6 +10,7 @@ #include "util/test.h" #include "sqfs/error.h" #include "sqfs/io.h" +#include "sqfs/dir_entry.h" int main(int argc, char **argv) { diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c index c82fe084..225841e7 100644 --- a/lib/tar/test/tar_write_simple.c +++ b/lib/tar/test/tar_write_simple.c @@ -9,6 +9,7 @@ #include "sqfs/io.h" #include "util/test.h" #include "sqfs/xattr.h" +#include "sqfs/dir_entry.h" #include "compat.h" static void hex_dump(const sqfs_u8 *data, size_t size)