Skip to contentSkip to conversation

arch: arc: uapi: be sure of "_UAPI" prefix for all guard macros

PATCH Superseded Chen Gang 3 participants 5 messages Nov 8, 2013 – Nov 21, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 arch: arc: uapi: be sure of "_UAPI" prefix for all guard macros

For all uapi headers, need use "_UAPI" prefix for its guard macro (which will be stripped by "scripts/headers_installler.sh").

And be sure of all "endif" append (or have correct) related comment.

Also reserve guard macro in empty file, since some of "usr/include/*" header files may check guard macro to know whether content related header file.

---
 arch/arc/include/uapi/asm/byteorder.h  |    6 +++---
 arch/arc/include/uapi/asm/cachectl.h   |    6 +++---
 arch/arc/include/uapi/asm/elf.h        |    2 +-
 arch/arc/include/uapi/asm/setup.h      |    9 +++++++--
 arch/arc/include/uapi/asm/sigcontext.h |    6 +++---
 arch/arc/include/uapi/asm/signal.h     |    6 +++---
 arch/arc/include/uapi/asm/swab.h       |    6 +++---
 arch/arc/include/uapi/asm/unistd.h     |    4 ++++
 8 files changed, 27 insertions(+), 18 deletions(-)
arch/arc/include/uapi/asm/byteorder.h +3 -3
index 9da71d4..859fde2 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ASM_ARC_BYTEORDER_H
-#define __ASM_ARC_BYTEORDER_H
+#ifndef _UAPI__ASM_ARC_BYTEORDER_H
+#define _UAPI__ASM_ARC_BYTEORDER_H
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
 #include <linux/byteorder/big_endian.h>
@@ -15,4 +15,4 @@
 #include <linux/byteorder/little_endian.h>
 #endif
 
-#endif /* ASM_ARC_BYTEORDER_H */
+#endif /* _UAPI__ASM_ARC_BYTEORDER_H */
arch/arc/include/uapi/asm/cachectl.h +3 -3
index 51c73f0..2437fc6 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARC_ASM_CACHECTL_H
-#define __ARC_ASM_CACHECTL_H
+#ifndef _UAPI__ARC_ASM_CACHECTL_H
+#define _UAPI__ARC_ASM_CACHECTL_H
 
 /*
  * ARC ABI flags defined for Android's finegrained cacheflush requirements
@@ -25,4 +25,4 @@
 #define DCACHE	CF_D_FLUSH
 #define BCACHE	(CF_I_INV | CF_D_FLUSH)
 
-#endif
+#endif /* _UAPI__ARC_ASM_CACHECTL_H */
arch/arc/include/uapi/asm/elf.h +1 -1
index 0f99ac8..4e82dc6 100644
@@ -23,4 +23,4 @@ typedef unsigned long elf_fpregset_t;
 
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-#endif
+#endif /* _UAPI__ASM_ARC_ELF_H */
arch/arc/include/uapi/asm/setup.h +7 -2
index a6d4e44..09a8df7 100644
@@ -1,6 +1,11 @@
 /*
  * setup.h is part of userspace header ABI so UAPI scripts have to generate it
  * even if there's nothing to export - causing empty <uapi/asm/setup.h>
- * However to prevent "patch" from discarding it we add this placeholder
- * comment
+ *
+ * And some user programs may check guard macro to know whether content related
+ * header file (e.g. some of "/usr/include/ *" header files check guard macro),
+ * so recommend to still reserve guard macro in empty file.
  */
+#ifndef _UAPI__ASM_ARC_SETUP_H
+#define _UAPI__ASM_ARC_SETUP_H
+#endif /* _UAPI__ASM_ARC_SETUP_H */
arch/arc/include/uapi/asm/sigcontext.h +3 -3
index 9678a11..b2063ff 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _ASM_ARC_SIGCONTEXT_H
-#define _ASM_ARC_SIGCONTEXT_H
+#ifndef _UAPI_ASM_ARC_SIGCONTEXT_H
+#define _UAPI_ASM_ARC_SIGCONTEXT_H
 
 #include <asm/ptrace.h>
 
