Unknown mailing list, search.

Re: [PATCH 3/3] Add timeout feature

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Takashi Sato <t-sato@...>
Cc: <viro@...>, <linux-ext4@...>, <xfs@...>, <dm-devel@...>, <linux-fsdevel@...>, <linux-kernel@...>, <axboe@...>, <mtk.manpages@...>
Date: Friday, June 27, 2008 - 2:57 pm

On Fri, 27 Jun 2008 20:33:58 +0900
"Takashi Sato" <t-sato@yk.jp.nec.com> wrote:


	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).


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] Add timeout feature, Takashi Sato, (Tue Jun 24, 3:00 am)
Re: [PATCH 3/3] Add timeout feature, Andrew Morton, (Tue Jun 24, 6:09 pm)
Re: [PATCH 3/3] Add timeout feature, Takashi Sato, (Fri Jun 27, 7:33 am)
Re: [PATCH 3/3] Add timeout feature, Andrew Morton, (Fri Jun 27, 2:57 pm)
Re: [PATCH 3/3] Add timeout feature, Takashi Sato, (Sun Jun 29, 7:13 pm)
Re: [PATCH 3/3] Add timeout feature, Andrew Morton, (Sun Jun 29, 8:01 pm)