aboutsummaryrefslogtreecommitdiff
path: root/extras/browse.c
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 /extras/browse.c
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 'extras/browse.c')
-rw-r--r--extras/browse.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/extras/browse.c b/extras/browse.c
index 1d6417f..1cd2cf1 100644
--- a/extras/browse.c
+++ b/extras/browse.c
@@ -293,13 +293,13 @@ static void stat_cmd(const char *filename)
case SQFS_INODE_SLINK:
printf("Hard link count: %u\n", inode->data.slink.nlink);
printf("Link target: %.*s\n", inode->data.slink.target_size,
- inode->slink_target);
+ (const char *)inode->extra);
break;
case SQFS_INODE_EXT_SLINK:
printf("Hard link count: %u\n", inode->data.slink_ext.nlink);
printf("Xattr index: 0x%X\n", inode->data.slink_ext.xattr_idx);
- printf("Link target: %.*s\n",
- inode->data.slink_ext.target_size, inode->slink_target);
+ printf("Link target: %.*s\n", inode->data.slink_ext.target_size,
+ (const char *)inode->extra);
break;
case SQFS_INODE_FILE:
printf("Blocks start: %u\n", inode->data.file.blocks_start);
@@ -313,8 +313,8 @@ static void stat_cmd(const char *filename)
for (i = 0; i < inode->num_file_blocks; ++i) {
printf("\tBlock #%lu size: %u (%s)\n", (unsigned long)i,
- inode->block_sizes[i] & 0x00FFFFFF,
- inode->block_sizes[i] & (1 << 24) ?
+ inode->extra[i] & 0x00FFFFFF,
+ inode->extra[i] & (1 << 24) ?
"uncompressed" : "compressed");
}
break;
@@ -334,8 +334,8 @@ static void stat_cmd(const char *filename)
for (i = 0; i < inode->num_file_blocks; ++i) {
printf("\tBlock #%lu size: %u (%s)\n", (unsigned long)i,
- inode->block_sizes[i] & 0x00FFFFFF,
- inode->block_sizes[i] & (1 << 24) ?
+ inode->extra[i] & 0x00FFFFFF,
+ inode->extra[i] & (1 << 24) ?
"compressed" : "uncompressed");
}
break;