@@ -19,4 +19,4 @@ struct sigcontext {
 	struct user_regs_struct regs;
 };
 
-#endif /* _ASM_ARC_SIGCONTEXT_H */
+#endif /* _UAPI_ASM_ARC_SIGCONTEXT_H */
arch/arc/include/uapi/asm/signal.h +3 -3
index fad62f7..f212d83 100644
@@ -8,8 +8,8 @@
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
 
-#ifndef _ASM_ARC_SIGNAL_H
-#define _ASM_ARC_SIGNAL_H
+#ifndef _UAPI_ASM_ARC_SIGNAL_H
+#define _UAPI_ASM_ARC_SIGNAL_H
 
 /*
  * This is much needed for ARC sigreturn optimization.
@@ -24,4 +24,4 @@
 
 #include <asm-generic/signal.h>
 
-#endif /* _ASM_ARC_SIGNAL_H */
+#endif /* _UAPI_ASM_ARC_SIGNAL_H */
arch/arc/include/uapi/asm/swab.h +3 -3
index 095599a..7237a21 100644
@@ -13,8 +13,8 @@
  *  -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  */
 
-#ifndef __ASM_ARC_SWAB_H
-#define __ASM_ARC_SWAB_H
+#ifndef _UAPI__ASM_ARC_SWAB_H
+#define _UAPI__ASM_ARC_SWAB_H
 
 #include <linux/types.h>
 
@@ -95,4 +95,4 @@
 #define __SWAB_64_THRU_32__
 #endif
 
-#endif
+#endif /* _UAPI__ASM_ARC_SWAB_H */
arch/arc/include/uapi/asm/unistd.h +4 -0
index 6f30484..109f32c 100644
@@ -7,6 +7,8 @@
  */
 
 /******** no-legacy-syscalls-ABI *******/
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
 
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
@@ -32,3 +34,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif /* _UAPI_ASM_ARC_UNISTD_H */
Signature · 1 line
1.7.7.6
author
#1 lore raw
Quoted 9 lines · Chen Gang

For all uapi headers, need use "_UAPI" prefix for its guard macro (which will be stripped by "scripts/headers_installler.sh").

And be sure of all "endif" append (or have correct) related comment.

Also reserve guard macro in empty file, since some of "usr/include/*" header files may check guard macro to know whether content related header file.

Oh, sorry.

Need add additional comment for the normal header file which missing guard macro.

And also need cc to David Howells which provide many valuable suggestions.

I will send patch v2 for it.

Quoted 166 lines
---
 arch/arc/include/uapi/asm/byteorder.h  |    6 +++---
 arch/arc/include/uapi/asm/cachectl.h   |    6 +++---
 arch/arc/include/uapi/asm/elf.h        |    2 +-
 arch/arc/include/uapi/asm/setup.h      |    9 +++++++--
 arch/arc/include/uapi/asm/sigcontext.h |    6 +++---
 arch/arc/include/uapi/asm/signal.h     |    6 +++---
 arch/arc/include/uapi/asm/swab.h       |    6 +++---
 arch/arc/include/uapi/asm/unistd.h     |    4 ++++
 8 files changed, 27 insertions(+), 18 deletions(-)
arch/arc/include/uapi/asm/byteorder.h +3 -3
index 9da71d4..859fde2 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ASM_ARC_BYTEORDER_H
-#define __ASM_ARC_BYTEORDER_H
+#ifndef _UAPI__ASM_ARC_BYTEORDER_H
+#define _UAPI__ASM_ARC_BYTEORDER_H
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
 #include <linux/byteorder/big_endian.h>
@@ -15,4 +15,4 @@
 #include <linux/byteorder/little_endian.h>
 #endif
 
