Re: [PATCH 0/4] Unexport several headers and cleanup

Previous thread: [PATCH] drivers/scsi/dpt_i2o: Convert to generic boolean by Richard Knutsson on Tuesday, October 30, 2007 - 3:54 am. (8 messages)

Next thread: [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup. by Richard Knutsson on Tuesday, October 30, 2007 - 3:54 am. (3 messages)
From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 4:02 am

This series of patches unexport several unneeded(I guess) headers from 
userspace. Patches based on patch posted to linux-kernel@ by Mike Frysinger
in July.
-

From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 4:02 am

Do not export asm/page.h during make headers_install.
This removes PAGE_SIZE from userspace headers.

Signed-off-by: Kirill A. Shutemov <k.shutemov@gmail.com>
---
 include/asm-frv/Kbuild         |    1 -
 include/asm-generic/Kbuild.asm |    1 -
 include/asm-s390/kexec.h       |    2 ++
 include/asm-x86/Kbuild         |    2 --
 include/linux/Kbuild           |    2 +-
 include/linux/a.out.h          |    8 ++++++++
 include/linux/shm.h            |    8 ++++++++
 7 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index 966a983..bc3f12c 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -4,4 +4,3 @@ header-y += registers.h
 
 unifdef-y += termios.h
 unifdef-y += ptrace.h
-unifdef-y += page.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 8fd8171..a10583a 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -31,4 +31,3 @@ unifdef-y += user.h
 
 # These probably shouldn't be exported
 unifdef-y += elf.h
-unifdef-y += page.h
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h
index 7592af7..f219c64 100644
--- a/include/asm-s390/kexec.h
+++ b/include/asm-s390/kexec.h
@@ -10,7 +10,9 @@
 #ifndef _S390_KEXEC_H
 #define _S390_KEXEC_H
 
+#ifdef __KERNEL__
 #include <asm/page.h>
+#endif
 #include <asm/processor.h>
 /*
  * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 12db5a1..828f9f8 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -16,8 +16,6 @@ unifdef-y += ist.h
 unifdef-y += mce.h
 unifdef-y += msr.h
 unifdef-y += mtrr.h
-unifdef-y += page_32.h
-unifdef-y += page_64.h
 unifdef-y += posix_types_32.h
 unifdef-y += posix_types_64.h
 unifdef-y += ptrace.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 6a65231..e41809b 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ ...
From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 4:02 am

Do not export asm/elf.h during make headers_install.

Signed-off-by: Kirill A. Shutemov <k.shutemov@gmail.com>
---
 include/asm-generic/Kbuild.asm |    3 ---
 include/linux/Kbuild           |    2 +-
 include/linux/elf.h            |    2 ++
 include/linux/elfcore.h        |    2 ++
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index a10583a..d744ee3 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -28,6 +28,3 @@ unifdef-y += termios.h
 unifdef-y += types.h
 unifdef-y += unistd.h
 unifdef-y += user.h
-
-# These probably shouldn't be exported
-unifdef-y += elf.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e41809b..ee3276c 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -57,7 +57,6 @@ header-y += dqblk_v2.h
 header-y += dqblk_xfs.h
 header-y += efs_fs_sb.h
 header-y += elf-fdpic.h
-header-y += elf.h
 header-y += elf-em.h
 header-y += fadvise.h
 header-y += fd.h
@@ -187,6 +186,7 @@ unifdef-y += dccp.h
 unifdef-y += dirent.h
 unifdef-y += dlm.h
 unifdef-y += edd.h
+unifdef-y += elf.h
 unifdef-y += elfcore.h
 unifdef-y += errno.h
 unifdef-y += errqueue.h
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 576e83b..3fad88b 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -3,7 +3,9 @@
 
 #include <linux/types.h>
 #include <linux/elf-em.h>
+#ifdef __KERNEL__
 #include <asm/elf.h>
+#endif
 
 struct file;
 
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 9631ddd..e227719 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -14,7 +14,9 @@ struct elf_siginfo
 	int	si_errno;			/* errno */
 };
 
+#ifdef __KERNEL__
 #include <asm/elf.h>
+#endif
 
 #ifndef __KERNEL__
 typedef elf_greg_t greg_t;
-- 
1.5.3.4.GIT

-

From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 4:02 am

Do not export asm/user.h and linux/user.h during make headers_install.

Signed-off-by: Kirill A. Shutemov <k.shutemov@gmail.com>
---
 include/asm-generic/Kbuild.asm |    1 -
 include/asm-x86/Kbuild         |    2 --
 include/linux/Kbuild           |    1 -
 include/linux/elfcore.h        |    2 ++
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index d744ee3..57ba606 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -27,4 +27,3 @@ unifdef-y += termbits.h
 unifdef-y += termios.h
 unifdef-y += types.h
 unifdef-y += unistd.h
-unifdef-y += user.h
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 828f9f8..f1b4dcb 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -21,7 +21,5 @@ unifdef-y += posix_types_64.h
 unifdef-y += ptrace.h
 unifdef-y += unistd_32.h
 unifdef-y += unistd_64.h
-unifdef-y += user_32.h
-unifdef-y += user_64.h
 unifdef-y += vm86.h
 unifdef-y += vsyscall.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index ee3276c..bace1ba 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -339,7 +339,6 @@ unifdef-y += uinput.h
 unifdef-y += uio.h
 unifdef-y += unistd.h
 unifdef-y += usbdevice_fs.h
