| To: | "Takashi Sato" <t-sato@xxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 3/3] Add timeout feature |
| From: | Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> |
| Date: | Fri, 27 Jun 2008 11:57:27 -0700 |
| Cc: | viro@xxxxxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, dm-devel@xxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, axboe@xxxxxxxxx, mtk.manpages@xxxxxxxxxxxxxx |
| In-reply-to: | <7B349EFCD35842D4ADAEB402D2BDCA4E@nsl.ad.nec.co.jp> |
| References: | <20080624160056t-sato@mail.jp.nec.com> <20080624150925.765155f0.akpm@linux-foundation.org> <7B349EFCD35842D4ADAEB402D2BDCA4E@nsl.ad.nec.co.jp> |
| Sender: | xfs-bounce@xxxxxxxxxxx |
On Fri, 27 Jun 2008 20:33:58 +0900
"Takashi Sato" <t-sato@xxxxxxxxxxxxx> wrote:
> >> case XFS_FSOP_GOING_FLAGS_DEFAULT: {
> >> - struct super_block *sb = freeze_bdev(mp->m_super->s_bdev);
> >> + struct super_block *sb = freeze_bdev(mp->m_super->s_bdev, 0);
> >
> > Using NULL here is clearer and will, I expect, avoid a sparse warning.
>
> I checked it but I couldn't find a sparse warning in xfs_fsops.c.
> Can you tell me how to use NULL?
struct super_block *sb = freeze_bdev(mp->m_super->s_bdev, NULL);
:)
It's much better to use NULL here rather than literal zero because the
reader of this code can then say "ah-hah, we're passing in a pointer".
Whereas plain old "0" could be a pointer or a scalar.
We should always use NULL to represent a null pointer in the kernel.
The one acceptable exception is when testing for nullness:
if (ptr1)
if (!ptr2)
Often people will use
if (ptr1 != NULL)
if (ptr2 == NULL)
in this case as well. (I prefer the shorter version personally, but
either is OK).
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] Fix disabled XFS POSIX ACL handling, Christoph Hellwig |
|---|---|
| Next by Date: | Re: Xfs Access to block zero exception and system crash, Dave Chinner |
| Previous by Thread: | Re: [PATCH 3/3] Add timeout feature, Takashi Sato |
| Next by Thread: | Re: [PATCH 3/3] Add timeout feature, Takashi Sato |
| Indexes: | [Date] [Thread] [Top] [All Lists] |