aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-19 20:05:13 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-19 20:05:13 +0100
commit4a091b656c0861e3f9335c38af25040cb3ff03c8 (patch)
tree263ee5a322bd263125ae07ef40ef5fed31812b29 /lib/common
parent001d3dc914d19b3d85aa04f2a042837cef4af0e4 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/data_reader_dump.c3
-rw-r--r--lib/common/serialize_fstree.c1
2 files changed, 1 insertions, 3 deletions
diff --git a/lib/common/data_reader_dump.c b/lib/common/data_reader_dump.c
index 96103ce..bf418c6 100644
--- a/lib/common/data_reader_dump.c
+++ b/lib/common/data_reader_dump.c
@@ -60,8 +60,7 @@ int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
for (i = 0; i < inode->num_file_blocks; ++i) {
diff = (filesz < block_size) ? filesz : block_size;
- if (SQFS_IS_SPARSE_BLOCK(inode->block_sizes[i]) &&
- allow_sparse) {
+ if (SQFS_IS_SPARSE_BLOCK(inode->extra[i]) && allow_sparse) {
if (fseek(fp, diff, SEEK_CUR) < 0)
goto fail_sparse;
} else {
diff --git a/lib/common/serialize_fstree.c b/lib/common/serialize_fstree.c
index f20ae07..c69f0ea 100644
--- a/lib/common/serialize_fstree.c
+++ b/lib/common/serialize_fstree.c
@@ -38,7 +38,6 @@ static sqfs_inode_generic_t *tree_node_to_inode(tree_node_t *node)
inode->base.type = SQFS_INODE_SLINK;
inode->data.slink.nlink = node->link_count;
inode->data.slink.target_size = extra;
- inode->slink_target = (char *)inode->extra;
memcpy(inode->extra, node->data.target, extra);
break;
case S_IFBLK: