aboutsummaryrefslogtreecommitdiff
path: root/bin/rdsquashfs/src/fill_files.c
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/rdsquashfs/src/fill_files.c
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/rdsquashfs/src/fill_files.c')
-rw-r--r--bin/rdsquashfs/src/fill_files.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/rdsquashfs/src/fill_files.c b/bin/rdsquashfs/src/fill_files.c
index 7087883..b26041a 100644
--- a/bin/rdsquashfs/src/fill_files.c
+++ b/bin/rdsquashfs/src/fill_files.c
@@ -137,6 +137,7 @@ static int fill_files(sqfs_data_reader_t *data, int flags)
{
int ret, openflags;
sqfs_ostream_t *fp;
+ sqfs_istream_t *in;
size_t i;
openflags = SQFS_FILE_OPEN_OVERWRITE;
@@ -154,8 +155,19 @@ static int fill_files(sqfs_data_reader_t *data, int flags)
if (!(flags & UNPACK_QUIET))
printf("unpacking %s\n", files[i].path);
- ret = sqfs_data_reader_dump(files[i].path, data, files[i].inode,
- fp, block_size);
+ ret = sqfs_data_reader_create_stream(data, files[i].inode,
+ files[i].path, &in);
+ if (ret) {
+ sqfs_perror(files[i].path, NULL, ret);
+ return -1;
+ }
+
+ do {
+ ret = sqfs_istream_splice(in, fp, block_size);
+ } while (ret > 0);
+
+ sqfs_drop(in);
+
if (ret == 0)
ret = fp->flush(fp);