-#endif /* ASM_ARC_BYTEORDER_H */
+#endif /* _UAPI__ASM_ARC_BYTEORDER_H */
arch/arc/include/uapi/asm/cachectl.h +3 -3
index 51c73f0..2437fc6 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARC_ASM_CACHECTL_H
-#define __ARC_ASM_CACHECTL_H
+#ifndef _UAPI__ARC_ASM_CACHECTL_H
+#define _UAPI__ARC_ASM_CACHECTL_H
 
 /*
  * ARC ABI flags defined for Android's finegrained cacheflush requirements
@@ -25,4 +25,4 @@
 #define DCACHE	CF_D_FLUSH
 #define BCACHE	(CF_I_INV | CF_D_FLUSH)
 
-#endif
+#endif /* _UAPI__ARC_ASM_CACHECTL_H */
arch/arc/include/uapi/asm/elf.h +1 -1
index 0f99ac8..4e82dc6 100644
@@ -23,4 +23,4 @@ typedef unsigned long elf_fpregset_t;
 
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-#endif
+#endif /* _UAPI__ASM_ARC_ELF_H */
arch/arc/include/uapi/asm/setup.h +7 -2
index a6d4e44..09a8df7 100644
@@ -1,6 +1,11 @@
 /*
  * setup.h is part of userspace header ABI so UAPI scripts have to generate it
  * even if there's nothing to export - causing empty <uapi/asm/setup.h>
- * However to prevent "patch" from discarding it we add this placeholder
- * comment
+ *
+ * And some user programs may check guard macro to know whether content related
+ * header file (e.g. some of "/usr/include/ *" header files check guard macro),
+ * so recommend to still reserve guard macro in empty file.
  */
+#ifndef _UAPI__ASM_ARC_SETUP_H
+#define _UAPI__ASM_ARC_SETUP_H
+#endif /* _UAPI__ASM_ARC_SETUP_H */
arch/arc/include/uapi/asm/sigcontext.h +3 -3
index 9678a11..b2063ff 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _ASM_ARC_SIGCONTEXT_H
-#define _ASM_ARC_SIGCONTEXT_H
+#ifndef _UAPI_ASM_ARC_SIGCONTEXT_H
+#define _UAPI_ASM_ARC_SIGCONTEXT_H
 
 #include <asm/ptrace.h>
 
@@ -19,4 +19,4 @@ struct sigcontext {
 	struct user_regs_struct regs;
 };
 
-#endif /* _ASM_ARC_SIGCONTEXT_H */
+#endif /* _UAPI_ASM_ARC_SIGCONTEXT_H */
arch/arc/include/uapi/asm/signal.h +3 -3
index fad62f7..f212d83 100644
@@ -8,8 +8,8 @@
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
 
-#ifndef _ASM_ARC_SIGNAL_H
-#define _ASM_ARC_SIGNAL_H
+#ifndef _UAPI_ASM_ARC_SIGNAL_H
+#define _UAPI_ASM_ARC_SIGNAL_H
 
 /*
  * This is much needed for ARC sigreturn optimization.
@@ -24,4 +24,4 @@
 
 #include <asm-generic/signal.h>
 
-#endif /* _ASM_ARC_SIGNAL_H */
+#endif /* _UAPI_ASM_ARC_SIGNAL_H */
arch/arc/include/uapi/asm/swab.h +3 -3
index 095599a..7237a21 100644
@@ -13,8 +13,8 @@
  *  -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  */
 
-#ifndef __ASM_ARC_SWAB_H
-#define __ASM_ARC_SWAB_H
+#ifndef _UAPI__ASM_ARC_SWAB_H
+#define _UAPI__ASM_ARC_SWAB_H
 
 #include <linux/types.h>
 
@@ -95,4 +95,4 @@
 #define __SWAB_64_THRU_32__
 #endif
 
