diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-03-27 23:54:12 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-03-27 23:54:12 +0000 |
commit | d3e71cb08747743fce908122bab08b479eb403a5 (patch) | |
tree | cbec6948fdbdee9af81cf3ecfb504070d2745d7b /arch/sparc64/kernel | |
parent | fe7ff1706e323d0e5ed83972960a1ecc1ee538b3 (diff) |
Merge with Linux 2.3.99-pre3.
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/Makefile | 4 | ||||
-rw-r--r-- | arch/sparc64/kernel/binfmt_aout32.c | 42 | ||||
-rw-r--r-- | arch/sparc64/kernel/ioctl32.c | 43 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc32.c | 40 |
4 files changed, 64 insertions, 65 deletions
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index f06ece682..124776f51 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.51 2000/02/08 05:11:31 jj Exp $ +# $Id: Makefile,v 1.52 2000/03/19 07:00:29 ecd Exp $ # Makefile for the linux kernel. # # Note! Dependencies are done automagically by 'make dep', which also @@ -61,7 +61,7 @@ head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \ # binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c -ifneq ($(IS_EGCS),y) +ifneq ($(NEW_GCC),y) CMODEL_CFLAG := -mmedlow else CMODEL_CFLAG := -mcmodel=medlow diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index 3504533d1..c72f7272f 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c @@ -198,7 +198,6 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) { struct exec ex; - struct file * file; int fd; unsigned long error; unsigned long fd_offset; @@ -209,7 +208,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || N_TRSIZE(ex) || N_DRSIZE(ex) || - bprm->dentry->d_inode->i_size < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { + bprm->file->f_dentry->d_inode->i_size < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { return -ENOEXEC; } @@ -245,21 +244,23 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) compute_creds(bprm); current->flags &= ~PF_FORKNOEXEC; if (N_MAGIC(ex) == NMAGIC) { + loff_t pos = fd_offset; /* Fuck me plenty... */ error = do_brk(N_TXTADDR(ex), ex.a_text); - read_exec(bprm->dentry, fd_offset, (char *) N_TXTADDR(ex), - ex.a_text, 0); + bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex), + ex.a_text, &pos); error = do_brk(N_DATADDR(ex), ex.a_data); - read_exec(bprm->dentry, fd_offset + ex.a_text, (char *) N_DATADDR(ex), - ex.a_data, 0); + bprm->file->f_op->read(bprm->file, (char *) N_DATADDR(ex), + ex.a_data, &pos); goto beyond_if; } if (N_MAGIC(ex) == OMAGIC) { + loff_t pos = fd_offset; do_brk(N_TXTADDR(ex) & PAGE_MASK, ex.a_text+ex.a_data + PAGE_SIZE - 1); - read_exec(bprm->dentry, fd_offset, (char *) N_TXTADDR(ex), - ex.a_text+ex.a_data, 0); + bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex), + ex.a_text+ex.a_data, &pos); } else { static unsigned long error_time; if ((ex.a_text & 0xfff || ex.a_data & 0xfff) && @@ -269,37 +270,36 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) error_time = jiffies; } - fd = open_dentry(bprm->dentry, O_RDONLY); + fd = get_unused_fd(); if (fd < 0) return fd; - file = fget(fd); + get_file(bprm->file); + fd_install(fd, bprm->file); - if (!file->f_op || !file->f_op->mmap) { - fput(file); + if (!bprm->file->f_op->mmap) { + loff_t pos = fd_offset; sys_close(fd); do_brk(0, ex.a_text+ex.a_data); - read_exec(bprm->dentry, fd_offset, - (char *) N_TXTADDR(ex), ex.a_text+ex.a_data, 0); + bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), + ex.a_text+ex.a_data, &pos); goto beyond_if; } - error = do_mmap(file, N_TXTADDR(ex), ex.a_text, + error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, PROT_READ | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset); if (error != N_TXTADDR(ex)) { - fput(file); sys_close(fd); send_sig(SIGKILL, current, 0); return error; } - error = do_mmap(file, N_DATADDR(ex), ex.a_data, + error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); - fput(file); sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); @@ -349,16 +349,12 @@ static int load_aout32_library(struct file *file) unsigned long bss, start_addr, len; unsigned long error; int retval; - loff_t offset = 0; struct exec ex; inode = file->f_dentry->d_inode; retval = -ENOEXEC; - /* N.B. Save current fs? */ - set_fs(KERNEL_DS); - error = file->f_op->read(file, (char *) &ex, sizeof(ex), &offset); - set_fs(USER_DS); + error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); if (error != sizeof(ex)) goto out; diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index 0ba88adf6..254e2eb8a 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c @@ -1,4 +1,4 @@ -/* $Id: ioctl32.c,v 1.83 2000/03/14 07:31:25 jj Exp $ +/* $Id: ioctl32.c,v 1.85 2000/03/23 05:25:41 davem Exp $ * ioctl32.c: Conversion between 32bit and 64bit native ioctls. * * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) @@ -1594,7 +1594,7 @@ static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) { mm_segment_t old_fs = get_fs(); struct loop_info l; - int err = 0; + int err = -EINVAL; switch(cmd) { case LOOP_SET_STATUS: @@ -1604,11 +1604,13 @@ static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) err |= __get_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice); err |= __copy_from_user((char *)&l.lo_offset, (char *)&((struct loop_info32 *)arg)->lo_offset, 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); - if (err) - return -EFAULT; - set_fs (KERNEL_DS); - err = sys_ioctl (fd, cmd, (unsigned long)&l); - set_fs (old_fs); + if (err) { + err = -EFAULT; + } else { + set_fs (KERNEL_DS); + err = sys_ioctl (fd, cmd, (unsigned long)&l); + set_fs (old_fs); + } break; case LOOP_GET_STATUS: set_fs (KERNEL_DS); @@ -1621,10 +1623,19 @@ static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) err |= __put_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice); err |= __copy_to_user((char *)&((struct loop_info32 *)arg)->lo_offset, (char *)&l.lo_offset, (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); + if (err) + err = -EFAULT; } break; + default: { + static int count = 0; + if (++count <= 20) + printk("%s: Unknown loop ioctl cmd, fd(%d) " + "cmd(%08x) arg(%08lx)\n", + __FUNCTION__, fd, cmd, arg); } - return err ? -EFAULT : 0; + } + return err; } extern int tty_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg); @@ -1803,6 +1814,8 @@ struct atm_iobuf32 { #define ATM_SETESIF32 _IOW('a', ATMIOC_ITF+13, struct atmif_sioc32) #define ATM_GETSTAT32 _IOW('a', ATMIOC_SARCOM+0, struct atmif_sioc32) #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32) +#define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32) +#define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32) static struct { unsigned int cmd32; @@ -1821,7 +1834,9 @@ static struct { { ATM_SETESI32, ATM_SETESI }, { ATM_SETESIF32, ATM_SETESIF }, { ATM_GETSTAT32, ATM_GETSTAT }, - { ATM_GETSTATZ32, ATM_GETSTATZ } + { ATM_GETSTATZ32, ATM_GETSTATZ }, + { ATM_GETLOOP32, ATM_GETLOOP }, + { ATM_SETLOOP32, ATM_SETLOOP } }; #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0])) @@ -1941,8 +1956,6 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) unsigned int cmd = 0; switch (cmd32) { - case SUNI_GETLOOP: - case SUNI_SETLOOP: case SONET_GETSTAT: case SONET_GETSTATZ: case SONET_GETDIAG: @@ -1954,7 +1967,6 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) return do_atmif_sioc(fd, cmd32, arg); } - if (cmd == 0) { for (i = 0; i < NR_ATM_IOCTL; i++) { if (cmd32 == atm_ioctl_map[i].cmd32) { cmd = atm_ioctl_map[i].cmd; @@ -1964,7 +1976,6 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) if (i == NR_ATM_IOCTL) { return -EINVAL; } - } switch (cmd) { case ATM_GETNAMES: @@ -1983,6 +1994,8 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) case ATM_SETESIF: case ATM_GETSTAT: case ATM_GETSTATZ: + case ATM_GETLOOP: + case ATM_SETLOOP: return do_atmif_sioc(fd, cmd, arg); } @@ -3076,8 +3089,8 @@ HANDLE_IOCTL(ATM_SETESI32, do_atm_ioctl) HANDLE_IOCTL(ATM_SETESIF32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETSTAT32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETSTATZ32, do_atm_ioctl) -HANDLE_IOCTL(SUNI_GETLOOP, do_atm_ioctl) -HANDLE_IOCTL(SUNI_SETLOOP, do_atm_ioctl) +HANDLE_IOCTL(ATM_GETLOOP32, do_atm_ioctl) +HANDLE_IOCTL(ATM_SETLOOP32, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTAT, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTATZ, do_atm_ioctl) HANDLE_IOCTL(SONET_GETDIAG, do_atm_ioctl) diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 763acdc0f..d752f1a0d 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc32.c,v 1.139 2000/03/16 20:37:57 davem Exp $ +/* $Id: sys_sparc32.c,v 1.141 2000/03/24 01:31:30 davem Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -3051,7 +3051,7 @@ static inline int do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) { struct linux_binprm bprm; - struct dentry * dentry; + struct file * file; int retval; int i; @@ -3059,28 +3059,24 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0])); lock_kernel(); - dentry = open_namei(filename); + file = open_exec(filename); unlock_kernel(); - retval = PTR_ERR(dentry); - if (IS_ERR(dentry)) + retval = PTR_ERR(file); + if (IS_ERR(file)) return retval; - bprm.dentry = dentry; + bprm.file = file; bprm.filename = filename; bprm.sh_bang = 0; bprm.loader = 0; bprm.exec = 0; if ((bprm.argc = count32(argv)) < 0) { - lock_kernel(); - dput(dentry); - unlock_kernel(); + fput(file); return bprm.argc; } if ((bprm.envc = count32(envp)) < 0) { - lock_kernel(); - dput(dentry); - unlock_kernel(); + fput(file); return bprm.envc; } @@ -3108,11 +3104,8 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) out: /* Something went wrong, return the inode and free the argument pages*/ - if (bprm.dentry) { - lock_kernel(); - dput(bprm.dentry); - unlock_kernel(); - } + if (bprm.file) + fput(bprm.file); for (i=0 ; i<MAX_ARG_PAGES ; i++) if (bprm.page[i]) @@ -3634,7 +3627,7 @@ struct nfsctl_arg32 { union nfsctl_res32 { __u8 cr32_getfh[NFS_FHSIZE]; - u32 cr32_debug; + struct knfsd_fh cr32_getfs; }; static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) @@ -3760,15 +3753,12 @@ static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32 return err; } +/* This really doesn't need translations, we are only passing + * back a union which contains opaque nfs file handle data. + */ static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32) { - int err; - - err = copy_to_user(&res32->cr32_getfh, - &kres->cr_getfh, - sizeof(res32->cr32_getfh)); - err |= __put_user(kres->cr_debug, &res32->cr32_debug); - return err; + return copy_to_user(res32, kres, sizeof(*res32)); } extern asmlinkage int sys_nfsservctl(int cmd, void *arg, void *resp); |