diff --git a/[refs] b/[refs] index a8a5a5e1e4b7..f5c7618f304f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9a459f6812fc26e0eb24bbe9c388000e23f67f6b +refs/heads/master: a52e6d181d10202712fb8dc7e397a80599133733 diff --git a/trunk/Documentation/filesystems/Locking b/trunk/Documentation/filesystems/Locking index 2db4283efa8d..bbcc15651a21 100644 --- a/trunk/Documentation/filesystems/Locking +++ b/trunk/Documentation/filesystems/Locking @@ -374,6 +374,8 @@ prototypes: ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, struct poll_table_struct *); + int (*ioctl) (struct inode *, struct file *, unsigned int, + unsigned long); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); @@ -407,7 +409,8 @@ write: no aio_write: no readdir: no poll: no -unlocked_ioctl: no +ioctl: yes (see below) +unlocked_ioctl: no (see below) compat_ioctl: no mmap: no open: no @@ -450,6 +453,9 @@ move ->readdir() to inode_operations and use a separate method for directory anything that resembles union-mount we won't have a struct file for all components. And there are other reasons why the current interface is a mess... +->ioctl() on regular files is superceded by the ->unlocked_ioctl() that +doesn't take the BKL. + ->read on directories probably must go away - we should just enforce -EISDIR in sys_read() and friends. diff --git a/trunk/Documentation/filesystems/vfs.txt b/trunk/Documentation/filesystems/vfs.txt index ed7e5efc06d8..94677e7dcb13 100644 --- a/trunk/Documentation/filesystems/vfs.txt +++ b/trunk/Documentation/filesystems/vfs.txt @@ -727,6 +727,7 @@ struct file_operations { ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, struct poll_table_struct *); + int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); @@ -767,7 +768,10 @@ otherwise noted. activity on this file and (optionally) go to sleep until there is activity. Called by the select(2) and poll(2) system calls - unlocked_ioctl: called by the ioctl(2) system call. + ioctl: called by the ioctl(2) system call + + unlocked_ioctl: called by the ioctl(2) system call. Filesystems that do not + require the BKL should use this method instead of the ioctl() above. compat_ioctl: called by the ioctl(2) system call when 32 bit system calls are used on 64 bit kernels. diff --git a/trunk/Makefile b/trunk/Makefile index 788111d21559..7431c283f15b 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -189,6 +189,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= $(SUBARCH) +CROSS_COMPILE ?= CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) # Architecture as present in compile.h diff --git a/trunk/arch/alpha/kernel/osf_sys.c b/trunk/arch/alpha/kernel/osf_sys.c index fb58150a7e8f..88131c6e42e3 100644 --- a/trunk/arch/alpha/kernel/osf_sys.c +++ b/trunk/arch/alpha/kernel/osf_sys.c @@ -244,7 +244,7 @@ do_osf_statfs(struct path *path, struct osf_statfs __user *buffer, return error; } -SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, +SYSCALL_DEFINE3(osf_statfs, char __user *, pathname, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct path path; @@ -358,7 +358,7 @@ osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) return do_mount("", dirname, "proc", flags, NULL); } -SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, +SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, char __user *, path, int, flag, void __user *, data) { int retval; @@ -932,7 +932,7 @@ SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in, } -SYSCALL_DEFINE2(osf_utimes, const char __user *, filename, +SYSCALL_DEFINE2(osf_utimes, char __user *, filename, struct timeval32 __user *, tvs) { struct timespec tv[2]; diff --git a/trunk/arch/alpha/kernel/process.c b/trunk/arch/alpha/kernel/process.c index 88e608aebc8c..395a464353b8 100644 --- a/trunk/arch/alpha/kernel/process.c +++ b/trunk/arch/alpha/kernel/process.c @@ -387,7 +387,7 @@ EXPORT_SYMBOL(dump_elf_task_fp); * sys_execve() executes a new program. */ asmlinkage int -do_sys_execve(const char __user *ufilename, char __user * __user *argv, +do_sys_execve(char __user *ufilename, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs) { int error; diff --git a/trunk/arch/arm/kernel/sys_arm.c b/trunk/arch/arm/kernel/sys_arm.c index 5b7c541a4c63..c23501842b98 100644 --- a/trunk/arch/arm/kernel/sys_arm.c +++ b/trunk/arch/arm/kernel/sys_arm.c @@ -62,7 +62,7 @@ asmlinkage int sys_vfork(struct pt_regs *regs) /* sys_execve() executes a new program. * This is called indirectly via a small wrapper */ -asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv, +asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs) { int error; @@ -84,7 +84,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]) int ret; memset(®s, 0, sizeof(struct pt_regs)); - ret = do_execve(filename, (char __user * __user *)argv, + ret = do_execve((char *)filename, (char __user * __user *)argv, (char __user * __user *)envp, ®s); if (ret < 0) goto out; diff --git a/trunk/arch/arm/kernel/sys_oabi-compat.c b/trunk/arch/arm/kernel/sys_oabi-compat.c index 4ad8da15ef2b..33ff678e32f2 100644 --- a/trunk/arch/arm/kernel/sys_oabi-compat.c +++ b/trunk/arch/arm/kernel/sys_oabi-compat.c @@ -141,7 +141,7 @@ static long cp_oldabi_stat64(struct kstat *stat, return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -asmlinkage long sys_oabi_stat64(const char __user * filename, +asmlinkage long sys_oabi_stat64(char __user * filename, struct oldabi_stat64 __user * statbuf) { struct kstat stat; @@ -151,7 +151,7 @@ asmlinkage long sys_oabi_stat64(const char __user * filename, return error; } -asmlinkage long sys_oabi_lstat64(const char __user * filename, +asmlinkage long sys_oabi_lstat64(char __user * filename, struct oldabi_stat64 __user * statbuf) { struct kstat stat; @@ -172,7 +172,7 @@ asmlinkage long sys_oabi_fstat64(unsigned long fd, } asmlinkage long sys_oabi_fstatat64(int dfd, - const char __user *filename, + char __user *filename, struct oldabi_stat64 __user *statbuf, int flag) { diff --git a/trunk/arch/avr32/include/asm/syscalls.h b/trunk/arch/avr32/include/asm/syscalls.h index ab608b70b24d..66a197266637 100644 --- a/trunk/arch/avr32/include/asm/syscalls.h +++ b/trunk/arch/avr32/include/asm/syscalls.h @@ -21,7 +21,7 @@ asmlinkage int sys_clone(unsigned long, unsigned long, unsigned long, unsigned long, struct pt_regs *); asmlinkage int sys_vfork(struct pt_regs *); -asmlinkage int sys_execve(const char __user *, char __user *__user *, +asmlinkage int sys_execve(char __user *, char __user *__user *, char __user *__user *, struct pt_regs *); /* kernel/signal.c */ diff --git a/trunk/arch/avr32/kernel/process.c b/trunk/arch/avr32/kernel/process.c index e5daddff397d..2d76515745a4 100644 --- a/trunk/arch/avr32/kernel/process.c +++ b/trunk/arch/avr32/kernel/process.c @@ -383,8 +383,7 @@ asmlinkage int sys_vfork(struct pt_regs *regs) 0, NULL, NULL); } -asmlinkage int sys_execve(const char __user *ufilename, - char __user *__user *uargv, +asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv, char __user *__user *uenvp, struct pt_regs *regs) { int error; diff --git a/trunk/arch/blackfin/kernel/process.c b/trunk/arch/blackfin/kernel/process.c index a566f61c002a..93ec07da2e51 100644 --- a/trunk/arch/blackfin/kernel/process.c +++ b/trunk/arch/blackfin/kernel/process.c @@ -209,7 +209,7 @@ copy_thread(unsigned long clone_flags, /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) +asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { int error; char *filename; diff --git a/trunk/arch/frv/kernel/process.c b/trunk/arch/frv/kernel/process.c index 428931cf2f0c..21d0fd19276d 100644 --- a/trunk/arch/frv/kernel/process.c +++ b/trunk/arch/frv/kernel/process.c @@ -250,8 +250,7 @@ int copy_thread(unsigned long clone_flags, /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, - char __user * __user *envp) +asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { int error; char * filename; diff --git a/trunk/arch/h8300/kernel/process.c b/trunk/arch/h8300/kernel/process.c index 8b7b78d77d5c..8c8b0ffa6ad7 100644 --- a/trunk/arch/h8300/kernel/process.c +++ b/trunk/arch/h8300/kernel/process.c @@ -212,7 +212,7 @@ int copy_thread(unsigned long clone_flags, /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...) +asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) { int error; char * filename; diff --git a/trunk/arch/ia64/include/asm/unistd.h b/trunk/arch/ia64/include/asm/unistd.h index 46f36fc5125f..bb8b0fff32b3 100644 --- a/trunk/arch/ia64/include/asm/unistd.h +++ b/trunk/arch/ia64/include/asm/unistd.h @@ -353,7 +353,7 @@ asmlinkage unsigned long sys_mmap2( int fd, long pgoff); struct pt_regs; struct sigaction; -long sys_execve(const char __user *filename, char __user * __user *argv, +long sys_execve(char __user *filename, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs); asmlinkage long sys_ia64_pipe(void); asmlinkage long sys_rt_sigaction(int sig, diff --git a/trunk/arch/ia64/kernel/process.c b/trunk/arch/ia64/kernel/process.c index a879c03b7f1c..53f1648c8b81 100644 --- a/trunk/arch/ia64/kernel/process.c +++ b/trunk/arch/ia64/kernel/process.c @@ -633,7 +633,7 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst) } long -sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp, +sys_execve (char __user *filename, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs) { char *fname; diff --git a/trunk/arch/m32r/kernel/process.c b/trunk/arch/m32r/kernel/process.c index 8665a4d868ec..bc8c8c1511b2 100644 --- a/trunk/arch/m32r/kernel/process.c +++ b/trunk/arch/m32r/kernel/process.c @@ -288,8 +288,7 @@ asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2, /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char __user *ufilename, - char __user * __user *uargv, +asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, char __user * __user *uenvp, unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, struct pt_regs regs) diff --git a/trunk/arch/m68k/kernel/process.c b/trunk/arch/m68k/kernel/process.c index 221d0b71ce39..1a6be27cf165 100644 --- a/trunk/arch/m68k/kernel/process.c +++ b/trunk/arch/m68k/kernel/process.c @@ -315,7 +315,7 @@ EXPORT_SYMBOL(dump_fpu); /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp) +asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { int error; char * filename; diff --git a/trunk/arch/m68knommu/kernel/process.c b/trunk/arch/m68knommu/kernel/process.c index 6350f68cd026..6aa66134b433 100644 --- a/trunk/arch/m68knommu/kernel/process.c +++ b/trunk/arch/m68knommu/kernel/process.c @@ -350,7 +350,7 @@ void dump(struct pt_regs *fp) /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char *name, char **argv, char **envp) +asmlinkage int sys_execve(char *name, char **argv, char **envp) { int error; char * filename; diff --git a/trunk/arch/microblaze/kernel/sys_microblaze.c b/trunk/arch/microblaze/kernel/sys_microblaze.c index 6abab6ebedbe..f4e00b7f1259 100644 --- a/trunk/arch/microblaze/kernel/sys_microblaze.c +++ b/trunk/arch/microblaze/kernel/sys_microblaze.c @@ -47,7 +47,7 @@ asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs return do_fork(flags, stack, regs, 0, NULL, NULL); } -asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv, +asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv, char __user *__user *envp, struct pt_regs *regs) { int error; diff --git a/trunk/arch/mips/kernel/syscall.c b/trunk/arch/mips/kernel/syscall.c index bddce0bca195..58bab2ef257f 100644 --- a/trunk/arch/mips/kernel/syscall.c +++ b/trunk/arch/mips/kernel/syscall.c @@ -254,7 +254,7 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) int error; char * filename; - filename = getname((const char __user *) (long)regs.regs[4]); + filename = getname((char __user *) (long)regs.regs[4]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; diff --git a/trunk/arch/mn10300/kernel/process.c b/trunk/arch/mn10300/kernel/process.c index 762eb325b949..82b817c7f7b6 100644 --- a/trunk/arch/mn10300/kernel/process.c +++ b/trunk/arch/mn10300/kernel/process.c @@ -268,7 +268,7 @@ asmlinkage long sys_vfork(void) 0, NULL, NULL); } -asmlinkage long sys_execve(const char __user *name, +asmlinkage long sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) { diff --git a/trunk/arch/parisc/hpux/fs.c b/trunk/arch/parisc/hpux/fs.c index 1444875a7611..6935123178eb 100644 --- a/trunk/arch/parisc/hpux/fs.c +++ b/trunk/arch/parisc/hpux/fs.c @@ -36,7 +36,7 @@ int hpux_execve(struct pt_regs *regs) int error; char *filename; - filename = getname((const char __user *) regs->gr[26]); + filename = getname((char __user *) regs->gr[26]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; @@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -long hpux_stat64(const char __user *filename, struct hpux_stat64 __user *statbuf) +long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -191,8 +191,7 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf) return error; } -long hpux_lstat64(const char __user *filename, - struct hpux_stat64 __user *statbuf) +long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf) { struct kstat stat; int error = vfs_lstat(filename, &stat); diff --git a/trunk/arch/powerpc/kernel/process.c b/trunk/arch/powerpc/kernel/process.c index feacfb789686..e78a5add7f15 100644 --- a/trunk/arch/powerpc/kernel/process.c +++ b/trunk/arch/powerpc/kernel/process.c @@ -1027,7 +1027,7 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, int error; char *filename; - filename = getname((const char __user *) a0); + filename = getname((char __user *) a0); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; diff --git a/trunk/arch/powerpc/kernel/sys_ppc32.c b/trunk/arch/powerpc/kernel/sys_ppc32.c index 20fd701a686a..19471a1cef1a 100644 --- a/trunk/arch/powerpc/kernel/sys_ppc32.c +++ b/trunk/arch/powerpc/kernel/sys_ppc32.c @@ -546,7 +546,7 @@ compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_siz return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); } -compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, +compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 poshi, u32 poslo) { return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); diff --git a/trunk/arch/s390/kernel/compat_linux.c b/trunk/arch/s390/kernel/compat_linux.c index 1e6449c79ab6..73b624ed9cd8 100644 --- a/trunk/arch/s390/kernel/compat_linux.c +++ b/trunk/arch/s390/kernel/compat_linux.c @@ -436,7 +436,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) * sys32_execve() executes a new program after the asm stub has set * things up for us. This should basically do what I want it to. */ -asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv, +asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp) { struct pt_regs *regs = task_pt_regs(current); @@ -570,7 +570,7 @@ static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat) return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf) +asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf) { struct kstat stat; int ret = vfs_stat(filename, &stat); @@ -579,7 +579,7 @@ asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 _ return ret; } -asmlinkage long sys32_lstat64(const char __user * filename, struct stat64_emu31 __user * statbuf) +asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf) { struct kstat stat; int ret = vfs_lstat(filename, &stat); @@ -597,7 +597,7 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * sta return ret; } -asmlinkage long sys32_fstatat64(unsigned int dfd, const char __user *filename, +asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename, struct stat64_emu31 __user* statbuf, int flag) { struct kstat stat; @@ -655,7 +655,7 @@ asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) return sys_read(fd, buf, count); } -asmlinkage long sys32_write(unsigned int fd, const char __user * buf, size_t count) +asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count) { if ((compat_ssize_t) count < 0) return -EINVAL; diff --git a/trunk/arch/s390/kernel/compat_linux.h b/trunk/arch/s390/kernel/compat_linux.h index 9635d759c2b9..cb97afc85c94 100644 --- a/trunk/arch/s390/kernel/compat_linux.h +++ b/trunk/arch/s390/kernel/compat_linux.h @@ -193,7 +193,7 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset, size_t sigsetsize); long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); -long sys32_execve(const char __user *name, compat_uptr_t __user *argv, +long sys32_execve(char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp); long sys32_init_module(void __user *umod, unsigned long len, const char __user *uargs); @@ -207,16 +207,16 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count); long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count); -long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf); -long sys32_lstat64(const char __user * filename, +long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf); +long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf); long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf); -long sys32_fstatat64(unsigned int dfd, const char __user *filename, +long sys32_fstatat64(unsigned int dfd, char __user *filename, struct stat64_emu31 __user* statbuf, int flag); unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg); long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg); long sys32_read(unsigned int fd, char __user * buf, size_t count); -long sys32_write(unsigned int fd, const char __user * buf, size_t count); +long sys32_write(unsigned int fd, char __user * buf, size_t count); long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise); long sys32_fadvise64_64(struct fadvise64_64_args __user *args); long sys32_sigaction(int sig, const struct old_sigaction32 __user *act, diff --git a/trunk/arch/s390/kernel/entry.h b/trunk/arch/s390/kernel/entry.h index 403fb430a896..5bb1e6b5db26 100644 --- a/trunk/arch/s390/kernel/entry.h +++ b/trunk/arch/s390/kernel/entry.h @@ -42,7 +42,7 @@ long sys_clone(unsigned long newsp, unsigned long clone_flags, int __user *parent_tidptr, int __user *child_tidptr); long sys_vfork(void); void execve_tail(void); -long sys_execve(const char __user *name, char __user * __user *argv, +long sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp); long sys_sigsuspend(int history0, int history1, old_sigset_t mask); long sys_sigaction(int sig, const struct old_sigaction __user *act, diff --git a/trunk/arch/s390/kernel/process.c b/trunk/arch/s390/kernel/process.c index 7eafaf2662b9..1039fdea15b5 100644 --- a/trunk/arch/s390/kernel/process.c +++ b/trunk/arch/s390/kernel/process.c @@ -267,7 +267,7 @@ asmlinkage void execve_tail(void) /* * sys_execve() executes a new program. */ -SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv, +SYSCALL_DEFINE3(execve, char __user *, name, char __user * __user *, argv, char __user * __user *, envp) { struct pt_regs *regs = task_pt_regs(current); diff --git a/trunk/arch/sh/include/asm/syscalls_32.h b/trunk/arch/sh/include/asm/syscalls_32.h index be201fdc97aa..8b30200305c3 100644 --- a/trunk/arch/sh/include/asm/syscalls_32.h +++ b/trunk/arch/sh/include/asm/syscalls_32.h @@ -19,7 +19,7 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs __regs); -asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv, +asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv, char __user * __user *uenvp, unsigned long r7, struct pt_regs __regs); asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, diff --git a/trunk/arch/sh/include/asm/syscalls_64.h b/trunk/arch/sh/include/asm/syscalls_64.h index ee519f41d950..751fd8811364 100644 --- a/trunk/arch/sh/include/asm/syscalls_64.h +++ b/trunk/arch/sh/include/asm/syscalls_64.h @@ -21,7 +21,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs *pregs); -asmlinkage int sys_execve(const char *ufilename, char **uargv, +asmlinkage int sys_execve(char *ufilename, char **uargv, char **uenvp, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs *pregs); diff --git a/trunk/arch/sh/kernel/process_64.c b/trunk/arch/sh/kernel/process_64.c index 68d128d651b3..d4ca6480e355 100644 --- a/trunk/arch/sh/kernel/process_64.c +++ b/trunk/arch/sh/kernel/process_64.c @@ -483,7 +483,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, /* * sys_execve() executes a new program. */ -asmlinkage int sys_execve(const char *ufilename, char **uargv, +asmlinkage int sys_execve(char *ufilename, char **uargv, char **uenvp, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs *pregs) diff --git a/trunk/arch/sparc/kernel/sys_sparc32.c b/trunk/arch/sparc/kernel/sys_sparc32.c index e6375a750d9a..c0ca87553e1c 100644 --- a/trunk/arch/sparc/kernel/sys_sparc32.c +++ b/trunk/arch/sparc/kernel/sys_sparc32.c @@ -162,7 +162,7 @@ static int cp_compat_stat64(struct kstat *stat, return err; } -asmlinkage long compat_sys_stat64(const char __user * filename, +asmlinkage long compat_sys_stat64(char __user * filename, struct compat_stat64 __user *statbuf) { struct kstat stat; @@ -173,7 +173,7 @@ asmlinkage long compat_sys_stat64(const char __user * filename, return error; } -asmlinkage long compat_sys_lstat64(const char __user * filename, +asmlinkage long compat_sys_lstat64(char __user * filename, struct compat_stat64 __user *statbuf) { struct kstat stat; @@ -195,8 +195,7 @@ asmlinkage long compat_sys_fstat64(unsigned int fd, return error; } -asmlinkage long compat_sys_fstatat64(unsigned int dfd, - const char __user *filename, +asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename, struct compat_stat64 __user * statbuf, int flag) { struct kstat stat; diff --git a/trunk/arch/um/kernel/exec.c b/trunk/arch/um/kernel/exec.c index 59b20d93b6d4..97974c1bdd12 100644 --- a/trunk/arch/um/kernel/exec.c +++ b/trunk/arch/um/kernel/exec.c @@ -44,7 +44,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) PT_REGS_SP(regs) = esp; } -static long execve1(const char *file, char __user * __user *argv, +static long execve1(char *file, char __user * __user *argv, char __user *__user *env) { long error; @@ -61,7 +61,7 @@ static long execve1(const char *file, char __user * __user *argv, return error; } -long um_execve(const char *file, char __user *__user *argv, char __user *__user *env) +long um_execve(char *file, char __user *__user *argv, char __user *__user *env) { long err; @@ -71,7 +71,7 @@ long um_execve(const char *file, char __user *__user *argv, char __user *__user return err; } -long sys_execve(const char __user *file, char __user *__user *argv, +long sys_execve(char __user *file, char __user *__user *argv, char __user *__user *env) { long error; diff --git a/trunk/arch/um/kernel/internal.h b/trunk/arch/um/kernel/internal.h index 1303a105fe91..3bda43c7a786 100644 --- a/trunk/arch/um/kernel/internal.h +++ b/trunk/arch/um/kernel/internal.h @@ -1 +1 @@ -extern long um_execve(const char *file, char __user *__user *argv, char __user *__user *env); +extern long um_execve(char *file, char __user *__user *argv, char __user *__user *env); diff --git a/trunk/arch/um/kernel/syscall.c b/trunk/arch/um/kernel/syscall.c index 7427c0b1930c..4393173923f5 100644 --- a/trunk/arch/um/kernel/syscall.c +++ b/trunk/arch/um/kernel/syscall.c @@ -58,7 +58,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]) fs = get_fs(); set_fs(KERNEL_DS); - ret = um_execve(filename, (char __user *__user *)argv, + ret = um_execve((char *)filename, (char __user *__user *)argv, (char __user *__user *) envp); set_fs(fs); diff --git a/trunk/arch/x86/ia32/sys_ia32.c b/trunk/arch/x86/ia32/sys_ia32.c index 849813f398e7..3d093311d5e2 100644 --- a/trunk/arch/x86/ia32/sys_ia32.c +++ b/trunk/arch/x86/ia32/sys_ia32.c @@ -51,7 +51,7 @@ #define AA(__x) ((unsigned long)(__x)) -asmlinkage long sys32_truncate64(const char __user *filename, +asmlinkage long sys32_truncate64(char __user *filename, unsigned long offset_low, unsigned long offset_high) { @@ -96,7 +96,7 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat) return 0; } -asmlinkage long sys32_stat64(const char __user *filename, +asmlinkage long sys32_stat64(char __user *filename, struct stat64 __user *statbuf) { struct kstat stat; @@ -107,7 +107,7 @@ asmlinkage long sys32_stat64(const char __user *filename, return ret; } -asmlinkage long sys32_lstat64(const char __user *filename, +asmlinkage long sys32_lstat64(char __user *filename, struct stat64 __user *statbuf) { struct kstat stat; @@ -126,7 +126,7 @@ asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf) return ret; } -asmlinkage long sys32_fstatat(unsigned int dfd, const char __user *filename, +asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename, struct stat64 __user *statbuf, int flag) { struct kstat stat; @@ -408,8 +408,8 @@ asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count, ((loff_t)AA(poshi) << 32) | AA(poslo)); } -asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf, - u32 count, u32 poslo, u32 poshi) +asmlinkage long sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, + u32 poslo, u32 poshi) { return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); @@ -449,7 +449,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, return ret; } -asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv, +asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, struct pt_regs *regs) { long error; diff --git a/trunk/arch/x86/include/asm/sys_ia32.h b/trunk/arch/x86/include/asm/sys_ia32.h index cb238526a9f1..cf4e2e381cba 100644 --- a/trunk/arch/x86/include/asm/sys_ia32.h +++ b/trunk/arch/x86/include/asm/sys_ia32.h @@ -18,13 +18,13 @@ #include /* ia32/sys_ia32.c */ -asmlinkage long sys32_truncate64(const char __user *, unsigned long, unsigned long); +asmlinkage long sys32_truncate64(char __user *, unsigned long, unsigned long); asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long); -asmlinkage long sys32_stat64(const char __user *, struct stat64 __user *); -asmlinkage long sys32_lstat64(const char __user *, struct stat64 __user *); +asmlinkage long sys32_stat64(char __user *, struct stat64 __user *); +asmlinkage long sys32_lstat64(char __user *, struct stat64 __user *); asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); -asmlinkage long sys32_fstatat(unsigned int, const char __user *, +asmlinkage long sys32_fstatat(unsigned int, char __user *, struct stat64 __user *, int); struct mmap_arg_struct32; asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); @@ -49,12 +49,12 @@ asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t); asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *); asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); -asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32); +asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32); asmlinkage long sys32_personality(unsigned long); asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); -asmlinkage long sys32_execve(const char __user *, compat_uptr_t __user *, +asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *, compat_uptr_t __user *, struct pt_regs *); asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *); diff --git a/trunk/arch/x86/include/asm/syscalls.h b/trunk/arch/x86/include/asm/syscalls.h index feb2ff9bfc2d..5c044b43e9a7 100644 --- a/trunk/arch/x86/include/asm/syscalls.h +++ b/trunk/arch/x86/include/asm/syscalls.h @@ -23,7 +23,7 @@ long sys_iopl(unsigned int, struct pt_regs *); /* kernel/process.c */ int sys_fork(struct pt_regs *); int sys_vfork(struct pt_regs *); -long sys_execve(const char __user *, char __user * __user *, +long sys_execve(char __user *, char __user * __user *, char __user * __user *, struct pt_regs *); long sys_clone(unsigned long, unsigned long, void __user *, void __user *, struct pt_regs *); diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index 17be5ec7cbba..c5ea5cdbe7b3 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -1185,13 +1185,13 @@ END(kernel_thread_helper) * execve(). This function needs to use IRET, not SYSRET, to set up all state properly. * * C extern interface: - * extern long execve(const char *name, char **argv, char **envp) + * extern long execve(char *name, char **argv, char **envp) * * asm input arguments: * rdi: name, rsi: argv, rdx: envp * * We want to fallback into: - * extern long sys_execve(const char *name, char **argv,char **envp, struct pt_regs *regs) + * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs) * * do_sys_execve asm fallback arguments: * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack diff --git a/trunk/arch/x86/kernel/process.c b/trunk/arch/x86/kernel/process.c index 64ecaf0af9af..d401f1d2d06e 100644 --- a/trunk/arch/x86/kernel/process.c +++ b/trunk/arch/x86/kernel/process.c @@ -301,7 +301,7 @@ EXPORT_SYMBOL(kernel_thread); /* * sys_execve() executes a new program. */ -long sys_execve(const char __user *name, char __user * __user *argv, +long sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp, struct pt_regs *regs) { long error; diff --git a/trunk/arch/xtensa/kernel/process.c b/trunk/arch/xtensa/kernel/process.c index 7c2f38f68ebb..f167e0f5e05e 100644 --- a/trunk/arch/xtensa/kernel/process.c +++ b/trunk/arch/xtensa/kernel/process.c @@ -318,7 +318,7 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp, */ asmlinkage -long xtensa_execve(const char __user *name, char __user * __user *argv, +long xtensa_execve(char __user *name, char __user * __user *argv, char __user * __user *envp, long a3, long a4, long a5, struct pt_regs *regs) diff --git a/trunk/drivers/input/joystick/amijoy.c b/trunk/drivers/input/joystick/amijoy.c index 0bc86204213e..e90694fe0d5c 100644 --- a/trunk/drivers/input/joystick/amijoy.c +++ b/trunk/drivers/input/joystick/amijoy.c @@ -139,7 +139,7 @@ static int __init amijoy_init(void) amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); for (j = 0; j < 2; j++) { - input_set_abs_params(amijoy_dev[i], ABS_X + j, + XXinput_set_abs_params(amijoy_dev[i], ABS_X + j, -1, 1, 0, 0); } diff --git a/trunk/drivers/input/keyboard/hil_kbd.c b/trunk/drivers/input/keyboard/hil_kbd.c index dcc86b97a153..ddd5afd301d4 100644 --- a/trunk/drivers/input/keyboard/hil_kbd.c +++ b/trunk/drivers/input/keyboard/hil_kbd.c @@ -235,7 +235,7 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr) if (val < input_abs_min(dev, ABS_X + i)) input_abs_set_min(dev, ABS_X + i, val); if (val > input_abs_max(dev, ABS_X + i)) - input_abs_set_max(dev, ABS_X + i, val); + XXinput_abs_set_max(dev, ABS_X + i, val); #endif if (i % 3) val = input_abs_max(dev, ABS_X + i) - val; @@ -391,7 +391,7 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr) int diff = input_abs_max(input_dev, ABS_X + i) / 10; input_abs_set_min(input_dev, ABS_X + i, input_abs_min(input_dev, ABS_X + i) + diff) - input_abs_set_max(input_dev, ABS_X + i, + XXinput_abs_set_max(input_dev, ABS_X + i, input_abs_max(input_dev, ABS_X + i) - diff) } #endif diff --git a/trunk/drivers/media/video/v4l2-compat-ioctl32.c b/trunk/drivers/media/video/v4l2-compat-ioctl32.c index 073f01390cdd..d2f20c2acae2 100644 --- a/trunk/drivers/media/video/v4l2-compat-ioctl32.c +++ b/trunk/drivers/media/video/v4l2-compat-ioctl32.c @@ -228,6 +228,11 @@ static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (file->f_op->unlocked_ioctl) ret = file->f_op->unlocked_ioctl(file, cmd, arg); + else if (file->f_op->ioctl) { + lock_kernel(); + ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg); + unlock_kernel(); + } return ret; } @@ -968,7 +973,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) { long ret = -ENOIOCTLCMD; - if (!file->f_op->unlocked_ioctl) + if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) return ret; switch (cmd) { diff --git a/trunk/drivers/net/pcmcia/xirc2ps_cs.c b/trunk/drivers/net/pcmcia/xirc2ps_cs.c index f5819526b5ee..4eb6f986703b 100644 --- a/trunk/drivers/net/pcmcia/xirc2ps_cs.c +++ b/trunk/drivers/net/pcmcia/xirc2ps_cs.c @@ -808,7 +808,6 @@ xirc2ps_config(struct pcmcia_device * link) } link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - link->io_lines = 10; if (local->modem) { int pass; @@ -840,6 +839,7 @@ xirc2ps_config(struct pcmcia_device * link) } printk(KNOT_XIRC "no ports available\n"); } else { + link->io_lines = 10; link->resource[0]->end = 16; for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { link->resource[0]->start = ioaddr; diff --git a/trunk/drivers/watchdog/hpwdt.c b/trunk/drivers/watchdog/hpwdt.c index fd312fc8940e..183b7a4525bd 100644 --- a/trunk/drivers/watchdog/hpwdt.c +++ b/trunk/drivers/watchdog/hpwdt.c @@ -16,30 +16,22 @@ #include #include #include -#include #include -#include #include +#include #include #include -#include #include #include #include #include #include #include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include +#include #include #define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */ diff --git a/trunk/fs/bad_inode.c b/trunk/fs/bad_inode.c index f024d8aaddef..52e59bf4aa5f 100644 --- a/trunk/fs/bad_inode.c +++ b/trunk/fs/bad_inode.c @@ -55,6 +55,12 @@ static unsigned int bad_file_poll(struct file *filp, poll_table *wait) return POLLERR; } +static int bad_file_ioctl (struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + return -EIO; +} + static long bad_file_unlocked_ioctl(struct file *file, unsigned cmd, unsigned long arg) { @@ -153,6 +159,7 @@ static const struct file_operations bad_file_ops = .aio_write = bad_file_aio_write, .readdir = bad_file_readdir, .poll = bad_file_poll, + .ioctl = bad_file_ioctl, .unlocked_ioctl = bad_file_unlocked_ioctl, .compat_ioctl = bad_file_compat_ioctl, .mmap = bad_file_mmap, diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 718c7062aec1..e6d5d70cf3cf 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -77,8 +77,7 @@ int compat_printk(const char *fmt, ...) * Not all architectures have sys_utime, so implement this in terms * of sys_utimes. */ -asmlinkage long compat_sys_utime(const char __user *filename, - struct compat_utimbuf __user *t) +asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t) { struct timespec tv[2]; @@ -92,7 +91,7 @@ asmlinkage long compat_sys_utime(const char __user *filename, return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); } -asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, struct compat_timespec __user *t, int flags) +asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, struct compat_timespec __user *t, int flags) { struct timespec tv[2]; @@ -107,7 +106,7 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filena return do_utimes(dfd, filename, t ? tv : NULL, flags); } -asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, struct compat_timeval __user *t) +asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t) { struct timespec tv[2]; @@ -126,7 +125,7 @@ asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filena return do_utimes(dfd, filename, t ? tv : NULL, 0); } -asmlinkage long compat_sys_utimes(const char __user *filename, struct compat_timeval __user *t) +asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t) { return compat_sys_futimesat(AT_FDCWD, filename, t); } @@ -170,7 +169,7 @@ static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) return err; } -asmlinkage long compat_sys_newstat(const char __user * filename, +asmlinkage long compat_sys_newstat(char __user * filename, struct compat_stat __user *statbuf) { struct kstat stat; @@ -182,7 +181,7 @@ asmlinkage long compat_sys_newstat(const char __user * filename, return cp_compat_stat(&stat, statbuf); } -asmlinkage long compat_sys_newlstat(const char __user * filename, +asmlinkage long compat_sys_newlstat(char __user * filename, struct compat_stat __user *statbuf) { struct kstat stat; @@ -195,8 +194,7 @@ asmlinkage long compat_sys_newlstat(const char __user * filename, } #ifndef __ARCH_WANT_STAT64 -asmlinkage long compat_sys_newfstatat(unsigned int dfd, - const char __user *filename, +asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename, struct compat_stat __user *statbuf, int flag) { struct kstat stat; @@ -839,10 +837,9 @@ static int do_nfs4_super_data_conv(void *raw_data) #define NCPFS_NAME "ncpfs" #define NFS4_NAME "nfs4" -asmlinkage long compat_sys_mount(const char __user * dev_name, - const char __user * dir_name, - const char __user * type, unsigned long flags, - const void __user * data) +asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, + char __user * type, unsigned long flags, + void __user * data) { char *kernel_type; unsigned long data_page; diff --git a/trunk/fs/compat_ioctl.c b/trunk/fs/compat_ioctl.c index 03e59aa318eb..70227e0dc01d 100644 --- a/trunk/fs/compat_ioctl.c +++ b/trunk/fs/compat_ioctl.c @@ -1699,7 +1699,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, goto out_fput; } - if (!filp->f_op || !filp->f_op->unlocked_ioctl) + if (!filp->f_op || + (!filp->f_op->ioctl && !filp->f_op->unlocked_ioctl)) goto do_ioctl; break; } diff --git a/trunk/fs/ioctl.c b/trunk/fs/ioctl.c index f855ea4fc888..2d140a713861 100644 --- a/trunk/fs/ioctl.c +++ b/trunk/fs/ioctl.c @@ -29,6 +29,7 @@ * @arg: command-specific argument for ioctl * * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise + * invokes filesystem specific ->ioctl method. If neither method exists, * returns -ENOTTY. * * Returns 0 on success, -errno on error. @@ -38,12 +39,21 @@ static long vfs_ioctl(struct file *filp, unsigned int cmd, { int error = -ENOTTY; - if (!filp->f_op || !filp->f_op->unlocked_ioctl) + if (!filp->f_op) goto out; - error = filp->f_op->unlocked_ioctl(filp, cmd, arg); - if (error == -ENOIOCTLCMD) - error = -EINVAL; + if (filp->f_op->unlocked_ioctl) { + error = filp->f_op->unlocked_ioctl(filp, cmd, arg); + if (error == -ENOIOCTLCMD) + error = -EINVAL; + goto out; + } else if (filp->f_op->ioctl) { + lock_kernel(); + error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, + filp, cmd, arg); + unlock_kernel(); + } + out: return error; } diff --git a/trunk/fs/logfs/dir.c b/trunk/fs/logfs/dir.c index 9777eb5b5522..675cc49197fe 100644 --- a/trunk/fs/logfs/dir.c +++ b/trunk/fs/logfs/dir.c @@ -824,7 +824,7 @@ const struct inode_operations logfs_dir_iops = { }; const struct file_operations logfs_dir_fops = { .fsync = logfs_fsync, - .unlocked_ioctl = logfs_ioctl, + .ioctl = logfs_ioctl, .readdir = logfs_readdir, .read = generic_read_dir, }; diff --git a/trunk/fs/logfs/file.c b/trunk/fs/logfs/file.c index e86376b87af1..4dd0f7c06e39 100644 --- a/trunk/fs/logfs/file.c +++ b/trunk/fs/logfs/file.c @@ -181,9 +181,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this) } -long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) { - struct inode *inode = file->f_path.dentry->d_inode; struct logfs_inode *li = logfs_inode(inode); unsigned int oldflags, flags; int err; @@ -255,7 +255,7 @@ const struct file_operations logfs_reg_fops = { .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, .fsync = logfs_fsync, - .unlocked_ioctl = logfs_ioctl, + .ioctl = logfs_ioctl, .llseek = generic_file_llseek, .mmap = generic_file_readonly_mmap, .open = generic_file_open, diff --git a/trunk/fs/logfs/logfs.h b/trunk/fs/logfs/logfs.h index b8786264d243..5e3b72077951 100644 --- a/trunk/fs/logfs/logfs.h +++ b/trunk/fs/logfs/logfs.h @@ -504,7 +504,8 @@ extern const struct inode_operations logfs_reg_iops; extern const struct file_operations logfs_reg_fops; extern const struct address_space_operations logfs_reg_aops; int logfs_readpage(struct file *file, struct page *page); -long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg); int logfs_fsync(struct file *file, int datasync); /* gc.c */ diff --git a/trunk/fs/proc/inode.c b/trunk/fs/proc/inode.c index 9c2b5f484879..23561cda7245 100644 --- a/trunk/fs/proc/inode.c +++ b/trunk/fs/proc/inode.c @@ -214,7 +214,8 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne { struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); long rv = -ENOTTY; - long (*ioctl)(struct file *, unsigned int, unsigned long); + long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); + int (*ioctl)(struct inode *, struct file *, unsigned int, unsigned long); spin_lock(&pde->pde_unload_lock); if (!pde->proc_fops) { @@ -222,11 +223,19 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne return rv; } pde->pde_users++; - ioctl = pde->proc_fops->unlocked_ioctl; + unlocked_ioctl = pde->proc_fops->unlocked_ioctl; + ioctl = pde->proc_fops->ioctl; spin_unlock(&pde->pde_unload_lock); - if (ioctl) - rv = ioctl(file, cmd, arg); + if (unlocked_ioctl) { + rv = unlocked_ioctl(file, cmd, arg); + if (rv == -ENOIOCTLCMD) + rv = -EINVAL; + } else if (ioctl) { + WARN_ONCE(1, "Procfs ioctl handlers must use unlocked_ioctl, " + "%pf will be called without the Bkl held\n", ioctl); + rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg); + } pde_users_dec(pde); return rv; diff --git a/trunk/fs/stat.c b/trunk/fs/stat.c index 12e90e213900..c4ecd52c5737 100644 --- a/trunk/fs/stat.c +++ b/trunk/fs/stat.c @@ -68,8 +68,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat) } EXPORT_SYMBOL(vfs_fstat); -int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, - int flag) +int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag) { struct path path; int error = -EINVAL; @@ -92,13 +91,13 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, } EXPORT_SYMBOL(vfs_fstatat); -int vfs_stat(const char __user *name, struct kstat *stat) +int vfs_stat(char __user *name, struct kstat *stat) { return vfs_fstatat(AT_FDCWD, name, stat, 0); } EXPORT_SYMBOL(vfs_stat); -int vfs_lstat(const char __user *name, struct kstat *stat) +int vfs_lstat(char __user *name, struct kstat *stat) { return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW); } @@ -148,8 +147,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -SYSCALL_DEFINE2(stat, const char __user *, filename, - struct __old_kernel_stat __user *, statbuf) +SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) { struct kstat stat; int error; @@ -161,8 +159,7 @@ SYSCALL_DEFINE2(stat, const char __user *, filename, return cp_old_stat(&stat, statbuf); } -SYSCALL_DEFINE2(lstat, const char __user *, filename, - struct __old_kernel_stat __user *, statbuf) +SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) { struct kstat stat; int error; @@ -237,8 +234,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -SYSCALL_DEFINE2(newstat, const char __user *, filename, - struct stat __user *, statbuf) +SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -248,8 +244,7 @@ SYSCALL_DEFINE2(newstat, const char __user *, filename, return cp_new_stat(&stat, statbuf); } -SYSCALL_DEFINE2(newlstat, const char __user *, filename, - struct stat __user *, statbuf) +SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf) { struct kstat stat; int error; @@ -262,7 +257,7 @@ SYSCALL_DEFINE2(newlstat, const char __user *, filename, } #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) -SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename, +SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename, struct stat __user *, statbuf, int, flag) { struct kstat stat; @@ -360,8 +355,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } -SYSCALL_DEFINE2(stat64, const char __user *, filename, - struct stat64 __user *, statbuf) +SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -372,8 +366,7 @@ SYSCALL_DEFINE2(stat64, const char __user *, filename, return error; } -SYSCALL_DEFINE2(lstat64, const char __user *, filename, - struct stat64 __user *, statbuf) +SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf) { struct kstat stat; int error = vfs_lstat(filename, &stat); @@ -395,7 +388,7 @@ SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf) return error; } -SYSCALL_DEFINE4(fstatat64, int, dfd, const char __user *, filename, +SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, struct stat64 __user *, statbuf, int, flag) { struct kstat stat; diff --git a/trunk/fs/utimes.c b/trunk/fs/utimes.c index 179b58690657..e4c75db5d373 100644 --- a/trunk/fs/utimes.c +++ b/trunk/fs/utimes.c @@ -126,8 +126,7 @@ static int utimes_common(struct path *path, struct timespec *times) * must be owner or have write permission. * Else, update from *times, must be owner or super user. */ -long do_utimes(int dfd, const char __user *filename, struct timespec *times, - int flags) +long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags) { int error = -EINVAL; @@ -171,7 +170,7 @@ long do_utimes(int dfd, const char __user *filename, struct timespec *times, return error; } -SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, +SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename, struct timespec __user *, utimes, int, flags) { struct timespec tstimes[2]; @@ -189,7 +188,7 @@ SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); } -SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename, +SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename, struct timeval __user *, utimes) { struct timeval times[2]; diff --git a/trunk/include/linux/compat.h b/trunk/include/linux/compat.h index 9ddc8780e8db..168f7daa7bde 100644 --- a/trunk/include/linux/compat.h +++ b/trunk/include/linux/compat.h @@ -331,7 +331,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, const compat_sigset_t __user *sigmask, compat_size_t sigsetsize); -asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, +asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, struct compat_timespec __user *t, int flags); asmlinkage long compat_sys_signalfd(int ufd, @@ -348,9 +348,9 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, const int __user *nodes, int __user *status, int flags); -asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, +asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t); -asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename, +asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, struct compat_stat __user *statbuf, int flag); asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, diff --git a/trunk/include/linux/dma-mapping.h b/trunk/include/linux/dma-mapping.h index ce29b8151198..e0670a512056 100644 --- a/trunk/include/linux/dma-mapping.h +++ b/trunk/include/linux/dma-mapping.h @@ -142,7 +142,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) return -EIO; } -#ifdef CONFIG_HAS_DMA static inline int dma_get_cache_alignment(void) { #ifdef ARCH_DMA_MINALIGN @@ -150,7 +149,6 @@ static inline int dma_get_cache_alignment(void) #endif return 1; } -#endif /* flags for the coherent memory api */ #define DMA_MEMORY_MAP 0x01 diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 9a96b4d83fc1..7a0625e26a39 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -1483,8 +1483,8 @@ struct block_device_operations; /* * NOTE: - * all file operations except setlease can be called without - * the big kernel lock held in all filesystems. + * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl + * can be called without the big kernel lock held in all filesystems. */ struct file_operations { struct module *owner; @@ -1495,6 +1495,7 @@ struct file_operations { ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, struct poll_table_struct *); + int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); @@ -2319,10 +2320,10 @@ void inode_set_bytes(struct inode *inode, loff_t bytes); extern int vfs_readdir(struct file *, filldir_t, void *); -extern int vfs_stat(const char __user *, struct kstat *); -extern int vfs_lstat(const char __user *, struct kstat *); +extern int vfs_stat(char __user *, struct kstat *); +extern int vfs_lstat(char __user *, struct kstat *); extern int vfs_fstat(unsigned int, struct kstat *); -extern int vfs_fstatat(int , const char __user *, struct kstat *, int); +extern int vfs_fstatat(int , char __user *, struct kstat *, int); extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg); diff --git a/trunk/include/linux/syscalls.h b/trunk/include/linux/syscalls.h index 6e5d19788634..1b67bd333b5e 100644 --- a/trunk/include/linux/syscalls.h +++ b/trunk/include/linux/syscalls.h @@ -394,7 +394,7 @@ asmlinkage long sys_umount(char __user *name, int flags); asmlinkage long sys_oldumount(char __user *name); asmlinkage long sys_truncate(const char __user *path, long length); asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); -asmlinkage long sys_stat(const char __user *filename, +asmlinkage long sys_stat(char __user *filename, struct __old_kernel_stat __user *statbuf); asmlinkage long sys_statfs(const char __user * path, struct statfs __user *buf); @@ -403,21 +403,21 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf); asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf); -asmlinkage long sys_lstat(const char __user *filename, +asmlinkage long sys_lstat(char __user *filename, struct __old_kernel_stat __user *statbuf); asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user *statbuf); -asmlinkage long sys_newstat(const char __user *filename, +asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf); -asmlinkage long sys_newlstat(const char __user *filename, +asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf); asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf); asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf); #if BITS_PER_LONG == 32 -asmlinkage long sys_stat64(const char __user *filename, +asmlinkage long sys_stat64(char __user *filename, struct stat64 __user *statbuf); asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf); -asmlinkage long sys_lstat64(const char __user *filename, +asmlinkage long sys_lstat64(char __user *filename, struct stat64 __user *statbuf); asmlinkage long sys_truncate64(const char __user *path, loff_t length); asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); @@ -760,7 +760,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname, int newdfd, const char __user *newname, int flags); asmlinkage long sys_renameat(int olddfd, const char __user * oldname, int newdfd, const char __user * newname); -asmlinkage long sys_futimesat(int dfd, const char __user *filename, +asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes); asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); asmlinkage long sys_fchmodat(int dfd, const char __user * filename, @@ -769,13 +769,13 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group, int flag); asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, int mode); -asmlinkage long sys_newfstatat(int dfd, const char __user *filename, +asmlinkage long sys_newfstatat(int dfd, char __user *filename, struct stat __user *statbuf, int flag); -asmlinkage long sys_fstatat64(int dfd, const char __user *filename, +asmlinkage long sys_fstatat64(int dfd, char __user *filename, struct stat64 __user *statbuf, int flag); asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, int bufsiz); -asmlinkage long sys_utimensat(int dfd, const char __user *filename, +asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags); asmlinkage long sys_unshare(unsigned long unshare_flags); diff --git a/trunk/include/linux/time.h b/trunk/include/linux/time.h index 9f15ac7ab92a..12612701b1ae 100644 --- a/trunk/include/linux/time.h +++ b/trunk/include/linux/time.h @@ -150,7 +150,7 @@ extern void do_gettimeofday(struct timeval *tv); extern int do_settimeofday(struct timespec *tv); extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) -extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); +extern long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags); struct itimerval; extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); diff --git a/trunk/kernel/time/timekeeping.c b/trunk/kernel/time/timekeeping.c index 49010d822f72..e960d824263f 100644 --- a/trunk/kernel/time/timekeeping.c +++ b/trunk/kernel/time/timekeeping.c @@ -710,10 +710,9 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) /* Accumulate raw time */ raw_nsecs = timekeeper.raw_interval << shift; raw_nsecs += raw_time.tv_nsec; - if (raw_nsecs >= NSEC_PER_SEC) { - u64 raw_secs = raw_nsecs; - raw_nsecs = do_div(raw_secs, NSEC_PER_SEC); - raw_time.tv_sec += raw_secs; + while (raw_nsecs >= NSEC_PER_SEC) { + raw_nsecs -= NSEC_PER_SEC; + raw_time.tv_sec++; } raw_time.tv_nsec = raw_nsecs; diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index efa9a380335e..b76f3ee0abe0 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -36,6 +36,11 @@ #include #include "internal.h" +static inline __attribute__((format(printf, 1, 2))) +void no_printk(const char *fmt, ...) +{ +} + #if 0 #define kenter(FMT, ...) \ printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__) diff --git a/trunk/scripts/kconfig/conf.c b/trunk/scripts/kconfig/conf.c index 5b7c86ea43a1..274f2716b03e 100644 --- a/trunk/scripts/kconfig/conf.c +++ b/trunk/scripts/kconfig/conf.c @@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) check_stdin(); case oldaskconfig: fflush(stdout); - xfgets(line, 128, stdin); + fgets(line, 128, stdin); return 1; default: break; @@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu) check_stdin(); case oldaskconfig: fflush(stdout); - xfgets(line, 128, stdin); + fgets(line, 128, stdin); strip(line); if (line[0] == '?') { print_help(menu); @@ -644,14 +644,3 @@ int main(int ac, char **av) } return 0; } -/* - * Helper function to facilitate fgets() by Jean Sacren. - */ -void xfgets(str, size, in) - char *str; - int size; - FILE *in; -{ - if (fgets(str, size, in) == NULL) - fprintf(stderr, "\nError in reading or end of file.\n"); -} diff --git a/trunk/scripts/kconfig/confdata.c b/trunk/scripts/kconfig/confdata.c index c39327e60ea4..f81f263b64f2 100644 --- a/trunk/scripts/kconfig/confdata.c +++ b/trunk/scripts/kconfig/confdata.c @@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name, while (1) { l = strcspn(str, "\"\\"); if (l) { - xfwrite(str, l, 1, out); + fwrite(str, l, 1, out); str += l; } if (!*str) @@ -497,7 +497,7 @@ int conf_write_defconfig(const char *filename) /* * If symbol is a choice value and equals to the * default for a choice - skip. - * But only if value is bool and equal to "y" . + * But only if value equal to "y". */ if (sym_is_choice_value(sym)) { struct symbol *cs; @@ -506,8 +506,9 @@ int conf_write_defconfig(const char *filename) cs = prop_get_symbol(sym_get_choice_prop(sym)); ds = sym_choice_default(cs); if (sym == ds) { - if ((sym->type == S_BOOLEAN) && - sym_get_tristate_value(sym) == yes) + if ((sym->type == S_BOOLEAN || + sym->type == S_TRISTATE) && + sym_get_tristate_value(sym) == yes) goto next_menu; } } @@ -918,73 +919,13 @@ void conf_set_changed_callback(void (*fn)(void)) conf_changed_callback = fn; } -static void randomize_choice_values(struct symbol *csym) -{ - struct property *prop; - struct symbol *sym; - struct expr *e; - int cnt, def; - - /* - * If choice is mod then we may have more items slected - * and if no then no-one. - * In both cases stop. - */ - if (csym->curr.tri != yes) - return; - - prop = sym_get_choice_prop(csym); - - /* count entries in choice block */ - cnt = 0; - expr_list_for_each_sym(prop->expr, e, sym) - cnt++; - - /* - * find a random value and set it to yes, - * set the rest to no so we have only one set - */ - def = (rand() % cnt); - - cnt = 0; - expr_list_for_each_sym(prop->expr, e, sym) { - if (def == cnt++) { - sym->def[S_DEF_USER].tri = yes; - csym->def[S_DEF_USER].val = sym; - } - else { - sym->def[S_DEF_USER].tri = no; - } - } - csym->flags |= SYMBOL_DEF_USER; - /* clear VALID to get value calculated */ - csym->flags &= ~(SYMBOL_VALID); -} - -static void set_all_choice_values(struct symbol *csym) -{ - struct property *prop; - struct symbol *sym; - struct expr *e; - - prop = sym_get_choice_prop(csym); - - /* - * Set all non-assinged choice values to no - */ - expr_list_for_each_sym(prop->expr, e, sym) { - if (!sym_has_value(sym)) - sym->def[S_DEF_USER].tri = no; - } - csym->flags |= SYMBOL_DEF_USER; - /* clear VALID to get value calculated */ - csym->flags &= ~(SYMBOL_VALID); -} void conf_set_all_new_symbols(enum conf_def_mode mode) { struct symbol *sym, *csym; - int i, cnt; + struct property *prop; + struct expr *e; + int i, cnt, def; for_all_symbols(i, sym) { if (sym_has_value(sym)) @@ -1020,6 +961,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) sym_clear_all_valid(); + if (mode != def_random) + return; /* * We have different type of choice blocks. * If curr.tri equal to mod then we can select several @@ -1034,9 +977,35 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) continue; sym_calc_value(csym); - if (mode == def_random) - randomize_choice_values(csym); - else - set_all_choice_values(csym); + + if (csym->curr.tri != yes) + continue; + + prop = sym_get_choice_prop(csym); + + /* count entries in choice block */ + cnt = 0; + expr_list_for_each_sym(prop->expr, e, sym) + cnt++; + + /* + * find a random value and set it to yes, + * set the rest to no so we have only one set + */ + def = (rand() % cnt); + + cnt = 0; + expr_list_for_each_sym(prop->expr, e, sym) { + if (def == cnt++) { + sym->def[S_DEF_USER].tri = yes; + csym->def[S_DEF_USER].val = sym; + } + else { + sym->def[S_DEF_USER].tri = no; + } + } + csym->flags |= SYMBOL_DEF_USER; + /* clear VALID to get value calculated */ + csym->flags &= ~(SYMBOL_VALID); } } diff --git a/trunk/scripts/kconfig/expr.c b/trunk/scripts/kconfig/expr.c index 330e7c0048a8..8f18e37892cb 100644 --- a/trunk/scripts/kconfig/expr.c +++ b/trunk/scripts/kconfig/expr.c @@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) { - xfwrite(str, strlen(str), 1, data); + fwrite(str, strlen(str), 1, data); } void expr_fprint(struct expr *e, FILE *out) diff --git a/trunk/scripts/kconfig/lkc.h b/trunk/scripts/kconfig/lkc.h index bdf71bd31412..76db065ed72c 100644 --- a/trunk/scripts/kconfig/lkc.h +++ b/trunk/scripts/kconfig/lkc.h @@ -72,9 +72,6 @@ void zconf_nextfile(const char *name); int zconf_lineno(void); char *zconf_curname(void); -/* conf.c */ -void xfgets(char *str, int size, FILE *in); - /* confdata.c */ const char *conf_get_configname(void); const char *conf_get_autoconfig_name(void); @@ -83,13 +80,6 @@ void sym_set_change_count(int count); void sym_add_change_count(int count); void conf_set_all_new_symbols(enum conf_def_mode mode); -/* confdata.c and expr.c */ -static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) -{ - if (fwrite(str, len, count, out) < count) - fprintf(stderr, "\nError in writing or end of file.\n"); -} - /* kconfig_load.c */ void kconfig_load(void); diff --git a/trunk/scripts/kconfig/nconf.c b/trunk/scripts/kconfig/nconf.c index 2ba71bcd38e6..762caf80ce37 100644 --- a/trunk/scripts/kconfig/nconf.c +++ b/trunk/scripts/kconfig/nconf.c @@ -676,8 +676,6 @@ static void *item_data(void) struct mitem *mcur; cur = current_item(curses_menu); - if (!cur) - return NULL; mcur = (struct mitem *) item_userptr(cur); return mcur->usrptr; diff --git a/trunk/scripts/setlocalversion b/trunk/scripts/setlocalversion index e90a91cc5185..64a9cb5556cd 100755 --- a/trunk/scripts/setlocalversion +++ b/trunk/scripts/setlocalversion @@ -86,7 +86,7 @@ scm_version() # Check for mercurial and a mercurial repo. if hgid=`hg id 2>/dev/null`; then - tag=`printf '%s' "$hgid" | cut -s -d' ' -f2` + tag=`printf '%s' "$hgid" | cut -d' ' -f2` # Do we have an untagged version? if [ -z "$tag" -o "$tag" = tip ]; then