aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor
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/block_processor
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/block_processor')
-rw-r--r--lib/sqfs/block_processor/common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index d855b51..51851ae 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -10,10 +10,14 @@
static void set_block_size(sqfs_inode_generic_t *inode,
sqfs_u32 index, sqfs_u32 size)
{
+ size_t min_size = (index + 1) * sizeof(sqfs_u32);
+
inode->extra[index] = size;
- if (index >= inode->num_file_blocks)
- inode->num_file_blocks = index + 1;
+ if (min_size >= inode->payload_bytes_used) {
+ inode->payload_bytes_used = min_size;
+ inode->payload_bytes_available = min_size;
+ }
}
int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)