diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Makemodule.am | 10 | ||||
-rw-r--r-- | lib/common/src/dir_tree.c (renamed from lib/sqfs/src/dir_reader/get_path.c) | 25 | ||||
-rw-r--r-- | lib/common/src/read_tree.c (renamed from lib/sqfs/src/dir_reader/read_tree.c) | 27 | ||||
-rw-r--r-- | lib/common/test/get_node_path.c (renamed from lib/sqfs/test/get_node_path.c) | 1 | ||||
-rw-r--r-- | lib/sqfs/Makemodule.am | 6 |
5 files changed, 36 insertions, 33 deletions
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am index a50ddcb..5549cc3 100644 --- a/lib/common/Makemodule.am +++ b/lib/common/Makemodule.am @@ -1,11 +1,12 @@ libcommon_a_SOURCES = include/common.h include/simple_writer.h \ - include/compress_cli.h \ + include/compress_cli.h include/dir_tree.h \ lib/common/src/hardlink.c lib/common/src/print_version.c \ lib/common/src/compress.c lib/common/src/comp_opt.c \ lib/common/src/parse_size.c lib/common/src/print_size.c \ lib/common/src/writer/init.c lib/common/src/writer/cleanup.c \ 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/fstree_cli.c lib/common/src/perror.c \ + lib/common/src/dir_tree.c lib/common/src/read_tree.c libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS) if WITH_LZO @@ -17,8 +18,11 @@ noinst_LIBRARIES += libcommon.a test_fstree_cli_SOURCES = lib/common/test/fstree_cli.c test_fstree_cli_LDADD = libcommon.a libio.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 + LIBCOMMON_TESTS = \ - test_fstree_cli + test_fstree_cli test_get_node_path check_PROGRAMS += $(LIBCOMMON_TESTS) TESTS += $(LIBCOMMON_TESTS) diff --git a/lib/sqfs/src/dir_reader/get_path.c b/lib/common/src/dir_tree.c index 847bfd3..1d778a2 100644 --- a/lib/sqfs/src/dir_reader/get_path.c +++ b/lib/common/src/dir_tree.c @@ -1,15 +1,32 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* SPDX-License-Identifier: GPL-3.0-or-later */ /* - * get_path.c + * dir_tree.c * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#define SQFS_BUILDING_DLL -#include "internal.h" +#include "common.h" #include <string.h> #include <stdlib.h> +void sqfs_dir_tree_destroy(sqfs_tree_node_t *root) +{ + sqfs_tree_node_t *it; + + if (!root) + return; + + while (root->children != NULL) { + it = root->children; + root->children = it->next; + + sqfs_dir_tree_destroy(it); + } + + free(root->inode); + free(root); +} + int sqfs_tree_node_get_path(const sqfs_tree_node_t *node, char **out) { const sqfs_tree_node_t *it; diff --git a/lib/sqfs/src/dir_reader/read_tree.c b/lib/common/src/read_tree.c index 7d6bf67..5d089e5 100644 --- a/lib/sqfs/src/dir_reader/read_tree.c +++ b/lib/common/src/read_tree.c @@ -1,11 +1,14 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* SPDX-License-Identifier: GPL-3.0-or-later */ /* * read_tree.c * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#define SQFS_BUILDING_DLL -#include "internal.h" +#include "util/util.h" +#include "common.h" + +#include <string.h> +#include <stdlib.h> static int should_skip(int type, unsigned int flags) { @@ -163,24 +166,6 @@ static int resolve_ids(sqfs_tree_node_t *root, const sqfs_id_table_t *idtbl) &root->gid); } -void sqfs_dir_tree_destroy(sqfs_tree_node_t *root) -{ - sqfs_tree_node_t *it; - - if (!root) - return; - - while (root->children != NULL) { - it = root->children; - root->children = it->next; - - sqfs_dir_tree_destroy(it); - } - - free(root->inode); - free(root); -} - int sqfs_dir_reader_get_full_hierarchy(sqfs_dir_reader_t *rd, const sqfs_id_table_t *idtbl, const char *path, unsigned int flags, diff --git a/lib/sqfs/test/get_node_path.c b/lib/common/test/get_node_path.c index c76cc1c..b02689f 100644 --- a/lib/sqfs/test/get_node_path.c +++ b/lib/common/test/get_node_path.c @@ -10,6 +10,7 @@ #include "sqfs/dir_reader.h" #include "sqfs/error.h" +#include "dir_tree.h" int main(int argc, char **argv) { diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am index 3d61cd5..00105e8 100644 --- a/lib/sqfs/Makemodule.am +++ b/lib/sqfs/Makemodule.am @@ -19,7 +19,6 @@ libsquashfs_la_SOURCES = $(LIBSQFS_HEARDS) lib/sqfs/src/id_table.c \ lib/sqfs/src/dir_writer.c lib/sqfs/src/xattr/xattr_reader.c \ lib/sqfs/src/read_table.c lib/sqfs/src/comp/compressor.c \ lib/sqfs/src/comp/internal.h lib/sqfs/src/dir_reader/dir_reader.c \ - lib/sqfs/src/dir_reader/read_tree.c lib/sqfs/src/dir_reader/get_path.c \ lib/sqfs/src/dir_reader/internal.h lib/sqfs/src/inode.c \ lib/sqfs/src/xattr/xattr_writer.c \ lib/sqfs/src/xattr/xattr_writer_flush.c \ @@ -125,9 +124,6 @@ test_xattr_writer_LDADD = libsquashfs.la libcompat.a xattr_benchmark_SOURCES = lib/sqfs/test/xattr_benchmark.c xattr_benchmark_LDADD = libcommon.a libsquashfs.la libcompat.a -test_get_node_path_SOURCES = lib/sqfs/test/get_node_path.c -test_get_node_path_LDADD = libcommon.a libsquashfs.la libcompat.a - test_istream_read_SOURCES = lib/sqfs/test/istream_read.c test_istream_read_LDADD = libio.a libsquashfs.la libutil.a libcompat.a @@ -144,7 +140,7 @@ test_hl_dir_SOURCES = lib/sqfs/test/hl_dir.c test_hl_dir_LDADD = libsquashfs.la libio.a libutil.a libcompat.a LIBSQFS_TESTS = \ - test_abi test_xattr test_table test_xattr_writer test_get_node_path \ + test_abi test_xattr test_table test_xattr_writer \ test_istream_read test_istream_skip test_stream_splice test_rec_dir \ test_hl_dir noinst_PROGRAMS += xattr_benchmark |