xfs
[Top] [All Lists]

Re: [PATCH] xfsprogs: fix harmless sparse endian nit

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH] xfsprogs: fix harmless sparse endian nit
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 27 Oct 2014 07:26:03 -0400
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <544992F1.8050803@xxxxxxxxxx>
References: <544992F1.8050803@xxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Thu, Oct 23, 2014 at 06:44:49PM -0500, Eric Sandeen wrote:
> h_crc is __le32 but cpu_to_be32() is... __be32.  So sparse
> complains, even though it's harmless.
> 
> Although sparse is smart about bare 0s, and we could
> drop the swap, other places explicitly swap to keep
> things clear (I guess?) so "swap" the 0 with the proper
> routine.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Looks good. I agree that the swap helps with clarity.

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

> 
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index 9ee89d3..dd8baa6 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -187,7 +187,7 @@ libxfs_log_header(
>               head->h_len = cpu_to_be32(sunit - BBSIZE);
>       else
>               head->h_len = cpu_to_be32(20);
> -     head->h_crc = cpu_to_be32(0);
> +     head->h_crc = cpu_to_le32(0);
>       head->h_prev_block = cpu_to_be32(-1);
>       head->h_num_logops = cpu_to_be32(1);
>       head->h_cycle_data[0] = cpu_to_be32(0xb0c0d0d0);
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>