All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] the standard for including header files?
@ 2007-05-28 20:35 Robert P. J. Day
  2007-05-28 22:09 ` Randy Dunlap
  2007-05-28 22:35 ` Richard Knutsson
  0 siblings, 2 replies; 3+ messages in thread
From: Robert P. J. Day @ 2007-05-28 20:35 UTC (permalink / raw)
  To: kernel-janitors


  in my travels thru the source tree, i've noticed header files like
the following (include/linux/ioctl.h):

#ifndef _LINUX_IOCTL_H
#define _LINUX_IOCTL_H

#include <asm/ioctl.h>

#endif /* _LINUX_IOCTL_H */

  fair enough -- it simply includes the asm-specific form of that
header file, so one can include either of those two header files to
get exactly the same effect.

  but what's the *correct* header file to include?  *at the moment*,
those two includes are equivalent but nothing says they have to be
that way forever.  perhaps some day some arch-independent content is
added to linux/ioctl.h.  if that happens, those files that include
*that* header file will pick up the additional content, while files
that instead include asm/ioctl.h won't.

  it may be that this will never be a problem, but there certainly is
some variety of who is including what in the source tree:

$ grep -r "include.*linux/ioctl.h" * | wc -l
131
$ grep -r "include.*asm/ioctl.h" * | wc -l
40

  there are a few other header files like that:  user.h, param.h, etc.
i'm just wondering what the standard is.

rday
-- 
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] the standard for including header files?
  2007-05-28 20:35 [KJ] the standard for including header files? Robert P. J. Day
@ 2007-05-28 22:09 ` Randy Dunlap
  2007-05-28 22:35 ` Richard Knutsson
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2007-05-28 22:09 UTC (permalink / raw)
  To: kernel-janitors

On Mon, 28 May 2007 16:35:26 -0400 (EDT) Robert P. J. Day wrote:

> 
>   in my travels thru the source tree, i've noticed header files like
> the following (include/linux/ioctl.h):
> 
> #ifndef _LINUX_IOCTL_H
> #define _LINUX_IOCTL_H
> 
> #include <asm/ioctl.h>
> 
> #endif /* _LINUX_IOCTL_H */
> 
>   fair enough -- it simply includes the asm-specific form of that
> header file, so one can include either of those two header files to
> get exactly the same effect.
> 
>   but what's the *correct* header file to include?  *at the moment*,
> those two includes are equivalent but nothing says they have to be
> that way forever.  perhaps some day some arch-independent content is
> added to linux/ioctl.h.  if that happens, those files that include
> *that* header file will pick up the additional content, while files
> that instead include asm/ioctl.h won't.
> 
>   it may be that this will never be a problem, but there certainly is
> some variety of who is including what in the source tree:
> 
> $ grep -r "include.*linux/ioctl.h" * | wc -l
> 131
> $ grep -r "include.*asm/ioctl.h" * | wc -l
> 40
> 
>   there are a few other header files like that:  user.h, param.h, etc.
> i'm just wondering what the standard is.

to include linux/foo.h instead of asm/foo.h if there is a
linux/foo.h.  IIRC, there are one or two instances of this not
being correct -- either irq.h or interrupt.h comes to mind.
(and I haven't looked at ioctl.h)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] the standard for including header files?
  2007-05-28 20:35 [KJ] the standard for including header files? Robert P. J. Day
  2007-05-28 22:09 ` Randy Dunlap
@ 2007-05-28 22:35 ` Richard Knutsson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Knutsson @ 2007-05-28 22:35 UTC (permalink / raw)
  To: kernel-janitors

Robert P. J. Day wrote:
>   in my travels thru the source tree, i've noticed header files like
> the following (include/linux/ioctl.h):
>
> #ifndef _LINUX_IOCTL_H
> #define _LINUX_IOCTL_H
>
> #include <asm/ioctl.h>
>
> #endif /* _LINUX_IOCTL_H */
>
>   fair enough -- it simply includes the asm-specific form of that
> header file, so one can include either of those two header files to
> get exactly the same effect.
>
>   but what's the *correct* header file to include?  *at the moment*,
> those two includes are equivalent but nothing says they have to be
> that way forever.  perhaps some day some arch-independent content is
> added to linux/ioctl.h.  if that happens, those files that include
> *that* header file will pick up the additional content, while files
> that instead include asm/ioctl.h won't.
>
>   it may be that this will never be a problem, but there certainly is
> some variety of who is including what in the source tree:
>
> $ grep -r "include.*linux/ioctl.h" * | wc -l
> 131
> $ grep -r "include.*asm/ioctl.h" * | wc -l
> 40
>
>   there are a few other header files like that:  user.h, param.h, etc.
> i'm just wondering what the standard is.
>   
We want our drivers to be independent of the architectures and if there 
is a header in include/linux/, then what is the reason to include the 
include/asm/? Like types.h, where the generic header includes the 
arch-specific header to get [su]{8,16,32,64}-types. The only reason I 
can see when you want to include from include/asm/ is when a driver will 
only work on a subset of the architectures.

But as a wise man said; that is just my opinion, I could be wrong.
Richard Knutson

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2007-05-28 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-28 20:35 [KJ] the standard for including header files? Robert P. J. Day
2007-05-28 22:09 ` Randy Dunlap
2007-05-28 22:35 ` Richard Knutsson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.