From 4a091b656c0861e3f9335c38af25040cb3ff03c8 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 19 Jan 2020 20:05:13 +0100 Subject: Cleanup: remove the payload pointers from sqfs_inode_generic_t There are 3 types of extra payload: - Directory index - File block sizes - Symlink target This commit removes the type specific pointers and modifies the code to use the payload area directly. To simplify the file block case and mitigate alignment issues, the type of the extra field is changed to sqfs_u32. For symlink target, the extra field can simply be cast to a character pointer (it had to be cast anyway for most uses). For block sizes, probably the most common usecase, it can be used as is. For directory indices, there is a helper function anyway. Signed-off-by: David Oberhollenzer --- extras/mk42sqfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'extras/mk42sqfs.c') diff --git a/extras/mk42sqfs.c b/extras/mk42sqfs.c index 25c9047..1c55bf1 100644 --- a/extras/mk42sqfs.c +++ b/extras/mk42sqfs.c @@ -42,8 +42,7 @@ static sqfs_inode_generic_t *create_file_inode(sqfs_id_table_t *idtbl, inode->data.file.fragment_index = 0xFFFFFFFF; inode->num_file_blocks = 1; - inode->block_sizes = (sqfs_u32 *)inode->extra; - inode->block_sizes[0] = (1 << 24) | inode->data.file.file_size; + inode->extra[0] = (1 << 24) | inode->data.file.file_size; return inode; } @@ -144,7 +143,7 @@ int main(void) inode = create_file_inode(idtbl, inode_num++); inode->data.file.blocks_start = sizeof(super); inode->data.file.file_size = strlen(README); - inode->block_sizes[0] = (1 << 24) | inode->data.file.file_size; + inode->extra[0] = (1 << 24) | inode->data.file.file_size; sqfs_meta_writer_get_position(inode_m, &block_start, &offset); sqfs_meta_writer_write_inode(inode_m, inode); -- cgit v1.2.3