consolidate cond_syscall and SYSCALL_ALIAS declarations
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 21 Jan 2013 22:16:07 +0000 (17:16 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 4 Mar 2013 03:55:19 +0000 (22:55 -0500)
take them to asm/linkage.h, with default in linux/linkage.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
29 files changed:
arch/alpha/include/asm/linkage.h
arch/alpha/include/asm/unistd.h
arch/arm/include/asm/unistd.h
arch/avr32/include/asm/unistd.h
arch/blackfin/include/asm/unistd.h
arch/cris/include/asm/unistd.h
arch/frv/include/asm/unistd.h
arch/h8300/include/asm/linkage.h
arch/h8300/include/asm/unistd.h
arch/ia64/include/asm/linkage.h
arch/ia64/include/asm/unistd.h
arch/m32r/include/asm/unistd.h
arch/m68k/include/asm/unistd.h
arch/microblaze/include/asm/unistd.h
arch/mips/include/asm/linkage.h
arch/mips/include/asm/unistd.h
arch/mn10300/include/asm/unistd.h
arch/parisc/include/asm/unistd.h
arch/powerpc/include/asm/linkage.h [new file with mode: 0644]
arch/powerpc/include/asm/unistd.h
arch/powerpc/include/uapi/asm/linkage.h [deleted file]
arch/s390/include/asm/unistd.h
arch/sh/include/asm/unistd.h
arch/sparc/include/asm/unistd.h
arch/x86/include/asm/unistd.h
arch/xtensa/include/asm/unistd.h
include/asm-generic/unistd.h
include/linux/linkage.h
include/linux/syscalls.h

index 291c2d01c44f29dad20f7623783b8bad362eaddf..7cfd06e8c935163801c01c79dd420c7c1e6e665f 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
 
-/* Nothing to see here... */
+#define cond_syscall(x)  asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
+#define SYSCALL_ALIAS(alias, name)                                     \
+       asm ( #alias " = " #name "\n\t.globl " #alias)
 
 #endif
index 6d6fe7ab5473f63f60e0c8c3e9ef55dd39ee8914..43baee17acdf43c065bc6a9bd59b2ffa2c391f80 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/* "Conditional" syscalls.  What we want is
-
-       __attribute__((weak,alias("sys_ni_syscall")))
-
-   but that raises the problem of what type to give the symbol.  If we use
-   a prototype, it'll conflict with the definition given in this file and
-   others.  If we use __typeof, we discover that not all symbols actually
-   have declarations.  If we use no prototype, then we get warnings from
-   -Wstrict-prototypes.  Ho hum.  */
-
-#define cond_syscall(x)  asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
-
 #endif /* _ALPHA_UNISTD_H */
index e4ddfb39ca34b0700592610d5c21de624ad95826..141baa3f9a72d1d931da67c30c600fa85bc4bfc5 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 /*
  * Unimplemented (or alternatively implemented) syscalls
  */
index dc4d5a931112ebe3b6bb9c9e32c7a81d434e1624..c1eb080e45fee5c1c85d315ef89974bacadf67f3 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-
 #endif /* __ASM_AVR32_UNISTD_H */
index 04e83ea8d5cc277e1bd90e654ab8ccdaf7f55a61..c35414bdf7bd3ddad8ff3371468e70ce95ab8fd6 100644 (file)
 #define __ARCH_WANT_SYS_NICE
 #define __ARCH_WANT_SYS_VFORK
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall");
-
 #endif                         /* __ASM_BFIN_UNISTD_H */
index be57a988bfb9125c25d9cec62da4d4109d962376..0ff3f6889842b7bb0922ec2b777595719556f004 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _ASM_CRIS_UNISTD_H_ */
index 4cfcc7bba25a9e2ed9526a9279bef01c5535907e..70ec7293dce78f56e7e3400dc8e52edf7ab8c0f5 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#ifndef cond_syscall
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-#endif
-
 #endif /* _ASM_UNISTD_H_ */
index 6f4df7d461808c174d1d452e51d2916c01fba337..1d81604fb0adf6b73361200219d56a62e8d92dda 100644 (file)
@@ -2,7 +2,5 @@
 #define _H8300_LINKAGE_H
 
 #undef SYMBOL_NAME_LABEL
-#undef SYMBOL_NAME
 #define SYMBOL_NAME_LABEL(_name_) _##_name_##:
-#define SYMBOL_NAME(_name_) _##_name_
 #endif
index 6721856d841b353321fd1f12a81f4e85a5ec65cc..ab671ecf51963d70517d651318b8bcfbb11a6a40 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- */
-#define cond_syscall(name)                                             \
-  asm (".weak\t_" #name "\n"                           \
-       ".set\t_" #name ",_sys_ni_syscall");
-
 #endif /* _ASM_H8300_UNISTD_H_ */
index ef22a45c1890bf26eb8f82a8f15c5e5f8f65c5f8..787575701f1ca94c34b872e3b2f37fd97da3afc7 100644 (file)
@@ -11,4 +11,8 @@
 
 #endif
 
+#define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")
+#define SYSCALL_ALIAS(alias, name)                                     \
+       asm ( #alias "# = " #name "#\n\t.globl " #alias "#")
+
 #endif
index 096373800f73d8b8eeec961657d1f940a2fb9919..afd45e0d552e1301536f2f8a21beea440c1ad6c5 100644 (file)
@@ -46,15 +46,5 @@ asmlinkage unsigned long sys_mmap2(
 struct pt_regs;
 asmlinkage long sys_ia64_pipe(void);
 
-/*
- * "Conditional" syscalls
- *
- * Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in
- * kernel/sys_ni.c.  This version causes warnings because the declaration isn't a
- * proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
- * declarations have prototypes at the moment.
- */
-#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
-
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_IA64_UNISTD_H */
index 555629b052672ed9c7532455b311fcdd90eb436a..59db80193454dab9c3c837b5bc7ac50f64102fdd 100644 (file)
 #define __IGNORE_getresgid
 #define __IGNORE_chown
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#ifndef cond_syscall
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-#endif
-
 #endif /* _ASM_M32R_UNISTD_H */
index 6cd92671ca5e61c572f5300dbc0f6de054457ca1..014f288fc81354e0eb088e500184e7e032ea6ba3 100644 (file)
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _ASM_M68K_UNISTD_H_ */
index b3778391d9cc6eb8513e590c0af79890cefc0ba8..6dece2d002dca98e5247f1ee043830cd8769c13f 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_FORK
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_MICROBLAZE_UNISTD_H */
index e9a940d1b0c6ff7ced02110a31ded281d29b1f61..2767dda9e309100f40142567a970d6a4a1b07a4a 100644 (file)
@@ -6,5 +6,8 @@
 #endif
 
 #define __weak __attribute__((weak))
+#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
+#define SYSCALL_ALIAS(alias, name)                                     \
+       asm ( #alias " = " #name "\n\t.globl " #alias)
 
 #endif
index 64f661e328796f55a0d52e144850e64cf94c4187..63c9c886173a68c6a89857b7f7d28046cb712e56 100644 (file)
 
 #endif /* !__ASSEMBLY__ */
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
-
 #endif /* _ASM_UNISTD_H */
index 7f9d9adfa51ed3433b44d91d6e5d89c7ac5b767a..9d4e2d1ef90edcec1e37a449440d932bd23403a9 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#ifndef cond_syscall
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-#endif
-
 #endif /* _ASM_UNISTD_H */
index ae9a46cbfd92b0256cf7520d395494300f3538d5..74d835820ee7bb16e72009b240844a804552b239 100644 (file)
@@ -170,12 +170,4 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)      \
 
 #undef STR
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _ASM_PARISC_UNISTD_H_ */
diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
new file mode 100644 (file)
index 0000000..b36f650
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _ASM_POWERPC_LINKAGE_H
+#define _ASM_POWERPC_LINKAGE_H
+
+#ifdef CONFIG_PPC64
+#define cond_syscall(x) \
+       asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"          \
+            "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
+#define SYSCALL_ALIAS(alias, name)                                     \
+       asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"      \
+            "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
+#endif
+
+#endif /* _ASM_POWERPC_LINKAGE_H */
index f25b5c45c4359632d2b5259438173f493bfb6810..91586d979c99ff46f2b561105bfc8e9c91d07556 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- */
-#define cond_syscall(x) \
-       asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
-
 #endif         /* __ASSEMBLY__ */
 #endif /* _ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/include/uapi/asm/linkage.h b/arch/powerpc/include/uapi/asm/linkage.h
deleted file mode 100644 (file)
index e1c4ac1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_POWERPC_LINKAGE_H
-#define _ASM_POWERPC_LINKAGE_H
-
-/* Nothing to see here... */
-
-#endif /* _ASM_POWERPC_LINKAGE_H */
index a6667a952969efc6cc3ba901a919fa554ab70be3..651886353551fce2f4d8a08fa87cf86ce0e98808 100644 (file)
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _ASM_S390_UNISTD_H_ */
index 5e90fa2b7eed348cadae62e3dd0523c2954ddee7..e77816c4b9bc4de14d75f7a8ce9cf5c2bc466b02 100644 (file)
 # define __ARCH_WANT_SYS_VFORK
 # define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #include <uapi/asm/unistd.h>
index 5356810bd7e758369fda84af123c28d9c15d7486..dfa53fdd5cbc8ec8d3bde130391b9d07972a3dca 100644 (file)
 #define __ARCH_WANT_COMPAT_SYS_SENDFILE
 #endif
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _SPARC_UNISTD_H */
index 3d5df1c4447fd9e57ca6e5920936bf88757ecdf9..c2a48139c3401b5d0202a83c676242119106b1f2 100644 (file)
 # define __ARCH_WANT_SYS_VFORK
 # define __ARCH_WANT_SYS_CLONE
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
 #endif /* _ASM_X86_UNISTD_H */
index c38834de9ac7dd3a6660d09135a165f491856038..cb4c2ce8d447b16711aff6fc06c0e27f21c6180e 100644 (file)
@@ -4,14 +4,6 @@
 #define __ARCH_WANT_SYS_CLONE
 #include <uapi/asm/unistd.h>
 
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_UTIME
 #define __ARCH_WANT_SYS_LLSEEK
index 4077b5d9ff8184f6a4446273b8fcaed792206dc0..0501fa3f783ddbc55ed1b12503a4dfaf4cbce6b0 100644 (file)
@@ -9,20 +9,3 @@
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SYS_LLSEEK
 #endif
-
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#ifndef cond_syscall
-#ifdef CONFIG_SYMBOL_PREFIX
-#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
-#else
-#define __SYMBOL_PREFIX
-#endif
-#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
-                           ".set\t" __SYMBOL_PREFIX #x "," \
-                           __SYMBOL_PREFIX "sys_ni_syscall")
-#endif
index 807f1e5332267e6bd776f9591f106b723e1c02ab..829d66c67fc20580a82b5ce7a1be3bf9083c2944 100644 (file)
@@ -2,6 +2,7 @@
 #define _LINUX_LINKAGE_H
 
 #include <linux/compiler.h>
+#include <linux/stringify.h>
 #include <asm/linkage.h>
 
 #ifdef __cplusplus
 #define asmlinkage CPP_ASMLINKAGE
 #endif
 
+#ifndef SYMBOL_NAME
+#ifdef CONFIG_SYMBOL_PREFIX
+#define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x
+#else
+#define SYMBOL_NAME(x) x
+#endif
+#endif
+#define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))
+
+#ifndef cond_syscall
+#define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \
+       "\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall));
+#endif
+
+#ifndef SYSCALL_ALIAS
+#define SYSCALL_ALIAS(alias, name)                             \
+       asm ("\t.globl " __SYMBOL_NAME(alias)                   \
+       "\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name))
+#endif
+
 #define __page_aligned_data    __section(.data..page_aligned) __aligned(PAGE_SIZE)
 #define __page_aligned_bss     __section(.bss..page_aligned) __aligned(PAGE_SIZE)
 
index 3e07b92efbf66972becd205a52cc1d25412c03fe..87584373305d66eb98c281016272116113dda403 100644 (file)
@@ -183,20 +183,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
 #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
 
-#ifdef CONFIG_PPC64
-#define SYSCALL_ALIAS(alias, name)                                     \
-       asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"      \
-            "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
-#else
-#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS)
-#define SYSCALL_ALIAS(alias, name)                                     \
-       asm ( #alias " = " #name "\n\t.globl " #alias)
-#else
-#define SYSCALL_ALIAS(alias, name)                                     \
-       asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
-#endif
-#endif
-
 #ifdef CONFIG_FTRACE_SYSCALLS
 #define SYSCALL_DEFINEx(x, sname, ...)                         \
        static const char *types_##sname[] = {                  \