sys32_ioctl: kill code duplication
Subsystems (2)
Hi!
This kills code duplication in sys32_ioctl. It should work on x86-64 and sparc64; other architecture maintainers said that "anything that moves code out of arch/*/kernel/ioctl32.c is welcome" or similar.
Linus, what is required to make it go in?
Alan, would you be willing to let this be merged through you?
Pavel
arch/ia64/ia32/ia32_entry.S +1 -1
@@ -252,7 +252,7 @@ data8 sys_acct data8 sys_umount /* recycled never used phys( */ data8 sys32_ni_syscall /* old lock syscall holder */ - data8 sys32_ioctl + data8 compat_sys_ioctl data8 sys32_fcntl /* 55 */ data8 sys32_ni_syscall /* old mpx syscall holder */ data8 sys_setpgid
arch/ia64/ia32/ia32_ioctl.c +0 -218
221 lines not on this page · raw message
arch/mips64/kernel/ioctl32.c +0 -67
70 lines not on this page · raw message
arch/mips64/kernel/scall_o32.S +1 -1
@@ -287,7 +287,7 @@ sys sys_acct 0 sys sys_umount 2 sys sys_ni_syscall 0 - sys sys32_ioctl 3 + sys compat_sys_ioctl 3 sys sys32_fcntl 3 /* 4055 */ sys sys_ni_syscall 2 sys sys_setpgid 2
arch/parisc/kernel/ioctl32.c +0 -143
146 lines not on this page · raw message
arch/ppc64/kernel/ioctl32.c +0 -126
129 lines not on this page · raw message
arch/ppc64/kernel/misc.S +1 -1
@@ -556,7 +556,7 @@ .llong .sys_acct .llong .sys32_umount .llong .sys_ni_syscall /* old lock syscall */ - .llong .sys32_ioctl + .llong .compat_sys_ioctl .llong .sys32_fcntl /* 55 */ .llong .sys_ni_syscall /* old mpx syscall */ .llong .sys32_setpgid
arch/s390x/kernel/ioctl32.c +0 -110
113 lines not on this page · raw message
arch/s390x/kernel/wrapper32.S +1 -1
@@ -225,7 +225,7 @@ llgfr %r2,%r2 # unsigned int llgfr %r3,%r3 # unsigned int llgfr %r4,%r4 # unsigned int - jg sys32_ioctl # branch to system call + jg compat_sys_ioctl # branch to system call .globl sys32_fcntl_wrapper sys32_fcntl_wrapper:
arch/sparc64/kernel/ioctl32.c +9 -141
172 lines not on this page · raw message
arch/sparc64/kernel/sparc64_ksyms.c +2 -2
@@ -89,7 +89,7 @@extern int svr4_getcontext (svr4_ucontext_t *uc,struct pt_regs *regs);extern int svr4_setcontext (svr4_ucontext_t *uc,struct pt_regs *regs);extern int sys_ioctl (unsigned int fd,unsigned int cmd,unsigned long arg); -extern int sys32_ioctl (unsigned int fd,unsigned int cmd,u32 arg); +extern int compat_sys_ioctl (unsigned int fd,unsigned int cmd,u32 arg);extern int (*handle_mathemu)(struct pt_regs *,struct fpustate *);extern long sparc32_open (const char * filename,int flags,int mode);extern int register_ioctl32_conversion (unsigned int cmd,int (*handler)(unsigned int ,unsigned int ,unsigned long ,struct file *));
@@ -318,7 +318,7 @@EXPORT_SYMBOL (svr4_setcontext);EXPORT_SYMBOL (prom_cpu_nodes);EXPORT_SYMBOL (sys_ioctl); -EXPORT_SYMBOL (sys32_ioctl); +EXPORT_SYMBOL (compat_sys_ioctl);EXPORT_SYMBOL (sparc32_open);#endif
arch/sparc64/kernel/sunos_ioctl32.c +26 -26
135 lines not on this page · raw message
arch/sparc64/kernel/systbls.S +1 -1
@@ -29,7 +29,7 @@ .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile /*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid .word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 -/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl +/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve /*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
arch/sparc64/solaris/ioctl.c +24 -23
91 lines not on this page · raw message
arch/sparc64/solaris/timod.c +0 -2
@@ -29,8 +29,6 @@ extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd,unsigned long arg); -extern asmlinkage int sys32_ioctl(unsigned int fd, unsigned int cmd, -u32 arg); asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg);static spinlock_t timod_pagelock =SPIN_LOCK_UNLOCKED ;
arch/x86_64/ia32/ia32_ioctl.c +3 -223
245 lines not on this page · raw message
arch/x86_64/ia32/ia32entry.S +1 -1
@@ -254,7 +254,7 @@ .quad sys_acct .quad sys_umount /* new_umount */ .quad ni_syscall /* old lock syscall holder */ - .quad sys32_ioctl + .quad compat_sys_ioctl .quad sys32_fcntl64 /* 55 */ .quad ni_syscall /* old mpx syscall holder */ .quad sys_setpgid
fs/compat.c +222 -1
238 lines not on this page · raw message
include/linux/ioctl32.h +5 -0
@@ -19,5 +19,10 @@extern int unregister_ioctl32_conversion (unsigned int cmd); +struct ioctl_trans { +unsigned long cmd; +int (*handler)(unsigned int ,unsigned int ,unsigned long ,struct file * filp); +struct ioctl_trans *next; +};#endif
arch/parisc/kernel/syscall.S +1 -2
@@ -407,8 +407,7 @@ ENTRY_SAME(umount) /* struct sockaddr... */ ENTRY_SAME(getpeername) - /* This one's a huge ugly mess */ - ENTRY_DIFF(ioctl) + ENTRY_COMP(ioctl) /* struct flock? */ ENTRY_DIFF(fcntl) /* 55 */ ENTRY_SAME(socketpair)
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Pavel> Hi!
Pavel> This kills code duplication in sys32_ioctl. It should work on x86-64 Pavel> and sparc64; other architecture maintainers said that "anything that Pavel> moves code out of arch/*/kernel/ioctl32.c is welcome" or similar.
Pavel> Linus, what is required to make it go in?
Pavel> Alan, would you be willing to let this be merged through you?
I think it's a good idea to get rid of the ioctl code duplication, but since the code involved is often subtle, I think it should be tested on all affected architectures first (or, at least, there should be some argument as to why the new code is no worse than the old one).
In the particular case of ia64, I'd suggest to ask on [email protected] for a volunteer to test the patch.
--daivd