Re: [PATCH 03/18] Squashfs: convert SQUASHFS_FRAGMENT_* to inline functions

From: Joe Perches

Date: Sat Nov 07 2026 - 05:05:44 EST


On Sat, 2026-11-07 at 05:28 +0000, Phillip Lougher wrote:
> Convert old fashioned #define macros into inline functions. This has
> the following improvements:
>
> 1. Inline functions are typed, which makes the width and sigedness of
> input and outputs explicit, which reduces errors.
[]
> diff --git a/fs/squashfs/squashfs_helpers.h b/fs/squashfs/squashfs_helpers.h
[]
> @@ -51,4 +51,31 @@ static inline s64 squashfs_mkinode(u32 start, u16 offset)
> {
> return ((s64)start << 16) | offset;
> }
> +
> +/* fragment and fragment table defines */
> +static inline s64 squashfs_fragment_bytes(u32 fragments)
> +{
> + return fragments * sizeof(struct squashfs_fragment_entry);

Needs a cast to make the multiply work properly no?

return (s64)fragments * sizeof(struct squashfs_fragment_entry);