2009-01-13 12:09:25

by Cyrill Gorcunov

[permalink] [raw]
Subject: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

Impact: cleanup

'make headers_check' warns that linux/types.h is
preferred over asm/types.h. So be it.

Signed-off-by: Cyrill Gorcunov <[email protected]>
CC: Jaswinder Singh Rajput <[email protected]>
CC: Sam Ravnborg <[email protected]>
CC: Harvey Harrison <[email protected]>
---

arch/x86/include/asm/e820.h | 2 ++
arch/x86/include/asm/kvm.h | 2 +-
arch/x86/include/asm/mce.h | 2 +-
arch/x86/include/asm/mtrr.h | 1 +
arch/x86/include/asm/ptrace-abi.h | 2 +-
arch/x86/include/asm/sigcontext.h | 2 +-
arch/x86/include/asm/swab.h | 2 +-
7 files changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6.git/arch/x86/include/asm/e820.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/e820.h
+++ linux-2.6.git/arch/x86/include/asm/e820.h
@@ -1,5 +1,6 @@
#ifndef _ASM_X86_E820_H
#define _ASM_X86_E820_H
+
#define E820MAP 0x2d0 /* our map */
#define E820MAX 128 /* number of entries in E820MAP */

@@ -49,6 +50,7 @@
#define E820_RESERVED_KERN 128

