aboutsummaryrefslogtreecommitdiff
path: root/lib/tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-12 21:21:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 13:38:25 +0200
commitba99ef34e7b073c03519ef74f017091de6c9bee8 (patch)
tree8c134f72990200550ac96e46bd47d4cc0ba85810 /lib/tar
parente811851deba9c45f3d9b3c5b4ad5eaa7945382d5 (diff)
Move sqfs_istream_t & sqfs_ostream_t into libsquashfs
For now, only the interfaces and helper functions are moved, the concrete implementations remain in libio. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar')
-rw-r--r--lib/tar/src/iterator.c4
-rw-r--r--lib/tar/src/read_header.c4
-rw-r--r--lib/tar/src/read_sparse_map_new.c4
-rw-r--r--lib/tar/src/read_sparse_map_old.c2
-rw-r--r--lib/tar/src/record_to_memory.c4
-rw-r--r--lib/tar/test/tar_fuzz.c2
-rw-r--r--lib/tar/test/tar_iterator.c4
-rw-r--r--lib/tar/test/tar_iterator2.c2
-rw-r--r--lib/tar/test/tar_iterator3.c8
-rw-r--r--lib/tar/test/tar_simple.c2
-rw-r--r--lib/tar/test/tar_target_filled.c8
-rw-r--r--lib/tar/test/tar_write_simple.c6
-rw-r--r--lib/tar/test/tar_xattr.c2
-rw-r--r--lib/tar/test/tar_xattr_bin.c2
14 files changed, 27 insertions, 27 deletions
diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c
index 5920b46..93c931c 100644
--- a/lib/tar/src/iterator.c
+++ b/lib/tar/src/iterator.c
@@ -177,13 +177,13 @@ static int it_next(dir_iterator_t *it, dir_entry_t **out)
return tar->state;
retry:
if (tar->record_size > 0) {
- ret = istream_skip(tar->stream, tar->record_size);
+ ret = sqfs_istream_skip(tar->stream, tar->record_size);
if (ret)
goto fail;
}
if (tar->padding > 0) {
- ret = istream_skip(tar->stream, tar->padding);
+ ret = sqfs_istream_skip(tar->stream, tar->padding);
if (ret)
goto fail;
}
diff --git a/lib/tar/src/read_header.c b/lib/tar/src/read_header.c
index 3117d8a..16fc9d7 100644
--- a/lib/tar/src/read_header.c
+++ b/lib/tar/src/read_header.c
@@ -175,7 +175,7 @@ int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out)
memset(out, 0, sizeof(*out));
for (;;) {
- ret = istream_read(fp, &hdr, sizeof(hdr));
+ ret = sqfs_istream_read(fp, &hdr, sizeof(hdr));
if (ret < 0)
goto fail;
@@ -226,7 +226,7 @@ int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out)
goto fail;
if (pax_size % 512)
pax_size += 512 - (pax_size % 512);
- istream_skip(fp, pax_size);
+ sqfs_istream_skip(fp, pax_size);
continue;
case TAR_TYPE_PAX:
clear_header(out);
diff --git a/lib/tar/src/read_sparse_map_new.c b/lib/tar/src/read_sparse_map_new.c
index a1f37fd..4e317a8 100644
--- a/lib/tar/src/read_sparse_map_new.c
+++ b/lib/tar/src/read_sparse_map_new.c
@@ -41,7 +41,7 @@ sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp, tar_header_decoded_t *out)
if (out->record_size < 512)
goto fail_format;
- ret = istream_read(fp, buffer, 512);
+ ret = sqfs_istream_read(fp, buffer, 512);
if (ret < 0)
goto fail;
@@ -68,7 +68,7 @@ sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp, tar_header_decoded_t *out)
if (out->record_size < 512)
goto fail_format;
- ret = istream_read(fp, buffer + 512, 512);
+ ret = sqfs_istream_read(fp, buffer + 512, 512);
if (ret < 0)
goto fail;
diff --git a/lib/tar/src/read_sparse_map_old.c b/lib/tar/src/read_sparse_map_old.c
index 832329b..1794073 100644
--- a/lib/tar/src/read_sparse_map_old.c
+++ b/lib/tar/src/read_sparse_map_old.c
@@ -59,7 +59,7 @@ sparse_map_t *read_gnu_old_sparse(sqfs_istream_t *fp, tar_header_t *hdr)
return list;
do {
- ret = istream_read(fp, &sph, sizeof(sph));
+ ret = sqfs_istream_read(fp, &sph, sizeof(sph));
if (ret < 0)
goto fail;
diff --git a/lib/tar/src/record_to_memory.c b/lib/tar/src/record_to_memory.c
index 1bd31aa..597d6f8 100644
--- a/lib/tar/src/record_to_memory.c
+++ b/lib/tar/src/record_to_memory.c
@@ -18,7 +18,7 @@ char *record_to_memory(sqfs_istream_t *fp, size_t size)
if (buffer == NULL)
goto fail_errno;
- ret = istream_read(fp, buffer, size);
+ ret = sqfs_istream_read(fp, buffer, size);
if (ret < 0)
goto fail;
@@ -28,7 +28,7 @@ char *record_to_memory(sqfs_istream_t *fp, size_t size)
}
if (size % 512) {
- if (istream_skip(fp, 512 - (size % 512)))
+ if (sqfs_istream_skip(fp, 512 - (size % 512)))
goto fail;
}
diff --git a/lib/tar/test/tar_fuzz.c b/lib/tar/test/tar_fuzz.c
index bdea98e..92c0952 100644
--- a/lib/tar/test/tar_fuzz.c
+++ b/lib/tar/test/tar_fuzz.c
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
if (ret < 0)
goto fail;
- ret = istream_skip(fp, hdr.record_size);
+ ret = sqfs_istream_skip(fp, hdr.record_size);
clear_header(&hdr);
if (ret < 0)
diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c
index 25e1389..f51ecd6 100644
--- a/lib/tar/test/tar_iterator.c
+++ b/lib/tar/test/tar_iterator.c
@@ -83,12 +83,12 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(((sqfs_object_t *)ti)->refcount, 1);
/* read the data from the stream */
- ret = istream_read(ti, buffer, sizeof(buffer));
+ ret = sqfs_istream_read(ti, buffer, sizeof(buffer));
TEST_EQUAL_I(ret, 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
- ret = istream_read(ti, buffer, sizeof(buffer));
+ ret = sqfs_istream_read(ti, buffer, sizeof(buffer));
TEST_EQUAL_I(ret, 0);
sqfs_drop(ti);
diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c
index 6f472ae..7483e81 100644
--- a/lib/tar/test/tar_iterator2.c
+++ b/lib/tar/test/tar_iterator2.c
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
offset = 0;
for (;;) {
- ret = istream_read(ti, buffer, sizeof(buffer));
+ ret = sqfs_istream_read(ti, buffer, sizeof(buffer));
TEST_ASSERT(ret >= 0);
if (ret == 0)
diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c
index 39e7b42..11c2fd2 100644
--- a/lib/tar/test/tar_iterator3.c
+++ b/lib/tar/test/tar_iterator3.c
@@ -86,10 +86,10 @@ int main(int argc, char **argv)
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(ti);
- TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 5);
+ TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
- TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 0);
+ TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 0);
ti = sqfs_drop(ti);
ret = it->next(it, &ent);
@@ -105,10 +105,10 @@ int main(int argc, char **argv)
TEST_EQUAL_I(ret, 0);
TEST_NOT_NULL(ti);
- TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 5);
+ TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
- TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 0);
+ TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 0);
ti = sqfs_drop(ti);
/* "deep" directory hierarchy containg a hard link */
diff --git a/lib/tar/test/tar_simple.c b/lib/tar/test/tar_simple.c
index 656e59b..a666eb5 100644
--- a/lib/tar/test/tar_simple.c
+++ b/lib/tar/test/tar_simple.c
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
TEST_STR_EQUAL(hdr.name, fname);
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
+ TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
clear_header(&hdr);
diff --git a/lib/tar/test/tar_target_filled.c b/lib/tar/test/tar_target_filled.c
index 815728a..4f061c0 100644
--- a/lib/tar/test/tar_target_filled.c
+++ b/lib/tar/test/tar_target_filled.c
@@ -50,10 +50,10 @@ int main(int argc, char **argv)
"20_characters_here03/20_characters_here04/"
"errored_file_tst");
TEST_EQUAL_UI(hdr.actual_size, 5);
- TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
+ TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
- TEST_ASSERT(istream_skip(fp, 512 - 5) == 0);
+ TEST_ASSERT(sqfs_istream_skip(fp, 512 - 5) == 0);
clear_header(&hdr);
TEST_ASSERT(read_header(fp, &hdr) == 0);
@@ -62,10 +62,10 @@ int main(int argc, char **argv)
"20_characters_here03/20_characters_here04/"
"some_test_file");
TEST_EQUAL_UI(hdr.actual_size, 5);
- TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
+ TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
- TEST_ASSERT(istream_skip(fp, 512 - 5) == 0);
+ TEST_ASSERT(sqfs_istream_skip(fp, 512 - 5) == 0);
clear_header(&hdr);
/* "deep" directory hierarchy containg a hard link */
diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c
index 98ac25b..ca8d1e5 100644
--- a/lib/tar/test/tar_write_simple.c
+++ b/lib/tar/test/tar_write_simple.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
#include "tar/tar.h"
-#include "io/ostream.h"
+#include "sqfs/io.h"
#include "io/file.h"
#include "util/test.h"
#include "sqfs/xattr.h"
@@ -191,11 +191,11 @@ int main(int argc, char **argv)
fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE));
TEST_NOT_NULL(fp);
- ret = istream_read(fp, rd_buffer, sizeof(rd_buffer));
+ ret = sqfs_istream_read(fp, rd_buffer, sizeof(rd_buffer));
TEST_ASSERT(ret > 0);
TEST_EQUAL_UI(ret, sizeof(rd_buffer));
- ret = istream_read(fp, rd_buffer, sizeof(rd_buffer));
+ ret = sqfs_istream_read(fp, rd_buffer, sizeof(rd_buffer));
TEST_EQUAL_I(ret, 0);
sqfs_drop(fp);
diff --git a/lib/tar/test/tar_xattr.c b/lib/tar/test/tar_xattr.c
index 657b73d..26a2cd0 100644
--- a/lib/tar/test/tar_xattr.c
+++ b/lib/tar/test/tar_xattr.c
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(hdr.mtime, 1543094477);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
+ TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");
diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c
index f897bce..94c8d76 100644
--- a/lib/tar/test/tar_xattr_bin.c
+++ b/lib/tar/test/tar_xattr_bin.c
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
TEST_EQUAL_UI(hdr.mtime, 1543094477);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
- TEST_ASSERT(istream_read(fp, buffer, 5) == 5);
+ TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5);
buffer[5] = '\0';
TEST_STR_EQUAL(buffer, "test\n");