From: David Teigland <teigland@redhat.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 01/16] GFS: headers
Date: Wed, 12 Oct 2005 13:46:58 -0500 [thread overview]
Message-ID: <20051012184658.GB10593@redhat.com> (raw)
In-Reply-To: <20051010190537.GA7683@mipter.zuzino.mipt.ru>
On Mon, Oct 10, 2005 at 11:05:37PM +0400, Alexey Dobriyan wrote:
> Please, mark on-disk structures with __le{16,32,64}. It would help
> typechecking with sparse.
Yes, that's something we're working on.
> > +#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.
I find this to be an ideal situation for macros, actually, cutting out a
lot of tedious repetition. I think it clarifies the code considerably in
the end. The macros are defined immediately above their use in
gfs2_ondisk.h and there's this comment explaining what's going on:
/*
* gfs2_xxx_in - read in an xxx struct
* first arg: the cpu-order structure
* buf: the disk-order buffer
*
* gfs2_xxx_out - write out an xxx struct
* first arg: the cpu-order structure
* buf: the disk-order buffer
*
* gfs2_xxx_print - print out an xxx struct
* first arg: the cpu-order structure
*/
If others said the same thing as you I wouldn't hesitate to admit I'm
wrong, but several other picky style reviewers haven't said anything...
Thanks,
Dave
next prev parent reply other threads:[~2005-10-12 18:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-10 17:09 [PATCH 01/16] GFS: headers David Teigland
2005-10-10 19:05 ` Alexey Dobriyan
2005-10-11 4:23 ` Andrew Morton
2005-10-12 18:46 ` David Teigland [this message]
2005-10-10 21:36 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051012184658.GB10593@redhat.com \
--to=teigland@redhat.com \
--cc=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox