[PATCH] fs/squashfs: use lldiv function for math

sean at geanix.com sean at geanix.com
Fri Dec 2 20:29:59 CET 2022


Quoting kasper at krinvent.dk:

> From: Kasper Revsbech <kasper.revsbech.ext at siemensgamesa.com>
>
> When compling for x86:
> u-boot/fs/squashfs/sqfs.c:90: undefined reference to `__udivmoddi4'
>
> Signed-off-by: Kasper Revsbech <kasper.revsbech.ext at siemensgamesa.com>
Tested-by: Sean Nyekjaer <sean at geanix.com>
> ---
>  fs/squashfs/sqfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
> index 74ca70c3ff..4226621923 100644
> --- a/fs/squashfs/sqfs.c
> +++ b/fs/squashfs/sqfs.c
> @@ -87,7 +87,7 @@ static int sqfs_calc_n_blks(__le64 start, __le64  
> end, u64 *offset)
>  	u64 start_, table_size;
>
>  	table_size = le64_to_cpu(end) - le64_to_cpu(start);
> -	start_ = le64_to_cpu(start) / ctxt.cur_dev->blksz;
> +	start_ = lldiv(le64_to_cpu(start), ctxt.cur_dev->blksz);
>  	*offset = le64_to_cpu(start) - (start_ * ctxt.cur_dev->blksz);
>
>  	return DIV_ROUND_UP(table_size + *offset, ctxt.cur_dev->blksz);
> --
> 2.34.1





More information about the U-Boot mailing list