-#endif
+#endif /* _UAPI__ASM_ARC_SWAB_H */
arch/arc/include/uapi/asm/unistd.h +4 -0
index 6f30484..109f32c 100644
@@ -7,6 +7,8 @@
  */
 
 /******** no-legacy-syscalls-ABI *******/
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
 
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
@@ -32,3 +34,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif /* _UAPI_ASM_ARC_UNISTD_H */
Signature · 1 line
Chen Gang
author
#2 lore raw

PATCH v2 1/1 arch: arc: uapi: be sure of "_UAPI" prefix for all guard macros

In reply to Chen Gang

For all uapi headers, need use "_UAPI" prefix for its guard macro (which will be stripped by "scripts/headers_installer.sh").

And be sure that all "endif" need append (or have correct) related comment, and all normal uapi header files need content guard macro.

Also reserve guard macro in empty file, since some "usr/include/*" header files may check guard macro to know whether content related header file.

Cc David Howells <[email protected]>
---
 arch/arc/include/uapi/asm/byteorder.h  |    6 +++---
 arch/arc/include/uapi/asm/cachectl.h   |    6 +++---
 arch/arc/include/uapi/asm/elf.h        |    2 +-
 arch/arc/include/uapi/asm/setup.h      |    9 +++++++--
 arch/arc/include/uapi/asm/sigcontext.h |    6 +++---
 arch/arc/include/uapi/asm/signal.h     |    6 +++---
 arch/arc/include/uapi/asm/swab.h       |    6 +++---
 arch/arc/include/uapi/asm/unistd.h     |    4 ++++
 8 files changed, 27 insertions(+), 18 deletions(-)
arch/arc/include/uapi/asm/byteorder.h +3 -3
index 9da71d4..859fde2 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ASM_ARC_BYTEORDER_H
-#define __ASM_ARC_BYTEORDER_H
+#ifndef _UAPI__ASM_ARC_BYTEORDER_H
+#define _UAPI__ASM_ARC_BYTEORDER_H
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
 #include <linux/byteorder/big_endian.h>
@@ -15,4 +15,4 @@
 #include <linux/byteorder/little_endian.h>
 #endif
 
-#endif /* ASM_ARC_BYTEORDER_H */
+#endif /* _UAPI__ASM_ARC_BYTEORDER_H */
arch/arc/include/uapi/asm/cachectl.h +3 -3
index 51c73f0..2437fc6 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARC_ASM_CACHECTL_H
-#define __ARC_ASM_CACHECTL_H
+#ifndef _UAPI__ARC_ASM_CACHECTL_H
+#define _UAPI__ARC_ASM_CACHECTL_H
 
 /*
  * ARC ABI flags defined for Android's finegrained cacheflush requirements
@@ -25,4 +25,4 @@
 #define DCACHE	CF_D_FLUSH
 #define BCACHE	(CF_I_INV | CF_D_FLUSH)
 
-#endif
+#endif /* _UAPI__ARC_ASM_CACHECTL_H */
arch/arc/include/uapi/asm/elf.h +1 -1
index 0f99ac8..4e82dc6 100644
@@ -23,4 +23,4 @@ typedef unsigned long elf_fpregset_t;
 
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-#endif
+#endif /* _UAPI__ASM_ARC_ELF_H */
arch/arc/include/uapi/asm/setup.h +7 -2
index a6d4e44..09a8df7 100644
@@ -1,6 +1,11 @@
 /*
  * setup.h is part of userspace header ABI so UAPI scripts have to generate it
  * even if there's nothing to export - causing empty <uapi/asm/setup.h>
- * However to prevent "patch" from discarding it we add this placeholder
- * comment
+ *
+ * And some user programs may check guard macro to know whether content related
+ * header file (e.g. some of "/usr/include/ *" header files check guard macro),
+ * so recommend to still reserve guard macro in empty file.
  */
