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/sqfshelper/write_xattr.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/sqfshelper/write_xattr.c')
-rw-r--r-- | lib/sqfshelper/write_xattr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqfshelper/write_xattr.c b/lib/sqfshelper/write_xattr.c index 6f71eeb..c4fb86e 100644 --- a/lib/sqfshelper/write_xattr.c +++ b/lib/sqfshelper/write_xattr.c @@ -167,7 +167,7 @@ static uint64_t *create_ool_locations_table(fstree_t *fs) return table; } -int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super, +int write_xattr(sqfs_file_t *file, fstree_t *fs, sqfs_super_t *super, sqfs_compressor_t *cmp) { uint64_t kv_start, id_start, block, *tbl, *ool_locations; @@ -185,7 +185,7 @@ int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super, if (ool_locations == NULL) return -1; - mw = sqfs_meta_writer_create(outfd, cmp, false); + mw = sqfs_meta_writer_create(file, cmp, false); if (mw == NULL) goto fail_ool; @@ -254,11 +254,14 @@ int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super, idtbl.xattr_ids = htole32(count); idtbl.unused = 0; - if (write_data("writing xattr ID table", outfd, &idtbl, sizeof(idtbl))) + if (file->write_at(file, file->get_size(file), &idtbl, sizeof(idtbl))) { + perror("writing xattr ID table"); goto fail_tbl; + } - if (write_data("writing xattr ID table", - outfd, tbl, sizeof(tbl[0]) * blocks)) { + if (file->write_at(file, file->get_size(file), + tbl, sizeof(tbl[0]) * blocks)) { + perror("writing xattr ID table"); goto fail_tbl; } |