From: Boaz Harrosh <bharrosh@panasas.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Andy Whitcroft <apw@shadowen.org>,
Randy Dunlap <rdunlap@xenotime.net>,
Joel Schopp <jschopp@austin.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: WARNING: do not add new typedefs - is that for real?
Date: Wed, 02 Jan 2008 14:18:27 +0200 [thread overview]
Message-ID: <477B8113.6080602@panasas.com> (raw)
In-Reply-To: <20080102100852.GA19859@infradead.org>
On Wed, Jan 02 2008 at 12:08 +0200, Christoph Hellwig <hch@infradead.org> wrote:
> On Tue, Jan 01, 2008 at 06:15:46PM +0200, Boaz Harrosh wrote:
>> I have this code:
>>
>> <c_code>
>> /*
>> * osd-r10 4.12.5 Data-In and Data-Out buffer offsets
>> * byte offset = mantissa * (2^(exponent+8))
>> */
>> typedef __be32 osd_cdb_offset;
>
> Given that you can't do normal arithmetic on this type it should't
> really be a __be32 but it's own __bitwise type with proper accessors.
There are all the proper accessors, and arithmetic is certainly not possible.
>
> But yes, this is one of the rare cases where a typedef makes sense,
> but �'d call it osd_off_t or something like that.
>
You mean osd_cdb_offset_t. I thought of dropping that _t, I hate it,
just a personal preference.
Point taken about the typedef + __bitwise. Because with __bitwise we
tell the compiler that the new type is assembly equivalent to some type
but otherwise un-mixable and unique type. Checkpatch actually allows
it. Code fixed! Thanks Christoph.
Boaz
next prev parent reply other threads:[~2008-01-02 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-01 16:15 WARNING: do not add new typedefs - is that for real? Boaz Harrosh
2008-01-02 9:58 ` Andy Whitcroft
2008-01-02 10:08 ` Christoph Hellwig
2008-01-02 12:18 ` Boaz Harrosh [this message]
2008-01-02 20:37 ` Christoph Hellwig
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=477B8113.6080602@panasas.com \
--to=bharrosh@panasas.com \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=hch@infradead.org \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/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