+#ifndef _UAPI__ASM_ARC_SETUP_H
+#define _UAPI__ASM_ARC_SETUP_H
+#endif /* _UAPI__ASM_ARC_SETUP_H */
arch/arc/include/uapi/asm/sigcontext.h +3 -3
index 9678a11..b2063ff 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _ASM_ARC_SIGCONTEXT_H
-#define _ASM_ARC_SIGCONTEXT_H
+#ifndef _UAPI_ASM_ARC_SIGCONTEXT_H
+#define _UAPI_ASM_ARC_SIGCONTEXT_H
 
 #include <asm/ptrace.h>
 
@@ -19,4 +19,4 @@ struct sigcontext {
 	struct user_regs_struct regs;
 };
 
-#endif /* _ASM_ARC_SIGCONTEXT_H */
+#endif /* _UAPI_ASM_ARC_SIGCONTEXT_H */
arch/arc/include/uapi/asm/signal.h +3 -3
index fad62f7..f212d83 100644
@@ -8,8 +8,8 @@
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
 
-#ifndef _ASM_ARC_SIGNAL_H
-#define _ASM_ARC_SIGNAL_H
+#ifndef _UAPI_ASM_ARC_SIGNAL_H
+#define _UAPI_ASM_ARC_SIGNAL_H
 
 /*
  * This is much needed for ARC sigreturn optimization.
@@ -24,4 +24,4 @@
 
 #include <asm-generic/signal.h>
 
-#endif /* _ASM_ARC_SIGNAL_H */
+#endif /* _UAPI_ASM_ARC_SIGNAL_H */
arch/arc/include/uapi/asm/swab.h +3 -3
index 095599a..7237a21 100644
@@ -13,8 +13,8 @@
  *  -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  */
 
-#ifndef __ASM_ARC_SWAB_H
-#define __ASM_ARC_SWAB_H
+#ifndef _UAPI__ASM_ARC_SWAB_H
+#define _UAPI__ASM_ARC_SWAB_H
 
 #include <linux/types.h>
 
@@ -95,4 +95,4 @@
 #define __SWAB_64_THRU_32__
 #endif
 
-#endif
+#endif /* _UAPI__ASM_ARC_SWAB_H */
arch/arc/include/uapi/asm/unistd.h +4 -0
index 6f30484..109f32c 100644
@@ -7,6 +7,8 @@
  */
 
 /******** no-legacy-syscalls-ABI *******/
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
 
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
@@ -32,3 +34,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif /* _UAPI_ASM_ARC_UNISTD_H */
Signature · 1 line
1.7.7.6
#3 lore raw

Hi Chen,

Quoted 13 lines · Chen Gang

For all uapi headers, need use "_UAPI" prefix for its guard macro (which will be stripped by "scripts/headers_installer.sh").

And be sure that all "endif" need append (or have correct) related comment, and all normal uapi header files need content guard macro.

Also reserve guard macro in empty file, since some "usr/include/*" header files may check guard macro to know whether content related header file.

Cc David Howells <[email protected]>
Quoted 9 lines
---
 arch/arc/include/uapi/asm/byteorder.h  |    6 +++---
 arch/arc/include/uapi/asm/cachectl.h   |    6 +++---
 arch/arc/include/uapi/asm/elf.h        |    2 +-
 arch/arc/include/uapi/asm/setup.h      |    9 +++++++--
 arch/arc/include/uapi/asm/sigcontext.h |    6 +++---
 arch/arc/include/uapi/asm/signal.h     |    6 +++---
 arch/arc/include/uapi/asm/swab.h       |    6 +++---
 arch/arc/include/uapi/asm/unistd.h     |    4 ++++

Form this patch, I'm picking up the hunk for unistd.h as it is missing a gaurd altogether. Although the guard is generated by installed headers, some of perf utils (e.g. sched-pipe.c) include kernel headers directly too, causing redef errors.

I'm dropping rest of the patch.

-Vineet

Quoted 155 lines
 8 files changed, 27 insertions(+), 18 deletions(-)
