aboutsummaryrefslogtreecommitdiff
path: root/bin/sqfs2tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-07-18 21:54:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-08-10 09:28:27 +0200
commit5a3b741b92b793be7221a481efca316aec208ebe (patch)
tree81eaa29e7f4510f4419a3dc2f0b29120aa5114ab /bin/sqfs2tar
parent9d431639effb4e33169110031a689fd1e9d435cf (diff)
Add a data reader based sqfs_istream_t implementation
To the sqfs_data_reader_t is added, an sqfs_istream_t implementation that internally reads through the data reader. The uses of the data_reader_dump function are removed and the function is subsequently removed from libcommon. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/sqfs2tar')
-rw-r--r--bin/sqfs2tar/src/write_tree.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/sqfs2tar/src/write_tree.c b/bin/sqfs2tar/src/write_tree.c
index dc3ac72..ed82173 100644
--- a/bin/sqfs2tar/src/write_tree.c
+++ b/bin/sqfs2tar/src/write_tree.c
@@ -157,13 +157,26 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
}
if (S_ISREG(sb.st_mode)) {
- if (sqfs_data_reader_dump(name, data, n->inode, out_file,
- super.block_size)) {
+ sqfs_istream_t *in;
+ int ret;
+
+ ret = sqfs_data_reader_create_stream(data, n->inode, name, &in);
+ if (ret) {
+ sqfs_perror(name, NULL, ret);
sqfs_free(name);
return -1;
}
- ret = padd_file(out_file, sb.st_size);
+ do {
+ ret = sqfs_istream_splice(in, out_file,
+ super.block_size);
+ } while (ret > 0);
+
+ sqfs_drop(in);
+
+ if (ret == 0)
+ ret = padd_file(out_file, sb.st_size);
+
if (ret) {
sqfs_perror(name, NULL, ret);
sqfs_free(name);