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 --- tar/sqfs2tar.c | 2 +- tar/tar2sqfs.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'tar') diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c index 4d31fbe..935b687 100644 --- a/tar/sqfs2tar.c +++ b/tar/sqfs2tar.c @@ -414,7 +414,7 @@ static int write_tree_dfs(const sqfs_tree_node_t *n) } } - target = S_ISLNK(sb.st_mode) ? n->inode->slink_target : NULL; + target = S_ISLNK(sb.st_mode) ? (char *)n->inode->extra : NULL; ret = write_tar_header(out_file, &sb, name, target, xattr, record_counter++); diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 12055c3..b180739 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -275,7 +275,6 @@ static int write_file(tar_header_decoded_t *hdr, file_info_t *fi, return -1; } - inode->block_sizes = (sqfs_u32 *)inode->extra; inode->base.type = SQFS_INODE_FILE; sqfs_inode_set_file_size(inode, filesize); sqfs_inode_set_frag_location(inode, 0xFFFFFFFF, 0xFFFFFFFF); -- cgit v1.2.3