arch/arc/include/uapi/asm/byteorder.h +3 -3
index 9da71d4..859fde2 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ASM_ARC_BYTEORDER_H
-#define __ASM_ARC_BYTEORDER_H
+#ifndef _UAPI__ASM_ARC_BYTEORDER_H
+#define _UAPI__ASM_ARC_BYTEORDER_H
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
 #include <linux/byteorder/big_endian.h>
@@ -15,4 +15,4 @@
 #include <linux/byteorder/little_endian.h>
 #endif
 
-#endif /* ASM_ARC_BYTEORDER_H */
+#endif /* _UAPI__ASM_ARC_BYTEORDER_H */
arch/arc/include/uapi/asm/cachectl.h +3 -3
index 51c73f0..2437fc6 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARC_ASM_CACHECTL_H
-#define __ARC_ASM_CACHECTL_H
+#ifndef _UAPI__ARC_ASM_CACHECTL_H
+#define _UAPI__ARC_ASM_CACHECTL_H
 
 /*
  * ARC ABI flags defined for Android's finegrained cacheflush requirements
@@ -25,4 +25,4 @@
 #define DCACHE	CF_D_FLUSH
 #define BCACHE	(CF_I_INV | CF_D_FLUSH)
 
-#endif
+#endif /* _UAPI__ARC_ASM_CACHECTL_H */
arch/arc/include/uapi/asm/elf.h +1 -1
index 0f99ac8..4e82dc6 100644
@@ -23,4 +23,4 @@ typedef unsigned long elf_fpregset_t;
 
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-#endif
+#endif /* _UAPI__ASM_ARC_ELF_H */
arch/arc/include/uapi/asm/setup.h +7 -2
index a6d4e44..09a8df7 100644
@@ -1,6 +1,11 @@
 /*
  * setup.h is part of userspace header ABI so UAPI scripts have to generate it
  * even if there's nothing to export - causing empty <uapi/asm/setup.h>
- * However to prevent "patch" from discarding it we add this placeholder
- * comment
+ *
+ * And some user programs may check guard macro to know whether content related
+ * header file (e.g. some of "/usr/include/ *" header files check guard macro),
+ * so recommend to still reserve guard macro in empty file.
  */
+#ifndef _UAPI__ASM_ARC_SETUP_H
+#define _UAPI__ASM_ARC_SETUP_H
+#endif /* _UAPI__ASM_ARC_SETUP_H */
arch/arc/include/uapi/asm/sigcontext.h +3 -3
index 9678a11..b2063ff 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _ASM_ARC_SIGCONTEXT_H
-#define _ASM_ARC_SIGCONTEXT_H
+#ifndef _UAPI_ASM_ARC_SIGCONTEXT_H
+#define _UAPI_ASM_ARC_SIGCONTEXT_H
 
 #include <asm/ptrace.h>
 
@@ -19,4 +19,4 @@ struct sigcontext {
 	struct user_regs_struct regs;
 };
 
-#endif /* _ASM_ARC_SIGCONTEXT_H */
+#endif /* _UAPI_ASM_ARC_SIGCONTEXT_H */
arch/arc/include/uapi/asm/signal.h +3 -3
index fad62f7..f212d83 100644
@@ -8,8 +8,8 @@
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
 
-#ifndef _ASM_ARC_SIGNAL_H
-#define _ASM_ARC_SIGNAL_H
+#ifndef _UAPI_ASM_ARC_SIGNAL_H
+#define _UAPI_ASM_ARC_SIGNAL_H
 
 /*
  * This is much needed for ARC sigreturn optimization.
@@ -24,4 +24,4 @@
 
 #include <asm-generic/signal.h>
 
-#endif /* _ASM_ARC_SIGNAL_H */
+#endif /* _UAPI_ASM_ARC_SIGNAL_H */
arch/arc/include/uapi/asm/swab.h +3 -3
index 095599a..7237a21 100644
@@ -13,8 +13,8 @@
  *  -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  */
 
