summaryrefslogtreecommitdiff
path: root/lib/sqfs/id_table.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-08 14:53:30 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-08 14:53:30 +0200
commit3a851dfe87c88ac1d4dddc2a26cc48b037f852f9 (patch)
treea8a8f34291aa58b25737088d247a91a7f60b4fec /lib/sqfs/id_table.c
parent60064dd0412a149fe00cfc4e2f2361c22656db57 (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/id_table.c')
-rw-r--r--lib/sqfs/id_table.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c
index 496049e..34db8f7 100644
--- a/lib/sqfs/id_table.c
+++ b/lib/sqfs/id_table.c
@@ -73,8 +73,8 @@ int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
return 0;
}
-int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
- sqfs_compressor_t *cmp)
+int sqfs_id_table_read(sqfs_id_table_t *tbl, sqfs_file_t *file,
+ sqfs_super_t *super, sqfs_compressor_t *cmp)
{
uint64_t upper_limit, lower_limit;
void *raw_ids;
@@ -106,7 +106,7 @@ int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
tbl->num_ids = super->id_count;
tbl->max_ids = super->id_count;
- ret = sqfs_read_table(fd, cmp, tbl->num_ids * sizeof(uint32_t),
+ ret = sqfs_read_table(file, cmp, tbl->num_ids * sizeof(uint32_t),
super->id_table_start, lower_limit,
upper_limit, &raw_ids);
if (ret)
@@ -120,8 +120,8 @@ int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
return 0;
}
-int sqfs_id_table_write(sqfs_id_table_t *tbl, int outfd, sqfs_super_t *super,
- sqfs_compressor_t *cmp)
+int sqfs_id_table_write(sqfs_id_table_t *tbl, sqfs_file_t *file,
+ sqfs_super_t *super, sqfs_compressor_t *cmp)
{
uint64_t start;
size_t i;
@@ -132,7 +132,7 @@ int sqfs_id_table_write(sqfs_id_table_t *tbl, int outfd, sqfs_super_t *super,
super->id_count = tbl->num_ids;
- ret = sqfs_write_table(outfd, super, cmp, tbl->ids,
+ ret = sqfs_write_table(file, super, cmp, tbl->ids,
sizeof(tbl->ids[0]) * tbl->num_ids, &start);
super->id_table_start = start;