Re: [PATCH 01/16] GFS: headers

From: Alexey Dobriyan
Date: Mon Oct 10 2005 - 13:54:25 EST


On Mon, Oct 10, 2005 at 12:09:48PM -0500, David Teigland wrote:
> --- a/fs/gfs2/gfs2.h
> +++ b/fs/gfs2/gfs2.h

> +#define MAKE_MULT8(x) (((x) + 7) & ~7)

ALIGN()

> +#define GFS2_IOCTL_IDENTIFY _GFS2C_(1)
> +#define GFS2_IOCTL_SUPER _GFS2C_(2)

Since patch is against -mm, please, add 2 entries to
Documentation/ioctl-mess.txt. Don't bother with "I: " and "O: ", since
they aren't finished yet.

> --- a/include/linux/gfs2_ondisk.h
> +++ b/include/linux/gfs2_ondisk.h

Please, mark on-disk structures with __le{16,32,64}. It would help
typechecking with sparse.

> +#define CPIN_08(s1, s2, member, count) {memcpy((s1->member), (s2->member), (count));}
> +#define CPOUT_08(s1, s2, member, count) {memcpy((s2->member), (s1->member), (count));}
> +#define CPIN_16(s1, s2, member) {(s1->member) = le16_to_cpu((s2->member));}
> +#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_le16((s1->member));}
> +#define CPIN_32(s1, s2, member) {(s1->member) = le32_to_cpu((s2->member));}
> +#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_le32((s1->member));}
> +#define CPIN_64(s1, s2, member) {(s1->member) = le64_to_cpu((s2->member));}
> +#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_le64((s1->member));}

Confusing names and implementation. CP{IN,OUT}_08 do memcpy, the rest
doesn't. "08" doesn't make sense in CPIN_08, while "16", ... do.
CPIN_64() expect fixed-endian value or host-endian? Answer is not
obvious until you look at a header. Fingers really want to type CPU
every time. I ask you to write a simple script and drop these macros
completely.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/