-#ifndef __ASM_ARC_SWAB_H
-#define __ASM_ARC_SWAB_H
+#ifndef _UAPI__ASM_ARC_SWAB_H
+#define _UAPI__ASM_ARC_SWAB_H
 
 #include <linux/types.h>
 
@@ -95,4 +95,4 @@
 #define __SWAB_64_THRU_32__
 #endif
 
-#endif
+#endif /* _UAPI__ASM_ARC_SWAB_H */
arch/arc/include/uapi/asm/unistd.h +4 -0
index 6f30484..109f32c 100644
@@ -7,6 +7,8 @@
  */
 
 /******** no-legacy-syscalls-ABI *******/
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
 
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
@@ -32,3 +34,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif /* _UAPI_ASM_ARC_UNISTD_H */
#4 lore raw
Quoted 26 lines · Vineet Gupta

Hi Chen,

Quoted 13 lines · Chen Gang

For all uapi headers, need use "_UAPI" prefix for its guard macro (which will be stripped by "scripts/headers_installer.sh").

And be sure that all "endif" need append (or have correct) related comment, and all normal uapi header files need content guard macro.

Also reserve guard macro in empty file, since some "usr/include/*" header files may check guard macro to know whether content related header file.

Cc David Howells <[email protected]>
Quoted 9 lines
---
 arch/arc/include/uapi/asm/byteorder.h  |    6 +++---
 arch/arc/include/uapi/asm/cachectl.h   |    6 +++---
 arch/arc/include/uapi/asm/elf.h        |    2 +-
 arch/arc/include/uapi/asm/setup.h      |    9 +++++++--
 arch/arc/include/uapi/asm/sigcontext.h |    6 +++---
 arch/arc/include/uapi/asm/signal.h     |    6 +++---
 arch/arc/include/uapi/asm/swab.h       |    6 +++---
 arch/arc/include/uapi/asm/unistd.h     |    4 ++++
Quoted 4 lines

Form this patch, I'm picking up the hunk for unistd.h as it is missing a gaurd altogether. Although the guard is generated by installed headers, some of perf utils (e.g. sched-pipe.c) include kernel headers directly too, causing redef errors.

OK, thanks. It seems it really can solve one issue (more or less).

Quoted 2 lines

I'm dropping rest of the patch.

Hmm... for me, I still recommend to apply the whole patch, "uapi" is the interface of Linux Kernel (like her address), it is better to make it clean and 'beautiful'.

Since it really can solve one issue (more or less), it is not a bad idea to clean up all related 'things'.

BTW: I need change my mail address to "[email protected]" (since I have to leave Asianux Corporation). Now I am a volunteer for public open source (just like another quit a few volunteers).

Thanks.

Quoted 165 lines

-Vineet

Quoted 150 lines
 8 files changed, 27 insertions(+), 18 deletions(-)
arch/arc/include/uapi/asm/byteorder.h +3 -3
index 9da71d4..859fde2 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ASM_ARC_BYTEORDER_H
-#define __ASM_ARC_BYTEORDER_H
+#ifndef _UAPI__ASM_ARC_BYTEORDER_H
+#define _UAPI__ASM_ARC_BYTEORDER_H
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
 #include <linux/byteorder/big_endian.h>
@@ -15,4 +15,4 @@
 #include <linux/byteorder/little_endian.h>
 #endif
 
