summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-06-26 16:45:52 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commit2087cc237cd0fe1ed29ebf891648bacb46f4833b (patch)
treeede4ba232bea36d8fc670ce360514927a2400bc7
parentaed35c78c6a51a4b4c37ebda5643d2246842fb74 (diff)
Cleanup: move libutil headers to sub directory
Move all the libutil stuff from the toplevel include/ to a util/ sub directory and fix up the includes that make use of them. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--COPYING.md2
-rw-r--r--include/util/array.h (renamed from include/array.h)0
-rw-r--r--include/util/hash_table.h (renamed from include/hash_table.h)0
-rw-r--r--include/util/mempool.h (renamed from include/mempool.h)0
-rw-r--r--include/util/rbtree.h (renamed from include/rbtree.h)0
-rw-r--r--include/util/str_table.h (renamed from include/str_table.h)0
-rw-r--r--include/util/threadpool.h (renamed from include/threadpool.h)0
-rw-r--r--include/util/util.h (renamed from include/util.h)0
-rw-r--r--include/util/w32threadwrap.h (renamed from include/w32threadwrap.h)0
-rw-r--r--lib/common/hardlink.c2
-rw-r--r--lib/sqfs/Makemodule.am10
-rw-r--r--lib/sqfs/block_processor/internal.h6
-rw-r--r--lib/sqfs/block_writer.c2
-rw-r--r--lib/sqfs/comp/internal.h2
-rw-r--r--lib/sqfs/data_reader.c2
-rw-r--r--lib/sqfs/dir_reader/internal.h4
-rw-r--r--lib/sqfs/dir_writer.c4
-rw-r--r--lib/sqfs/frag_table.c2
-rw-r--r--lib/sqfs/id_table.c2
-rw-r--r--lib/sqfs/inode.c2
-rw-r--r--lib/sqfs/meta_reader.c2
-rw-r--r--lib/sqfs/meta_writer.c2
-rw-r--r--lib/sqfs/read_inode.c2
-rw-r--r--lib/sqfs/read_super.c2
-rw-r--r--lib/sqfs/read_table.c2
-rw-r--r--lib/sqfs/write_table.c2
-rw-r--r--lib/sqfs/xattr/xattr_reader.c2
-rw-r--r--lib/sqfs/xattr/xattr_writer.h8
-rw-r--r--lib/util/Makemodule.am13
-rw-r--r--lib/util/alloc.c2
-rw-r--r--lib/util/array.c2
-rw-r--r--lib/util/hash_table.c2
-rw-r--r--lib/util/is_memory_zero.c2
-rw-r--r--lib/util/mempool.c2
-rw-r--r--lib/util/rbtree.c2
-rw-r--r--lib/util/str_table.c4
-rw-r--r--lib/util/threadpool.c6
-rw-r--r--lib/util/threadpool_serial.c4
-rw-r--r--lib/util/xxhash.c2
-rw-r--r--tests/libutil/is_memory_zero.c2
-rw-r--r--tests/libutil/rbtree.c2
-rw-r--r--tests/libutil/str_table.c2
-rw-r--r--tests/libutil/threadpool.c2
-rw-r--r--tests/libutil/xxhash.c2
44 files changed, 57 insertions, 56 deletions
diff --git a/COPYING.md b/COPYING.md
index ff98c72..574aad6 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -11,7 +11,7 @@ with the following exceptions:
- `lib/lz4` contains files extracted from the LZ4 compression library.
See `lib/lz4/README` for details and `licenses/LZ4.txt` for copyright and
licensing information (2 clause BSD license).
- - `lib/util/hash_table.c`, `include/hash_table.h` and
+ - `lib/util/hash_table.c`, `include/util/hash_table.h` and
`lib/util/fast_urem_by_const.h` contain a hash table implementation (MIT
license). See `licenses/hash_table.txt` for details.
diff --git a/include/array.h b/include/util/array.h
index cbac7c2..cbac7c2 100644
--- a/include/array.h
+++ b/include/util/array.h
diff --git a/include/hash_table.h b/include/util/hash_table.h
index 813e059..813e059 100644
--- a/include/hash_table.h
+++ b/include/util/hash_table.h
diff --git a/include/mempool.h b/include/util/mempool.h
index c946c31..c946c31 100644
--- a/include/mempool.h
+++ b/include/util/mempool.h
diff --git a/include/rbtree.h b/include/util/rbtree.h
index aac175b..aac175b 100644
--- a/include/rbtree.h
+++ b/include/util/rbtree.h
diff --git a/include/str_table.h b/include/util/str_table.h
index 206fa3a..206fa3a 100644
--- a/include/str_table.h
+++ b/include/util/str_table.h
diff --git a/include/threadpool.h b/include/util/threadpool.h
index f25c497..f25c497 100644
--- a/include/threadpool.h
+++ b/include/util/threadpool.h
diff --git a/include/util.h b/include/util/util.h
index 4b05340..4b05340 100644
--- a/include/util.h
+++ b/include/util/util.h
diff --git a/include/w32threadwrap.h b/include/util/w32threadwrap.h
index 6b7344c..6b7344c 100644
--- a/include/w32threadwrap.h
+++ b/include/util/w32threadwrap.h
diff --git a/lib/common/hardlink.c b/lib/common/hardlink.c
index ab19671..c64ec4a 100644
--- a/lib/common/hardlink.c
+++ b/lib/common/hardlink.c
@@ -5,7 +5,7 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "common.h"
-#include "rbtree.h"
+#include "util/rbtree.h"
#include <stdlib.h>
#include <assert.h>
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index aaf63d8..d49482e 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -44,14 +44,14 @@ libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS)
# directly "import" stuff from libutil
libsquashfs_la_SOURCES += lib/util/str_table.c lib/util/alloc.c
libsquashfs_la_SOURCES += lib/util/xxhash.c
-libsquashfs_la_SOURCES += lib/util/hash_table.c include/hash_table.h
-libsquashfs_la_SOURCES += lib/util/rbtree.c include/rbtree.h
-libsquashfs_la_SOURCES += lib/util/array.c include/array.h
+libsquashfs_la_SOURCES += lib/util/hash_table.c include/util/hash_table.h
+libsquashfs_la_SOURCES += lib/util/rbtree.c include/util/rbtree.h
+libsquashfs_la_SOURCES += lib/util/array.c include/util/array.h
libsquashfs_la_SOURCES += lib/util/is_memory_zero.c
-libsquashfs_la_SOURCES += include/threadpool.h
+libsquashfs_la_SOURCES += include/util/threadpool.h
if CUSTOM_ALLOC
-libsquashfs_la_SOURCES += lib/util/mempool.c include/mempool.h
+libsquashfs_la_SOURCES += lib/util/mempool.c include/util/mempool.h
endif
if WINDOWS
diff --git a/lib/sqfs/block_processor/internal.h b/lib/sqfs/block_processor/internal.h
index 1c184c5..0b2c88d 100644
--- a/lib/sqfs/block_processor/internal.h
+++ b/lib/sqfs/block_processor/internal.h
@@ -19,9 +19,9 @@
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "hash_table.h"
-#include "threadpool.h"
-#include "util.h"
+#include "util/hash_table.h"
+#include "util/threadpool.h"
+#include "util/util.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/sqfs/block_writer.c b/lib/sqfs/block_writer.c
index 54f0c89..1230c2d 100644
--- a/lib/sqfs/block_writer.c
+++ b/lib/sqfs/block_writer.c
@@ -11,7 +11,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/comp/internal.h b/lib/sqfs/comp/internal.h
index 0566683..e4c3dd8 100644
--- a/lib/sqfs/comp/internal.h
+++ b/lib/sqfs/comp/internal.h
@@ -14,7 +14,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
SQFS_INTERNAL
int sqfs_generic_write_options(sqfs_file_t *file, const void *data,
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index e3a2eef..1033db9 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -15,7 +15,7 @@
#include "sqfs/table.h"
#include "sqfs/inode.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/dir_reader/internal.h b/lib/sqfs/dir_reader/internal.h
index 4b2ed21..7275cd2 100644
--- a/lib/sqfs/dir_reader/internal.h
+++ b/lib/sqfs/dir_reader/internal.h
@@ -17,8 +17,8 @@
#include "sqfs/inode.h"
#include "sqfs/error.h"
#include "sqfs/dir.h"
-#include "rbtree.h"
-#include "util.h"
+#include "util/rbtree.h"
+#include "util/util.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c
index ad44458..a02faa7 100644
--- a/lib/sqfs/dir_writer.c
+++ b/lib/sqfs/dir_writer.c
@@ -15,8 +15,8 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/dir.h"
-#include "array.h"
-#include "util.h"
+#include "util/array.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/frag_table.c b/lib/sqfs/frag_table.c
index f15da5c..71627df 100644
--- a/lib/sqfs/frag_table.c
+++ b/lib/sqfs/frag_table.c
@@ -13,7 +13,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "compat.h"
-#include "array.h"
+#include "util/array.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c
index 746a5cc..cebf64b 100644
--- a/lib/sqfs/id_table.c
+++ b/lib/sqfs/id_table.c
@@ -12,7 +12,7 @@
#include "sqfs/table.h"
#include "sqfs/error.h"
#include "compat.h"
-#include "array.h"
+#include "util/array.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/inode.c b/lib/sqfs/inode.c
index 01e5ebe..0fb4809 100644
--- a/lib/sqfs/inode.c
+++ b/lib/sqfs/inode.c
@@ -14,7 +14,7 @@
#include <string.h>
#include <stdlib.h>
-#include "util.h"
+#include "util/util.h"
static int inverse_type[] = {
[SQFS_INODE_DIR] = SQFS_INODE_EXT_DIR,
diff --git a/lib/sqfs/meta_reader.c b/lib/sqfs/meta_reader.c
index 94da268..cddcda6 100644
--- a/lib/sqfs/meta_reader.c
+++ b/lib/sqfs/meta_reader.c
@@ -12,7 +12,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c
index 80f0fdd..2314e06 100644
--- a/lib/sqfs/meta_writer.c
+++ b/lib/sqfs/meta_writer.c
@@ -12,7 +12,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c
index 4f9fd3c..12bef48 100644
--- a/lib/sqfs/read_inode.c
+++ b/lib/sqfs/read_inode.c
@@ -12,7 +12,7 @@
#include "sqfs/super.h"
#include "sqfs/inode.h"
#include "sqfs/dir.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/read_super.c b/lib/sqfs/read_super.c
index 919e720..11bc314 100644
--- a/lib/sqfs/read_super.c
+++ b/lib/sqfs/read_super.c
@@ -10,7 +10,7 @@
#include "sqfs/super.h"
#include "sqfs/error.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <string.h>
diff --git a/lib/sqfs/read_table.c b/lib/sqfs/read_table.c
index 1c9c8ad..8f9bddd 100644
--- a/lib/sqfs/read_table.c
+++ b/lib/sqfs/read_table.c
@@ -12,7 +12,7 @@
#include "sqfs/table.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
diff --git a/lib/sqfs/write_table.c b/lib/sqfs/write_table.c
index b198941..7f1b201 100644
--- a/lib/sqfs/write_table.c
+++ b/lib/sqfs/write_table.c
@@ -13,7 +13,7 @@
#include "sqfs/table.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
diff --git a/lib/sqfs/xattr/xattr_reader.c b/lib/sqfs/xattr/xattr_reader.c
index d3adc46..a55ad2f 100644
--- a/lib/sqfs/xattr/xattr_reader.c
+++ b/lib/sqfs/xattr/xattr_reader.c
@@ -14,7 +14,7 @@
#include "sqfs/error.h"
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/sqfs/xattr/xattr_writer.h b/lib/sqfs/xattr/xattr_writer.h
index 6f414b8..792cfae 100644
--- a/lib/sqfs/xattr/xattr_writer.h
+++ b/lib/sqfs/xattr/xattr_writer.h
@@ -18,10 +18,10 @@
#include "sqfs/block.h"
#include "sqfs/io.h"
-#include "str_table.h"
-#include "rbtree.h"
-#include "array.h"
-#include "util.h"
+#include "util/str_table.h"
+#include "util/rbtree.h"
+#include "util/array.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index c66c786..01ffa31 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -1,11 +1,12 @@
-libutil_a_SOURCES = include/util.h include/str_table.h include/hash_table.h
+libutil_a_SOURCES = include/util/util.h include/util/str_table.h
+libutil_a_SOURCES += include/util/hash_table.h
libutil_a_SOURCES += lib/util/str_table.c lib/util/alloc.c
-libutil_a_SOURCES += lib/util/rbtree.c include/rbtree.h
-libutil_a_SOURCES += lib/util/array.c include/array.h
+libutil_a_SOURCES += lib/util/rbtree.c include/util/rbtree.h
+libutil_a_SOURCES += lib/util/array.c include/util/array.h
libutil_a_SOURCES += lib/util/xxhash.c lib/util/hash_table.c
libutil_a_SOURCES += lib/util/fast_urem_by_const.h
-libutil_a_SOURCES += include/threadpool.h
-libutil_a_SOURCES += include/w32threadwrap.h
+libutil_a_SOURCES += include/util/threadpool.h
+libutil_a_SOURCES += include/util/w32threadwrap.h
libutil_a_SOURCES += lib/util/threadpool_serial.c
libutil_a_SOURCES += lib/util/is_memory_zero.c
libutil_a_CFLAGS = $(AM_CFLAGS)
@@ -27,7 +28,7 @@ endif
endif
if CUSTOM_ALLOC
-libutil_a_SOURCES += lib/util/mempool.c include/mempool.h
+libutil_a_SOURCES += lib/util/mempool.c include/util/mempool.h
endif
noinst_LIBRARIES += libutil.a
diff --git a/lib/util/alloc.c b/lib/util/alloc.c
index e8305d8..359fef5 100644
--- a/lib/util/alloc.c
+++ b/lib/util/alloc.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "util.h"
+#include "util/util.h"
#include <stdlib.h>
#include <errno.h>
diff --git a/lib/util/array.c b/lib/util/array.c
index 3697a07..40bac50 100644
--- a/lib/util/array.c
+++ b/lib/util/array.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
#include "compat.h"
-#include "array.h"
+#include "util/array.h"
#include "sqfs/error.h"
diff --git a/lib/util/hash_table.c b/lib/util/hash_table.c
index a78aeee..0010e9f 100644
--- a/lib/util/hash_table.c
+++ b/lib/util/hash_table.c
@@ -45,7 +45,7 @@
#include <assert.h>
#include "fast_urem_by_const.h"
-#include "hash_table.h"
+#include "util/hash_table.h"
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
diff --git a/lib/util/is_memory_zero.c b/lib/util/is_memory_zero.c
index 3974ee2..aabd45d 100644
--- a/lib/util/is_memory_zero.c
+++ b/lib/util/is_memory_zero.c
@@ -5,7 +5,7 @@
* Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "util.h"
+#include "util/util.h"
#include <stdint.h>
diff --git a/lib/util/mempool.c b/lib/util/mempool.c
index 5191fa2..229ab28 100644
--- a/lib/util/mempool.c
+++ b/lib/util/mempool.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "mempool.h"
+#include "util/mempool.h"
#include <stdlib.h>
#include <limits.h>
diff --git a/lib/util/rbtree.c b/lib/util/rbtree.c
index 8839f82..8b43e43 100644
--- a/lib/util/rbtree.c
+++ b/lib/util/rbtree.c
@@ -7,7 +7,7 @@
#include "config.h"
#include "sqfs/error.h"
-#include "rbtree.h"
+#include "util/rbtree.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/util/str_table.c b/lib/util/str_table.c
index 2816ff8..2d3e354 100644
--- a/lib/util/str_table.c
+++ b/lib/util/str_table.c
@@ -11,8 +11,8 @@
#include <string.h>
#include "sqfs/error.h"
-#include "str_table.h"
-#include "util.h"
+#include "util/str_table.h"
+#include "util/util.h"
/* R5 hash function (borrowed from reiserfs) */
static sqfs_u32 strhash(const char *s)
diff --git a/lib/util/threadpool.c b/lib/util/threadpool.c
index d20fe8b..c7357cd 100644
--- a/lib/util/threadpool.c
+++ b/lib/util/threadpool.c
@@ -4,14 +4,14 @@
*
* Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "threadpool.h"
-#include "util.h"
+#include "util/threadpool.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
#if defined(_WIN32) || defined(__WINDOWS__)
-#include "w32threadwrap.h"
+#include "util/w32threadwrap.h"
#define THREAD_FUN(funname, argname) DWORD WINAPI funname(LPVOID argname)
#define THREAD_EXIT_SUCCESS (0)
diff --git a/lib/util/threadpool_serial.c b/lib/util/threadpool_serial.c
index 834cfa7..fb24ee8 100644
--- a/lib/util/threadpool_serial.c
+++ b/lib/util/threadpool_serial.c
@@ -4,8 +4,8 @@
*
* Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "threadpool.h"
-#include "util.h"
+#include "util/threadpool.h"
+#include "util/util.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/util/xxhash.c b/lib/util/xxhash.c
index 0644e75..60467fb 100644
--- a/lib/util/xxhash.c
+++ b/lib/util/xxhash.c
@@ -35,7 +35,7 @@
* - xxHash source repository: https://github.com/Cyan4973/xxHash
*/
#include "config.h"
-#include "util.h"
+#include "util/util.h"
#include <string.h>
diff --git a/tests/libutil/is_memory_zero.c b/tests/libutil/is_memory_zero.c
index 0d10dd8..967e2e8 100644
--- a/tests/libutil/is_memory_zero.c
+++ b/tests/libutil/is_memory_zero.c
@@ -7,7 +7,7 @@
#include "config.h"
#include "../test.h"
-#include "util.h"
+#include "util/util.h"
int main(int argc, char **argv)
{
diff --git a/tests/libutil/rbtree.c b/tests/libutil/rbtree.c
index 05f7aa3..d7b475a 100644
--- a/tests/libutil/rbtree.c
+++ b/tests/libutil/rbtree.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "rbtree.h"
+#include "util/rbtree.h"
#include "../test.h"
static int key_compare(const void *ctx, const void *a, const void *b)
diff --git a/tests/libutil/str_table.c b/tests/libutil/str_table.c
index b75bb91..a69a9c4 100644
--- a/tests/libutil/str_table.c
+++ b/tests/libutil/str_table.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "str_table.h"
+#include "util/str_table.h"
#include "fstream.h"
#include "compat.h"
#include "../test.h"
diff --git a/tests/libutil/threadpool.c b/tests/libutil/threadpool.c
index cd52ad3..4b07935 100644
--- a/tests/libutil/threadpool.c
+++ b/tests/libutil/threadpool.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "threadpool.h"
+#include "util/threadpool.h"
#include "../test.h"
#if defined(_WIN32) || defined(__WINDOWS__)
diff --git a/tests/libutil/xxhash.c b/tests/libutil/xxhash.c
index b0b1bac..cccbb68 100644
--- a/tests/libutil/xxhash.c
+++ b/tests/libutil/xxhash.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "util.h"
+#include "util/util.h"
#include "../test.h"
static const struct {