#ifndef __ASSEMBLY__
+#include <linux/types.h>
struct e820entry {
__u64 addr; /* start of memory segment */
__u64 size; /* size of memory segment */
Index: linux-2.6.git/arch/x86/include/asm/kvm.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/kvm.h
+++ linux-2.6.git/arch/x86/include/asm/kvm.h
@@ -6,7 +6,7 @@
*
*/

-#include <asm/types.h>
+#include <linux/types.h>
#include <linux/ioctl.h>

/* Architectural interrupt line count. */
Index: linux-2.6.git/arch/x86/include/asm/mce.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/mce.h
+++ linux-2.6.git/arch/x86/include/asm/mce.h
@@ -4,7 +4,7 @@
#ifdef __x86_64__

#include <asm/ioctls.h>
-#include <asm/types.h>
+#include <linux/types.h>

/*
* Machine Check support for x86
Index: linux-2.6.git/arch/x86/include/asm/mtrr.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/mtrr.h
+++ linux-2.6.git/arch/x86/include/asm/mtrr.h
@@ -23,6 +23,7 @@
#ifndef _ASM_X86_MTRR_H
#define _ASM_X86_MTRR_H

+#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/errno.h>

Index: linux-2.6.git/arch/x86/include/asm/ptrace-abi.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/ptrace-abi.h
+++ linux-2.6.git/arch/x86/include/asm/ptrace-abi.h
@@ -83,7 +83,7 @@
#ifdef CONFIG_X86_PTRACE_BTS

#ifndef __ASSEMBLY__
-#include <asm/types.h>
+#include <linux/types.h>

/* configuration/status structure used in PTRACE_BTS_CONFIG and
PTRACE_BTS_STATUS commands.
Index: linux-2.6.git/arch/x86/include/asm/sigcontext.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/sigcontext.h
+++ linux-2.6.git/arch/x86/include/asm/sigcontext.h
@@ -2,7 +2,7 @@
#define _ASM_X86_SIGCONTEXT_H

#include <linux/compiler.h>
-#include <asm/types.h>
+#include <linux/types.h>

#define FP_XSTATE_MAGIC1 0x46505853U
#define FP_XSTATE_MAGIC2 0x46505845U
Index: linux-2.6.git/arch/x86/include/asm/swab.h
===================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/swab.h
+++ linux-2.6.git/arch/x86/include/asm/swab.h
@@ -1,7 +1,7 @@
#ifndef _ASM_X86_SWAB_H
#define _ASM_X86_SWAB_H

-#include <asm/types.h>
+#include <linux/types.h>
#include <linux/compiler.h>

static inline __attribute_const__ __u32 __arch_swab32(__u32 val)


2009-01-13 12:57:24

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
| Impact: cleanup
|
| 'make headers_check' warns that linux/types.h is
| preferred over asm/types.h. So be it.
|
| Signed-off-by: Cyrill Gorcunov <[email protected]>
| CC: Jaswinder Singh Rajput <[email protected]>
| CC: Sam Ravnborg <[email protected]>
| CC: Harvey Harrison <[email protected]>
| ---
|
| arch/x86/include/asm/e820.h | 2 ++
| arch/x86/include/asm/kvm.h | 2 +-
| arch/x86/include/asm/mce.h | 2 +-
| arch/x86/include/asm/mtrr.h | 1 +
| arch/x86/include/asm/ptrace-abi.h | 2 +-
| arch/x86/include/asm/sigcontext.h | 2 +-
| arch/x86/include/asm/swab.h | 2 +-
| 7 files changed, 8 insertions(+), 5 deletions(-)
|
...

well... on the other hand I'm not sure if it's really
a good idea to include linux/types.h where we need only
__u[8,16] and so on definitions.

Ingo, don't apply this patch please -- have to check
for other ways.

- Cyrill -

2009-01-13 12:59:52

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h


* Cyrill Gorcunov <[email protected]> wrote:

> [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
> | Impact: cleanup
> |
> | 'make headers_check' warns that linux/types.h is
> | preferred over asm/types.h. So be it.
> |
> | Signed-off-by: Cyrill Gorcunov <[email protected]>
> | CC: Jaswinder Singh Rajput <[email protected]>
> | CC: Sam Ravnborg <[email protected]>
> | CC: Harvey Harrison <[email protected]>
> | ---
> |
> | arch/x86/include/asm/e820.h | 2 ++
> | arch/x86/include/asm/kvm.h | 2 +-
> | arch/x86/include/asm/mce.h | 2 +-
> | arch/x86/include/asm/mtrr.h | 1 +
> | arch/x86/include/asm/ptrace-abi.h | 2 +-
> | arch/x86/include/asm/sigcontext.h | 2 +-
> | arch/x86/include/asm/swab.h | 2 +-
> | 7 files changed, 8 insertions(+), 5 deletions(-)
> |
> ...
>
> well... on the other hand I'm not sure if it's really
> a good idea to include linux/types.h where we need only
> __u[8,16] and so on definitions.

Well, linux/types.h is supposed to be a 'lightweight', 'core data types
only' kind of header file, so including it is not wrong per se.

Sam, is there some other preferred way perhaps to resolve these?

Ingo

2009-01-13 13:08:20

by Jaswinder Singh

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

On Tue, Jan 13, 2009 at 6:27 PM, Cyrill Gorcunov <[email protected]> wrote:
> [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
> | Impact: cleanup
> |
> | 'make headers_check' warns that linux/types.h is
> | preferred over asm/types.h. So be it.
> |
> | Signed-off-by: Cyrill Gorcunov <[email protected]>
> | CC: Jaswinder Singh Rajput <[email protected]>
> | CC: Sam Ravnborg <[email protected]>
> | CC: Harvey Harrison <[email protected]>
> | ---
> |
> | arch/x86/include/asm/e820.h | 2 ++
> | arch/x86/include/asm/kvm.h | 2 +-
> | arch/x86/include/asm/mce.h | 2 +-
> | arch/x86/include/asm/mtrr.h | 1 +
> | arch/x86/include/asm/ptrace-abi.h | 2 +-
> | arch/x86/include/asm/sigcontext.h | 2 +-
> | arch/x86/include/asm/swab.h | 2 +-
> | 7 files changed, 8 insertions(+), 5 deletions(-)
> |
> ...
>
> well... on the other hand I'm not sure if it's really
> a good idea to include linux/types.h where we need only
> __u[8,16] and so on definitions.
>
> Ingo, don't apply this patch please -- have to check
> for other ways.
>

I am attaching usr/include/linux/types.h for your reference which
includes all these definations for userspace.

Thanks
--
JSR


Attachments:
types.h (3.31 kB)

2009-01-13 13:10:32

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Ingo Molnar - Tue, Jan 13, 2009 at 01:59:28PM +0100]
|
| * Cyrill Gorcunov <[email protected]> wrote:
|
| > [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
| > | Impact: cleanup
| > |
| > | 'make headers_check' warns that linux/types.h is
| > | preferred over asm/types.h. So be it.
| > |
| > | Signed-off-by: Cyrill Gorcunov <[email protected]>
| > | CC: Jaswinder Singh Rajput <[email protected]>
| > | CC: Sam Ravnborg <[email protected]>
| > | CC: Harvey Harrison <[email protected]>
| > | ---
| > |
| > | arch/x86/include/asm/e820.h | 2 ++
| > | arch/x86/include/asm/kvm.h | 2 +-
| > | arch/x86/include/asm/mce.h | 2 +-
| > | arch/x86/include/asm/mtrr.h | 1 +
| > | arch/x86/include/asm/ptrace-abi.h | 2 +-
| > | arch/x86/include/asm/sigcontext.h | 2 +-
| > | arch/x86/include/asm/swab.h | 2 +-
| > | 7 files changed, 8 insertions(+), 5 deletions(-)
| > |
| > ...
| >
| > well... on the other hand I'm not sure if it's really
| > a good idea to include linux/types.h where we need only
| > __u[8,16] and so on definitions.
|
| Well, linux/types.h is supposed to be a 'lightweight', 'core data types
| only' kind of header file, so including it is not wrong per se.
|
| Sam, is there some other preferred way perhaps to resolve these?
|
| Ingo
|

Until such a file not passed to some *.S. For example for e820.h
we have it included to arch/x86/boot/header.S but fortunately
we're bound by __ASSEMBLY__. So there linux/types.h shouldn't hurt.
Will check others and report then.

- Cyrill -

2009-01-13 13:12:28

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Jaswinder Singh Rajput - Tue, Jan 13, 2009 at 06:38:02PM +0530]
| On Tue, Jan 13, 2009 at 6:27 PM, Cyrill Gorcunov <[email protected]> wrote:
| > [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
| > | Impact: cleanup
| > |
| > | 'make headers_check' warns that linux/types.h is
| > | preferred over asm/types.h. So be it.
| > |
| > | Signed-off-by: Cyrill Gorcunov <[email protected]>
| > | CC: Jaswinder Singh Rajput <[email protected]>
| > | CC: Sam Ravnborg <[email protected]>
| > | CC: Harvey Harrison <[email protected]>
| > | ---
| > |
| > | arch/x86/include/asm/e820.h | 2 ++
| > | arch/x86/include/asm/kvm.h | 2 +-
| > | arch/x86/include/asm/mce.h | 2 +-
| > | arch/x86/include/asm/mtrr.h | 1 +
| > | arch/x86/include/asm/ptrace-abi.h | 2 +-
| > | arch/x86/include/asm/sigcontext.h | 2 +-
| > | arch/x86/include/asm/swab.h | 2 +-
| > | 7 files changed, 8 insertions(+), 5 deletions(-)
| > |
| > ...
| >
| > well... on the other hand I'm not sure if it's really
| > a good idea to include linux/types.h where we need only
| > __u[8,16] and so on definitions.
| >
| > Ingo, don't apply this patch please -- have to check
| > for other ways.
| >
|
| I am attaching usr/include/linux/types.h for your reference which
| includes all these definations for userspace.
|
| Thanks
| --
| JSR

yeah, thanks! I already have one in my git clone but anyway ;-)

- Cyrill -

2009-01-13 13:25:42

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Cyrill Gorcunov - Tue, Jan 13, 2009 at 04:10:20PM +0300]
...
| | >
| | > well... on the other hand I'm not sure if it's really
| | > a good idea to include linux/types.h where we need only
| | > __u[8,16] and so on definitions.
| |
| | Well, linux/types.h is supposed to be a 'lightweight', 'core data types
| | only' kind of header file, so including it is not wrong per se.
| |
| | Sam, is there some other preferred way perhaps to resolve these?
| |
| | Ingo
| |
|
| Until such a file not passed to some *.S. For example for e820.h
| we have it included to arch/x86/boot/header.S but fortunately
| we're bound by __ASSEMBLY__. So there linux/types.h shouldn't hurt.
| Will check others and report then.
|
| - Cyrill -

ok, have checked -- this patch seems to be safe.

- Cyrill -

2009-01-13 14:45:31

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h


* Cyrill Gorcunov <[email protected]> wrote:

> [Ingo Molnar - Tue, Jan 13, 2009 at 01:59:28PM +0100]
> |
> | * Cyrill Gorcunov <[email protected]> wrote:
> |
> | > [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
> | > | Impact: cleanup
> | > |
> | > | 'make headers_check' warns that linux/types.h is
> | > | preferred over asm/types.h. So be it.
> | > |
> | > | Signed-off-by: Cyrill Gorcunov <[email protected]>
> | > | CC: Jaswinder Singh Rajput <[email protected]>
> | > | CC: Sam Ravnborg <[email protected]>
> | > | CC: Harvey Harrison <[email protected]>
> | > | ---
> | > |
> | > | arch/x86/include/asm/e820.h | 2 ++
> | > | arch/x86/include/asm/kvm.h | 2 +-
> | > | arch/x86/include/asm/mce.h | 2 +-
> | > | arch/x86/include/asm/mtrr.h | 1 +
> | > | arch/x86/include/asm/ptrace-abi.h | 2 +-
> | > | arch/x86/include/asm/sigcontext.h | 2 +-
> | > | arch/x86/include/asm/swab.h | 2 +-
> | > | 7 files changed, 8 insertions(+), 5 deletions(-)
> | > |
> | > ...
> | >
> | > well... on the other hand I'm not sure if it's really
> | > a good idea to include linux/types.h where we need only
> | > __u[8,16] and so on definitions.
> |
> | Well, linux/types.h is supposed to be a 'lightweight', 'core data types
> | only' kind of header file, so including it is not wrong per se.
> |
> | Sam, is there some other preferred way perhaps to resolve these?
> |
> | Ingo
> |
>
> Until such a file not passed to some *.S. For example for e820.h we have
> it included to arch/x86/boot/header.S but fortunately we're bound by
> __ASSEMBLY__. So there linux/types.h shouldn't hurt. Will check others
> and report then.

Any reason to not protect types.h with #ifndef __ASSEMBLY__ ?

Ingo

2009-01-13 14:50:14

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Ingo Molnar - Tue, Jan 13, 2009 at 03:45:05PM +0100]
...
| >
| > Until such a file not passed to some *.S. For example for e820.h we have
| > it included to arch/x86/boot/header.S but fortunately we're bound by
| > __ASSEMBLY__. So there linux/types.h shouldn't hurt. Will check others
| > and report then.
|
| Any reason to not protect types.h with #ifndef __ASSEMBLY__ ?
|
| Ingo
|

hmm... good question :) letme check

- Cyrill -

2009-01-13 15:07:07

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h

[Cyrill Gorcunov - Tue, Jan 13, 2009 at 05:49:56PM +0300]
| [Ingo Molnar - Tue, Jan 13, 2009 at 03:45:05PM +0100]
| ...
| | >
| | > Until such a file not passed to some *.S. For example for e820.h we have
| | > it included to arch/x86/boot/header.S but fortunately we're bound by
| | > __ASSEMBLY__. So there linux/types.h shouldn't hurt. Will check others
| | > and report then.
| |
| | Any reason to not protect types.h with #ifndef __ASSEMBLY__ ?
| |
| | Ingo
| |
|
| hmm... good question :) letme check
|
| - Cyrill -

Dunno Ingo, it's dubious. I don't like the idea
to start including types.h into any kind of *.S
with #ifndef __ASSEMBLY__ protection. We export it
into user space and I don't remember if it mentioned
somewhere that user is not allowed to use -D__ASSEMBLY__.

Someone more experienced (then me) in this area should
asked first :-)

- Cyrill -