From 07fe6e00f6cca6fef85a14a1dc3ed4f2e35d3f0b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 21 Jan 2013 15:03:44 -0500 Subject: get rid of duplicate logics in __SC_....[1-6] definitions All those guys have the same form - "take a list of type/name pairs, apply some macro to each of them". Abstract that part away, convert all __SC_FOO##x(__VA_ARGS__) to __MAP(x,__SC_FOO,__VA_ARGS__). Signed-off-by: Al Viro --- include/linux/compat.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index 76a87fb57ac2..8c1dfc8d830d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -27,12 +27,6 @@ #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) #endif -#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1) -#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__) -#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__) -#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__) -#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__) -#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__) #define COMPAT_SYSCALL_DEFINE1(name, ...) \ COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) #define COMPAT_SYSCALL_DEFINE2(name, ...) \ @@ -49,19 +43,19 @@ #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ - asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ - static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ - asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ + asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ { \ - return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ + return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ } \ SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ - static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) + static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ - asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)) + asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ -- cgit v1.2.3 From 22d1a35da0e247a006c286842a1846acb4ffed4f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 21 Jan 2013 17:18:07 -0500 Subject: make HAVE_SYSCALL_WRAPPERS unconditional Signed-off-by: Al Viro --- include/linux/compat.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index 8c1dfc8d830d..110132527e4c 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -40,8 +40,6 @@ #define COMPAT_SYSCALL_DEFINE6(name, ...) \ COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) -#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS - #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ @@ -52,13 +50,6 @@ SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) -#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ - -#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ - asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) - -#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ - #ifndef compat_user_stack_pointer #define compat_user_stack_pointer() current_user_stack_pointer() #endif -- cgit v1.2.3 From 19f4fc3aee180000fe45952691bbe69dde1d9e95 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 24 Feb 2013 02:17:03 -0500 Subject: convert sendfile{,64} to COMPAT_SYSCALL_DEFINE Signed-off-by: Al Viro --- include/linux/compat.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index 110132527e4c..ad299afcd488 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -670,6 +670,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, compat_size_t count); +asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, + compat_loff_t __user *offset, compat_size_t count); asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, compat_stack_t __user *uoss_ptr); -- cgit v1.2.3 From 35280bd4a3fa841897e2638437607fdec6c34f31 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 24 Feb 2013 14:52:17 -0500 Subject: switch epoll_pwait to COMPAT_SYSCALL_DEFINE Signed-off-by: Al Viro --- include/linux/compat.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index ad299afcd488..cdec8f2e9e21 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -432,10 +432,9 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, /* * epoll (fs/eventpoll.c) compat bits follow ... */ -struct epoll_event; -#define compat_epoll_event epoll_event +struct epoll_event; /* fortunately, this one is fixed-layout */ asmlinkage long compat_sys_epoll_pwait(int epfd, - struct compat_epoll_event __user *events, + struct epoll_event __user *events, int maxevents, int timeout, const compat_sigset_t __user *sigmask, compat_size_t sigsetsize); -- cgit v1.2.3 From d5dc77bfeeab0b03a32e3db5e31e2f64605634ab Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 25 Feb 2013 18:42:04 -0500 Subject: consolidate compat lookup_dcookie() Signed-off-by: Al Viro --- include/linux/compat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index cdec8f2e9e21..482c9e65b5bf 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -429,6 +429,7 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, compat_long_t addr, compat_long_t data); +asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t); /* * epoll (fs/eventpoll.c) compat bits follow ... */ -- cgit v1.2.3 From 56e41d3c5aa84d679eebdb3cb8a70b03c5fbd6c3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 21 Jan 2013 23:15:25 -0500 Subject: merge compat sys_ipc instances Signed-off-by: Al Viro --- include/linux/compat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index 482c9e65b5bf..79a4781ac502 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -318,6 +318,7 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third, int version, void __user *uptr); long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, void __user *uptr); +asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32); #else long compat_sys_semctl(int semid, int semnum, int cmd, int arg); long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, -- cgit v1.2.3 From 0e65a81b105a3f646793d46740ad90fa5c067986 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 3 Feb 2013 14:36:44 -0500 Subject: get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC Signed-off-by: Al Viro --- include/linux/compat.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'include/linux/compat.h') diff --git a/include/linux/compat.h b/include/linux/compat.h index 79a4781ac502..2bfe67329dc4 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -311,22 +311,13 @@ asmlinkage long compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, compat_size_t __user *len_ptr); -#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC -long compat_sys_semctl(int first, int second, int third, void __user *uptr); -long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); -long compat_sys_msgrcv(int first, int second, int msgtyp, int third, - int version, void __user *uptr); -long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, - void __user *uptr); asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32); -#else -long compat_sys_semctl(int semid, int semnum, int cmd, int arg); -long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, +asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); +asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); +asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz, int msgflg); -long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, +asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz, long msgtyp, int msgflg); -long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); -#endif long compat_sys_msgctl(int first, int second, void __user *uptr); long compat_sys_shmctl(int first, int second, void __user *uptr); long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, -- cgit v1.2.3