linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Two question about kernel global function declaration and directory layout
@ 2012-09-03 15:32 daley
  2012-09-04  0:59 ` Ryan Mallon
  0 siblings, 1 reply; 2+ messages in thread
From: daley @ 2012-09-03 15:32 UTC (permalink / raw)
  To: linux-kernel

hi, everyone, I'm a big fan of the kernel, I was always being attracted 
by its clean and intelligent design. I'm new to the mailing list and 
this is my first post. I want to ask two basic question about kernel 
which bother me a lot, I've googled a lot but nobody could give a 
suitable answer .

The first one is about global function declaration, I was confused about 
the usage of keyword "extern" before a global function which declared in 
the header file. for example,

<include/linux/kernel.h>
extern long (*panic_blink)(int state);
__printf(1, 2)
void panic(const char *fmt, ...)
         __noreturn __cold;
extern void oops_enter(void);
extern void oops_exit(void);
void print_oops_end_marker(void);
extern int oops_may_print(void);
void do_exit(long error_code)
         __noreturn;
void complete_and_exit(struct completion *, long)
         __noreturn;

the same thing also appeared on other header files a lot. To my 
knowledge, there's no difference between whether has the "extern" before 
global function, is this due to the legacy problem or have other meaning?

The second question is why not move the *sound* directory into the 
*drivers* directory or put bigger subsystem out of drivers, since there 
are more bigger subsystems(e.g. media, scsi) than sound?

Can anybody help?
Thanks.

-- 
daleydeng
Beijing, China


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two question about kernel global function declaration and directory layout
  2012-09-03 15:32 Two question about kernel global function declaration and directory layout daley
@ 2012-09-04  0:59 ` Ryan Mallon
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Mallon @ 2012-09-04  0:59 UTC (permalink / raw)
  To: daley; +Cc: linux-kernel

On 04/09/12 01:32, daley wrote:
> hi, everyone, I'm a big fan of the kernel, I was always being attracted
> by its clean and intelligent design. I'm new to the mailing list and
> this is my first post. I want to ask two basic question about kernel
> which bother me a lot, I've googled a lot but nobody could give a
> suitable answer .
> 
> The first one is about global function declaration, I was confused about
> the usage of keyword "extern" before a global function which declared in
> the header file. for example,

It specifies that the function has external linkage, which is the
opposite of internal (static keyword) linkage. The default linkage for
functions in external, so the extern keyword is not technically
required, but many developers like to specify it explicitly. C linkage
is explained here:

  http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html

> The second question is why not move the *sound* directory into the
> *drivers* directory or put bigger subsystem out of drivers, since there
> are more bigger subsystems(e.g. media, scsi) than sound?

This was discussed a couple of years back, but never happened. I'm not
sure what the reasons were. You can read through the discussion yourself
if you are so inclined. There is an email from Linus explaining some of
the historical reasons why the sound code is in sound/ and not
drivers/sound:

  http://lkml.indiana.edu/hypermail/linux/kernel/0805.2/3026.html

~Ryan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-04  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-03 15:32 Two question about kernel global function declaration and directory layout daley
2012-09-04  0:59 ` Ryan Mallon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).