-#endif /* ASM_ARC_BYTEORDER_H */
+#endif /* _UAPI__ASM_ARC_BYTEORDER_H */
arch/arc/include/uapi/asm/cachectl.h +3 -3
index 51c73f0..2437fc6 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARC_ASM_CACHECTL_H
-#define __ARC_ASM_CACHECTL_H
+#ifndef _UAPI__ARC_ASM_CACHECTL_H
+#define _UAPI__ARC_ASM_CACHECTL_H
 
 /*
  * ARC ABI flags defined for Android's finegrained cacheflush requirements
@@ -25,4 +25,4 @@
 #define DCACHE	CF_D_FLUSH
 #define BCACHE	(CF_I_INV | CF_D_FLUSH)
 
-#endif
+#endif /* _UAPI__ARC_ASM_CACHECTL_H */
arch/arc/include/uapi/asm/elf.h +1 -1
index 0f99ac8..4e82dc6 100644
@@ -23,4 +23,4 @@ typedef unsigned long elf_fpregset_t;
 
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-#endif
+#endif /* _UAPI__ASM_ARC_ELF_H */
arch/arc/include/uapi/asm/setup.h +7 -2
index a6d4e44..09a8df7 100644
@@ -1,6 +1,11 @@
 /*
  * setup.h is part of userspace header ABI so UAPI scripts have to generate it
  * even if there's nothing to export - causing empty <uapi/asm/setup.h>
- * However to prevent "patch" from discarding it we add this placeholder
- * comment
+ *
+ * And some user programs may check guard macro to know whether content related
+ * header file (e.g. some of "/usr/include/ *" header files check guard macro),
+ * so recommend to still reserve guard macro in empty file.
  */
+#ifndef _UAPI__ASM_ARC_SETUP_H
+#define _UAPI__ASM_ARC_SETUP_H
+#endif /* _UAPI__ASM_ARC_SETUP_H */
arch/arc/include/uapi/asm/sigcontext.h +3 -3
index 9678a11..b2063ff 100644
@@ -6,8 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef _ASM_ARC_SIGCONTEXT_H
-#define _ASM_ARC_SIGCONTEXT_H
+#ifndef _UAPI_ASM_ARC_SIGCONTEXT_H
+#define _UAPI_ASM_ARC_SIGCONTEXT_H
 
 #include <asm/ptrace.h>
 
@@ -19,4 +19,4 @@ struct sigcontext {
 	struct user_regs_struct regs;
 };
 
-#endif /* _ASM_ARC_SIGCONTEXT_H */
+#endif /* _UAPI_ASM_ARC_SIGCONTEXT_H */
arch/arc/include/uapi/asm/signal.h +3 -3
index fad62f7..f212d83 100644
@@ -8,8 +8,8 @@
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
 
-#ifndef _ASM_ARC_SIGNAL_H
-#define _ASM_ARC_SIGNAL_H
+#ifndef _UAPI_ASM_ARC_SIGNAL_H
+#define _UAPI_ASM_ARC_SIGNAL_H
 
 /*
  * This is much needed for ARC sigreturn optimization.
@@ -24,4 +24,4 @@
 
 #include <asm-generic/signal.h>
 
-#endif /* _ASM_ARC_SIGNAL_H */
+#endif /* _UAPI_ASM_ARC_SIGNAL_H */
arch/arc/include/uapi/asm/swab.h +3 -3
index 095599a..7237a21 100644
@@ -13,8 +13,8 @@
  *  -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  */
 
-#ifndef __ASM_ARC_SWAB_H
-#define __ASM_ARC_SWAB_H
+#ifndef _UAPI__ASM_ARC_SWAB_H
+#define _UAPI__ASM_ARC_SWAB_H
 
 #include <linux/types.h>
 
@@ -95,4 +95,4 @@
 #define __SWAB_64_THRU_32__
 #endif
 
-#endif
+#endif /* _UAPI__ASM_ARC_SWAB_H */
arch/arc/include/uapi/asm/unistd.h +2 -0
index 6f30484..109f32c 100644
@@ -7,6 +7,8 @@
  */
 
 /******** no-legacy-syscalls-ABI *******/
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
 
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE

arch/arc/include/uapi/asm/unistd.h __SYSCALL(__NR_arc_gettls, sys_arc_gettls) · line 38

Quoted 5 lines
arch/arc/include/uapi/asm/unistd.h +2 -0
@@ -32,3 +34,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif /* _UAPI_ASM_ARC_UNISTD_H */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 4 lines
Chen Gang

-- 
Chen Gang