diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-08 14:53:30 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-08 14:53:30 +0200 |
commit | 3a851dfe87c88ac1d4dddc2a26cc48b037f852f9 (patch) | |
tree | a8a8f34291aa58b25737088d247a91a7f60b4fec /lib/sqfs/read_super.c | |
parent | 60064dd0412a149fe00cfc4e2f2361c22656db57 (diff) |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/read_super.c')
-rw-r--r-- | lib/sqfs/read_super.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqfs/read_super.c b/lib/sqfs/read_super.c index 9f7425c..23909e0 100644 --- a/lib/sqfs/read_super.c +++ b/lib/sqfs/read_super.c @@ -9,19 +9,21 @@ #include "sqfs/super.h" #include "sqfs/error.h" +#include "sqfs/io.h" #include "util.h" #include <endian.h> #include <string.h> -int sqfs_super_read(sqfs_super_t *super, int fd) +int sqfs_super_read(sqfs_super_t *super, sqfs_file_t *file) { size_t block_size = 0; sqfs_super_t temp; - int i; + int i, ret; - if (read_data_at("reading super block", 0, fd, &temp, sizeof(temp))) - return SQFS_ERROR_IO; + ret = file->read_at(file, 0, &temp, sizeof(temp)); + if (ret) + return ret; temp.magic = le32toh(temp.magic); temp.inode_count = le32toh(temp.inode_count); |