diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-23 03:44:33 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-23 04:02:49 +0100 |
commit | c924d87a4cbbeb93825f34f997add1ca4573a368 (patch) | |
tree | a2497b2954e0f6538cfa669062ab409f16518fc7 /lib/sqfs/read_inode.c | |
parent | 7350bebc4ceee0bf065e73f392edb725f8d0cd14 (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/read_inode.c')
-rw-r--r-- | lib/sqfs/read_inode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sqfs/read_inode.c b/lib/sqfs/read_inode.c index 8653928..6ca61d5 100644 --- a/lib/sqfs/read_inode.c +++ b/lib/sqfs/read_inode.c @@ -101,7 +101,8 @@ static int read_inode_file(sqfs_meta_reader_t *ir, sqfs_inode_t *base, out->base = *base; out->data.file = file; - out->num_file_blocks = count; + out->payload_bytes_available = count * sizeof(sqfs_u32); + out->payload_bytes_used = count * sizeof(sqfs_u32); err = sqfs_meta_reader_read(ir, out->extra, count * sizeof(sqfs_u32)); if (err) { @@ -147,7 +148,8 @@ static int read_inode_file_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base, out->base = *base; out->data.file_ext = file; - out->num_file_blocks = count; + out->payload_bytes_available = count * sizeof(sqfs_u32); + out->payload_bytes_used = count * sizeof(sqfs_u32); err = sqfs_meta_reader_read(ir, out->extra, count * sizeof(sqfs_u32)); if (err) { @@ -186,6 +188,8 @@ static int read_inode_slink(sqfs_meta_reader_t *ir, sqfs_inode_t *base, if (out == NULL) return SQFS_ERROR_ALLOC; + out->payload_bytes_available = size - sizeof(*out); + out->payload_bytes_used = size - sizeof(*out) - 1; out->base = *base; out->data.slink = slink; @@ -298,7 +302,8 @@ static int read_inode_dir_ext(sqfs_meta_reader_t *ir, sqfs_inode_t *base, index_used += ent.size + 1; } - out->num_dir_idx_bytes = index_used; + out->payload_bytes_used = index_used; + out->payload_bytes_available = index_used; *result = out; return 0; } |