aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/gensquashfs/Makemodule.am14
-rw-r--r--bin/gensquashfs/test/fstree_from_file.c1
-rw-r--r--bin/gensquashfs/test/fstree_from_file2.c1
-rw-r--r--bin/gensquashfs/test/sort_file.c1
-rw-r--r--bin/rdsquashfs/Makemodule.am2
-rw-r--r--bin/sqfsdiff/Makemodule.am2
-rw-r--r--include/common.h8
-rw-r--r--include/io/mem.h24
-rw-r--r--include/io/std.h42
-rw-r--r--lib/common/Makemodule.am11
-rw-r--r--lib/common/src/stream.c (renamed from lib/io/src/mem.c)27
-rw-r--r--lib/common/test/istream_mem.c (renamed from lib/io/test/istream_mem.c)2
-rw-r--r--lib/io/Makemodule.am23
-rw-r--r--lib/io/src/internal.h1
-rw-r--r--lib/io/src/std.c35
-rw-r--r--lib/io/test/xfrm.c2
-rw-r--r--lib/sqfs/Makemodule.am10
-rw-r--r--lib/sqfs/test/istream_read.c2
-rw-r--r--lib/sqfs/test/istream_skip.c2
-rw-r--r--lib/sqfs/test/stream_splice.c2
-rw-r--r--lib/util/Makemodule.am4
-rw-r--r--lib/util/test/get_line.c2
22 files changed, 72 insertions, 146 deletions
diff --git a/bin/gensquashfs/Makemodule.am b/bin/gensquashfs/Makemodule.am
index a5bf78f..81a88a1 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 libio.a libsquashfs.la libfstree.a
+gensquashfs_LDADD = libcommon.a libsquashfs.la libio.a libfstree.a
gensquashfs_LDADD += libutil.a libcompat.a $(LZO_LIBS) $(PTHREAD_LIBS)
gensquashfs_CPPFLAGS = $(AM_CPPFLAGS)
gensquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
@@ -24,7 +24,7 @@ test_filemap_xattr_SOURCES = bin/gensquashfs/test/filemap_xattr.c \
bin/gensquashfs/src/mkfs.h
test_filemap_xattr_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
test_filemap_xattr_CPPFLAGS += -DTESTPATH=$(GENDATADIR)/xattr1.txt
-test_filemap_xattr_LDADD = libio.a libsquashfs.la libfstree.a libutil.a
+test_filemap_xattr_LDADD = libsquashfs.la libfstree.a libutil.a
test_filemap_xattr_LDADD += libcommon.a libcompat.a
test_fstree_from_file_SOURCES = bin/gensquashfs/test/fstree_from_file.c \
@@ -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 = libio.a libsquashfs.la libcommon.a libfstree.a \
+test_fstree_from_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.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 = libio.a libsquashfs.la libcommon.a libfstree.a \
+test_fstree_from_file2_LDADD = libsquashfs.la libcommon.a libfstree.a libio.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 = libio.a libsquashfs.la libcommon.a libfstree.a \
+test_fstree_glob1_LDADD = libsquashfs.la libcommon.a libfstree.a libio.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 = libio.a libsquashfs.la libcommon.a libfstree.a \
+test_sort_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.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 = libio.a libsquashfs.la libcommon.a libfstree.a \
+fstree_fuzz_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
libutil.a libcompat.a
GENSQUASHFS_TESTS = \
diff --git a/bin/gensquashfs/test/fstree_from_file.c b/bin/gensquashfs/test/fstree_from_file.c
index bbd1c09..4cf9f25 100644
--- a/bin/gensquashfs/test/fstree_from_file.c
+++ b/bin/gensquashfs/test/fstree_from_file.c
@@ -7,7 +7,6 @@
#include "config.h"
#include "util/test.h"
-#include "io/mem.h"
#include "mkfs.h"
const char *listing =
diff --git a/bin/gensquashfs/test/fstree_from_file2.c b/bin/gensquashfs/test/fstree_from_file2.c
index 3f9561b..5ee486c 100644
--- a/bin/gensquashfs/test/fstree_from_file2.c
+++ b/bin/gensquashfs/test/fstree_from_file2.c
@@ -7,7 +7,6 @@
#include "config.h"
#include "util/test.h"
-#include "io/mem.h"
#include "mkfs.h"
const char *listing =
diff --git a/bin/gensquashfs/test/sort_file.c b/bin/gensquashfs/test/sort_file.c
index 828548a..17d8685 100644
--- a/bin/gensquashfs/test/sort_file.c
+++ b/bin/gensquashfs/test/sort_file.c
@@ -9,7 +9,6 @@
#include "sqfs/block.h"
#include "util/test.h"
#include "util/util.h"
-#include "io/mem.h"
#include "mkfs.h"
static const char *listing =
diff --git a/bin/rdsquashfs/Makemodule.am b/bin/rdsquashfs/Makemodule.am
index 380883e..d53ea77 100644
--- a/bin/rdsquashfs/Makemodule.am
+++ b/bin/rdsquashfs/Makemodule.am
@@ -4,7 +4,7 @@ rdsquashfs_SOURCES = bin/rdsquashfs/src/rdsquashfs.c \
bin/rdsquashfs/src/describe.c bin/rdsquashfs/src/fill_files.c \
bin/rdsquashfs/src/dump_xattrs.c bin/rdsquashfs/src/stat.c
rdsquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-rdsquashfs_LDADD = libcommon.a libio.a libcompat.a libutil.a libsquashfs.la
+rdsquashfs_LDADD = libcommon.a libcompat.a libutil.a libsquashfs.la
rdsquashfs_LDADD += libfstree.a $(LZO_LIBS) $(PTHREAD_LIBS)
dist_man1_MANS += bin/rdsquashfs/rdsquashfs.1
diff --git a/bin/sqfsdiff/Makemodule.am b/bin/sqfsdiff/Makemodule.am
index f520453..43caf90 100644
--- a/bin/sqfsdiff/Makemodule.am
+++ b/bin/sqfsdiff/Makemodule.am
@@ -4,7 +4,7 @@ sqfsdiff_SOURCES = bin/sqfsdiff/src/sqfsdiff.c bin/sqfsdiff/src/sqfsdiff.h \
bin/sqfsdiff/src/compare_files.c bin/sqfsdiff/src/super.c \
bin/sqfsdiff/src/extract.c
sqfsdiff_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-sqfsdiff_LDADD = libcommon.a libio.a libsquashfs.la libcompat.a libutil.a
+sqfsdiff_LDADD = libcommon.a libsquashfs.la libcompat.a libutil.a
sqfsdiff_LDADD += $(LZO_LIBS) libfstree.a $(PTHREAD_LIBS)
dist_man1_MANS += bin/sqfsdiff/sqfsdiff.1
diff --git a/include/common.h b/include/common.h
index ab6fccf..13d79ba 100644
--- a/include/common.h
+++ b/include/common.h
@@ -22,7 +22,6 @@
#include "simple_writer.h"
#include "compress_cli.h"
#include "dir_tree.h"
-#include "io/std.h"
#include "compat.h"
#include "fstree.h"
@@ -54,4 +53,11 @@ void print_size(sqfs_u64 size, char *buffer, bool round_to_int);
*/
int parse_fstree_defaults(fstree_defaults_t *out, char *str);
+int istream_open_stdin(sqfs_istream_t **out);
+
+int ostream_open_stdout(sqfs_ostream_t **out);
+
+sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz,
+ const void *data, size_t size);
+
#endif /* COMMON_H */
diff --git a/include/io/mem.h b/include/io/mem.h
deleted file mode 100644
index 20b04ab..0000000
--- a/include/io/mem.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * mem.h
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#ifndef IO_MEM_STREAM_H
-#define IO_MEM_STREAM_H
-
-#include "sqfs/predef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SQFS_INTERNAL
-sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz,
- const void *data, size_t size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* IO_MEM_STREAM_H */
diff --git a/include/io/std.h b/include/io/std.h
deleted file mode 100644
index a9f436a..0000000
--- a/include/io/std.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * std.h
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#ifndef IO_STD_H
-#define IO_STD_H
-
-#include "sqfs/io.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Create an input stream that reads from standard input.
- *
- * @memberof sqfs_istream_t
- *
- * @param out Returns a pointer to an input stream on success.
- *
- * @return Zero on success, a negative @ref SQFS_ERROR number on failure
- */
-SQFS_INTERNAL int istream_open_stdin(sqfs_istream_t **out);
-
-/**
- * @brief Create an output stream that writes to standard output.
- *
- * @memberof sqfs_ostream_t
- *
- * @param out Returns a pointer to an output stream on success.
- *
- * @return Zero on success, a negative @ref SQFS_ERROR number on failure
- */
-SQFS_INTERNAL int ostream_open_stdout(sqfs_ostream_t **out);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* IO_STD_H */
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am
index 7c07d48..9438d3a 100644
--- a/lib/common/Makemodule.am
+++ b/lib/common/Makemodule.am
@@ -6,7 +6,8 @@ libcommon_a_SOURCES = include/common.h include/simple_writer.h \
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/dir_tree.c lib/common/src/read_tree.c
+ lib/common/src/dir_tree.c lib/common/src/read_tree.c \
+ lib/common/src/stream.c
libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS)
if WITH_LZO
@@ -15,14 +16,18 @@ endif
noinst_LIBRARIES += libcommon.a
+test_istream_mem_SOURCES = lib/common/test/istream_mem.c
+test_istream_mem_LDADD = libcommon.a libsquashfs.la libcompat.a
+test_istream_mem_CPPFLAGS = $(AM_CPPFLAGS)
+
test_fstree_cli_SOURCES = lib/common/test/fstree_cli.c
-test_fstree_cli_LDADD = libcommon.a libio.a libutil.a libcompat.a
+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
LIBCOMMON_TESTS = \
- test_fstree_cli test_get_node_path
+ test_istream_mem test_fstree_cli test_get_node_path
check_PROGRAMS += $(LIBCOMMON_TESTS)
TESTS += $(LIBCOMMON_TESTS)
diff --git a/lib/io/src/mem.c b/lib/common/src/stream.c
index 7150d1f..a557360 100644
--- a/lib/io/src/mem.c
+++ b/lib/common/src/stream.c
@@ -5,14 +5,24 @@
* Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/mem.h"
#include "compat.h"
+#include "common.h"
#include "sqfs/io.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#if defined(_WIN32) || defined(__WINDOWS__)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#else
+#include <unistd.h>
+#define STD_INPUT_HANDLE STDIN_FILENO
+#define STD_OUTPUT_HANDLE STDOUT_FILENO
+#define GetStdHandle(hnd) hnd
+#endif
+
typedef struct {
sqfs_istream_t base;
@@ -108,3 +118,18 @@ sqfs_istream_t *istream_memory_create(const char *name, size_t bufsz,
strm->get_filename = mem_in_get_filename;
return strm;
}
+
+int istream_open_stdin(sqfs_istream_t **out)
+{
+ sqfs_file_handle_t hnd = GetStdHandle(STD_INPUT_HANDLE);
+
+ return sqfs_istream_open_handle(out, "stdin", hnd, 0);
+}
+
+int ostream_open_stdout(sqfs_ostream_t **out)
+{
+ sqfs_file_handle_t hnd = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ return sqfs_ostream_open_handle(out, "stdout", hnd,
+ SQFS_FILE_OPEN_NO_SPARSE);
+}
diff --git a/lib/io/test/istream_mem.c b/lib/common/test/istream_mem.c
index d5e0c2c..2213168 100644
--- a/lib/io/test/istream_mem.c
+++ b/lib/common/test/istream_mem.c
@@ -7,8 +7,8 @@
#include "config.h"
#include "util/test.h"
-#include "io/mem.h"
#include "sqfs/io.h"
+#include "common.h"
static const size_t end0 = 449; /* region 1: filled with 'A' */
static const size_t end1 = 521; /* region 2: filled with 'B' */
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am
index d342063..2f6fb1c 100644
--- a/lib/io/Makemodule.am
+++ b/lib/io/Makemodule.am
@@ -1,20 +1,14 @@
-libio_a_SOURCES = include/io/xfrm.h include/io/std.h \
- include/io/dir_iterator.h include/io/mem.h lib/io/src/internal.h \
- lib/io/src/xfrm/ostream.c \
- lib/io/src/xfrm/istream.c lib/io/src/dir_tree_iterator.c \
- lib/io/src/mem.c lib/io/src/std.c
+libio_a_SOURCES = include/io/xfrm.h include/io/dir_iterator.h \
+ lib/io/src/internal.h lib/io/src/xfrm/ostream.c \
+ lib/io/src/xfrm/istream.c 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_istream_mem test_dir_iterator \
+LIBIO_TESTS = test_dir_iterator \
test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3
-test_istream_mem_SOURCES = lib/io/test/istream_mem.c
-test_istream_mem_LDADD = libio.a libcompat.a
-test_istream_mem_CPPFLAGS = $(AM_CPPFLAGS)
-
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)
@@ -37,7 +31,8 @@ test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir
if WITH_XZ
test_io_xfrm_xz_SOURCES = lib/io/test/xfrm.c
-test_io_xfrm_xz_LDADD = libsquashfs.la libio.a libxfrm.a libcompat.a $(XZ_LIBS)
+test_io_xfrm_xz_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \
+ libcompat.a $(XZ_LIBS)
test_io_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1
LIBIO_TESTS += test_io_xfrm_xz
@@ -45,7 +40,7 @@ endif
if WITH_BZIP2
test_io_xfrm_bzip2_SOURCES = lib/io/test/xfrm.c
-test_io_xfrm_bzip2_LDADD = libsquashfs.la libio.a libxfrm.a \
+test_io_xfrm_bzip2_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \
libcompat.a $(BZIP2_LIBS)
test_io_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1
@@ -54,7 +49,7 @@ endif
if WITH_GZIP
test_io_xfrm_gzip_SOURCES = lib/io/test/xfrm.c
-test_io_xfrm_gzip_LDADD = libsquashfs.la libio.a libxfrm.a \
+test_io_xfrm_gzip_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \
libcompat.a $(ZLIB_LIBS)
test_io_xfrm_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1
@@ -64,7 +59,7 @@ endif
if WITH_ZSTD
if HAVE_ZSTD_STREAM
test_io_xfrm_zstd_SOURCES = lib/io/test/xfrm.c
-test_io_xfrm_zstd_LDADD = libsquashfs.la libio.a libxfrm.a \
+test_io_xfrm_zstd_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \
libcompat.a $(ZSTD_LIBS)
test_io_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1
diff --git a/lib/io/src/internal.h b/lib/io/src/internal.h
index e9804b9..7c2b1df 100644
--- a/lib/io/src/internal.h
+++ b/lib/io/src/internal.h
@@ -10,7 +10,6 @@
#include "config.h"
#include "compat.h"
#include "io/xfrm.h"
-#include "io/std.h"
#include "xfrm/compress.h"
#include <string.h>
diff --git a/lib/io/src/std.c b/lib/io/src/std.c
deleted file mode 100644
index 62635ec..0000000
--- a/lib/io/src/std.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * std.c
- *
- * Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-#include "compat.h"
-#include "io/std.h"
-#include "sqfs/io.h"
-
-#if defined(_WIN32) || defined(__WINDOWS__)
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#else
-#include <unistd.h>
-#define STD_INPUT_HANDLE STDIN_FILENO
-#define STD_OUTPUT_HANDLE STDOUT_FILENO
-#define GetStdHandle(hnd) hnd
-#endif
-
-int istream_open_stdin(sqfs_istream_t **out)
-{
- sqfs_file_handle_t hnd = GetStdHandle(STD_INPUT_HANDLE);
-
- return sqfs_istream_open_handle(out, "stdin", hnd, 0);
-}
-
-int ostream_open_stdout(sqfs_ostream_t **out)
-{
- sqfs_file_handle_t hnd = GetStdHandle(STD_OUTPUT_HANDLE);
-
- return sqfs_ostream_open_handle(out, "stdout", hnd,
- SQFS_FILE_OPEN_NO_SPARSE);
-}
diff --git a/lib/io/test/xfrm.c b/lib/io/test/xfrm.c
index b871610..26eee87 100644
--- a/lib/io/test/xfrm.c
+++ b/lib/io/test/xfrm.c
@@ -9,7 +9,7 @@
#include "util/test.h"
#include "sqfs/io.h"
#include "io/xfrm.h"
-#include "io/mem.h"
+#include "common.h"
static const sqfs_u8 blob_in[] = {
#if defined(DO_XZ)
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index b40473e..41ea608 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -125,19 +125,19 @@ xattr_benchmark_SOURCES = lib/sqfs/test/xattr_benchmark.c
xattr_benchmark_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
+test_istream_read_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_istream_skip_SOURCES = lib/sqfs/test/istream_skip.c
-test_istream_skip_LDADD = libsquashfs.la libio.a libutil.a libcompat.a
+test_istream_skip_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_stream_splice_SOURCES = lib/sqfs/test/stream_splice.c
-test_stream_splice_LDADD = libsquashfs.la libio.a libutil.a libcompat.a
+test_stream_splice_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_rec_dir_SOURCES = lib/sqfs/test/rec_dir.c
-test_rec_dir_LDADD = libsquashfs.la libio.a libutil.a libcompat.a
+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 libio.a libutil.a libcompat.a
+test_hl_dir_LDADD = libsquashfs.la libutil.a libcompat.a
LIBSQFS_TESTS = \
test_abi test_xattr test_table test_xattr_writer \
diff --git a/lib/sqfs/test/istream_read.c b/lib/sqfs/test/istream_read.c
index f8facea..dc17c8e 100644
--- a/lib/sqfs/test/istream_read.c
+++ b/lib/sqfs/test/istream_read.c
@@ -8,7 +8,7 @@
#include "util/test.h"
#include "sqfs/io.h"
-#include "io/mem.h"
+#include "common.h"
static const sqfs_u64 end0 = 449; /* region 1: filled with 'A' */
static const sqfs_u64 end1 = 521; /* region 2: filled with 'B' */
diff --git a/lib/sqfs/test/istream_skip.c b/lib/sqfs/test/istream_skip.c
index d8a81f2..8ce2fd9 100644
--- a/lib/sqfs/test/istream_skip.c
+++ b/lib/sqfs/test/istream_skip.c
@@ -8,7 +8,7 @@
#include "sqfs/io.h"
#include "util/test.h"
-#include "io/mem.h"
+#include "common.h"
static const sqfs_u64 end0 = 449; /* region 1: filled with 'A' */
static const sqfs_u64 end1 = 521; /* region 2: filled with 'B' */
diff --git a/lib/sqfs/test/stream_splice.c b/lib/sqfs/test/stream_splice.c
index 6f40d1f..1b58ea0 100644
--- a/lib/sqfs/test/stream_splice.c
+++ b/lib/sqfs/test/stream_splice.c
@@ -6,9 +6,9 @@
*/
#include "config.h"
-#include "io/mem.h"
#include "util/test.h"
#include "sqfs/io.h"
+#include "common.h"
static const sqfs_u64 end0 = 449; /* region 1: filled with 'A' */
static const sqfs_u64 end1 = 521; /* region 2: filled with 'B' */
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index 24fb50b..d7b5021 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -36,7 +36,7 @@ endif
noinst_LIBRARIES += libutil.a
test_str_table_SOURCES = lib/util/test/str_table.c
-test_str_table_LDADD = libio.a libsquashfs.la libutil.a libcompat.a
+test_str_table_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_str_table_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/lib/util/test
test_rbtree_SOURCES = lib/util/test/rbtree.c
@@ -79,7 +79,7 @@ test_base64_decode_SOURCES = lib/util/test/base64_decode.c
test_base64_decode_LDADD = libutil.a libcompat.a
test_get_line_SOURCES = lib/util/test/get_line.c
-test_get_line_LDADD = libutil.a libio.a libcompat.a
+test_get_line_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_split_line_SOURCES = lib/util/test/split_line.c
test_split_line_LDADD = libutil.a libcompat.a
diff --git a/lib/util/test/get_line.c b/lib/util/test/get_line.c
index 6189d31..2ea5687 100644
--- a/lib/util/test/get_line.c
+++ b/lib/util/test/get_line.c
@@ -5,8 +5,8 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "util/parse.h"
-#include "io/mem.h"
#include "util/test.h"
+#include "common.h"
typedef struct {
size_t line_num;