aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 15:16:03 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 15:16:03 +0200
commit484cd01590ec488cca1f8a5c7c76cd223609e299 (patch)
tree0e3bc268688c2feb8773871a43381a998ce846e7 /lib
parent8cf84b4995552bad4e77eb795e36c0b1d65a720a (diff)
Migrate file istream/ostream from libio to libsquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/io/Makemodule.am4
-rw-r--r--lib/io/src/internal.h1
-rw-r--r--lib/io/src/std.c7
-rw-r--r--lib/sqfs/Makemodule.am7
-rw-r--r--lib/sqfs/src/unix/istream.c (renamed from lib/io/src/unix/istream.c)28
-rw-r--r--lib/sqfs/src/unix/ostream.c (renamed from lib/io/src/unix/ostream.c)20
-rw-r--r--lib/sqfs/src/win32/istream.c (renamed from lib/io/src/win32/istream.c)16
-rw-r--r--lib/sqfs/src/win32/ostream.c (renamed from lib/io/src/win32/ostream.c)14
-rw-r--r--lib/tar/test/tar_big_file.c5
-rw-r--r--lib/tar/test/tar_fuzz.c4
-rw-r--r--lib/tar/test/tar_iterator.c6
-rw-r--r--lib/tar/test/tar_iterator2.c4
-rw-r--r--lib/tar/test/tar_iterator3.c4
-rw-r--r--lib/tar/test/tar_simple.c5
-rw-r--r--lib/tar/test/tar_sparse.c4
-rw-r--r--lib/tar/test/tar_sparse_gnu.c4
-rw-r--r--lib/tar/test/tar_target_filled.c4
-rw-r--r--lib/tar/test/tar_write_simple.c4
-rw-r--r--lib/tar/test/tar_xattr.c5
-rw-r--r--lib/tar/test/tar_xattr_bin.c5
-rw-r--r--lib/util/test/str_table.c6
21 files changed, 95 insertions, 62 deletions
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am
index e128eef..4f2c180 100644
--- a/lib/io/Makemodule.am
+++ b/lib/io/Makemodule.am
@@ -1,5 +1,5 @@
libio_a_SOURCES = include/io/istream.h include/io/xfrm.h \
- include/io/file.h include/io/std.h include/io/dir_entry.h \
+ include/io/std.h include/io/dir_entry.h \
include/io/dir_iterator.h include/io/mem.h lib/io/src/internal.h \
lib/io/src/get_line.c lib/io/src/xfrm/ostream.c \
lib/io/src/xfrm/istream.c lib/io/src/dir_tree_iterator.c \
@@ -8,11 +8,9 @@ libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS)
libio_a_CFLAGS += $(ZSTD_CFLAGS) $(BZIP2_CFLAGS)
if WINDOWS
-libio_a_SOURCES += lib/io/src/win32/ostream.c lib/io/src/win32/istream.c
libio_a_SOURCES += lib/io/src/win32/dir_iterator.c
libio_a_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
else
-libio_a_SOURCES += lib/io/src/unix/ostream.c lib/io/src/unix/istream.c
libio_a_SOURCES += lib/io/src/unix/dir_iterator.c
endif
diff --git a/lib/io/src/internal.h b/lib/io/src/internal.h
index e010727..a618ed3 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/istream.h"
-#include "io/file.h"
#include "io/xfrm.h"
#include "io/std.h"
#include "xfrm/compress.h"
diff --git a/lib/io/src/std.c b/lib/io/src/std.c
index 212fa6f..c52b4c5 100644
--- a/lib/io/src/std.c
+++ b/lib/io/src/std.c
@@ -6,7 +6,6 @@
*/
#include "config.h"
#include "compat.h"
-#include "io/file.h"
#include "io/std.h"
#include "sqfs/io.h"
@@ -24,13 +23,13 @@ int istream_open_stdin(sqfs_istream_t **out)
{
sqfs_file_handle_t hnd = GetStdHandle(STD_INPUT_HANDLE);
- return istream_open_handle(out, "stdin", hnd);
+ return sqfs_istream_open_handle(out, "stdin", hnd);
}
int ostream_open_stdout(sqfs_ostream_t **out)
{
sqfs_file_handle_t hnd = GetStdHandle(STD_OUTPUT_HANDLE);
- return ostream_open_handle(out, "stdout", hnd,
- SQFS_FILE_OPEN_NO_SPARSE);
+ return sqfs_ostream_open_handle(out, "stdout", hnd,
+ SQFS_FILE_OPEN_NO_SPARSE);
}
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index 2727b11..83ca478 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -57,12 +57,15 @@ libsquashfs_la_SOURCES += lib/util/src/mempool.c include/util/mempool.h
endif
if WINDOWS
-libsquashfs_la_SOURCES += lib/sqfs/src/win32/io_file.c
+libsquashfs_la_SOURCES += lib/sqfs/src/win32/io_file.c \
+ lib/sqfs/src/win32/ostream.c lib/sqfs/src/win32/istream.c
+
libsquashfs_la_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
libsquashfs_la_CFLAGS += -Wc,-static-libgcc
libsquashfs_la_LDFLAGS += -no-undefined -avoid-version
else
-libsquashfs_la_SOURCES += lib/sqfs/src/unix/io_file.c
+libsquashfs_la_SOURCES += lib/sqfs/src/unix/io_file.c \
+ lib/sqfs/src/unix/ostream.c lib/sqfs/src/unix/istream.c
endif
if HAVE_PTHREAD
diff --git a/lib/io/src/unix/istream.c b/lib/sqfs/src/unix/istream.c
index 55b467e..fd2f120 100644
--- a/lib/io/src/unix/istream.c
+++ b/lib/sqfs/src/unix/istream.c
@@ -1,13 +1,24 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* istream.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "../internal.h"
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
#include "sqfs/io.h"
#include "sqfs/error.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#define BUFSZ (131072)
+
typedef struct {
sqfs_istream_t base;
char *path;
@@ -101,8 +112,8 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-int istream_open_handle(sqfs_istream_t **out, const char *path,
- sqfs_file_handle_t fd)
+int sqfs_istream_open_handle(sqfs_istream_t **out, const char *path,
+ sqfs_file_handle_t fd)
{
file_istream_t *file = calloc(1, sizeof(*file));
sqfs_istream_t *strm = (sqfs_istream_t *)file;
@@ -138,7 +149,7 @@ int istream_open_handle(sqfs_istream_t **out, const char *path,
return 0;
}
-int istream_open_file(sqfs_istream_t **out, const char *path)
+int sqfs_istream_open_file(sqfs_istream_t **out, const char *path)
{
sqfs_file_handle_t fd;
int ret;
@@ -147,9 +158,12 @@ int istream_open_file(sqfs_istream_t **out, const char *path)
if (ret)
return ret;
- ret = istream_open_handle(out, path, fd);
- if (ret != 0)
+ ret = sqfs_istream_open_handle(out, path, fd);
+ if (ret != 0) {
+ int temp = errno;
close(fd);
+ errno = temp;
+ }
return ret;
}
diff --git a/lib/io/src/unix/ostream.c b/lib/sqfs/src/unix/ostream.c
index 57467f5..89982c1 100644
--- a/lib/io/src/unix/ostream.c
+++ b/lib/sqfs/src/unix/ostream.c
@@ -1,13 +1,21 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* ostream.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "../internal.h"
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
#include "sqfs/io.h"
#include "sqfs/error.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+
typedef struct {
sqfs_ostream_t base;
char *path;
@@ -135,8 +143,8 @@ static const char *file_get_filename(sqfs_ostream_t *strm)
return ((file_ostream_t *)strm)->path;
}
-int ostream_open_handle(sqfs_ostream_t **out, const char *path,
- sqfs_file_handle_t fd, int flags)
+int sqfs_ostream_open_handle(sqfs_ostream_t **out, const char *path,
+ sqfs_file_handle_t fd, int flags)
{
file_ostream_t *file = calloc(1, sizeof(*file));
sqfs_ostream_t *strm = (sqfs_ostream_t *)file;
@@ -175,7 +183,7 @@ int ostream_open_handle(sqfs_ostream_t **out, const char *path,
return 0;
}
-int ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
+int sqfs_ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
{
sqfs_file_handle_t fd;
int ret;
@@ -185,7 +193,7 @@ int ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
if (ret)
return ret;
- ret = ostream_open_handle(out, path, fd, flags);
+ ret = sqfs_ostream_open_handle(out, path, fd, flags);
if (ret) {
int temp = errno;
close(fd);
diff --git a/lib/io/src/win32/istream.c b/lib/sqfs/src/win32/istream.c
index a09f3c3..ba44c0b 100644
--- a/lib/io/src/win32/istream.c
+++ b/lib/sqfs/src/win32/istream.c
@@ -1,15 +1,20 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* istream.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "../internal.h"
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
#include "sqfs/io.h"
#include "sqfs/error.h"
+#define BUFSZ (131072)
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <assert.h>
typedef struct {
sqfs_istream_t base;
@@ -112,7 +117,8 @@ static void file_destroy(sqfs_object_t *obj)
free(file);
}
-int istream_open_handle(sqfs_istream_t **out, const char *path, HANDLE hnd)
+int sqfs_istream_open_handle(sqfs_istream_t **out, const char *path,
+ sqfs_file_handle_t hnd)
{
file_istream_t *file = calloc(1, sizeof(*file));
sqfs_istream_t *strm = (sqfs_istream_t *)file;
@@ -152,7 +158,7 @@ int istream_open_handle(sqfs_istream_t **out, const char *path, HANDLE hnd)
return 0;
}
-int istream_open_file(sqfs_istream_t **out, const char *path)
+int sqfs_istream_open_file(sqfs_istream_t **out, const char *path)
{
sqfs_file_handle_t hnd;
int ret;
@@ -161,7 +167,7 @@ int istream_open_file(sqfs_istream_t **out, const char *path)
if (ret)
return ret;
- ret = istream_open_handle(out, path, hnd);
+ ret = sqfs_istream_open_handle(out, path, hnd);
if (ret) {
DWORD temp = GetLastError();
CloseHandle(hnd);
diff --git a/lib/io/src/win32/ostream.c b/lib/sqfs/src/win32/ostream.c
index b7f0e06..3e6a8a7 100644
--- a/lib/io/src/win32/ostream.c
+++ b/lib/sqfs/src/win32/ostream.c
@@ -1,10 +1,12 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* ostream.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "../internal.h"
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
#include "sqfs/io.h"
#include "sqfs/error.h"
@@ -128,8 +130,8 @@ static const char *file_get_filename(sqfs_ostream_t *strm)
return ((file_ostream_t *)strm)->path;
}
-int ostream_open_handle(sqfs_ostream_t **out, const char *path,
- sqfs_file_handle_t hnd, int flags)
+int sqfs_ostream_open_handle(sqfs_ostream_t **out, const char *path,
+ sqfs_file_handle_t hnd, int flags)
{
file_ostream_t *file = calloc(1, sizeof(*file));
sqfs_ostream_t *strm = (sqfs_ostream_t *)file;
@@ -168,7 +170,7 @@ int ostream_open_handle(sqfs_ostream_t **out, const char *path,
return 0;
}
-int ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
+int sqfs_ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
{
sqfs_file_handle_t hnd;
int ret;
@@ -178,7 +180,7 @@ int ostream_open_file(sqfs_ostream_t **out, const char *path, int flags)
if (ret)
return ret;
- ret = ostream_open_handle(out, path, hnd, flags);
+ ret = sqfs_ostream_open_handle(out, path, hnd, flags);
if (ret) {
DWORD temp = GetLastError();
CloseHandle(hnd);
diff --git a/lib/tar/test/tar_big_file.c b/lib/tar/test/tar_big_file.c
index 6a88d4c..2c8a176 100644
--- a/lib/tar/test/tar_big_file.c
+++ b/lib/tar/test/tar_big_file.c
@@ -6,8 +6,8 @@
*/
#include "config.h"
#include "tar/tar.h"
-#include "io/file.h"
#include "util/test.h"
+#include "sqfs/io.h"
int main(int argc, char **argv)
{
@@ -16,7 +16,8 @@ int main(int argc, char **argv)
int ret;
(void)argc; (void)argv;
- ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ ret = sqfs_istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/tar/test/tar_fuzz.c b/lib/tar/test/tar_fuzz.c
index 42fe73d..1c4b52e 100644
--- a/lib/tar/test/tar_fuzz.c
+++ b/lib/tar/test/tar_fuzz.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "io/file.h"
+#include "sqfs/io.h"
#include "tar/tar.h"
#include "common.h"
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- ret = istream_open_file(&fp, argv[1]);
+ ret = sqfs_istream_open_file(&fp, argv[1]);
if (ret) {
sqfs_perror("stdint", NULL, ret);
return EXIT_FAILURE;
diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c
index 8de50ed..d4c2a35 100644
--- a/lib/tar/test/tar_iterator.c
+++ b/lib/tar/test/tar_iterator.c
@@ -5,10 +5,10 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
#include "sqfs/error.h"
+#include "sqfs/io.h"
#ifndef TESTUID
#define TESTUID 1000
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
(void)argc; (void)argv;
/* Open the file, create an iterator */
- iret = istream_open_file(&fp,
+ iret = sqfs_istream_open_file(&fp,
STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(iret, 0);
TEST_NOT_NULL(fp);
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
sqfs_drop(fp);
/* re-open the tar iterator */
- iret = istream_open_file(&fp,
+ iret = sqfs_istream_open_file(&fp,
STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(iret, 0);
TEST_NOT_NULL(fp);
diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c
index 8826762..8bbaf62 100644
--- a/lib/tar/test/tar_iterator2.c
+++ b/lib/tar/test/tar_iterator2.c
@@ -5,9 +5,9 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
+#include "sqfs/io.h"
static const struct {
uint64_t offset;
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
int iret;
(void)argc; (void)argv;
- iret = istream_open_file(&fp,
+ iret = sqfs_istream_open_file(&fp,
STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(iret, 0);
TEST_NOT_NULL(fp);
diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c
index 0aee0e3..9fd5f59 100644
--- a/lib/tar/test/tar_iterator3.c
+++ b/lib/tar/test/tar_iterator3.c
@@ -6,10 +6,10 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
#include "sqfs/error.h"
+#include "sqfs/io.h"
int main(int argc, char **argv)
{
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
TEST_ASSERT(chdir(TEST_PATH) == 0);
- ret = istream_open_file(&fp, "format-acceptance/link_filled.tar");
+ ret = sqfs_istream_open_file(&fp, "format-acceptance/link_filled.tar");
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_EQUAL_UI(((sqfs_object_t *)fp)->refcount, 1);
diff --git a/lib/tar/test/tar_simple.c b/lib/tar/test/tar_simple.c
index 8ee5b84..ad9fdde 100644
--- a/lib/tar/test/tar_simple.c
+++ b/lib/tar/test/tar_simple.c
@@ -5,9 +5,9 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
+#include "sqfs/io.h"
#ifndef TESTUID
#define TESTUID 1000
@@ -43,7 +43,8 @@ int main(int argc, char **argv)
int ret;
(void)argc; (void)argv;
- ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ ret = sqfs_istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/tar/test/tar_sparse.c b/lib/tar/test/tar_sparse.c
index d93482d..49b2064 100644
--- a/lib/tar/test/tar_sparse.c
+++ b/lib/tar/test/tar_sparse.c
@@ -5,9 +5,9 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
+#include "sqfs/io.h"
static void test_case_sparse(const char *path)
{
@@ -16,7 +16,7 @@ static void test_case_sparse(const char *path)
sqfs_istream_t *fp;
int ret;
- ret = istream_open_file(&fp, path);
+ ret = sqfs_istream_open_file(&fp, path);
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/tar/test/tar_sparse_gnu.c b/lib/tar/test/tar_sparse_gnu.c
index 6effb52..a2f8332 100644
--- a/lib/tar/test/tar_sparse_gnu.c
+++ b/lib/tar/test/tar_sparse_gnu.c
@@ -5,9 +5,9 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
+#include "sqfs/io.h"
int main(int argc, char **argv)
{
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
TEST_ASSERT(chdir(TEST_PATH) == 0);
- ret = istream_open_file(&fp, "sparse-files/gnu-small.tar");
+ ret = sqfs_istream_open_file(&fp, "sparse-files/gnu-small.tar");
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/tar/test/tar_target_filled.c b/lib/tar/test/tar_target_filled.c
index 85a1af4..93c3b02 100644
--- a/lib/tar/test/tar_target_filled.c
+++ b/lib/tar/test/tar_target_filled.c
@@ -5,9 +5,9 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
+#include "sqfs/io.h"
int main(int argc, char **argv)
{
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
TEST_ASSERT(chdir(TEST_PATH) == 0);
- ret = istream_open_file(&fp, "format-acceptance/link_filled.tar");
+ ret = sqfs_istream_open_file(&fp, "format-acceptance/link_filled.tar");
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c
index 28f199f..bc1b93e 100644
--- a/lib/tar/test/tar_write_simple.c
+++ b/lib/tar/test/tar_write_simple.c
@@ -7,7 +7,6 @@
#include "config.h"
#include "tar/tar.h"
#include "sqfs/io.h"
-#include "io/file.h"
#include "util/test.h"
#include "sqfs/xattr.h"
#include "compat.h"
@@ -188,7 +187,8 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(wr_offset, sizeof(wr_buffer));
TEST_EQUAL_UI(sizeof(rd_buffer), sizeof(wr_buffer));
- ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ ret = sqfs_istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
diff --git a/lib/tar/test/tar_xattr.c b/lib/tar/test/tar_xattr.c
index 0e0579c..d074e31 100644
--- a/lib/tar/test/tar_xattr.c
+++ b/lib/tar/test/tar_xattr.c
@@ -5,10 +5,10 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
#include "sqfs/xattr.h"
+#include "sqfs/io.h"
int main(int argc, char **argv)
{
@@ -18,7 +18,8 @@ int main(int argc, char **argv)
int ret;
(void)argc; (void)argv;
- ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ ret = sqfs_istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c
index 617c356..68f23fe 100644
--- a/lib/tar/test/tar_xattr_bin.c
+++ b/lib/tar/test/tar_xattr_bin.c
@@ -5,10 +5,10 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "io/file.h"
#include "tar/tar.h"
#include "util/test.h"
#include "sqfs/xattr.h"
+#include "sqfs/io.h"
static const uint8_t value[] = {
0x00, 0x00, 0x00, 0x02,
@@ -26,7 +26,8 @@ int main(int argc, char **argv)
int ret;
(void)argc; (void)argv;
- ret = istream_open_file(&fp, STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
+ ret = sqfs_istream_open_file(&fp,
+ STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(fp);
TEST_ASSERT(read_header(fp, &hdr) == 0);
diff --git a/lib/util/test/str_table.c b/lib/util/test/str_table.c
index 4a62b59..02e5e67 100644
--- a/lib/util/test/str_table.c
+++ b/lib/util/test/str_table.c
@@ -7,10 +7,10 @@
#include "config.h"
#include "util/str_table.h"
-#include "io/istream.h"
-#include "io/file.h"
#include "compat.h"
+#include "io/istream.h"
#include "util/test.h"
+#include "sqfs/io.h"
static char *strings[1000];
@@ -21,7 +21,7 @@ static int read_strings(void)
char *line;
int i;
- i = istream_open_file(&fp, "words.txt");
+ i = sqfs_istream_open_file(&fp, "words.txt");
TEST_EQUAL_I(i, 0);
TEST_NOT_NULL(fp);