[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080125104217.GA6700@does.not.exist>
Date: Fri, 25 Jan 2008 12:42:17 +0200
From: Adrian Bunk <bunk@...nel.org>
To: Tigran Aivazian <tigran@...azian.fsnet.co.uk>
Cc: Dmitri Vorobiev <dmitri.vorobiev@...il.com>,
Heikki Orsila <shdl@...alwe.fi>, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, trivial@...nel.org
Subject: Re: [PATCH 5/9] bfs: move function prototype to the proper header
file
On Thu, Jan 24, 2008 at 11:22:21PM +0000, Tigran Aivazian wrote:
> On Fri, 25 Jan 2008, Dmitri Vorobiev wrote:
>
>> Heikki Orsila пишет:
>>>> +extern void dump_imap(const char *, struct super_block *);
>>>> +
>>>
>>> Functions should not be externed, remove extern keyword.
>>>
>>
>> Care to explain why?
>
> because dump_imap() is just a BFS' internal helper (for debugging
> purposes only btw) to dump the inode map via printk. Why should it be
> moved into the header, i.e. where one expects to see things potentially
> visible by the rest of the kernel?
>...
fs/bfs/bfs.h is not visible to the rest of the kernel, it's the right
place for bfs-internal code.
Whether there's an "extern" written is just a syntax thing with zero
semantical implications. We tend to not write the "extern" in the
kernel, but that's nothing cast in stone.
But prototypes really belong into header files - bugs in this area are
rare, but when they occur they can cause nasty hard-to-debug bugs
(e.g. depending on the calling convention on the architecture calling
the function can turn your stack into garbage), and with the prototypes
in header files gcc can do type checks.
> Kind regards
> Tigran
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists