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 --- include/sqfs/inode.h | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'include/sqfs/inode.h') diff --git a/include/sqfs/inode.h b/include/sqfs/inode.h index 65ff45e..17df022 100644 --- a/include/sqfs/inode.h +++ b/include/sqfs/inode.h @@ -482,23 +482,6 @@ struct sqfs_inode_generic_t { */ sqfs_inode_t base; - /** - * @brief A pointer into the extra field holding the symlink target. - * - * @param This string is not null terminated. The helper functions rely - * entirely on the length stored in the symlink inode. - */ - char *slink_target; - - /** - * @brief A pointer into the extra field holding file blocks sizes. - * - * For file inodes, holds the consecutive block sizes. Bit number 24 is - * set if the block is stored uncompressed. If it the size is zero, - * the block is sparse. - */ - sqfs_u32 *block_sizes; - /** * @brief For file inodes, stores the number of blocks used. */ @@ -528,8 +511,13 @@ struct sqfs_inode_generic_t { /** * @brief Holds type specific extra data, such as symlink target. + * + * For regular file inodes, this is an array of block sizes. For symlink + * inodes, this is actually a string holding the target. For extended + * directory inodes, this is actually a blob of tightly packed directory + * index entries. */ - sqfs_u8 extra[]; + sqfs_u32 extra[]; }; #ifdef __cplusplus -- cgit v1.2.3