-unifdef-y += user.h
 unifdef-y += utsname.h
 unifdef-y += videodev2.h
 unifdef-y += videodev.h
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index e227719..5ca54d7 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -4,7 +4,9 @@
 #include <linux/types.h>
 #include <linux/signal.h>
 #include <linux/time.h>
+#ifdef __KERNEL__
 #include <linux/user.h>
+#endif
 #include <linux/ptrace.h>
 
 struct elf_siginfo
-- 
1.5.3.4.GIT

-

From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 4:02 am

asm/elf.h, asm/page.h and asm/user.h don't export to userspace now, so
we can drop #ifdef __KERNEL__ for them.

Signed-off-by: Kirill A. Shutemov <k.shutemov@gmail.com>
---
 include/asm-alpha/elf.h       |    3 ---
 include/asm-alpha/page.h      |    3 ---
 include/asm-arm/elf.h         |    3 ---
 include/asm-arm/page.h        |    5 -----
 include/asm-avr32/elf.h       |    2 --
 include/asm-avr32/page.h      |    4 ----
 include/asm-blackfin/elf.h    |    2 --
 include/asm-blackfin/page.h   |    3 ---
 include/asm-cris/elf.h        |    3 ---
 include/asm-cris/page.h       |    4 ----
 include/asm-frv/elf.h         |    2 --
 include/asm-frv/page.h        |    4 ----
 include/asm-h8300/elf.h       |    2 --
 include/asm-h8300/page.h      |    4 ----
 include/asm-ia64/elf.h        |    3 ---
 include/asm-ia64/page.h       |    3 ---
 include/asm-m32r/elf.h        |    2 --
 include/asm-m32r/page.h       |    2 --
 include/asm-m68k/elf.h        |    2 --
 include/asm-m68k/page.h       |    5 -----
 include/asm-m68knommu/elf.h   |    2 --
 include/asm-m68knommu/page.h  |    4 ----
 include/asm-mips/elf.h        |    4 ----
 include/asm-mips/page.h       |    5 -----
 include/asm-mips/user.h       |    4 ----
 include/asm-parisc/elf.h      |    3 ---
 include/asm-parisc/page.h     |    4 ----
 include/asm-powerpc/elf.h     |    9 ---------
 include/asm-powerpc/page.h    |    3 ---
 include/asm-powerpc/page_32.h |    2 --
 include/asm-powerpc/page_64.h |    2 --
 include/asm-powerpc/user.h    |    4 ----
 include/asm-s390/elf.h        |    2 --
 include/asm-s390/page.h       |    3 ---
 include/asm-sh/elf.h          |    2 --
 include/asm-sh/page.h         |    3 ---
 include/asm-sh64/elf.h        |    2 --
 include/asm-sh64/page.h       |    2 --
 include/asm-sparc/elf.h       |    3 ---
 include/asm-sparc/page.h      |    4 ----
 include/asm-sparc64/elf.h     |    4 ----
 include/asm-sparc64/page.h    |    3 ---
 include/asm-v850/elf.h        |    2 --
 ...
From: Mike Frysinger
Date: Tuesday, October 30, 2007 - 4:50 pm

... this sounds great ... thanks (for Blackfin bits) :)
-mike
-

From: David Woodhouse
Date: Tuesday, October 30, 2007 - 5:47 am

Looks OK to me, in general. How much userspace have you tested building
with this? Does it include stuff like gdb?

Not that I necessarily care about the answer in the normal way -- it's
just that if userspace will need to adapt, I'd like to get them moving
ASAP. One option for easing that might be to export stuff like page.h
but _empty_.

-- 
dwmw2

-

From: Kirill A. Shutemov
Date: Tuesday, October 30, 2007 - 6:50 am

I have rebuilt gdb-6.6 on x86_64. Ok.

Also, it fix building directfb on ARM. ;)

It's bad idea. Taken from directfb:

#if HAVE_ASM_PAGE_H
#include <asm/page.h>
#else
#define PAGE_SIZE   sysconf( _SC_PAGESIZE )
#endif

Other application can use something like this. I think we should drop
empty headers.

--=20
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + Velesys LLC, http://www.velesys.com/
 + ALT Linux Team, http://www.altlinux.com/
From: David Woodhouse
Date: Tuesday, October 30, 2007 - 7:25 am

Well, it ought to be using sysconf unconditionally, but I take your
point. I'm happy enough then -- and since it doesn't change the kernel
build it could perhaps even be considered for 2.6.24.

Here you are... make sure you use them in the correct order:
Reviewed-By: David Woodhouse <dwmw2@infradead.org>
Reviewed-By: David Woodhouse <dwmw2@infradead.org>
Reviewed-By: David Woodhouse <dwmw2@infradead.org>
Reviewed-By: David Woodhouse <dwmw2@infradead.org>

-- 
dwmw2

-

Previous thread: [PATCH] drivers/scsi/dpt_i2o: Convert to generic boolean by Richard Knutsson on Tuesday, October 30, 2007 - 3:54 am. (8 messages)

Next thread: [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup. by Richard Knutsson on Tuesday, October 30, 2007 - 3:54 am. (3 messages)