strange code in linux kernel

Hi List,

I found that there are some weird looking instances in kernel where a
function has been DEFINED (as opposite to DECLARED) using and "extern"
keyword. For e.g., the following code in arch/alpha/include/asm/io.h:

extern inline void __iomem *generic_ioportmap(unsigned long a)
{
return alpha_mv.mv_ioportmap(a);
}

Using a definition along with extern does not make any sense to me.
Can some one please enlighten what is its use / purpose?

Thanks,

Rajat Jain

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis [at] nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ
Rajat Jain [ Di, 06 Oktober 2009 05:34 ] [ ID #2018132 ]

Re: strange code in linux kernel

--=-=-=
Content-Transfer-Encoding: quoted-printable

Rajat Jain <rajat.noida.india [at] gmail.com> writes:
> I found that there are some weird looking instances in kernel where a
> function has been DEFINED (as opposite to DECLARED) using and "extern"
> keyword. For e.g., the following code in arch/alpha/include/asm/io.h:
>
> extern inline void __iomem *generic_ioportmap(unsigned long a)
> {
> return alpha_mv.mv_ioportmap(a);
> }
>
> Using a definition along with extern does not make any sense to me.
> Can some one please enlighten what is its use / purpose?

Note that at the same time an "inline" keyword has been used. You might
want to refer to GCC's documentation in particular
<http://gcc.gnu.org/onlinedocs/gcc/Inline.html> for more information.
Google also pointed to this site
<http://www.greenend.org.uk/rjk/2003/03/inline.html> which also might
have some insight.

=2D-
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=3D./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAkrM4aEACgkQUyzLALfG3x5TrgCgkt5SK9ilhnxXHBhZa20J GI9S
h2oAoK8KeISQ4CQcyoejAdKMIZowRLph
=x86Q
-----END PGP SIGNATURE-----
--=-=-=--
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Michal Nazarewicz [ Mi, 07 Oktober 2009 20:44 ] [ ID #2018309 ]
Linux » gmane.linux.newbie » strange code in linux kernel

Vorheriges Thema: Changing Kernel 3g / 1g memory split
Nächstes Thema: Give squish mittens DUE attention