summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/serialize_fstree.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-09 11:45:26 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-09 12:03:15 +0200
commit8ef9f10b20e313db5edd0b9c11ecdd8690812b8d (patch)
tree2695e7026197e016702abfa963f4034ca72e9362 /lib/sqfshelper/serialize_fstree.c
parent526fd8b4969b2efe62e0fbc339a7b7dafefb7729 (diff)
Remove ad-hoc image size accounting
Much simpler to just set the correct size in the end, before writing the super block. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/serialize_fstree.c')
-rw-r--r--lib/sqfshelper/serialize_fstree.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c
index ea3d479..1953e8d 100644
--- a/lib/sqfshelper/serialize_fstree.c
+++ b/lib/sqfshelper/serialize_fstree.c
@@ -64,6 +64,8 @@ int sqfs_serialize_fstree(sqfs_file_t *file, sqfs_super_t *super, fstree_t *fs,
if (dirwr == NULL)
goto out_dm;
+ super->inode_table_start = file->get_size(file);
+
for (i = 2; i < fs->inode_tbl_size; ++i) {
if (S_ISDIR(fs->inode_table[i]->mode)) {
if (write_dir_entries(dirwr, fs->inode_table[i]))
@@ -104,14 +106,7 @@ int sqfs_serialize_fstree(sqfs_file_t *file, sqfs_super_t *super, fstree_t *fs,
goto out;
super->root_inode_ref = fs->root->inode_ref;
-
- sqfs_meta_writer_get_position(im, &block, &offset);
- super->inode_table_start = super->bytes_used;
- super->bytes_used += block;
-
- sqfs_meta_writer_get_position(dm, &block, &offset);
- super->directory_table_start = super->bytes_used;
- super->bytes_used += block;
+ super->directory_table_start = file->get_size(file);
if (sqfs_meta_write_write_to_file(dm))
goto out;