aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/dir_writer.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-23 03:44:33 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-23 04:02:49 +0100
commitc924d87a4cbbeb93825f34f997add1ca4573a368 (patch)
treea2497b2954e0f6538cfa669062ab409f16518fc7 /lib/sqfs/dir_writer.c
parent7350bebc4ceee0bf065e73f392edb725f8d0cd14 (diff)
Unify the payload counters in the sqfs_inode_generic_t
Instead of having seperate counters for blocks, dir index bytes and having to fiddle out the link target size, simply use a single value that stores the number of payload bytes used. A seperate "payload bytes available" is used for dynamically growing inodes during processing. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/dir_writer.c')
-rw-r--r--lib/sqfs/dir_writer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c
index 9dd7ad2..bb3e867 100644
--- a/lib/sqfs/dir_writer.c
+++ b/lib/sqfs/dir_writer.c
@@ -392,6 +392,7 @@ sqfs_inode_generic_t
if (inode == NULL)
return NULL;
+ inode->payload_bytes_available = index_size;
start_block = writer->dir_ref >> 16;
block_offset = writer->dir_ref & 0xFFFF;
@@ -416,7 +417,7 @@ sqfs_inode_generic_t
inode->data.dir_ext.offset = block_offset;
inode->data.dir_ext.xattr_idx = xattr;
inode->data.dir_ext.inodex_count = 0;
- inode->num_dir_idx_bytes = 0;
+ inode->payload_bytes_used = 0;
for (idx = writer->idx; idx != NULL; idx = idx->next) {
memset(&ent, 0, sizeof(ent));
@@ -425,14 +426,14 @@ sqfs_inode_generic_t
ent.size = idx->ent->name_len - 1;
ptr = (sqfs_u8 *)inode->extra +
- inode->num_dir_idx_bytes;
+ inode->payload_bytes_used;
memcpy(ptr, &ent, sizeof(ent));
memcpy(ptr + sizeof(ent), idx->ent->name,
idx->ent->name_len);
inode->data.dir_ext.inodex_count += 1;
- inode->num_dir_idx_bytes += sizeof(ent);
- inode->num_dir_idx_bytes += idx->ent->name_len;
+ inode->payload_bytes_used += sizeof(ent);
+ inode->payload_bytes_used += idx->ent->name_len;
}
}