From 3a851dfe87c88ac1d4dddc2a26cc48b037f852f9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 8 Sep 2019 14:53:30 +0200 Subject: Replace direct file I/O with abstraction layer This should make it easier to use libsquashfs with custom setups that embedd a squashfs image inside something else. Also, it should make it easier to port to non unix-like platforms. Signed-off-by: David Oberhollenzer --- lib/sqfs/read_table.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/sqfs/read_table.c') diff --git a/lib/sqfs/read_table.c b/lib/sqfs/read_table.c index 843247e..129ecaf 100644 --- a/lib/sqfs/read_table.c +++ b/lib/sqfs/read_table.c @@ -11,13 +11,14 @@ #include "sqfs/error.h" #include "sqfs/table.h" #include "sqfs/data.h" +#include "sqfs/io.h" #include "util.h" #include #include -int sqfs_read_table(int fd, sqfs_compressor_t *cmp, size_t table_size, - uint64_t location, uint64_t lower_limit, +int sqfs_read_table(sqfs_file_t *file, sqfs_compressor_t *cmp, + size_t table_size, uint64_t location, uint64_t lower_limit, uint64_t upper_limit, void **out) { size_t diff, block_count, blk_idx = 0; @@ -43,14 +44,13 @@ int sqfs_read_table(int fd, sqfs_compressor_t *cmp, size_t table_size, goto fail_data; } - if (read_data_at("reading table locations", location, - fd, locations, sizeof(uint64_t) * block_count)) { - err = SQFS_ERROR_IO; + err = file->read_at(file, location, locations, + sizeof(uint64_t) * block_count); + if (err) goto fail_idx; - } /* Read the actual data */ - m = sqfs_meta_reader_create(fd, cmp, lower_limit, upper_limit); + m = sqfs_meta_reader_create(file, cmp, lower_limit, upper_limit); if (m == NULL) { err = SQFS_ERROR_ALLOC; goto fail_idx; -- cgit v1.2.3