diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-03-03 04:44:03 -0500 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-03-04 03:05:33 -0500 |
commit | 0473c9b5f05948df780bbc7b996dd7aefc4ec41d (patch) | |
tree | 3413bbef3bcaa444bb051f7a9c9de9579d0e0374 | |
parent | 0414855fdc4a40da05221fc6062cccbc0c30f169 (diff) |
compat: let architectures define __ARCH_WANT_COMPAT_SYS_GETDENTS64
For architecture dependent compat syscalls in common code an architecture
must define something like __ARCH_WANT_<WHATEVER> if it wants to use the
code.
This however is not true for compat_sys_getdents64 for which architectures
must define __ARCH_OMIT_COMPAT_SYS_GETDENTS64 if they do not want the code.
This leads to the situation where all architectures, except mips, get the
compat code but only x86_64, arm64 and the generic syscall architectures
actually use it.
So invert the logic, so that architectures actively must do something to
get the compat code.
This way a couple of architectures get rid of otherwise dead code.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r-- | arch/arm64/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | fs/compat.c | 4 | ||||
-rw-r--r-- | include/linux/compat.h | 2 | ||||
-rw-r--r-- | include/uapi/asm-generic/unistd.h | 1 |
6 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 82ce217e94cf..a4654c656a1e 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h | |||
@@ -14,6 +14,7 @@ | |||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | */ | 15 | */ |
16 | #ifdef CONFIG_COMPAT | 16 | #ifdef CONFIG_COMPAT |
17 | #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 | ||
17 | #define __ARCH_WANT_COMPAT_STAT64 | 18 | #define __ARCH_WANT_COMPAT_STAT64 |
18 | #define __ARCH_WANT_SYS_GETHOSTNAME | 19 | #define __ARCH_WANT_SYS_GETHOSTNAME |
19 | #define __ARCH_WANT_SYS_PAUSE | 20 | #define __ARCH_WANT_SYS_PAUSE |
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index 4d3b92886665..413d6c612bec 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
26 | 26 | ||
27 | #define __ARCH_OMIT_COMPAT_SYS_GETDENTS64 | ||
28 | #define __ARCH_WANT_OLD_READDIR | 27 | #define __ARCH_WANT_OLD_READDIR |
29 | #define __ARCH_WANT_SYS_ALARM | 28 | #define __ARCH_WANT_SYS_ALARM |
30 | #define __ARCH_WANT_SYS_GETHOSTNAME | 29 | #define __ARCH_WANT_SYS_GETHOSTNAME |
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index c2a48139c340..f4b5795d7e34 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h | |||
@@ -23,6 +23,7 @@ | |||
23 | # include <asm/unistd_64.h> | 23 | # include <asm/unistd_64.h> |
24 | # include <asm/unistd_64_x32.h> | 24 | # include <asm/unistd_64_x32.h> |
25 | # define __ARCH_WANT_COMPAT_SYS_TIME | 25 | # define __ARCH_WANT_COMPAT_SYS_TIME |
26 | # define __ARCH_WANT_COMPAT_SYS_GETDENTS64 | ||
26 | 27 | ||
27 | # endif | 28 | # endif |
28 | 29 | ||
diff --git a/fs/compat.c b/fs/compat.c index 6af20de2c1a3..0095a6978eef 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -981,7 +981,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd, | |||
981 | return error; | 981 | return error; |
982 | } | 982 | } |
983 | 983 | ||
984 | #ifndef __ARCH_OMIT_COMPAT_SYS_GETDENTS64 | 984 | #ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64 |
985 | 985 | ||
986 | struct compat_getdents_callback64 { | 986 | struct compat_getdents_callback64 { |
987 | struct dir_context ctx; | 987 | struct dir_context ctx; |
@@ -1066,7 +1066,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd, | |||
1066 | fdput(f); | 1066 | fdput(f); |
1067 | return error; | 1067 | return error; |
1068 | } | 1068 | } |
1069 | #endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ | 1069 | #endif /* __ARCH_WANT_COMPAT_SYS_GETDENTS64 */ |
1070 | 1070 | ||
1071 | /* | 1071 | /* |
1072 | * Exactly like fs/open.c:sys_open(), except that it doesn't set the | 1072 | * Exactly like fs/open.c:sys_open(), except that it doesn't set the |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 3f448c65511b..beded18f992d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -502,9 +502,11 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd, | |||
502 | asmlinkage long compat_sys_getdents(unsigned int fd, | 502 | asmlinkage long compat_sys_getdents(unsigned int fd, |
503 | struct compat_linux_dirent __user *dirent, | 503 | struct compat_linux_dirent __user *dirent, |
504 | unsigned int count); | 504 | unsigned int count); |
505 | #ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64 | ||
505 | asmlinkage long compat_sys_getdents64(unsigned int fd, | 506 | asmlinkage long compat_sys_getdents64(unsigned int fd, |
506 | struct linux_dirent64 __user *dirent, | 507 | struct linux_dirent64 __user *dirent, |
507 | unsigned int count); | 508 | unsigned int count); |
509 | #endif | ||
508 | asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, | 510 | asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, |
509 | unsigned int nr_segs, unsigned int flags); | 511 | unsigned int nr_segs, unsigned int flags); |
510 | asmlinkage long compat_sys_open(const char __user *filename, int flags, | 512 | asmlinkage long compat_sys_open(const char __user *filename, int flags, |
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index dde8041f40d2..6db66783d268 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h | |||
@@ -191,6 +191,7 @@ __SYSCALL(__NR_quotactl, sys_quotactl) | |||
191 | 191 | ||
192 | /* fs/readdir.c */ | 192 | /* fs/readdir.c */ |
193 | #define __NR_getdents64 61 | 193 | #define __NR_getdents64 61 |
194 | #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 | ||
194 | __SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) | 195 | __SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) |
195 | 196 | ||
196 | /* fs/read_write.c */ | 197 | /* fs/read_write.c */ |