From 28cb16bbe295588704043bbeb6559f4e968ec1dc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:30:14 -0500 Subject: [PATCH] Import 2.3.40pre5 --- CREDITS | 15 +- arch/i386/kernel/ptrace.c | 387 ++++++++++++++--------------- arch/i386/mm/fault.c | 9 +- arch/ppc/config.in | 2 + arch/ppc/defconfig | 2 +- arch/ppc/kernel/ppc_ksyms.c | 1 + arch/ppc/kernel/setup.c | 23 +- arch/sparc/config.in | 4 +- arch/sparc/defconfig | 38 +-- arch/sparc/mm/init.c | 32 +-- arch/sparc/mm/io-unit.c | 4 +- arch/sparc/mm/iommu.c | 6 +- arch/sparc/mm/srmmu.c | 53 ++-- arch/sparc/mm/sun4c.c | 16 +- arch/sparc/mm/viking.S | 50 +--- arch/sparc64/kernel/binfmt_elf32.c | 7 + arch/sparc64/kernel/entry.S | 10 +- arch/sparc64/kernel/signal32.c | 2 +- arch/sparc64/kernel/sys_sparc32.c | 191 +++++++++++++- arch/sparc64/kernel/systbls.S | 34 +-- drivers/acorn/block/mfmhd.c | 52 ++-- drivers/ap1000/ddv.c | 26 +- drivers/block/DAC960.c | 20 +- drivers/block/acsi.c | 49 ++-- drivers/block/alim15x3.c | 16 +- drivers/block/cpqarray.c | 39 ++- drivers/block/hd.c | 47 ++-- drivers/block/ide-cd.c | 77 ++++++ drivers/block/ide-probe.c | 2 - drivers/block/ide.c | 42 ++-- drivers/block/md.c | 15 +- drivers/block/paride/pd.c | 61 ++--- drivers/block/ps2esdi.c | 28 +-- drivers/block/xd.c | 71 +++--- drivers/block/xd.h | 2 +- drivers/i2o/i2o_block.c | 13 +- drivers/scsi/sd.c | 21 +- fs/ncpfs/inode.c | 51 +++- fs/ncpfs/ioctl.c | 144 ++++++----- fs/partitions/check.c | 30 +-- fs/smbfs/ioctl.c | 2 +- fs/super.c | 2 +- include/asm-alpha/posix_types.h | 2 - include/asm-arm/posix_types.h | 6 - include/asm-i386/posix_types.h | 2 - include/asm-m68k/posix_types.h | 6 - include/asm-ppc/ipcbuf.h | 11 + include/asm-ppc/msgbuf.h | 26 ++ include/asm-ppc/posix_types.h | 2 - include/asm-ppc/sembuf.h | 20 ++ include/asm-ppc/shmbuf.h | 37 +++ include/asm-sparc/pgalloc.h | 14 +- include/asm-sparc/posix_types.h | 3 - include/asm-sparc64/posix_types.h | 12 +- include/linux/blkdev.h | 2 +- include/linux/fb.h | 24 +- include/linux/genhd.h | 2 - include/linux/highuid.h | 7 +- include/linux/ide.h | 1 - include/linux/ncp_fs.h | 30 ++- include/linux/ncp_fs_sb.h | 2 +- include/linux/ncp_mount.h | 46 ++++ include/linux/smb_fs.h | 2 +- include/linux/types.h | 3 + kernel/ksyms.c | 4 +- kernel/signal.c | 139 +++++------ kernel/sys.c | 4 - kernel/sysctl.c | 2 - 68 files changed, 1209 insertions(+), 896 deletions(-) create mode 100644 include/asm-ppc/ipcbuf.h create mode 100644 include/asm-ppc/msgbuf.h create mode 100644 include/asm-ppc/sembuf.h create mode 100644 include/asm-ppc/shmbuf.h diff --git a/CREDITS b/CREDITS index 6d8fa008771a..80a8c5317ea6 100644 --- a/CREDITS +++ b/CREDITS @@ -2348,18 +2348,15 @@ S: Germany N: Lars Wirzenius E: liw@iki.fi -D: Linux System Administrator's Guide -D: Co-moderator, comp.os.linux.announce +D: Linux System Administrator's Guide, author, former maintainer +D: comp.os.linux.announce, former moderator +D: Linux Documentation Project, co-founder D: Original sprintf in kernel -D: Personal information about Linus -D: Original kernel README -D: Linux News (electronic magazine) -D: Meta-FAQ, originator +D: Original kernel README (for version 0.97) +D: Linux News (electronic magazine, now dead), founder and former editor +D: Meta-FAQ, originator, former maintainer D: INFO-SHEET, former maintainer D: Author of the longest-living linux bug -S: Hernesaarenkatu 15 A 2 -S: Fin-00150 Helsinki -S: Finland N: Jonathan Woithe E: jwoithe@physics.adelaide.edu.au diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index 1e6576860c7e..ed64f15a2d0d 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c @@ -198,259 +198,242 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) switch (request) { /* when I and D space are separate, these will need to be fixed. */ - case PTRACE_PEEKTEXT: /* read word at location addr. */ - case PTRACE_PEEKDATA: { - unsigned long tmp; - int copied; - - copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); - ret = -EIO; - if (copied != sizeof(tmp)) - goto out; - ret = put_user(tmp,(unsigned long *) data); - goto out; - } + case PTRACE_PEEKTEXT: /* read word at location addr. */ + case PTRACE_PEEKDATA: { + unsigned long tmp; + int copied; + + copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); + ret = -EIO; + if (copied != sizeof(tmp)) + break; + ret = put_user(tmp,(unsigned long *) data); + break; + } /* read the word at location addr in the USER area. */ - case PTRACE_PEEKUSR: { - unsigned long tmp; + case PTRACE_PEEKUSR: { + unsigned long tmp; - ret = -EIO; - if ((addr & 3) || addr < 0 || - addr > sizeof(struct user) - 3) - goto out; - - tmp = 0; /* Default return condition */ - if(addr < 17*sizeof(long)) - tmp = getreg(child, addr); - if(addr >= (long) &dummy->u_debugreg[0] && - addr <= (long) &dummy->u_debugreg[7]){ - addr -= (long) &dummy->u_debugreg[0]; - addr = addr >> 2; - tmp = child->thread.debugreg[addr]; - }; - ret = put_user(tmp,(unsigned long *) data); - goto out; - } + ret = -EIO; + if ((addr & 3) || addr < 0 || + addr > sizeof(struct user) - 3) + break; - /* when I and D space are separate, this will have to be fixed. */ - case PTRACE_POKETEXT: /* write the word at location addr. */ - case PTRACE_POKEDATA: - ret = 0; - if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data)) - goto out; - ret = -EIO; - goto out; + tmp = 0; /* Default return condition */ + if(addr < 17*sizeof(long)) + tmp = getreg(child, addr); + if(addr >= (long) &dummy->u_debugreg[0] && + addr <= (long) &dummy->u_debugreg[7]){ + addr -= (long) &dummy->u_debugreg[0]; + addr = addr >> 2; + tmp = child->thread.debugreg[addr]; + } + ret = put_user(tmp,(unsigned long *) data); + break; + } - case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ - ret = -EIO; - if ((addr & 3) || addr < 0 || - addr > sizeof(struct user) - 3) - goto out; + /* when I and D space are separate, this will have to be fixed. */ + case PTRACE_POKETEXT: /* write the word at location addr. */ + case PTRACE_POKEDATA: + ret = 0; + if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data)) + break; + ret = -EIO; + break; - if (addr < 17*sizeof(long)) { - ret = putreg(child, addr, data); - goto out; - } + case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ + ret = -EIO; + if ((addr & 3) || addr < 0 || + addr > sizeof(struct user) - 3) + break; - /* We need to be very careful here. We implicitly - want to modify a portion of the task_struct, and we - have to be selective about what portions we allow someone - to modify. */ + if (addr < 17*sizeof(long)) { + ret = putreg(child, addr, data); + break; + } + /* We need to be very careful here. We implicitly + want to modify a portion of the task_struct, and we + have to be selective about what portions we allow someone + to modify. */ + ret = -EIO; if(addr >= (long) &dummy->u_debugreg[0] && addr <= (long) &dummy->u_debugreg[7]){ - if(addr == (long) &dummy->u_debugreg[4]) return -EIO; - if(addr == (long) &dummy->u_debugreg[5]) return -EIO; + if(addr == (long) &dummy->u_debugreg[4]) break; + if(addr == (long) &dummy->u_debugreg[5]) break; if(addr < (long) &dummy->u_debugreg[4] && - ((unsigned long) data) >= TASK_SIZE-3) return -EIO; + ((unsigned long) data) >= TASK_SIZE-3) break; - ret = -EIO; if(addr == (long) &dummy->u_debugreg[7]) { data &= ~DR_CONTROL_RESERVED; for(i=0; i<4; i++) if ((0x5f54 >> ((data >> (16 + 4*i)) & 0xf)) & 1) goto out; - }; + } addr -= (long) &dummy->u_debugreg; addr = addr >> 2; child->thread.debugreg[addr] = data; ret = 0; - goto out; - }; - ret = -EIO; - goto out; + } + break; - case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ - case PTRACE_CONT: { /* restart after signal. */ - long tmp; + case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ + case PTRACE_CONT: { /* restart after signal. */ + long tmp; - ret = -EIO; - if ((unsigned long) data > _NSIG) - goto out; - if (request == PTRACE_SYSCALL) - child->flags |= PF_TRACESYS; - else - child->flags &= ~PF_TRACESYS; - child->exit_code = data; + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + if (request == PTRACE_SYSCALL) + child->flags |= PF_TRACESYS; + else + child->flags &= ~PF_TRACESYS; + child->exit_code = data; /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; - put_stack_long(child, EFL_OFFSET,tmp); - wake_up_process(child); - ret = 0; - goto out; - } + tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; + put_stack_long(child, EFL_OFFSET,tmp); + wake_up_process(child); + ret = 0; + break; + } /* * make the child exit. Best I can do is send it a sigkill. * perhaps it should be put in the status that it wants to * exit. */ - case PTRACE_KILL: { - long tmp; + case PTRACE_KILL: { + long tmp; - ret = 0; - if (child->state == TASK_ZOMBIE) /* already dead */ - goto out; - child->exit_code = SIGKILL; - /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; - put_stack_long(child, EFL_OFFSET, tmp); - wake_up_process(child); - goto out; + ret = 0; + if (child->state == TASK_ZOMBIE) /* already dead */ + break; + child->exit_code = SIGKILL; + /* make sure the single step bit is not set. */ + tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; + put_stack_long(child, EFL_OFFSET, tmp); + wake_up_process(child); + break; + } + + case PTRACE_SINGLESTEP: { /* set the trap flag. */ + long tmp; + + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + child->flags &= ~PF_TRACESYS; + if ((child->flags & PF_DTRACE) == 0) { + /* Spurious delayed TF traps may occur */ + child->flags |= PF_DTRACE; } + tmp = get_stack_long(child, EFL_OFFSET) | TRAP_FLAG; + put_stack_long(child, EFL_OFFSET, tmp); + child->exit_code = data; + /* give it a chance to run. */ + wake_up_process(child); + ret = 0; + break; + } + + case PTRACE_DETACH: { /* detach a process that was attached. */ + long tmp; - case PTRACE_SINGLESTEP: { /* set the trap flag. */ - long tmp; + ret = -EIO; + if ((unsigned long) data > _NSIG) + break; + child->flags &= ~(PF_PTRACED|PF_TRACESYS); + child->exit_code = data; + write_lock_irqsave(&tasklist_lock, flags); + REMOVE_LINKS(child); + child->p_pptr = child->p_opptr; + SET_LINKS(child); + write_unlock_irqrestore(&tasklist_lock, flags); + /* make sure the single step bit is not set. */ + tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; + put_stack_long(child, EFL_OFFSET, tmp); + wake_up_process(child); + ret = 0; + break; + } + case PTRACE_GETREGS: { /* Get all gp regs from the child. */ + if (!access_ok(VERIFY_WRITE, (unsigned *)data, 17*sizeof(long))) { ret = -EIO; - if ((unsigned long) data > _NSIG) - goto out; - child->flags &= ~PF_TRACESYS; - if ((child->flags & PF_DTRACE) == 0) { - /* Spurious delayed TF traps may occur */ - child->flags |= PF_DTRACE; - } - tmp = get_stack_long(child, EFL_OFFSET) | TRAP_FLAG; - put_stack_long(child, EFL_OFFSET, tmp); - child->exit_code = data; - /* give it a chance to run. */ - wake_up_process(child); - ret = 0; - goto out; + break; } + for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) { + __put_user(getreg(child, i),(unsigned long *) data); + data += sizeof(long); + } + ret = 0; + break; + } - case PTRACE_DETACH: { /* detach a process that was attached. */ - long tmp; - + case PTRACE_SETREGS: { /* Set all gp regs in the child. */ + unsigned long tmp; + if (!access_ok(VERIFY_READ, (unsigned *)data, 17*sizeof(long))) { ret = -EIO; - if ((unsigned long) data > _NSIG) - goto out; - child->flags &= ~(PF_PTRACED|PF_TRACESYS); - child->exit_code = data; - write_lock_irqsave(&tasklist_lock, flags); - REMOVE_LINKS(child); - child->p_pptr = child->p_opptr; - SET_LINKS(child); - write_unlock_irqrestore(&tasklist_lock, flags); - /* make sure the single step bit is not set. */ - tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG; - put_stack_long(child, EFL_OFFSET, tmp); - wake_up_process(child); - ret = 0; - goto out; + break; } + for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) { + __get_user(tmp, (unsigned long *) data); + putreg(child, i, tmp); + data += sizeof(long); + } + ret = 0; + break; + } - case PTRACE_GETREGS: { /* Get all gp regs from the child. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, - 17*sizeof(long))) - { - ret = -EIO; - goto out; - } - for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) - { - __put_user(getreg(child, i),(unsigned long *) data); - data += sizeof(long); - } - ret = 0; - goto out; - }; - - case PTRACE_SETREGS: { /* Set all gp regs in the child. */ - unsigned long tmp; - if (!access_ok(VERIFY_READ, (unsigned *)data, - 17*sizeof(long))) - { - ret = -EIO; - goto out; - } - for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) - { - __get_user(tmp, (unsigned long *) data); - putreg(child, i, tmp); - data += sizeof(long); - } - ret = 0; - goto out; - }; - - case PTRACE_GETFPREGS: { /* Get the child FPU state. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, - sizeof(struct user_i387_struct))) - { - ret = -EIO; - goto out; - } - ret = 0; - if ( !child->used_math ) { - /* Simulate an empty FPU. */ - child->thread.i387.hard.cwd = 0xffff037f; - child->thread.i387.hard.swd = 0xffff0000; - child->thread.i387.hard.twd = 0xffffffff; - } + case PTRACE_GETFPREGS: { /* Get the child FPU state. */ + if (!access_ok(VERIFY_WRITE, (unsigned *)data, sizeof(struct user_i387_struct))) { + ret = -EIO; + break; + } + ret = 0; + if ( !child->used_math ) { + /* Simulate an empty FPU. */ + child->thread.i387.hard.cwd = 0xffff037f; + child->thread.i387.hard.swd = 0xffff0000; + child->thread.i387.hard.twd = 0xffffffff; + } #ifdef CONFIG_MATH_EMULATION - if ( boot_cpu_data.hard_math ) { + if ( boot_cpu_data.hard_math ) { #endif - __copy_to_user((void *)data, &child->thread.i387.hard, - sizeof(struct user_i387_struct)); + __copy_to_user((void *)data, &child->thread.i387.hard, sizeof(struct user_i387_struct)); #ifdef CONFIG_MATH_EMULATION - } else { - save_i387_soft(&child->thread.i387.soft, - (struct _fpstate *)data); - } + } else { + save_i387_soft(&child->thread.i387.soft, (struct _fpstate *)data); + } #endif - goto out; - }; - - case PTRACE_SETFPREGS: { /* Set the child FPU state. */ - if (!access_ok(VERIFY_READ, (unsigned *)data, - sizeof(struct user_i387_struct))) - { - ret = -EIO; - goto out; - } - child->used_math = 1; + break; + } + + case PTRACE_SETFPREGS: { /* Set the child FPU state. */ + if (!access_ok(VERIFY_READ, (unsigned *)data, sizeof(struct user_i387_struct))) { + ret = -EIO; + break; + } + child->used_math = 1; #ifdef CONFIG_MATH_EMULATION - if ( boot_cpu_data.hard_math ) { + if ( boot_cpu_data.hard_math ) { #endif - __copy_from_user(&child->thread.i387.hard, (void *)data, - sizeof(struct user_i387_struct)); + __copy_from_user(&child->thread.i387.hard, (void *)data, sizeof(struct user_i387_struct)); #ifdef CONFIG_MATH_EMULATION - } else { - restore_i387_soft(&child->thread.i387.soft, - (struct _fpstate *)data); - } + } else { + restore_i387_soft(&child->thread.i387.soft, (struct _fpstate *)data); + } #endif - ret = 0; - goto out; - }; + ret = 0; + break; + } - default: - ret = -EIO; - goto out; + default: + ret = -EIO; + break; } out: unlock_kernel(); diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index 618b36544ad1..4cdc21fb3d3f 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -123,6 +123,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) unsigned long page; unsigned long fixup; int write; + int si_code = SEGV_MAPERR; /* get the address */ __asm__("movl %%cr2,%0":"=r" (address)); @@ -164,6 +165,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) */ good_area: write = 0; + si_code = SEGV_ACCERR; + switch (error_code & 3) { default: /* 3: write, present */ #ifdef TEST_VERIFY_AREA @@ -216,10 +219,14 @@ bad_area: /* User mode accesses just cause a SIGSEGV */ if (error_code & 4) { + struct siginfo si; tsk->thread.cr2 = address; tsk->thread.error_code = error_code; tsk->thread.trap_no = 14; - force_sig(SIGSEGV, tsk); + si.si_signo = SIGSEGV; + si.si_code = si_code; + si.si_addr = (void*) address; + force_sig_info(SIGSEGV, &si, tsk); return; } diff --git a/arch/ppc/config.in b/arch/ppc/config.in index 0a281b5533f7..43a678c6d3bf 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -2,6 +2,8 @@ # For a description of the syntax of this configuration file, # see the Configure script. # +define_bool CONFIG_UID16 n + mainmenu_name "Linux/PowerPC Kernel Configuration" mainmenu_option next_comment diff --git a/arch/ppc/defconfig b/arch/ppc/defconfig index 08acbd87419f..795aa5b833e1 100644 --- a/arch/ppc/defconfig +++ b/arch/ppc/defconfig @@ -35,8 +35,8 @@ CONFIG_KMOD=y # # General setup # +# CONFIG_PCI is not set CONFIG_PCI=y -CONFIG_PCI_NAMES=y CONFIG_NET=y CONFIG_SYSCTL=y CONFIG_SYSVIPC=y diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 00e8b3fe2621..65e9250343a3 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c @@ -270,3 +270,4 @@ EXPORT_SYMBOL(ppc_irq_dispatch_handler); EXPORT_SYMBOL(decrementer_count); EXPORT_SYMBOL(get_wchan); EXPORT_SYMBOL(console_drivers); +EXPORT_SYMBOL(do_bottom_half); diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index 94aae2a05750..dccb066ffb89 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c @@ -716,25 +716,25 @@ void ppc_generic_ide_fix_driveid(struct hd_driveid *id) id->word72 = __le16_to_cpu(id->word72); id->word73 = __le16_to_cpu(id->word73); id->word74 = __le16_to_cpu(id->word74); - id->word75 = __le16_to_cpu(id->word75); + id->queue_depth = __le16_to_cpu(id->queue_depth); id->word76 = __le16_to_cpu(id->word76); id->word77 = __le16_to_cpu(id->word77); id->word78 = __le16_to_cpu(id->word78); id->word79 = __le16_to_cpu(id->word79); - id->word80 = __le16_to_cpu(id->word80); - id->word81 = __le16_to_cpu(id->word81); - id->command_sets = __le16_to_cpu(id->command_sets); - id->word83 = __le16_to_cpu(id->word83); - id->word84 = __le16_to_cpu(id->word84); - id->word85 = __le16_to_cpu(id->word85); - id->word86 = __le16_to_cpu(id->word86); - id->word87 = __le16_to_cpu(id->word87); + id->major_rev_num = __le16_to_cpu(id->major_rev_num); + id->minor_rev_num = __le16_to_cpu(id->minor_rev_num); + id->command_set_1 = __le16_to_cpu(id->command_set_1); + id->command_set_2 = __le16_to_cpu(id->command_set_2); + id->cfsse = __le16_to_cpu(id->cfsse); + id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1); + id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2); + id->csf_default = __le16_to_cpu(id->csf_default); id->dma_ultra = __le16_to_cpu(id->dma_ultra); id->word89 = __le16_to_cpu(id->word89); id->word90 = __le16_to_cpu(id->word90); - id->word91 = __le16_to_cpu(id->word91); + id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues); id->word92 = __le16_to_cpu(id->word92); - id->word93 = __le16_to_cpu(id->word93); + id->hw_config = __le16_to_cpu(id->hw_config); id->word94 = __le16_to_cpu(id->word94); id->word95 = __le16_to_cpu(id->word95); id->word96 = __le16_to_cpu(id->word96); @@ -769,7 +769,6 @@ void ppc_generic_ide_fix_driveid(struct hd_driveid *id) id->word125 = __le16_to_cpu(id->word125); id->word126 = __le16_to_cpu(id->word126); id->word127 = __le16_to_cpu(id->word127); - id->security = __le16_to_cpu(id->security); for (i=0; i<127; i++) id->reserved[i] = __le16_to_cpu(id->reserved[i]); } diff --git a/arch/sparc/config.in b/arch/sparc/config.in index 9ed06dc1f9b5..31e126f3342d 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -1,9 +1,11 @@ -# $Id: config.in,v 1.79 1999/12/23 01:46:00 davem Exp $ +# $Id: config.in,v 1.80 2000/01/14 07:12:30 davem Exp $ # For a description of the syntax of this configuration file, # see the Configure script. # mainmenu_name "Linux/SPARC Kernel Configuration" +define_bool CONFIG_UID16 y + mainmenu_option next_comment comment 'Code maturity level options' bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL diff --git a/arch/sparc/defconfig b/arch/sparc/defconfig index b02a836b6fd3..26037c33e868 100644 --- a/arch/sparc/defconfig +++ b/arch/sparc/defconfig @@ -1,35 +1,33 @@ # # Automatically generated make config: don't edit # +CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODVERSIONS=y -CONFIG_KMOD=y - # # General setup # CONFIG_VT=y CONFIG_VT_CONSOLE=y -# CONFIG_AP1000 is not set # CONFIG_SMP is not set +# CONFIG_AP1000 is not set # CONFIG_SUN4 is not set # CONFIG_PCI is not set -# CONFIG_PCI_NAMES is not set # # Console drivers # CONFIG_PROM_CONSOLE=y CONFIG_FB=y + +# +# Frame-buffer support +# +CONFIG_FB=y CONFIG_DUMMY_CONSOLE=y CONFIG_FB_SBUS=y CONFIG_FB_CGSIX=y @@ -67,6 +65,7 @@ CONFIG_SUN_MOSTEK_RTC=y # CONFIG_SUN_VIDEOPIX is not set CONFIG_SUN_AURORA=m # CONFIG_TADPOLE_TS102_UCTRL is not set +# CONFIG_SUN_JSFLASH is not set # # Linux/SPARC audio subsystem (EXPERIMENTAL) @@ -82,7 +81,6 @@ CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y CONFIG_KCORE_ELF=y -# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=m @@ -90,10 +88,18 @@ CONFIG_SUNOS_EMUL=y # CONFIG_PARPORT is not set # CONFIG_PRINTER is not set +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODVERSIONS=y +CONFIG_KMOD=y + # # Floppy, IDE, and other block devices # CONFIG_BLK_DEV_FD=y +# CONFIG_BLK_DEV_IDE is not set CONFIG_BLK_DEV_MD=y CONFIG_MD_LINEAR=m CONFIG_MD_STRIPED=m @@ -239,14 +245,15 @@ CONFIG_AUTOFS_FS=m # CONFIG_ADFS_FS is not set CONFIG_AFFS_FS=m # CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=m CONFIG_EFS_FS=m +# CONFIG_CRAMFS is not set CONFIG_ISO9660_FS=m # CONFIG_JOLIET is not set -# CONFIG_UDF_FS is not set CONFIG_MINIX_FS=m # CONFIG_NTFS_FS is not set CONFIG_HPFS_FS=m @@ -256,6 +263,8 @@ CONFIG_DEVPTS_FS=y CONFIG_ROMFS_FS=m CONFIG_EXT2_FS=y CONFIG_SYSV_FS=m +# CONFIG_SYSV_FS_WRITE is not set +# CONFIG_UDF_FS is not set CONFIG_UFS_FS=m CONFIG_UFS_FS_WRITE=y @@ -265,7 +274,7 @@ CONFIG_UFS_FS_WRITE=y CONFIG_CODA_FS=m CONFIG_NFS_FS=y CONFIG_NFSD=m -# CONFIG_NFSD_SUN is not set +# CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y CONFIG_SMB_FS=m @@ -275,7 +284,9 @@ CONFIG_NCP_FS=m # CONFIG_NCPFS_STRONG is not set # CONFIG_NCPFS_NFS_NS is not set # CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_MOUNT_SUBDIR is not set +# CONFIG_NCPFS_NDS_DOMAINS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_EXTRAS is not set @@ -284,9 +295,6 @@ CONFIG_NCP_FS=m # # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y -CONFIG_BSD_DISKLABEL=y -CONFIG_SOLARIS_X86_PARTITION=y -# CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set CONFIG_SUN_PARTITION=y CONFIG_NLS=y diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c index 221496f98d7d..817861a19459 100644 --- a/arch/sparc/mm/init.c +++ b/arch/sparc/mm/init.c @@ -1,9 +1,10 @@ -/* $Id: init.c,v 1.72 1999/12/27 06:30:06 anton Exp $ +/* $Id: init.c,v 1.73 2000/01/15 00:51:26 anton Exp $ * linux/arch/sparc/mm/init.c * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 Eddie C. Dost (ecd@skynet.be) * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * Copyright (C) 2000 Anton Blanchard (anton@progsoc.uts.edu.au) */ #include @@ -70,8 +71,7 @@ pte_t *__bad_pagetable(void) pte_t __bad_page(void) { memset((void *) &empty_bad_page, 0, PAGE_SIZE); - return pte_mkdirty(mk_pte_phys((((unsigned long) &empty_bad_page) - - PAGE_OFFSET + phys_base), + return pte_mkdirty(mk_pte_phys((unsigned long)__pa(&empty_bad_page) + phys_base, PAGE_SHARED)); } @@ -115,7 +115,7 @@ void __init sparc_context_init(int numctx) add_to_free_ctxlist(ctx_list_pool + ctx); } -#undef DEBUG_BOOTMEM +#define DEBUG_BOOTMEM extern unsigned long cmdline_memory_size; @@ -125,6 +125,10 @@ unsigned long __init bootmem_init(void) unsigned long end_of_phys_memory = 0UL; int i; + /* Limit maximum memory until we implement highmem for sparc */ + if (cmdline_memory_size > 0x9000000) + cmdline_memory_size = 0x9000000; + /* XXX It is a bit ambiguous here, whether we should * XXX treat the user specified mem=xxx as total wanted * XXX physical memory, or as a limit to the upper @@ -161,7 +165,7 @@ unsigned long __init bootmem_init(void) /* Start with page aligned address of last symbol in kernel * image. */ - start_pfn = PAGE_ALIGN((unsigned long) &_end) - PAGE_OFFSET; + start_pfn = (unsigned long)__pa(PAGE_ALIGN((unsigned long) &_end)); /* Adjust up to the physical address where the kernel begins. */ start_pfn += phys_base; @@ -281,8 +285,8 @@ static void __init taint_real_pages(void) unsigned long start, end; start = sp_banks[i].base_addr; - end = start + - sp_banks[i].num_bytes; + end = start + sp_banks[i].num_bytes; + while (start < end) { set_bit (start >> 20, sparc_valid_addr_bitmap); @@ -379,19 +383,17 @@ void __init mem_init(void) } memset(sparc_valid_addr_bitmap, 0, i << 2); - addr = KERNBASE; - last = PAGE_ALIGN((unsigned long)&_end); /* fix this */ - while(addr < last) { #ifdef CONFIG_BLK_DEV_INITRD + addr = __va(phys_base); + last = PAGE_ALIGN((unsigned long)&_end) + phys_base; + while(addr < last) { if (initrd_below_start_ok && addr >= initrd_start && addr < initrd_end) mem_map[MAP_NR(addr)].flags &= ~(1<> 8, sparc_valid_addr_bitmap); addr += PAGE_SIZE; } +#endif taint_real_pages(); @@ -444,9 +446,7 @@ void free_initmem (void) unsigned long page; struct page *p; - page = (addr + - ((unsigned long) __va(phys_base)) - - PAGE_OFFSET); + page = addr + phys_base; p = mem_map + MAP_NR(page); ClearPageReserved(p); diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 2e8bb204e220..90b4aee694d0 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -1,4 +1,4 @@ -/* $Id: io-unit.c,v 1.19 2000/01/08 17:01:18 anton Exp $ +/* $Id: io-unit.c,v 1.20 2000/01/15 00:51:27 anton Exp $ * io-unit.c: IO-UNIT specific routines for memory management. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -190,7 +190,7 @@ static void iounit_map_dma_area(unsigned long va, __u32 addr, int len) pmdp = pmd_offset(pgdp, addr); ptep = pte_offset(pmdp, addr); - set_pte(ptep, pte_val(mk_pte(page, dvma_prot))); + set_pte(ptep, pte_val(mk_pte(mem_map + MAP_NR(page), dvma_prot))); i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 94214b4e11c9..5a8cc8c5b6d5 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c @@ -1,4 +1,4 @@ -/* $Id: iommu.c,v 1.17 2000/01/08 17:01:18 anton Exp $ +/* $Id: iommu.c,v 1.18 2000/01/15 00:51:27 anton Exp $ * iommu.c: IOMMU specific routines for memory management. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -241,13 +241,13 @@ static void iommu_map_dma_area(unsigned long va, __u32 addr, int len) else if (viking_flush) viking_flush_page(page); else - flush_page_to_ram(page); + __flush_page_to_ram(page); pgdp = pgd_offset(&init_mm, addr); pmdp = pmd_offset(pgdp, addr); ptep = pte_offset(pmdp, addr); - set_pte(ptep, pte_val(mk_pte(page, dvma_prot))); + set_pte(ptep, mk_pte(mem_map + MAP_NR(page), dvma_prot)); if (ipte_cache != 0) { iopte_val(*iopte++) = MKIOPTE(__pa(page)); } else { diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 616fbe599be6..77e9aa841166 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1,4 +1,4 @@ -/* $Id: srmmu.c,v 1.202 2000/01/09 10:46:50 anton Exp $ +/* $Id: srmmu.c,v 1.203 2000/01/15 00:51:28 anton Exp $ * srmmu.c: SRMMU specific routines for memory management. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -118,13 +118,13 @@ static inline int srmmu_device_memory(unsigned long x) } static unsigned long srmmu_pgd_page(pgd_t pgd) -{ return srmmu_device_memory(pgd_val(pgd))?~0:__va((pgd_val(pgd) & SRMMU_PTD_PMASK) << 4); } +{ return srmmu_device_memory(pgd_val(pgd))?~0:(unsigned long)__va((pgd_val(pgd) & SRMMU_PTD_PMASK) << 4); } static unsigned long srmmu_pmd_page(pmd_t pmd) -{ return srmmu_device_memory(pmd_val(pmd))?~0:__va((pmd_val(pmd) & SRMMU_PTD_PMASK) << 4); } +{ return srmmu_device_memory(pmd_val(pmd))?~0:(unsigned long)__va((pmd_val(pmd) & SRMMU_PTD_PMASK) << 4); } static unsigned long srmmu_pte_pagenr(pte_t pte) -{ return srmmu_device_memory(pte_val(pte))?~0:__va((pte_val(pte) & SRMMU_PTE_PMASK) << 4); } +{ return srmmu_device_memory(pte_val(pte))?~0:(((pte_val(pte) & SRMMU_PTE_PMASK) << 4) >> PAGE_SHIFT); } static inline int srmmu_pte_none(pte_t pte) { return !(pte_val(pte) & 0xFFFFFFF); } @@ -169,8 +169,8 @@ static inline pte_t srmmu_pte_mkyoung(pte_t pte) { return __pte(pte_val(pte) * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -static pte_t srmmu_mk_pte(unsigned long page, pgprot_t pgprot) -{ return __pte(((__pa(page)) >> 4) | pgprot_val(pgprot)); } +static pte_t srmmu_mk_pte(struct page *page, pgprot_t pgprot) +{ return __pte((((page - mem_map) << PAGE_SHIFT) >> 4) | pgprot_val(pgprot)); } static pte_t srmmu_mk_pte_phys(unsigned long page, pgprot_t pgprot) { return __pte(((page) >> 4) | pgprot_val(pgprot)); } @@ -595,7 +595,7 @@ void srmmu_mapioaddr(unsigned long physaddr, unsigned long virt_addr, int bus_ty tmp |= SRMMU_PRIV_RDONLY; else tmp |= SRMMU_PRIV; - flush_page_to_ram(virt_addr); + __flush_page_to_ram(virt_addr); set_pte(ptep, __pte(tmp)); flush_tlb_all(); } @@ -1200,22 +1200,16 @@ static inline void memprobe_error(char *msg) prom_halt(); } -/* Assumptions: The bank given to the kernel from the prom/bootloader - * is part of a full bank which is at least 4MB in size and begins at - * 0xf0000000 (ie. KERNBASE). - */ static inline void map_kernel(void) { int i; for (i = 0; sp_banks[i].num_bytes != 0; i++) { - map_spbank(sp_banks[i].base_addr + PAGE_OFFSET, i); + map_spbank(__va(sp_banks[i].base_addr), i); } init_mm.mmap->vm_start = PAGE_OFFSET; BTFIXUPSET_SIMM13(user_ptrs_per_pgd, PAGE_OFFSET / SRMMU_PGDIR_SIZE); - - return; /* SUCCESS! */ } /* Paging initialization on the Sparc Reference MMU. */ @@ -1261,7 +1255,7 @@ void __init srmmu_paging_init(void) last_valid_pfn = end_pfn = bootmem_init(); - srmmu_allocate_ptable_skeleton(KERNBASE, end_of_phys_memory + PAGE_OFFSET); + srmmu_allocate_ptable_skeleton(KERNBASE, __va(end_of_phys_memory)); #if CONFIG_SUN_IO srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END); srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END); @@ -1275,7 +1269,16 @@ void __init srmmu_paging_init(void) srmmu_inherit_prom_mappings(0xfe400000,(LINUX_OPPROM_ENDVM-PAGE_SIZE)); map_kernel(); - srmmu_context_table = __alloc_bootmem(num_contexts*sizeof(ctxd_t), SMP_CACHE_BYTES, 0UL); + +#define BOOTMEM_BROKEN +#ifdef BOOTMEM_BROKEN + srmmu_context_table = __alloc_bootmem(num_contexts*sizeof(ctxd_t)*2, SMP_CACHE_BYTES, 0UL); + (unsigned long)srmmu_context_table += num_contexts*sizeof(ctxd_t); + (unsigned long)srmmu_context_table &= ~(num_contexts*sizeof(ctxd_t)-1); +#else + srmmu_context_table = __alloc_bootmem(num_contexts*sizeof(ctxd_t), num_contexts*sizeof(ctxd_t), 0UL); +#endif + srmmu_ctx_table_phys = (ctxd_t *) __pa((unsigned long) srmmu_context_table); for(i = 0; i < num_contexts; i++) ctxd_set(&srmmu_context_table[i], swapper_pg_dir); @@ -1550,7 +1553,7 @@ static void __init init_hypersparc(void) BTFIXUPSET_CALL(flush_tlb_range, hypersparc_flush_tlb_range, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_page, hypersparc_flush_tlb_page, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, hypersparc_flush_page_to_ram, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, hypersparc_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, hypersparc_flush_sig_insns, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_page_for_dma, hypersparc_flush_page_for_dma, BTFIXUPCALL_NOP); @@ -1624,7 +1627,7 @@ static void __init init_cypress_common(void) BTFIXUPSET_CALL(flush_chunk, cypress_flush_chunk, BTFIXUPCALL_NORM); /* local flush _only_ */ - BTFIXUPSET_CALL(flush_page_to_ram, cypress_flush_page_to_ram, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, cypress_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, cypress_flush_sig_insns, BTFIXUPCALL_NOP); BTFIXUPSET_CALL(flush_page_for_dma, cypress_flush_page_for_dma, BTFIXUPCALL_NOP); @@ -1738,7 +1741,7 @@ static void __init init_swift(void) BTFIXUPSET_CALL(flush_tlb_page, swift_flush_tlb_page, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_range, swift_flush_tlb_range, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, swift_flush_page_to_ram, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, swift_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, swift_flush_sig_insns, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_page_for_dma, swift_flush_page_for_dma, BTFIXUPCALL_NORM); @@ -1898,7 +1901,7 @@ static void __init init_turbosparc(void) BTFIXUPSET_CALL(flush_tlb_page, turbosparc_flush_tlb_page, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_range, turbosparc_flush_tlb_range, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, turbosparc_flush_page_to_ram, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, turbosparc_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_chunk, turbosparc_flush_chunk, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, turbosparc_flush_sig_insns, BTFIXUPCALL_NOP); @@ -1940,7 +1943,7 @@ static void __init init_tsunami(void) BTFIXUPSET_CALL(flush_tlb_page, tsunami_flush_tlb_page, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_range, tsunami_flush_tlb_range, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, tsunami_flush_page_to_ram, BTFIXUPCALL_NOP); + BTFIXUPSET_CALL(__flush_page_to_ram, tsunami_flush_page_to_ram, BTFIXUPCALL_NOP); BTFIXUPSET_CALL(flush_sig_insns, tsunami_flush_sig_insns, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_page_for_dma, tsunami_flush_page_for_dma, BTFIXUPCALL_NORM); @@ -1997,7 +2000,7 @@ static void __init poke_viking(void) BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm); BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range); BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page); - BTFIXUPCOPY_CALL(flush_page_to_ram, local_flush_page_to_ram); + BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram); BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns); BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma); btfixup(); @@ -2060,7 +2063,7 @@ static void __init init_viking(void) BTFIXUPSET_CALL(flush_tlb_range, viking_flush_tlb_range, BTFIXUPCALL_NORM); } - BTFIXUPSET_CALL(flush_page_to_ram, viking_flush_page_to_ram, BTFIXUPCALL_NOP); + BTFIXUPSET_CALL(__flush_page_to_ram, viking_flush_page_to_ram, BTFIXUPCALL_NOP); BTFIXUPSET_CALL(flush_sig_insns, viking_flush_sig_insns, BTFIXUPCALL_NOP); poke_srmmu = poke_viking; @@ -2388,7 +2391,7 @@ void __init ld_mmu_srmmu(void) BTFIXUPCOPY_CALL(local_flush_tlb_mm, flush_tlb_mm); BTFIXUPCOPY_CALL(local_flush_tlb_range, flush_tlb_range); BTFIXUPCOPY_CALL(local_flush_tlb_page, flush_tlb_page); - BTFIXUPCOPY_CALL(local_flush_page_to_ram, flush_page_to_ram); + BTFIXUPCOPY_CALL(local_flush_page_to_ram, __flush_page_to_ram); BTFIXUPCOPY_CALL(local_flush_sig_insns, flush_sig_insns); BTFIXUPCOPY_CALL(local_flush_page_for_dma, flush_page_for_dma); @@ -2402,7 +2405,7 @@ void __init ld_mmu_srmmu(void) BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_page, smp_flush_tlb_page, BTFIXUPCALL_NORM); } - BTFIXUPSET_CALL(flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM); #endif diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 132a115a6147..e0bd738d68d2 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -1,4 +1,4 @@ -/* $Id: sun4c.c,v 1.184 2000/01/09 09:13:34 anton Exp $ +/* $Id: sun4c.c,v 1.185 2000/01/15 00:51:32 anton Exp $ * sun4c.c: Doing in software what should be done in hardware. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -1563,13 +1563,12 @@ static void sun4c_flush_cache_page_hw(struct vm_area_struct *vma, unsigned long } } -static void sun4c_flush_page_to_ram_hw(struct page *page) +static void sun4c_flush_page_to_ram_hw(unsigned long page) { unsigned long flags; - unsigned long addr = page_address(page); save_and_cli(flags); - sun4c_flush_page_hw(addr); + sun4c_flush_page_hw(page); restore_flags(flags); } @@ -1686,13 +1685,12 @@ static void sun4c_flush_cache_page_sw(struct vm_area_struct *vma, unsigned long } } -static void sun4c_flush_page_to_ram_sw(struct page *page) +static void sun4c_flush_page_to_ram_sw(unsigned long page) { unsigned long flags; - unsigned long addr = page_address(page); save_and_cli(flags); - sun4c_flush_page_sw(addr); + sun4c_flush_page_sw(page); restore_flags(flags); } @@ -2638,7 +2636,7 @@ void __init ld_mmu_sun4c(void) BTFIXUPSET_CALL(flush_cache_mm, sun4c_flush_cache_mm_hw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_cache_range, sun4c_flush_cache_range_hw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_cache_page, sun4c_flush_cache_page_hw, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, sun4c_flush_page_to_ram_hw, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, sun4c_flush_page_to_ram_hw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_mm, sun4c_flush_tlb_mm_hw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_range, sun4c_flush_tlb_range_hw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_page, sun4c_flush_tlb_page_hw, BTFIXUPCALL_NORM); @@ -2649,7 +2647,7 @@ void __init ld_mmu_sun4c(void) BTFIXUPSET_CALL(flush_cache_mm, sun4c_flush_cache_mm_sw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_cache_range, sun4c_flush_cache_range_sw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_cache_page, sun4c_flush_cache_page_sw, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(flush_page_to_ram, sun4c_flush_page_to_ram_sw, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(__flush_page_to_ram, sun4c_flush_page_to_ram_sw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_mm, sun4c_flush_tlb_mm_sw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_range, sun4c_flush_tlb_range_sw, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_tlb_page, sun4c_flush_tlb_page_sw, BTFIXUPCALL_NORM); diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S index f8959a0ac953..bee2865dcc53 100644 --- a/arch/sparc/mm/viking.S +++ b/arch/sparc/mm/viking.S @@ -1,4 +1,4 @@ -/* $Id: viking.S,v 1.14 1999/08/14 03:51:50 anton Exp $ +/* $Id: viking.S,v 1.15 2000/01/15 00:51:36 anton Exp $ * viking.S: High speed Viking cache/mmu operations * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -35,37 +35,14 @@ sun4dsmp_flush_tlb_spin: .globl viking_flush_tlb_all, viking_flush_tlb_mm .globl viking_flush_tlb_range, viking_flush_tlb_page - .globl viking_c_flush_chunk, viking_s_flush_chunk - -viking_s_flush_chunk: - sethi %hi(KERNBASE), %g2 - ba 2f - sub %o0, %g2, %g3 - -viking_c_flush_chunk: - sethi %hi(KERNBASE), %g2 - cmp %o0, %g2 - bgeu 2f - sub %o0, %g2, %g3 - sethi BTFIXUP_SETHI(page_contig_offset), %g2 - ba 2f - sub %o0, %g2, %g3 - -viking_flush_page: viking_flush_chunk: - sethi %hi(C_LABEL(srmmu_v2p_hash)), %g2 - srl %o0, 24, %o1 - or %g2, %lo(C_LABEL(srmmu_v2p_hash)), %g2 - sll %o1, 2, %o1 - ld [%g2 + %o1], %g3 - and %o0, PAGE_MASK, %o0 - cmp %g3, -1 - be 9f - add %o0, %g3, %g3 -2: srl %g3, 12, %g1 ! ppage >> 12 +viking_flush_page: + sethi %hi(PAGE_OFFSET), %g2 + sub %o0, %g2, %g3 + srl %g3, 12, %g1 ! ppage >> 12 clr %o1 ! set counter, 0 - 127 - sethi %hi(KERNBASE + PAGE_SIZE - 0x80000000), %o3 + sethi %hi(PAGE_OFFSET + PAGE_SIZE - 0x80000000), %o3 sethi %hi(0x80000000), %o4 sethi %hi(VIKING_PTAG_VALID), %o5 sethi %hi(2*PAGE_SIZE), %o0 @@ -85,7 +62,7 @@ viking_flush_chunk: andcc %g2, %o5, %g0 ! ptag VALID? be 7f - add %g4, %o3, %g2 ! (KERNBASE + PAGE_SIZE) | (set << 5) + add %g4, %o3, %g2 ! (PAGE_OFFSET + PAGE_SIZE) | (set << 5) ld [%g2], %g3 ld [%g2 + %g7], %g3 add %g2, %o0, %g2 @@ -113,16 +90,9 @@ viking_flush_chunk: nop viking_mxcc_flush_page: - sethi %hi(C_LABEL(srmmu_v2p_hash)), %g2 - srl %o0, 24, %o1 - or %g2, %lo(C_LABEL(srmmu_v2p_hash)), %g2 - sll %o1, 2, %o1 - ld [%g2 + %o1], %g3 - and %o0, PAGE_MASK, %o0 - cmp %g3, -1 - be 9f - add %o0, %g3, %g3 -2: sub %g3, -PAGE_SIZE, %g3 ! ppage + PAGE_SIZE + sethi %hi(PAGE_OFFSET), %g2 + sub %o0, %g2, %g3 + sub %g3, -PAGE_SIZE, %g3 ! ppage + PAGE_SIZE sethi %hi(MXCC_SRCSTREAM), %o3 ! assume %hi(MXCC_SRCSTREAM) == %hi(MXCC_DESTSTREAM) mov 0x10, %g2 ! set cacheable bit or %o3, %lo(MXCC_SRCSTREAM), %o2 diff --git a/arch/sparc64/kernel/binfmt_elf32.c b/arch/sparc64/kernel/binfmt_elf32.c index 252a685f415f..76516f2f246d 100644 --- a/arch/sparc64/kernel/binfmt_elf32.c +++ b/arch/sparc64/kernel/binfmt_elf32.c @@ -129,6 +129,13 @@ struct elf_prpsinfo32 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; +#include + +#undef NEW_TO_OLD_UID +#undef NEW_TO_OLD_GID +#define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) +#define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) + #define elf_addr_t u32 #define elf_caddr_t u32 #undef start_thread diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 225780f9d148..df636ec6f9f3 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S @@ -1,4 +1,4 @@ -/* $Id: entry.S,v 1.111 2000/01/11 17:33:29 jj Exp $ +/* $Id: entry.S,v 1.112 2000/01/14 07:12:31 davem Exp $ * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points. * * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu) @@ -768,9 +768,9 @@ sunos_getpid: /* SunOS getuid() returns uid in %o0 and euid in %o1 */ .globl sunos_getuid sunos_getuid: - call sys_geteuid16 + call sys32_geteuid16 nop - call sys_getuid16 + call sys32_getuid16 stx %o0, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I1] b,pt %xcc, ret_sys_call stx %o0, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I0] @@ -778,9 +778,9 @@ sunos_getuid: /* SunOS getgid() returns gid in %o0 and egid in %o1 */ .globl sunos_getgid sunos_getgid: - call sys_getegid16 + call sys32_getegid16 nop - call sys_getgid16 + call sys32_getgid16 stx %o0, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I1] b,pt %xcc, ret_sys_call stx %o0, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I0] diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c index 66e2b0bbec99..f0e512666532 100644 --- a/arch/sparc64/kernel/signal32.c +++ b/arch/sparc64/kernel/signal32.c @@ -1,4 +1,4 @@ -/* $Id: signal32.c,v 1.56 1999/12/20 01:16:16 davem Exp $ +/* $Id: signal32.c,v 1.58 2000/01/14 09:40:08 jj Exp $ * arch/sparc64/kernel/signal32.c * * Copyright (C) 1991, 1992 Linus Torvalds diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 51e68a412a95..4083680603df 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.128 2000/01/11 17:33:25 jj Exp $ +/* $Id: sys_sparc32.c,v 1.130 2000/01/14 09:40:07 jj Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -77,6 +77,181 @@ __ret; \ }) +extern asmlinkage long sys_chown(const char *, uid_t,gid_t); +extern asmlinkage long sys_lchown(const char *, uid_t,gid_t); +extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t); +extern asmlinkage long sys_setregid(gid_t, gid_t); +extern asmlinkage long sys_setgid(gid_t); +extern asmlinkage long sys_setreuid(uid_t, uid_t); +extern asmlinkage long sys_setuid(uid_t); +extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t); +extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t); +extern asmlinkage long sys_setfsuid(uid_t); +extern asmlinkage long sys_setfsgid(gid_t); + +/* For this source file, we want overflow handling. */ + +#undef high2lowuid +#undef high2lowgid +#undef low2highuid +#undef low2highgid +#undef SET_UID16 +#undef SET_GID16 +#undef NEW_TO_OLD_UID +#undef NEW_TO_OLD_GID +#undef SET_OLDSTAT_UID +#undef SET_OLDSTAT_GID +#undef SET_STAT_UID +#undef SET_STAT_GID + +#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) +#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) +#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid) +#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid) +#define SET_UID16(var, uid) var = high2lowuid(uid) +#define SET_GID16(var, gid) var = high2lowgid(gid) +#define NEW_TO_OLD_UID(uid) high2lowuid(uid) +#define NEW_TO_OLD_GID(gid) high2lowgid(gid) +#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) +#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) +#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) +#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) + +asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) +{ + return sys_chown(filename, low2highuid(user), low2highgid(group)); +} + +asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) +{ + return sys_lchown(filename, low2highuid(user), low2highgid(group)); +} + +asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group) +{ + return sys_fchown(fd, low2highuid(user), low2highgid(group)); +} + +asmlinkage long sys32_setregid16(u16 rgid, u16 egid) +{ + return sys_setregid(low2highgid(rgid), low2highgid(egid)); +} + +asmlinkage long sys32_setgid16(u16 gid) +{ + return sys_setgid((gid_t)gid); +} + +asmlinkage long sys32_setreuid16(u16 ruid, u16 euid) +{ + return sys_setreuid(low2highuid(ruid), low2highuid(euid)); +} + +asmlinkage long sys32_setuid16(u16 uid) +{ + return sys_setuid((uid_t)uid); +} + +asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid) +{ + return sys_setresuid(low2highuid(ruid), low2highuid(euid), + low2highuid(suid)); +} + +asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) +{ + int retval; + + if (!(retval = put_user(high2lowuid(current->uid), ruid)) && + !(retval = put_user(high2lowuid(current->euid), euid))) + retval = put_user(high2lowuid(current->suid), suid); + + return retval; +} + +asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid) +{ + return sys_setresgid(low2highgid(rgid), low2highgid(egid), + low2highgid(sgid)); +} + +asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) +{ + int retval; + + if (!(retval = put_user(high2lowgid(current->gid), rgid)) && + !(retval = put_user(high2lowgid(current->egid), egid))) + retval = put_user(high2lowgid(current->sgid), sgid); + + return retval; +} + +asmlinkage long sys32_setfsuid16(u16 uid) +{ + return sys_setfsuid((uid_t)uid); +} + +asmlinkage long sys32_setfsgid16(u16 gid) +{ + return sys_setfsgid((gid_t)gid); +} + +asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) +{ + u16 groups[NGROUPS]; + int i,j; + + if (gidsetsize < 0) + return -EINVAL; + i = current->ngroups; + if (gidsetsize) { + if (i > gidsetsize) + return -EINVAL; + for(j=0;jgroups[j]; + if (copy_to_user(grouplist, groups, sizeof(u16)*i)) + return -EFAULT; + } + return i; +} + +asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) +{ + u16 groups[NGROUPS]; + int i; + + if (!capable(CAP_SETGID)) + return -EPERM; + if ((unsigned) gidsetsize > NGROUPS) + return -EINVAL; + if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16))) + return -EFAULT; + for (i = 0 ; i < gidsetsize ; i++) + current->groups[i] = (gid_t)groups[i]; + current->ngroups = gidsetsize; + return 0; +} + +asmlinkage long sys32_getuid16(void) +{ + return high2lowuid(current->uid); +} + +asmlinkage long sys32_geteuid16(void) +{ + return high2lowuid(current->euid); +} + +asmlinkage long sys32_getgid16(void) +{ + return high2lowgid(current->gid); +} + +asmlinkage long sys32_getegid16(void) +{ + return high2lowgid(current->egid); +} + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. @@ -1528,11 +1703,11 @@ static void *do_ncp_super_data_conv(void *raw_data) n->dir_mode = n32->dir_mode; n->file_mode = n32->file_mode; - n->gid = n32->gid; - n->uid = n32->uid; + n->gid = low2highgid(n32->gid); + n->uid = low2highuid(n32->uid); memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int))); n->wdog_pid = n32->wdog_pid; - n->mounted_uid = n32->mounted_uid; + n->mounted_uid = low2highuid(n32->mounted_uid); return raw_data; } @@ -1551,9 +1726,9 @@ static void *do_smb_super_data_conv(void *raw_data) struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; s->version = s32->version; - s->mounted_uid = s32->mounted_uid; - s->uid = s32->uid; - s->gid = s32->gid; + s->mounted_uid = low2highuid(s32->mounted_uid); + s->uid = low2highuid(s32->uid); + s->gid = low2highgid(s32->gid); s->file_mode = s32->file_mode; s->dir_mode = s32->dir_mode; return raw_data; @@ -3568,6 +3743,8 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) &arg32->ca32_export.ex32_anon_uid); err |= __get_user(karg->ca_export.ex_anon_gid, &arg32->ca32_export.ex32_anon_gid); + karg->ca_export.ex_anon_uid = high2lowuid(karg->ca_export.ex_anon_uid); + karg->ca_export.ex_anon_gid = high2lowgid(karg->ca_export.ex_anon_gid); return err; } diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index 073ba40a53b1..b66a116b43cc 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S @@ -1,4 +1,4 @@ -/* $Id: systbls.S,v 1.64 2000/01/11 17:33:28 jj Exp $ +/* $Id: systbls.S,v 1.65 2000/01/14 07:12:34 davem Exp $ * systbls.S: System call entry point tables for OS compatibility. * The native Linux system call table lives here also. * @@ -21,21 +21,21 @@ sys_call_table32: /*0*/ .word sys_nis_syscall, sparc_exit, sys_fork, sys_read, sys_write /*5*/ .word sparc32_open, sys_close, sys32_wait4, sys_creat, sys_link -/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod -/*15*/ .word sys32_chmod, sys_lchown16, sparc_brk, sys_perfctr, sys32_lseek -/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 +/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod +/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek +/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 /*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause /*30*/ .word sys32_utime, sys_lchown, sys_fchown, sys_access, sys_nice .word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile /*40*/ .word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_getuid - .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 -/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl + .word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 +/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve /*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize .word sys_msync, sys_vfork, sys32_pread, sys32_pwrite, sys_geteuid /*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect - .word sys_setregid, sys_vhangup, sys32_truncate64, sys_getgroups, sys_getgroups16 -/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64 + .word sys_setregid, sys_vhangup, sys32_truncate64, sys_getgroups, sys32_getgroups16 +/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64 .word sys_swapon, sys32_getitimer, sys_setuid, sys_sethostname, sys_setgid /*90*/ .word sys_dup2, sys_setfsuid, sys32_fcntl, sys32_select, sys_setfsgid .word sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall @@ -43,8 +43,8 @@ sys_call_table32: .word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid /*110*/ .word sys_setresgid, sys_getresgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd -/*120*/ .word sys32_readv, sys32_writev, sys32_settimeofday, sys_fchown16, sys_fchmod - .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate +/*120*/ .word sys32_readv, sys32_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod + .word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate /*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64 /*140*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getrlimit @@ -64,7 +64,7 @@ sys_call_table32: /*210*/ .word sys_nis_syscall, sys_nis_syscall, sys_waitpid, sys_swapoff, sys32_sysinfo .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex /*220*/ .word sys32_sigprocmask, sys32_create_module, sys32_delete_module, sys32_get_kernel_syms, sys_getpgid - .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys_setfsuid16, sys_setfsgid16 + .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 /*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_nis_syscall .word sys_nis_syscall, sys_llseek, sys_mlock, sys_munlock, sys_mlockall /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler @@ -143,7 +143,7 @@ sunos_sys_table: .word sys_close, sunos_wait4, sys_creat .word sys_link, sys_unlink, sunos_execv .word sys_chdir, sunos_nosys, sys32_mknod - .word sys32_chmod, sys_lchown16, sunos_brk + .word sys32_chmod, sys32_lchown16, sunos_brk .word sunos_nosys, sys32_lseek, sunos_getpid .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_getuid, sunos_nosys, sys_ptrace @@ -164,8 +164,8 @@ sunos_sys_table: .word sunos_nosys, sunos_sbrk, sunos_sstk .word sunos_mmap, sunos_vadvise, sys_munmap .word sys_mprotect, sunos_madvise, sys_vhangup - .word sunos_nosys, sunos_mincore, sys_getgroups16 - .word sys_setgroups16, sys_getpgrp, sunos_setpgrp + .word sunos_nosys, sunos_mincore, sys32_getgroups16 + .word sys32_setgroups16, sys_getpgrp, sunos_setpgrp .word sys32_setitimer, sunos_nosys, sys_swapon .word sys32_getitimer, sys_gethostname, sys_sethostname .word sunos_getdtablesize, sys_dup2, sunos_nop @@ -179,9 +179,9 @@ sunos_sys_table: .word sys32_sigstack, sys32_recvmsg, sys32_sendmsg .word sunos_nosys, sys32_gettimeofday, sys32_getrusage .word sunos_getsockopt, sunos_nosys, sunos_readv - .word sunos_writev, sys32_settimeofday, sys_fchown16 - .word sys_fchmod, sys32_recvfrom, sys_setreuid16 - .word sys_setregid16, sys_rename, sys_truncate + .word sunos_writev, sys32_settimeofday, sys32_fchown16 + .word sys_fchmod, sys32_recvfrom, sys32_setreuid16 + .word sys32_setregid16, sys_rename, sys_truncate .word sys_ftruncate, sys_flock, sunos_nosys .word sys32_sendto, sys_shutdown, sys_socketpair .word sys_mkdir, sys_rmdir, sys32_utimes diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c index fb440ae10d15..7db80f3e49d0 100644 --- a/drivers/acorn/block/mfmhd.c +++ b/drivers/acorn/block/mfmhd.c @@ -1018,8 +1018,7 @@ static void mfm_interrupt_handler(int unused, void *dev_id, struct pt_regs *regs /* - * Tell the user about the drive if we decided it exists. Also, - * set the size of the drive. + * Tell the user about the drive if we decided it exists. */ static void mfm_geometry (int drive) { @@ -1028,8 +1027,6 @@ static void mfm_geometry (int drive) mfm_info[drive].cylinders * mfm_info[drive].heads * mfm_info[drive].sectors / 4096, mfm_info[drive].cylinders, mfm_info[drive].heads, mfm_info[drive].sectors, mfm_info[drive].lowcurrent, mfm_info[drive].precomp); - mfm[drive << 6].start_sect = 0; - mfm[drive << 6].nr_sects = mfm_info[drive].cylinders * mfm_info[drive].heads * mfm_info[drive].sectors / 2; } #ifdef CONFIG_BLK_DEV_MFM_AUTODETECT @@ -1283,6 +1280,7 @@ void mfm_setup(char *str, int *ints) * Set the CHS from the ADFS boot block if it is present. This is not ideal * since if there are any non-ADFS partitions on the disk, this won't work! * Hence, I want to get rid of this... + * Please, do. It does seriously sucking things. */ void xd_set_geometry(kdev_t dev, unsigned char secsptrack, unsigned char heads, unsigned long discsize, unsigned int secsize) @@ -1308,18 +1306,16 @@ void xd_set_geometry(kdev_t dev, unsigned char secsptrack, unsigned char heads, if (raw_cmd.dev == drive) mfm_specify (); mfm_geometry (drive); + mfm[drive << 6].start_sect = 0; + mfm[drive << 6].nr_sects = mfm_info[drive].cylinders * mfm_info[drive].heads * mfm_info[drive].sectors / 2; } } -static void mfm_geninit (struct gendisk *gdev); - static struct gendisk mfm_gendisk = { MAJOR_NR, /* Major number */ "mfm", /* Major name */ 6, /* Bits to shift to get real from partition */ 1 << 6, /* Number of partitions per real */ - MFM_MAXDRIVES, /* maximum number of real */ - mfm_geninit, /* init function */ mfm, /* hd struct */ mfm_sizes, /* block sizes */ 0, /* number */ @@ -1327,17 +1323,23 @@ static struct gendisk mfm_gendisk = { NULL /* next */ }; -static void mfm_geninit (struct gendisk *gdev) +static void mfm_geninit (void) { int i; - mfm_drives = mfm_initdrives(); + for (i = 0; i < (MFM_MAXDRIVES << 6); i++) { + /* Can't increase this - if you do all hell breaks loose */ + mfm_blocksizes[i] = 1024; + mfm_sectsizes[i] = 512; + } + blksize_size[MAJOR_NR] = mfm_blocksizes; + hardsect_size[MAJOR_NR] = mfm_sectsizes; - printk("mfm: detected %d hard drive%s\n", mfm_drives, mfm_drives == 1 ? "" : "s"); - gdev->nr_real = mfm_drives; + mfm_drives = mfm_initdrives(); - for (i = 0; i < mfm_drives; i++) - mfm_geometry (i); + printk("mfm: detected %d hard drive%s\n", mfm_drives, + mfm_drives == 1 ? "" : "s"); + mfm_gendisk.nr_real = mfm_drives; if (request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL)) printk("mfm: unable to get IRQ%d\n", mfm_irq); @@ -1345,12 +1347,11 @@ static void mfm_geninit (struct gendisk *gdev) if (mfm_irqenable) outw(0x80, mfm_irqenable); /* Required to enable IRQs from MFM podule */ - for (i = 0; i < (MFM_MAXDRIVES << 6); i++) { - mfm_blocksizes[i] = 1024; /* Can't increase this - if you do all hell breaks loose */ - mfm_sectsizes[i] = 512; + for (i = 0; i < mfm_drives; i++) { + mfm_geometry (i); + grok_partitions(&mfm_gendisk, i, 1<<6, mfm_info[i].cylinders * + mfm_info[i].heads * mfm_info[i].sectors / 2); } - blksize_size[MAJOR_NR] = mfm_blocksizes; - hardsect_size[MAJOR_NR] = mfm_sectsizes; } static struct block_device_operations mfm_fops = @@ -1457,6 +1458,7 @@ int mfm_init (void) Busy = 0; lastspecifieddrive = -1; + mfm_geninit(); return 0; } @@ -1495,10 +1497,10 @@ static int mfm_reread_partitions(kdev_t dev) mfm_gendisk.part[minor].nr_sects = 0; } - mfm_gendisk.part[start].nr_sects = mfm_info[target].heads * - mfm_info[target].cylinders * mfm_info[target].sectors / 2; + /* Divide by 2, since sectors are 2 times smaller than usual ;-) */ - resetup_one_dev(&mfm_gendisk, target); + grok_partitions(&mfm_gendisk, target, 1<<6, mfm_info[target].heads * + mfm_info[target].cylinders * mfm_info[target].sectors / 2); mfm_info[target].busy = 0; wake_up (&mfm_wait_open); @@ -1508,11 +1510,7 @@ static int mfm_reread_partitions(kdev_t dev) #ifdef MODULE int init_module(void) { - int ret; - ret = mfm_init(); - if (!ret) - mfm_geninit(&mfm_gendisk); - return ret; + return mfm_geninit(); } void cleanup_module(void) diff --git a/drivers/ap1000/ddv.c b/drivers/ap1000/ddv.c index d48b0d9e39a1..86a01136efe5 100644 --- a/drivers/ap1000/ddv.c +++ b/drivers/ap1000/ddv.c @@ -76,7 +76,7 @@ extern void ddv_load_kernel(char *opcodep); extern int ddv_restart_cpu(void); extern int ddv_mlist_available(void); static int ddv_revalidate(kdev_t dev, struct gendisk *gdev); -static void ddv_geninit(struct gendisk *ignored); +static void ddv_geninit(void); static void ddv_release(struct inode * inode, struct file * filp); static void ddv_request1(void); @@ -109,12 +109,6 @@ static struct gendisk ddv_gendisk = { DEVICE_NAME, /* Major name */ PARTN_BITS, /* Bits to shift to get real from partition */ 1 << PARTN_BITS, /* Number of partitions per real */ - 1, /* maximum number of real */ -#ifdef MODULE - NULL, /* called from init_module */ -#else - ddv_geninit, /* init function */ -#endif partition_tables,/* hd struct */ ddv_blk_length, /* block sizes */ 1, /* number */ @@ -122,7 +116,6 @@ static struct gendisk ddv_gendisk = { NULL /* next */ }; - struct ddv_geometry { unsigned char heads; unsigned char sectors; @@ -738,11 +731,9 @@ static void ddv_load_opiu(void) ddv_geometry.cylinders = ddv_sect_length[0] / (ddv_geometry.heads*ddv_geometry.sectors); - ddv_gendisk.part[0].start_sect = 0; - ddv_gendisk.part[0].nr_sects = ddv_sect_length[0]; - - resetup_one_dev(&ddv_gendisk, 0); + grok_partitions(&ddv_gendisk, 0, 1<> 1; @@ -794,8 +785,7 @@ static int ddv_revalidate(kdev_t dev, struct gendisk *gdev) ddv_sect_length[start] = DiskInfo->blocks; ddv_blk_length[start] = DiskInfo->blocks >> 1; - gdev->part[start].nr_sects = ddv_sect_length[start]; - resetup_one_dev(gdev, target); + grok_partitions(gdev, target, 1<GenericDiskInfo.major_name = "rd"; Controller->GenericDiskInfo.minor_shift = DAC960_MaxPartitionsBits; Controller->GenericDiskInfo.max_p = DAC960_MaxPartitions; - Controller->GenericDiskInfo.max_nr = DAC960_MaxLogicalDrives; - Controller->GenericDiskInfo.init = DAC960_InitializeGenericDiskInfo; Controller->GenericDiskInfo.nr_real = Controller->LogicalDriveCount; Controller->GenericDiskInfo.real_devices = Controller; Controller->GenericDiskInfo.next = NULL; @@ -1166,6 +1164,7 @@ static void DAC960_InitializeController(DAC960_Controller_T *Controller) Controller->MonitoringTimer.function = DAC960_MonitoringTimerFunction; add_timer(&Controller->MonitoringTimer); Controller->ControllerInitialized = true; + DAC960_InitializeGenericDiskInfo(&Controller->GenericDiskInfo); } else DAC960_FinalizeController(Controller); } @@ -2439,7 +2438,6 @@ static int DAC960_Open(Inode_T *Inode, File_T *File) Controller->LogicalDriveInitialState[LogicalDriveNumber] = DAC960_LogicalDrive_Online; DAC960_InitializeGenericDiskInfo(&Controller->GenericDiskInfo); - resetup_one_dev(&Controller->GenericDiskInfo, LogicalDriveNumber); } if (Controller->GenericDiskInfo.sizes[MINOR(Inode->i_rdev)] == 0) return -ENXIO; @@ -2573,7 +2571,13 @@ static int DAC960_IOCTL(Inode_T *Inode, File_T *File, */ set_blocksize(Device, BLOCK_SIZE); } - resetup_one_dev(&Controller->GenericDiskInfo, LogicalDriveNumber); + /* + * Leonard, I'll tie you, draw around you a pentagram + * and read this file. Aloud. + */ + grok_partitions( + &Controller->GenericDiskInfo, LogicalDriveNumber, DAC960_MaxPartitions, + Controller->LogicalDriveInformation[Controller->LogicalDriveInformationIndex][LogicalDriveNumber].LogicalDriveSize); return 0; } return -EINVAL; @@ -2895,8 +2899,8 @@ static void DAC960_InitializeGenericDiskInfo(GenericDiskInfo_T *GenericDiskInfo) for (LogicalDriveNumber = 0; LogicalDriveNumber < Controller->LogicalDriveCount; LogicalDriveNumber++) - GenericDiskInfo->part[DAC960_MinorNumber(LogicalDriveNumber, 0)].nr_sects = - LogicalDriveInformation[LogicalDriveNumber].LogicalDriveSize; + grok_partitions(GenericDiskInfo,LogicalDriveNumber,DAC960_MaxPartitions, + LogicalDriveInformation[LogicalDriveNumber].LogicalDriveSize); } @@ -3518,10 +3522,6 @@ int init_module(void) DAC960_Controller_T *Controller = DAC960_Controllers[ControllerNumber]; if (Controller == NULL) continue; DAC960_InitializeGenericDiskInfo(&Controller->GenericDiskInfo); - for (LogicalDriveNumber = 0; - LogicalDriveNumber < Controller->LogicalDriveCount; - LogicalDriveNumber++) - resetup_one_dev(&Controller->GenericDiskInfo, LogicalDriveNumber); } return 0; } diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c index 47ceb63acfed..596c69dcc74e 100644 --- a/drivers/block/acsi.c +++ b/drivers/block/acsi.c @@ -369,7 +369,7 @@ static int acsi_release( struct inode * inode, struct file * file ); static void acsi_prevent_removal( int target, int flag ); static int acsi_change_blk_size( int target, int lun); static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd ); -static void acsi_geninit( struct gendisk *gd ); +static void acsi_geninit(void); static int revalidate_acsidisk( int dev, int maxusage ); static int acsi_revalidate (dev_t); @@ -1386,21 +1386,15 @@ static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd ) static struct gendisk acsi_gendisk = { - MAJOR_NR, /* Major number */ - "ad", /* Major name */ - 4, /* Bits to shift to get real from partition */ - 1 << 4, /* Number of partitions per real */ - MAX_DEV, /* maximum number of real */ -#ifdef MODULE - NULL, /* called from init_module() */ -#else - acsi_geninit, /* init function */ -#endif - acsi_part, /* hd struct */ - acsi_sizes, /* block sizes */ - 0, /* number */ + MAJOR_NR, /* Major number */ + "ad", /* Major name */ + 4, /* Bits to shift to get real from partition */ + 1 << 4, /* Number of partitions per real */ + acsi_part, /* hd struct */ + acsi_sizes, /* block sizes */ + 0, /* number */ (void *)acsi_info, /* internal */ - NULL /* next */ + NULL /* next */ }; #define MAX_SCSI_DEVICE_CODE 10 @@ -1659,7 +1653,7 @@ EXPORT_SYMBOL(acsi_attach_SLMs); int SLM_devices[8]; #endif -static void acsi_geninit( struct gendisk *gd ) +static void acsi_geninit(void) { int i, target, lun; struct acsi_info_struct *aip; @@ -1741,14 +1735,14 @@ static void acsi_geninit( struct gendisk *gd ) NDevices, n_slm ); #endif - for( i = 0; i < NDevices; ++i ) { - acsi_part[i<<4].start_sect = 0; - acsi_part[i<<4].nr_sects = acsi_info[i].size; - } - acsi_gendisk.nr_real = NDevices; for( i = 0; i < (MAX_DEV << 4); i++ ) acsi_blocksizes[i] = 1024; blksize_size[MAJOR_NR] = acsi_blocksizes; + for( i = 0; i < NDevices; ++i ) + grok_partitions(&acsi_gendisk, i, + (acsi_info[i].type==HARDDISK)?1<<4:1, + acsi_info[i].size); + acsi_gendisk.nr_real = NDevices; } #ifdef CONFIG_ATARI_SLM_MODULE @@ -1778,6 +1772,7 @@ static struct block_device_operations acsi_fops = { int acsi_init( void ) { + int err = 0; if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ACSI)) return 0; @@ -1801,10 +1796,11 @@ int acsi_init( void ) gendisk_head = &acsi_gendisk; #ifdef CONFIG_ATARI_SLM - return( slm_init() ); -#else - return 0; + err = slm_init(); #endif + if (!err) + acsi_geninit(); + return err; } @@ -1816,7 +1812,6 @@ int init_module(void) if ((err = acsi_init())) return( err ); printk( KERN_INFO "ACSI driver loaded as module.\n"); - acsi_geninit( &(struct gendisk){ 0,0,0,0,0,0,0,0,0,0,0 } ); return( 0 ); } @@ -1914,9 +1909,7 @@ static int revalidate_acsidisk( int dev, int maxusage ) ENABLE_IRQ(); stdma_release(); - gdev->part[start].nr_sects = aip->size; - if (aip->type == HARDDISK && aip->size > 0) - resetup_one_dev(gdev, device); + grok_partitions(gdev, device, (aip->type==HARDDISK)?1<<4:1, aip->size); DEVICE_BUSY = 0; wake_up(&busy_wait); diff --git a/drivers/block/alim15x3.c b/drivers/block/alim15x3.c index b3b3d1f4e506..9da12d453c50 100644 --- a/drivers/block/alim15x3.c +++ b/drivers/block/alim15x3.c @@ -313,7 +313,6 @@ static void ali15x3_tune_drive (ide_drive_t *drive, byte pio) static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed) { - ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; byte unit = (drive->select.b.unit & 0x01); byte tmpbyte = 0x00; @@ -325,9 +324,9 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed) /* * clear "ultra enable" bit */ - pci_read_config_byte(hwif->pci_dev, m5229_udma, &tmpbyte); + pci_read_config_byte(dev, m5229_udma, &tmpbyte); tmpbyte &= ultra_enable; - pci_write_config_byte(hwif->pci_dev, m5229_udma, tmpbyte); + pci_write_config_byte(dev, m5229_udma, tmpbyte); } err = ide_config_drive_speed(drive, speed); @@ -339,17 +338,17 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed) } if (speed >= XFER_UDMA_0) { - pci_read_config_byte(hwif->pci_dev, m5229_udma, &tmpbyte); + pci_read_config_byte(dev, m5229_udma, &tmpbyte); tmpbyte &= (0x0f << ((1-unit) << 2)); /* * enable ultra dma and set timing */ tmpbyte |= ((0x08 | (4-speed)) << (unit << 2)); - pci_write_config_byte(hwif->pci_dev, m5229_udma, tmpbyte); + pci_write_config_byte(dev, m5229_udma, tmpbyte); if (speed >= XFER_UDMA_3) { - pci_read_config_byte(hwif->pci_dev, 0x4b, &tmpbyte); + pci_read_config_byte(dev, 0x4b, &tmpbyte); tmpbyte |= 1; - pci_write_config_byte(hwif->pci_dev, 0x4b, tmpbyte); + pci_write_config_byte(dev, 0x4b, tmpbyte); } } @@ -519,7 +518,6 @@ unsigned int __init pci_init_ali15x3 (struct pci_dev *dev, const char *name) unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) { - ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; byte ata66mask = hwif->channel ? 0x02 : 0x01; unsigned int ata66 = 0; @@ -614,7 +612,7 @@ unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) * 0x4a, bit1 is 0 => secondary channel * has 80-pin (from host view) */ - pci_read_config_byte(hwif->pci_dev, 0x4a, &tmpbyte); + pci_read_config_byte(dev, 0x4a, &tmpbyte); ata66 = (!(tmpbyte & ata66mask)) ? 0 : 1; __restore_flags(flags); diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 9f5cadc2cfbc..1f65dc71975a 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -171,9 +171,8 @@ static int ida_proc_get_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data) {} #endif -static void ida_geninit(struct gendisk *g) +static void ida_geninit(int ctlr) { - int ctlr = g-ida_gendisk; int i,j; drv_info_t *drv; @@ -317,13 +316,6 @@ int __init init_module(void) cpqarray_init(); if (nr_ctlr == 0) return -EIO; - - for(i=0; iaccess.set_intr_mask(hba[i], FIFO_NOT_EMPTY); ida_procinit(i); - ida_gendisk[i].major = MAJOR_NR + i; - ida_gendisk[i].major_name = "ida"; - ida_gendisk[i].minor_shift = NWD_SHIFT; - ida_gendisk[i].max_p = 16; - ida_gendisk[i].max_nr = 16; - ida_gendisk[i].init = ida_geninit; - ida_gendisk[i].part = ida + (i*256); - ida_gendisk[i].sizes = ida_sizes + (i*256); - /* ida_gendisk[i].nr_real is handled by getgeometry */ blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR + i), request_fns[i]); blk_queue_headactive(BLK_DEFAULT_QUEUE(MAJOR_NR + i), 0); blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256); hardsect_size[MAJOR_NR+i] = ida_hardsizes + (i*256); + read_ahead[MAJOR_NR+i] = READ_AHEAD; + ida_gendisk[i].major = MAJOR_NR + i; + ida_gendisk[i].major_name = "ida"; + ida_gendisk[i].minor_shift = NWD_SHIFT; + ida_gendisk[i].max_p = 16; + ida_gendisk[i].part = ida + (i*256); + ida_gendisk[i].sizes = ida_sizes + (i*256); + /* ida_gendisk[i].nr_real is handled by getgeometry */ /* Get on the disk list */ ida_gendisk[i].next = gendisk_head; @@ -487,6 +478,10 @@ void __init cpqarray_init(void) hba[i]->timer.function = ida_timer; add_timer(&hba[i]->timer); + ida_geninit(i); + for(j=0; jdrv[j].nr_blks); } /* done ! */ return; @@ -1494,7 +1489,7 @@ static int revalidate_allvol(kdev_t dev) getgeometry(ctlr); hba[ctlr]->access.set_intr_mask(hba[ctlr], FIFO_NOT_EMPTY); - ida_geninit(&ida_gendisk[ctlr]); + ida_geninit(ctlr); for(i=0; ipart[start].nr_sects = hba[ctlr]->drv[target].nr_blks; - resetup_one_dev(gdev, target); + /* 16 minors per disk... */ + grok_partitions(gdev, target, 16, hba[ctlr]->drv[target].nr_blks); hba[ctlr]->drv[target].usage_count--; return 0; } diff --git a/drivers/block/hd.c b/drivers/block/hd.c index 5575f54a2de5..7277e0fc23e9 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c @@ -662,15 +662,11 @@ static int hd_release(struct inode * inode, struct file * file) return 0; } -static void hd_geninit(struct gendisk *); - static struct gendisk hd_gendisk = { MAJOR_NR, /* Major number */ "hd", /* Major name */ 6, /* Bits to shift to get real from partition */ 1 << 6, /* Number of partitions per real */ - MAX_HD, /* maximum number of real */ - hd_geninit, /* init function */ hd, /* hd struct */ hd_sizes, /* block sizes */ 0, /* number */ @@ -699,10 +695,17 @@ static void hd_interrupt(int irq, void *dev_id, struct pt_regs *regs) * We enable interrupts in some of the routines after making sure it's * safe. */ -static void hd_geninit(struct gendisk *ignored) +static void hd_geninit(void) { int drive; + for(drive=0; drive < (MAX_HD << 6); drive++) { + hd_blocksizes[drive] = 1024; + hd_hardsectsizes[drive] = 512; + } + blksize_size[MAJOR_NR] = hd_blocksizes; + hardsect_size[MAJOR_NR] = hd_hardsectsizes; + #ifdef __i386__ if (!NR_HD) { extern struct drive_info drive_info; @@ -765,29 +768,27 @@ static void hd_geninit(struct gendisk *ignored) #endif for (drive=0 ; drive < NR_HD ; drive++) { - hd[drive<<6].nr_sects = hd_info[drive].head * - hd_info[drive].sect * hd_info[drive].cyl; printk ("hd%c: %ldMB, CHS=%d/%d/%d\n", drive+'a', hd[drive<<6].nr_sects / 2048, hd_info[drive].cyl, hd_info[drive].head, hd_info[drive].sect); } - if (NR_HD) { - if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) { - printk("hd: unable to get IRQ%d for the hard disk driver\n",HD_IRQ); - NR_HD = 0; - } else { - request_region(HD_DATA, 8, "hd"); - request_region(HD_CMD, 1, "hd(cmd)"); - } + if (!NR_HD) + return; + + if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) { + printk("hd: unable to get IRQ%d for the hard disk driver\n", + HD_IRQ); + NR_HD = 0; + return; } + request_region(HD_DATA, 8, "hd"); + request_region(HD_CMD, 1, "hd(cmd)"); + hd_gendisk.nr_real = NR_HD; - for(drive=0; drive < (MAX_HD << 6); drive++) { - hd_blocksizes[drive] = 1024; - hd_hardsectsizes[drive] = 512; - } - blksize_size[MAJOR_NR] = hd_blocksizes; - hardsect_size[MAJOR_NR] = hd_hardsectsizes; + for(drive=0; drive < NR_HD; drive++) + grok_partitions(&hd_gendisk, drive, 1<<6, hd_info[drive].head * + hd_info[drive].sect * hd_info[drive].cyl); } static struct block_device_operations hd_fops = { @@ -807,6 +808,7 @@ int __init hd_init(void) hd_gendisk.next = gendisk_head; gendisk_head = &hd_gendisk; timer_table[HD_TIMER].fn = hd_times_out; + hd_geninit(); return 0; } @@ -867,8 +869,7 @@ static int revalidate_hddisk(kdev_t dev, int maxusage) MAYBE_REINIT; #endif - gdev->part[start].nr_sects = CAPACITY; - resetup_one_dev(gdev, target); + grok_partitions(gdev, target, 1<<6, CAPACITY); DEVICE_BUSY = 0; wake_up(&busy_wait); diff --git a/drivers/block/ide-cd.c b/drivers/block/ide-cd.c index 2d385556410a..48cf87c81ce0 100644 --- a/drivers/block/ide-cd.c +++ b/drivers/block/ide-cd.c @@ -2005,9 +2005,60 @@ int ide_cdrom_lock_door (struct cdrom_device_info *cdi, int lock) return cdrom_lockdoor (drive, lock); } +#undef __ACER50__ + +#ifdef __ACER50__ +/* + * the buffer struct used by ide_cdrom_get_capabilities() + */ +struct get_capabilities_buf { + char pad[8]; + struct atapi_capabilities_page cap; /* this is 4 bytes short of ATAPI standard */ + char extra_cap[4]; /* Acer 50X needs the regulation size buffer */ +}; + +static +int ide_cdrom_get_capabilities (struct cdrom_device_info *cdi, struct get_capabilities_buf *buf) +{ + int stat, attempts = 3, buflen = sizeof(*buf); + ide_drive_t *drive = (ide_drive_t*) cdi->handle; + struct cdrom_generic_command cgc; + + /* + * Most drives don't care about the buffer size; + * they return as much info as there's room for. + * But some older drives (?) had trouble with the + * standard size, preferring 4 bytes less. + * And the modern Acer 50X rejects anything smaller + * than the standard size. + */ + if (!(drive->id && !strcmp(drive->id->model,"ATAPI CD ROM DRIVE 50X MAX"))) + buflen -= sizeof(buf->extra_cap); /* for all drives except Acer 50X */ + + do { /* we seem to get stat=0x01,err=0x00 the first time (??) */ + stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CAPABILITIES_PAGE, 0); + if (stat == 0) { + /* + * The ACER/AOpen 24X cdrom has the speed + * fields byte-swapped from the standard. + */ + if (!(drive->id && !drive->id->model[0] && !strncmp(drive->id->fw_rev, "241N", 4))) { + buf->cap.curspeed = ntohs(buf->cap.curspeed); + buf->cap.maxspeed = ntohs(buf->cap.maxspeed); + } + CDROM_STATE_FLAGS (drive)->current_speed = (((unsigned int)buf->cap.curspeed) + (176/2)) / 176; + CDROM_CONFIG_FLAGS(drive)->max_speed = (((unsigned int)buf->cap.maxspeed) + (176/2)) / 176; + return 0; + } + } while (--attempts); + return stat; +} +#endif /* __ACER50__ */ + static int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) { +#ifndef __ACER50__ int stat, attempts = 3; ide_drive_t *drive = (ide_drive_t*) cdi->handle; struct cdrom_generic_command cgc; @@ -2015,11 +2066,19 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) char pad[8]; struct atapi_capabilities_page cap; } buf; +#else + int stat; + ide_drive_t *drive = (ide_drive_t*) cdi->handle; + struct cdrom_generic_command cgc; + struct get_capabilities_buf buf; +#endif /* __ACER50__ */ if ((stat = cdrom_select_speed (drive, speed)) < 0) return stat; init_cdrom_command(&cgc, &buf, sizeof(buf)); + +#ifndef __ACER50__ /* Now with that done, update the speed fields */ do { /* we seem to get stat=0x01,err=0x00 the first time (??) */ if (attempts-- <= 0) @@ -2039,6 +2098,11 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) CDROM_CONFIG_FLAGS (drive)->max_speed = (ntohs(buf.cap.maxspeed) + (176/2)) / 176; } +#else + if (ide_cdrom_get_capabilities(cdi,&buf)) + return 0; +#endif /* __ACER50__ */ + cdi->speed = CDROM_STATE_FLAGS (drive)->current_speed; return 0; } @@ -2216,12 +2280,18 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) { struct cdrom_info *info = drive->driver_data; struct cdrom_device_info *cdi = &info->devinfo; +#ifndef __ACER50__ int stat, nslots = 1, attempts = 3; struct cdrom_generic_command cgc; struct { char pad[8]; struct atapi_capabilities_page cap; } buf; +#else + int nslots = 1; + struct cdrom_generic_command cgc; + struct get_capabilities_buf buf; +#endif /* __ACER50__ */ if (CDROM_CONFIG_FLAGS (drive)->nec260) { CDROM_CONFIG_FLAGS (drive)->no_eject = 0; @@ -2238,12 +2308,17 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) */ cdi->handle = (ide_drive_t *) drive; cdi->ops = &ide_cdrom_dops; +#ifndef __ACER50__ /* we seem to get stat=0x01,err=0x00 the first time (??) */ do { if (attempts-- <= 0) return 0; stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CAPABILITIES_PAGE, 0); } while (stat); +#else + if (ide_cdrom_get_capabilities(cdi,&buf)) + return 0; +#endif /* __ACER50__ */ if (buf.cap.lock == 0) CDROM_CONFIG_FLAGS (drive)->no_doorlock = 1; @@ -2282,6 +2357,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) } } +#ifndef __ACER50__ /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */ if (drive->id && !drive->id->model[0] && !strncmp(drive->id->fw_rev, "241N", 4)) { CDROM_STATE_FLAGS (drive)->current_speed = @@ -2294,6 +2370,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) CDROM_CONFIG_FLAGS (drive)->max_speed = (ntohs(buf.cap.maxspeed) + (176/2)) / 176; } +#endif /* __ACER50__ */ /* don't print speed if the drive reported 0. */ diff --git a/drivers/block/ide-probe.c b/drivers/block/ide-probe.c index 5f0ebb7b6d61..efb4705f3018 100644 --- a/drivers/block/ide-probe.c +++ b/drivers/block/ide-probe.c @@ -687,9 +687,7 @@ static void init_gendisk (ide_hwif_t *hwif) gd->major_name = IDE_MAJOR_NAME; /* treated special in genhd.c */ gd->minor_shift = PARTN_BITS; /* num bits for partitions */ gd->max_p = 1<max_nr = units; /* max num real drives */ gd->nr_real = units; /* current num real drives */ - gd->init = &ide_geninit; /* initialization function */ gd->real_devices= hwif; /* ptr to internal data */ gd->next = NULL; /* linked list of major devs */ diff --git a/drivers/block/ide.c b/drivers/block/ide.c index f1c4cedf6e75..f7cfed3998b0 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -548,24 +548,23 @@ unsigned long current_capacity (ide_drive_t *drive) } /* - * ide_geninit() is called exactly *once* for each major, from genhd.c, - * at the beginning of the initial partition check for the drives. + * ide_geninit() is called exactly *once* for each interface. */ -void ide_geninit (struct gendisk *gd) +void ide_geninit (ide_hwif_t *hwif) { unsigned int unit; - ide_hwif_t *hwif = gd->real_devices; + struct gendisk *gd = hwif->gd; for (unit = 0; unit < gd->nr_real; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; - drive->part[0].nr_sects = current_capacity(drive); - if (!drive->present || (drive->media != ide_disk && drive->media != ide_floppy) || + grok_partitions(gd,unit, #ifdef CONFIG_BLK_DEV_ISAPNP - (drive->forced_geom && drive->noprobe) || + (drive->forced_geom && drive->noprobe) || #endif /* CONFIG_BLK_DEV_ISAPNP */ - drive->driver == NULL || !drive->part[0].nr_sects) - drive->part[0].start_sect = -1; /* skip partition check */ + (drive->media != ide_disk && + drive->media != ide_floppy) ? 1 : 1<drives[unit]; -#if 1 - if (drive->present) -#else +#if 0 if ((drive->present) && (drive->part[minor].nr_sects)) +#else + if (drive->present) #endif return drive; } @@ -1775,11 +1776,10 @@ int ide_revalidate_disk (kdev_t i_rdev) drive->part[p].nr_sects = 0; }; - drive->part[0].nr_sects = current_capacity(drive); - if ((drive->media != ide_disk && drive->media != ide_floppy) || - drive->driver == NULL || !drive->part[0].nr_sects) - drive->part[0].start_sect = -1; - resetup_one_dev(HWIF(drive)->gd, drive->select.b.unit); + grok_partitions(HWIF(drive)->gd, drive->select.b.unit, + (drive->media != ide_disk && + drive->media != ide_floppy) ? 1 : 1<busy = 0; wake_up(&drive->wqueue); @@ -3399,7 +3399,6 @@ EXPORT_SYMBOL(ide_spin_wait_hwgroup); EXPORT_SYMBOL(drive_is_flashcard); EXPORT_SYMBOL(ide_timer_expiry); EXPORT_SYMBOL(ide_intr); -EXPORT_SYMBOL(ide_geninit); EXPORT_SYMBOL(ide_fops); EXPORT_SYMBOL(ide_get_queue); EXPORT_SYMBOL(do_ide0_request); @@ -3481,6 +3480,7 @@ EXPORT_SYMBOL(current_capacity); int __init ide_init (void) { static char banner_printed = 0; + int i; if (!banner_printed) { printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); @@ -3493,6 +3493,12 @@ int __init ide_init (void) ide_init_builtin_drivers(); initializing = 0; + for (i = 0; i < MAX_HWIFS; ++i) { + ide_hwif_t *hwif = &ide_hwifs[i]; + if (hwif->present) + ide_geninit(hwif); + } + return 0; } diff --git a/drivers/block/md.c b/drivers/block/md.c index 5786f9765997..9a1a58e882ff 100644 --- a/drivers/block/md.c +++ b/drivers/block/md.c @@ -77,16 +77,12 @@ static struct md_thread *md_sync_thread = NULL; int md_size[MAX_MD_DEV]={0, }; -static void md_geninit (struct gendisk *); - static struct gendisk md_gendisk= { MD_MAJOR, "md", 0, 1, - MAX_MD_DEV, - md_geninit, md_hd_struct, md_size, MAX_MD_DEV, @@ -909,22 +905,20 @@ static int md_status_read_proc(char *page, char **start, off_t off, } #endif -static void md_geninit (struct gendisk *gdisk) +static void md_geninit (void) { int i; + blksize_size[MD_MAJOR] = md_blocksizes; + max_readahead[MD_MAJOR] = md_maxreadahead; for(i=0;ii_rdev; unit = DEVICE_NR(devp); @@ -566,8 +565,8 @@ static int pd_revalidate(kdev_t dev) pd_hd[minor].nr_sects = 0; } - pd_identify(unit); - resetup_one_dev(&pd_gendisk,unit); + if (pd_identify(unit)) + grok_partitions(&pd_gendisk,unit,1< 0; i--) - if(((xd[i] = xd[i-1]) >= 0) && !count) - count = i; - if((xd[0] = count)) - xd_setup(NULL, xd); - xd_geninit(&(struct gendisk) { 0,0,0,0,0,0,0,0,0,0,0 }); - if (!xd_drives) { - /* no drives detected - unload module */ - unregister_blkdev(MAJOR_NR, "xd"); - xd_done(); - return (-1); - } - for (i = 0; i < xd_drives; i++) - resetup_one_dev(&xd_gendisk, i); + int error; + + for (i = 4; i > 0; i--) + if(((xd[i] = xd[i-1]) >= 0) && !count) + count = i; + if((xd[0] = count)) + xd_setup(NULL, xd); + + if (error = xd_init()) + return error; + + printk(KERN_INFO "XD: Loaded as a module.\n"); + if (!xd_drives) { + /* no drives detected - unload module */ + unregister_blkdev(MAJOR_NR, "xd"); + xd_done(); + return (-1); } - return error; + return 0; } void cleanup_module(void) diff --git a/drivers/block/xd.h b/drivers/block/xd.h index c121e8e9f949..b3b9cf4bfd1b 100644 --- a/drivers/block/xd.h +++ b/drivers/block/xd.h @@ -109,7 +109,7 @@ void xd_manual_geo_init (char *command,int *integers); #endif /* MODULE */ static u_char xd_detect (u_char *controller, unsigned int *address); static u_char xd_initdrives (void (*init_drive)(u_char drive)); -static void xd_geninit (struct gendisk *); +static void xd_geninit (void); static int xd_open (struct inode *inode,struct file *file); static void do_xd_request (request_queue_t * q); diff --git a/drivers/i2o/i2o_block.c b/drivers/i2o/i2o_block.c index cbc987e442ea..8e8bf4cd80d8 100644 --- a/drivers/i2o/i2o_block.c +++ b/drivers/i2o/i2o_block.c @@ -821,7 +821,6 @@ static int i2ob_install_device(struct i2o_controller *c, struct i2o_device *d, i i2ob_query_device(dev, 0x0000, 6, &status, 4); i2ob_sizes[unit] = (int)(size>>10); i2ob_hardsizes[unit] = blocksize; - i2ob_gendisk.part[unit].nr_sects = i2ob_sizes[unit]; limit=4096; /* 8 deep scatter gather */ @@ -869,7 +868,7 @@ static int i2ob_install_device(struct i2o_controller *c, struct i2o_device *d, i printk(".\n"); printk("%s: Maximum sectors/read set to %d.\n", d->dev_name, i2ob_max_sectors[unit]); - resetup_one_dev(&i2ob_gendisk, unit>>4); + grok_partitions(&i2ob_gendisk, unit>>4, 1<<4, (long)(size>>9)); return 0; } @@ -1013,14 +1012,6 @@ static struct block_device_operations i2ob_fops = check_media_change: i2ob_media_change, revalidate: i2ob_revalidate, }; - -/* - * Partitioning - */ - -static void i2ob_geninit(struct gendisk *gd) -{ -} static struct gendisk i2ob_gendisk = { @@ -1028,8 +1019,6 @@ static struct gendisk i2ob_gendisk = "i2ohd", 4, 1<<4, - MAX_I2OB, - i2ob_geninit, i2ob, i2ob_sizes, 0, diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 850b71e7f8d6..b4b14362c4f5 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -469,8 +469,6 @@ static int sd_release(struct inode *inode, struct file *file) return 0; } -static void sd_geninit(struct gendisk *); - static struct block_device_operations sd_fops = { open: sd_open, @@ -491,8 +489,6 @@ static struct gendisk sd_gendisk = "sd", /* Major name */ 4, /* Bits to shift to get real from partition */ 1 << 4, /* Number of partitions per real */ - 0, /* maximum number of real */ - sd_geninit, /* init function */ NULL, /* hd struct */ NULL, /* block sizes */ 0, /* number */ @@ -505,13 +501,14 @@ static struct gendisk *sd_gendisks = &sd_gendisk; #define SD_GENDISK(i) sd_gendisks[(i) / SCSI_DISKS_PER_MAJOR] #define LAST_SD_GENDISK sd_gendisks[N_USED_SD_MAJORS - 1] -static void sd_geninit(struct gendisk *ignored) +static void sd_geninit(void) { int i; for (i = 0; i < sd_template.dev_max; ++i) if (rscsi_disks[i].device) - sd[i << 4].nr_sects = rscsi_disks[i].capacity; + grok_partitions(&SD_GENDISK(i), i%SCSI_DISKS_PER_MAJOR, + 1<<4, rscsi_disks[i].capacity); } /* @@ -1018,8 +1015,6 @@ static int sd_init() sd_gendisks[i].major_name = "sd"; sd_gendisks[i].minor_shift = 4; sd_gendisks[i].max_p = 1 << 4; - sd_gendisks[i].max_nr = SCSI_DISKS_PER_MAJOR; - sd_gendisks[i].init = sd_geninit; sd_gendisks[i].part = sd + (i * SCSI_DISKS_PER_MAJOR << 4); sd_gendisks[i].sizes = sd_sizes + (i * SCSI_DISKS_PER_MAJOR << 4); sd_gendisks[i].nr_real = 0; @@ -1028,9 +1023,8 @@ static int sd_init() (void *) (rscsi_disks + i * SCSI_DISKS_PER_MAJOR); } - LAST_SD_GENDISK.max_nr = - (sd_template.dev_max - 1) % SCSI_DISKS_PER_MAJOR + 1; LAST_SD_GENDISK.next = NULL; + sd_geninit(); return 0; } @@ -1175,11 +1169,8 @@ int revalidate_scsidisk(kdev_t dev, int maxusage) MAYBE_REINIT; #endif - sd_gendisks->part[start].nr_sects = CAPACITY; - if (!rscsi_disks[target].device) - return -EBUSY; - resetup_one_dev(&SD_GENDISK(target), - target % SCSI_DISKS_PER_MAJOR); + grok_partitions(&SD_GENDISK(target), target % SCSI_DISKS_PER_MAJOR, + 1<<4, CAPACITY); DEVICE_BUSY = 0; return 0; diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 26bd474d2a37..eca5ddf1556b 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -258,7 +258,7 @@ ncp_delete_inode(struct inode *inode) struct super_block * ncp_read_super(struct super_block *sb, void *raw_data, int silent) { - struct ncp_mount_data *data = (struct ncp_mount_data *) raw_data; + struct ncp_mount_data_kernel data; struct ncp_server *server; struct file *ncp_filp; struct inode *root_inode; @@ -270,11 +270,50 @@ ncp_read_super(struct super_block *sb, void *raw_data, int silent) struct ncp_entry_info finfo; MOD_INC_USE_COUNT; - if (data == NULL) + if (raw_data == NULL) goto out_no_data; - if (data->version != NCP_MOUNT_VERSION) - goto out_bad_mount; - ncp_filp = fget(data->ncp_fd); + switch (*(int*)raw_data) { + case NCP_MOUNT_VERSION: + { + struct ncp_mount_data* md = (struct ncp_mount_data*)raw_data; + + data.flags = md->flags; + data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; + data.mounted_uid = md->mounted_uid; + data.wdog_pid = md->wdog_pid; + data.ncp_fd = md->ncp_fd; + data.time_out = md->time_out; + data.retry_count = md->retry_count; + data.uid = md->uid; + data.gid = md->gid; + data.file_mode = md->file_mode; + data.dir_mode = md->dir_mode; + memcpy(data.mounted_vol, md->mounted_vol, + NCP_VOLNAME_LEN+1); + } + break; + case NCP_MOUNT_VERSION_V4: + { + struct ncp_mount_data_v4* md = (struct ncp_mount_data_v4*)raw_data; + + data.flags = md->flags; + data.int_flags = 0; + data.mounted_uid = md->mounted_uid; + data.wdog_pid = md->wdog_pid; + data.ncp_fd = md->ncp_fd; + data.time_out = md->time_out; + data.retry_count = md->retry_count; + data.uid = md->uid; + data.gid = md->gid; + data.file_mode = md->file_mode; + data.dir_mode = md->dir_mode; + data.mounted_vol[0] = 0; + } + break; + default: + goto out_bad_mount; + } + ncp_filp = fget(data.ncp_fd); if (!ncp_filp) goto out_bad_file; if (!S_ISSOCK(ncp_filp->f_dentry->d_inode->i_mode)) @@ -310,7 +349,7 @@ ncp_read_super(struct super_block *sb, void *raw_data, int silent) /* server->priv.len = 0; */ /* server->priv.data = NULL; */ - server->m = *data; + server->m = data; /* Althought anything producing this is buggy, it happens now because of PATH_MAX changes.. */ if (server->m.time_out < 1) { diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 0a361b6c3b71..6cf94831fb9f 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c @@ -32,25 +32,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp, struct ncp_server *server = NCP_SERVER(inode); int result; struct ncp_ioctl_request request; - struct ncp_fs_info info; char* bouncebuffer; -#ifdef NCP_IOC_GETMOUNTUID_INT - /* remove after ncpfs-2.0.13/2.2.0 gets released */ - if ((NCP_IOC_GETMOUNTUID != NCP_IOC_GETMOUNTUID_INT) && - (cmd == NCP_IOC_GETMOUNTUID_INT)) { - int tmp = server->m.mounted_uid; - - if ( (permission(inode, MAY_READ) != 0) - && (current->uid != server->m.mounted_uid)) - { - return -EACCES; - } - if (put_user(tmp, (unsigned int*) arg)) return -EFAULT; - return 0; - } -#endif /* NCP_IOC_GETMOUNTUID_INT */ - switch (cmd) { case NCP_IOC_NCPREQUEST: @@ -67,10 +50,6 @@ int ncp_ioctl(struct inode *inode, struct file *filp, NCP_PACKET_SIZE - sizeof(struct ncp_request_header))) { return -EINVAL; } - if ((result = verify_area(VERIFY_WRITE, (char *) request.data, - NCP_PACKET_SIZE)) != 0) { - return result; - } bouncebuffer = kmalloc(NCP_PACKET_SIZE, GFP_NFS); if (!bouncebuffer) return -ENOMEM; @@ -108,53 +87,82 @@ int ncp_ioctl(struct inode *inode, struct file *filp, && (current->uid != server->m.mounted_uid)) { return -EACCES; } - if (server->root_setuped) return -EBUSY; + if (!(server->m.int_flags & NCP_IMOUNT_LOGGEDIN_POSSIBLE)) + return -EINVAL; + if (server->root_setuped) + return -EBUSY; server->root_setuped = 1; return ncp_conn_logged_in(inode->i_sb); case NCP_IOC_GET_FS_INFO: + { + struct ncp_fs_info info; - if ((permission(inode, MAY_WRITE) != 0) - && (current->uid != server->m.mounted_uid)) { - return -EACCES; - } - if ((result = verify_area(VERIFY_WRITE, (char *) arg, - sizeof(info))) != 0) { - return result; - } - copy_from_user(&info, (struct ncp_fs_info *) arg, sizeof(info)); + if ((permission(inode, MAY_WRITE) != 0) + && (current->uid != server->m.mounted_uid)) { + return -EACCES; + } + if (copy_from_user(&info, (struct ncp_fs_info *) arg, + sizeof(info))) + return -EFAULT; - if (info.version != NCP_GET_FS_INFO_VERSION) { - DPRINTK("info.version invalid: %d\n", info.version); - return -EINVAL; + if (info.version != NCP_GET_FS_INFO_VERSION) { + DPRINTK("info.version invalid: %d\n", info.version); + return -EINVAL; + } + /* TODO: info.addr = server->m.serv_addr; */ + info.mounted_uid = NEW_TO_OLD_UID(server->m.mounted_uid); + info.connection = server->connection; + info.buffer_size = server->buffer_size; + info.volume_number = NCP_FINFO(inode)->volNumber; + info.directory_id = NCP_FINFO(inode)->DosDirNum; + + if (copy_to_user((struct ncp_fs_info *) arg, &info, + sizeof(info))) return -EFAULT; + return 0; } - /* TODO: info.addr = server->m.serv_addr; */ - info.mounted_uid = NEW_TO_OLD_UID(server->m.mounted_uid); - info.connection = server->connection; - info.buffer_size = server->buffer_size; - info.volume_number = NCP_FINFO(inode)->volNumber; - info.directory_id = NCP_FINFO(inode)->DosDirNum; - - copy_to_user((struct ncp_fs_info *) arg, &info, sizeof(info)); - return 0; - case NCP_IOC_GETMOUNTUID: + case NCP_IOC_GET_FS_INFO_V2: + { + struct ncp_fs_info_v2 info2; - if ((permission(inode, MAY_READ) != 0) - && (current->uid != server->m.mounted_uid)) { - return -EACCES; + if ((permission(inode, MAY_WRITE) != 0) + && (current->uid != server->m.mounted_uid)) { + return -EACCES; + } + if (copy_from_user(&info2, (struct ncp_fs_info_v2 *) arg, + sizeof(info2))) + return -EFAULT; + + if (info2.version != NCP_GET_FS_INFO_VERSION_V2) { + DPRINTK("info.version invalid: %d\n", info2.version); + return -EINVAL; + } + info2.mounted_uid = server->m.mounted_uid; + info2.connection = server->connection; + info2.buffer_size = server->buffer_size; + info2.volume_number = NCP_FINFO(inode)->volNumber; + info2.directory_id = NCP_FINFO(inode)->DosDirNum; + info2.dummy1 = info2.dummy2 = info2.dummy3 = 0; + + if (copy_to_user((struct ncp_fs_info_v2 *) arg, &info2, + sizeof(info2))) return -EFAULT; + return 0; } - put_user(NEW_TO_OLD_UID(server->m.mounted_uid), (old_uid_t *) arg); - return 0; - case NCP_IOC_GETMOUNTUID32: + case NCP_IOC_GETMOUNTUID2: + { + unsigned long tmp = server->m.mounted_uid; - if ((permission(inode, MAY_READ) != 0) - && (current->uid != server->m.mounted_uid)) { - return -EACCES; + if ( (permission(inode, MAY_READ) != 0) + && (current->uid != server->m.mounted_uid)) + { + return -EACCES; + } + if (put_user(tmp, (unsigned long*) arg)) + return -EFAULT; + return 0; } - put_user(server->m.mounted_uid, (uid_t *) arg); - return 0; #ifdef CONFIG_NCPFS_MOUNT_SUBDIR case NCP_IOC_GETROOT: @@ -377,11 +385,6 @@ int ncp_ioctl(struct inode *inode, struct file *filp, struct ncp_objectname_ioctl user; int outl; - if ((result = verify_area(VERIFY_WRITE, - (struct ncp_objectname_ioctl*)arg, - sizeof(user))) != 0) { - return result; - } if (copy_from_user(&user, (struct ncp_objectname_ioctl*)arg, sizeof(user))) return -EFAULT; @@ -452,11 +455,6 @@ int ncp_ioctl(struct inode *inode, struct file *filp, struct ncp_privatedata_ioctl user; int outl; - if ((result = verify_area(VERIFY_WRITE, - (struct ncp_privatedata_ioctl*)arg, - sizeof(user))) != 0) { - return result; - } if (copy_from_user(&user, (struct ncp_privatedata_ioctl*)arg, sizeof(user))) return -EFAULT; @@ -635,7 +633,19 @@ int ncp_ioctl(struct inode *inode, struct file *filp, return 0; } - default: - return -EINVAL; } +/* #ifdef CONFIG_UID16 */ + /* NCP_IOC_GETMOUNTUID may be same as NCP_IOC_GETMOUNTUID2, + so we have this out of switch */ + if (cmd == NCP_IOC_GETMOUNTUID) { + if ((permission(inode, MAY_READ) != 0) + && (current->uid != server->m.mounted_uid)) { + return -EACCES; + } + if (put_user(NEW_TO_OLD_UID(server->m.mounted_uid), (__kernel_uid_t *) arg)) + return -EFAULT; + return 0; + } +/* #endif */ + return -EINVAL; } diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 76476f51279a..e0bdc1337939 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -234,7 +234,7 @@ int get_partition_list(char * page) } #endif -void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor) +static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor) { static int first_time = 1; unsigned long first_sector; @@ -272,13 +272,18 @@ void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor) * Much of the cleanup from the old partition tables should have already been * done */ -void resetup_one_dev(struct gendisk *dev, int drive) + +void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size) { int i; int first_minor = drive << dev->minor_shift; int end_minor = first_minor + dev->max_p; blk_size[dev->major] = NULL; + dev->part[first_minor].nr_sects = size; + /* No Such Agen^Wdevice or no minors to use for partitions */ + if (!size || minors == 1) + return; check_partition(dev, MKDEV(dev->major, first_minor), 1 + first_minor); /* @@ -292,31 +297,10 @@ void resetup_one_dev(struct gendisk *dev, int drive) } } -static inline void setup_dev(struct gendisk *dev) -{ - int i, drive; - int end_minor = dev->max_nr * dev->max_p; - - blk_size[dev->major] = NULL; - for (i = 0; i < end_minor; i++) { - dev->part[i].start_sect = 0; - dev->part[i].nr_sects = 0; - dev->sizes[i] = 0; - } - dev->init(dev); - for (drive = 0 ; drive < dev->nr_real ; drive++) - resetup_one_dev(dev, drive); -} - int __init partition_setup(void) { - struct gendisk *p; - device_init(); - for (p = gendisk_head ; p ; p=p->next) - setup_dev(p); - #ifdef CONFIG_BLK_DEV_RAM #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && mount_initrd) initrd_load(); diff --git a/fs/smbfs/ioctl.c b/fs/smbfs/ioctl.c index 6ea26fe25565..dee105a5e834 100644 --- a/fs/smbfs/ioctl.c +++ b/fs/smbfs/ioctl.c @@ -28,7 +28,7 @@ smb_ioctl(struct inode *inode, struct file *filp, switch (cmd) { case SMB_IOC_GETMOUNTUID: - result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid), (old_uid_t *) arg); + result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid), (uid16_t *) arg); break; case SMB_IOC_GETMOUNTUID32: result = put_user(server->mnt->mounted_uid, (uid_t *) arg); diff --git a/fs/super.c b/fs/super.c index 4284062e70ed..889938116121 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1173,7 +1173,7 @@ void __init mount_root(void) #endif bdev = bdget(kdev_t_to_nr(ROOT_DEV)); - if (!bdget) + if (!bdev) panic(__FUNCTION__ ": unable to allocate root device"); mode = FMODE_READ; if (!(root_mountflags & MS_RDONLY)) diff --git a/include/asm-alpha/posix_types.h b/include/asm-alpha/posix_types.h index 431f8d7af63e..01a1021a62f6 100644 --- a/include/asm-alpha/posix_types.h +++ b/include/asm-alpha/posix_types.h @@ -33,12 +33,10 @@ typedef struct { int val[2]; } __kernel_fsid_t; -#ifdef __KERNEL__ typedef __kernel_uid_t __kernel_old_uid_t; typedef __kernel_gid_t __kernel_old_gid_t; typedef __kernel_uid_t __kernel_uid32_t; typedef __kernel_gid_t __kernel_gid32_t; -#endif /* __KERNEL__ */ #ifdef __KERNEL__ diff --git a/include/asm-arm/posix_types.h b/include/asm-arm/posix_types.h index bb383ff4ea9e..8ad590dd49c9 100644 --- a/include/asm-arm/posix_types.h +++ b/include/asm-arm/posix_types.h @@ -9,10 +9,6 @@ #ifndef __ARCH_ARM_POSIX_TYPES_H #define __ARCH_ARM_POSIX_TYPES_H -#if defined(__KERNEL__) -#include -#endif /* __KERNEL__ */ - /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -41,10 +37,8 @@ typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ && CONFIG_UID16 */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h index 071373138202..b0434b172d3b 100644 --- a/include/asm-i386/posix_types.h +++ b/include/asm-i386/posix_types.h @@ -33,10 +33,8 @@ typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-m68k/posix_types.h b/include/asm-m68k/posix_types.h index 60718fdea9a1..fa372b22616c 100644 --- a/include/asm-m68k/posix_types.h +++ b/include/asm-m68k/posix_types.h @@ -1,10 +1,6 @@ #ifndef __ARCH_M68K_POSIX_TYPES_H #define __ARCH_M68K_POSIX_TYPES_H -#if defined(__KERNEL__) -#include -#endif /* __KERNEL__ */ - /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -33,10 +29,8 @@ typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#if defined(__KERNEL__) && defined(CONFIG_UID16) typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-ppc/ipcbuf.h b/include/asm-ppc/ipcbuf.h new file mode 100644 index 000000000000..98c75e646564 --- /dev/null +++ b/include/asm-ppc/ipcbuf.h @@ -0,0 +1,11 @@ +#ifndef __PPC_IPCBUF_H__ +#define __PPC_IPCBUF_H__ + +/* + * The ipc64_perm structure for the PPC is identical to kern_ipc_perm + * as we have always had 32-bit UIDs and GIDs in the kernel. + */ + +#define ipc64_perm kern_ipc_perm + +#endif /* __PPC_IPCBUF_H__ */ diff --git a/include/asm-ppc/msgbuf.h b/include/asm-ppc/msgbuf.h new file mode 100644 index 000000000000..ebfb950a2ea0 --- /dev/null +++ b/include/asm-ppc/msgbuf.h @@ -0,0 +1,26 @@ +#ifndef _PPC_MSGBUF_H +#define _PPC_MSGBUF_H + +/* + * The msqid64_ds structure for the PPC architecture. + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + unsigned int __unused0; + unsigned int __unused1; + __kernel_time_t msg_stime; /* last msgsnd time */ + unsigned int __unused2; + __kernel_time_t msg_rtime; /* last msgrcv time */ + unsigned int __unused3; + __kernel_time_t msg_ctime; /* last change time */ + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* _PPC_MSGBUF_H */ diff --git a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h index f5cc58b0920f..f6d0d70ea79f 100644 --- a/include/asm-ppc/posix_types.h +++ b/include/asm-ppc/posix_types.h @@ -29,10 +29,8 @@ typedef unsigned int __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ typedef unsigned int __kernel_old_uid_t; typedef unsigned int __kernel_old_gid_t; -#endif /* __KERNEL__ */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-ppc/sembuf.h b/include/asm-ppc/sembuf.h new file mode 100644 index 000000000000..6b6a182a8744 --- /dev/null +++ b/include/asm-ppc/sembuf.h @@ -0,0 +1,20 @@ +#ifndef _PPC_SEMBUF_H +#define _PPC_SEMBUF_H + +/* + * The semid64_ds structure for PPC architecture. + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + unsigned int __unused0; + unsigned int __unused1; + __kernel_time_t sem_otime; /* last semop time */ + unsigned int __unused2; + __kernel_time_t sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _PPC_SEMBUF_H */ diff --git a/include/asm-ppc/shmbuf.h b/include/asm-ppc/shmbuf.h new file mode 100644 index 000000000000..df84f0b0913d --- /dev/null +++ b/include/asm-ppc/shmbuf.h @@ -0,0 +1,37 @@ +#ifndef _PPC_SHMBUF_H +#define _PPC_SHMBUF_H + +/* + * The shmid64_ds structure for PPC architecture. + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + unsigned int __unused0; + size_t shm_segsz; /* size of segment (bytes) */ + unsigned long __unused1; + __kernel_time_t shm_atime; /* last attach time */ + unsigned long __unused2; + __kernel_time_t shm_dtime; /* last detach time */ + unsigned long __unused3; + __kernel_time_t shm_ctime; /* last change time */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused4; + unsigned long __unused5; +}; + +struct shminfo64 { + unsigned long shmmax; + unsigned long shmmin; + unsigned long shmmni; + unsigned long shmseg; + unsigned long shmall; + unsigned long __unused1; + unsigned long __unused2; + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _PPC_SHMBUF_H */ diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h index c8e5d10628b8..ab87c062961b 100644 --- a/include/asm-sparc/pgalloc.h +++ b/include/asm-sparc/pgalloc.h @@ -1,4 +1,4 @@ -/* $Id: pgalloc.h,v 1.1 1999/12/28 04:13:35 anton Exp $ */ +/* $Id: pgalloc.h,v 1.2 2000/01/15 00:51:42 anton Exp $ */ #ifndef _SPARC_PGALLOC_H #define _SPARC_PGALLOC_H @@ -30,10 +30,10 @@ BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned lo #define local_flush_tlb_range(mm,start,end) BTFIXUP_CALL(local_flush_tlb_range)(mm,start,end) #define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr) -BTFIXUPDEF_CALL(void, local_flush_page_to_ram, struct page *) +BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long) BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long) -#define local_flush_page_to_ram(page) BTFIXUP_CALL(local_flush_page_to_ram)(page) +#define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr) #define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr) extern void smp_flush_cache_all(void); @@ -49,7 +49,7 @@ extern void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end); extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page); -extern void smp_flush_page_to_ram(struct page *page); +extern void smp_flush_page_to_ram(unsigned long page); extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr); #endif @@ -74,12 +74,14 @@ BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long) #define flush_tlb_range(mm,start,end) BTFIXUP_CALL(flush_tlb_range)(mm,start,end) #define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr) -BTFIXUPDEF_CALL(void, flush_page_to_ram, struct page *) +BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) -#define flush_page_to_ram(page) BTFIXUP_CALL(flush_page_to_ram)(page) +#define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr) #define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr) +#define flush_page_to_ram(page) __flush_page_to_ram(page_address(page)) + extern struct pgtable_cache_struct { unsigned long *pgd_cache; unsigned long *pte_cache; diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h index ec8ad3f747bd..72991ca023d9 100644 --- a/include/asm-sparc/posix_types.h +++ b/include/asm-sparc/posix_types.h @@ -29,11 +29,8 @@ typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ -#define UID16_COMPAT_NEEDED typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ */ #ifdef __GNUC__ typedef long long __kernel_loff_t; diff --git a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h index 47415f2cc38a..e2a024e3e7e9 100644 --- a/include/asm-sparc64/posix_types.h +++ b/include/asm-sparc64/posix_types.h @@ -31,13 +31,11 @@ typedef long __kernel_off_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; -typedef unsigned int __kernel_uid32_t; -typedef unsigned int __kernel_gid32_t; -#ifdef __KERNEL__ -#define UID16_COMPAT_NEEDED -typedef unsigned short __kernel_old_uid_t; -typedef unsigned short __kernel_old_gid_t; -#endif /* __KERNEL__ */ + +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +typedef __kernel_uid_t __kernel_uid32_t; +typedef __kernel_gid_t __kernel_gid32_t; /* Note this piece of asymmetry from the v9 ABI. */ typedef int __kernel_suseconds_t; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 77d31cc9a673..69eb0fd47834 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -104,7 +104,7 @@ struct sec_size { extern struct sec_size * blk_sec[MAX_BLKDEV]; extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; extern wait_queue_head_t wait_for_request; -extern void resetup_one_dev(struct gendisk *dev, int drive); +extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size); extern void unplug_device(void * data); extern void make_request(int major,int rw, struct buffer_head * bh); diff --git a/include/linux/fb.h b/include/linux/fb.h index c537cfb36a3a..56a0f03b6389 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -197,6 +197,12 @@ struct fb_con2fbmap { __u32 framebuffer; }; +/* VESA Blanking Levels */ +#define VESA_NO_BLANKING 0 +#define VESA_VSYNC_SUSPEND 1 +#define VESA_HSYNC_SUSPEND 2 +#define VESA_POWERDOWN 3 + struct fb_monspecs { __u32 hfmin; /* hfreq lower limit (Hz) */ __u32 hfmax; /* hfreq upper limit (Hz) */ @@ -261,9 +267,13 @@ struct fb_info { char modename[40]; /* default video mode */ kdev_t node; int flags; + int open; /* Has this been open already ? */ #define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */ + struct fb_var_screeninfo var; /* Current var */ + struct fb_fix_screeninfo fix; /* Current fix */ + struct fb_monspecs monspecs; /* Current Monitor specs */ struct fb_ops *fbops; - struct fb_monspecs monspecs; + char *screen_base; /* Virtual address */ struct display *disp; /* initial display variable */ struct vc_data *display_fg; /* Console visible on this display */ char fontname[40]; /* default font name */ @@ -275,8 +285,11 @@ struct fb_info { void (*blank)(int, struct fb_info*); /* tell fb to (un)blank the screen */ /* arg = 0: unblank */ /* arg > 0: VESA level (arg-1) */ - + void *pseudo_palette; /* Fake palette of 16 colors and + the cursor's color for non + palette mode */ /* From here on everything is device dependent */ + void *par; }; #ifdef MODULE @@ -383,13 +396,6 @@ extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, extern struct fb_cmap *fb_default_cmap(int len); extern void fb_invert_cmaps(void); -/* VESA Blanking Levels */ -#define VESA_NO_BLANKING 0 -#define VESA_VSYNC_SUSPEND 1 -#define VESA_HSYNC_SUSPEND 2 -#define VESA_POWERDOWN 3 - - struct fb_videomode { const char *name; /* optional */ u32 refresh; /* optional */ diff --git a/include/linux/genhd.h b/include/linux/genhd.h index be07a362e944..8b743b450cb0 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -53,9 +53,7 @@ struct gendisk { int minor_shift; /* number of times minor is shifted to get real minor */ int max_p; /* maximum partitions per device */ - int max_nr; /* maximum number of real devices */ - void (*init)(struct gendisk *); /* Initialization called before we do our thing */ struct hd_struct *part; /* [indexed by minor] */ int *sizes; /* [idem], device size in blocks */ int nr_real; /* number of real devices */ diff --git a/include/linux/highuid.h b/include/linux/highuid.h index 26e9d57c8757..40f121ca76e1 100644 --- a/include/linux/highuid.h +++ b/include/linux/highuid.h @@ -13,15 +13,15 @@ * kernel code should use uid_t and gid_t at all times when dealing with * kernel-private data. * - * old_uid_t and old_gid_t are only used if CONFIG_UID16 is defined. + * old_uid_t and old_gid_t should only be different if CONFIG_UID16 is + * defined, else the platform should provide dummy typedefs for them + * such that they are equivalent to __kernel_{u,g}id_t. * * uid16_t and gid16_t are used on all architectures. (when dealing * with structures hard coded to 16 bits, such as in filesystems) */ -#ifdef CONFIG_UID16 - /* * This is the "overflow" UID and GID. They are used to signify uid/gid * overflow to old programs when they request uid/gid information but are @@ -38,6 +38,7 @@ extern int overflowgid; #define DEFAULT_OVERFLOWUID 65534 #define DEFAULT_OVERFLOWGID 65534 +#ifdef CONFIG_UID16 /* prevent uid mod 65536 effect by returning a default value for high UIDs */ #define high2lowuid(uid) ((uid) > 65535) ? (old_uid_t)overflowuid : (old_uid_t)(uid) diff --git a/include/linux/ide.h b/include/linux/ide.h index 868ad8179708..1b438bf745de 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -757,7 +757,6 @@ int drive_is_flashcard (ide_drive_t *drive); int ide_spin_wait_hwgroup(ide_drive_t *drive, unsigned long *flags); void ide_timer_expiry (unsigned long data); void ide_intr (int irq, void *dev_id, struct pt_regs *regs); -void ide_geninit (struct gendisk *gd); void do_ide0_request (request_queue_t * q); #if MAX_HWIFS > 1 void do_ide1_request (request_queue_t * q); diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 9f881403b7ab..a9d46d35bf84 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h @@ -37,6 +37,20 @@ struct ncp_fs_info { __u32 directory_id; }; +struct ncp_fs_info_v2 { + int version; + unsigned long mounted_uid; + unsigned int connection; + unsigned int buffer_size; + + unsigned int volume_number; + __u32 directory_id; + + __u32 dummy1; + __u32 dummy2; + __u32 dummy3; +}; + struct ncp_sign_init { char sign_root[8]; @@ -90,19 +104,15 @@ struct ncp_nls_ioctl }; #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) -#define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_uid_t) - -#if 1 -#ifdef __KERNEL__ -/* remove after ncpfs-2.0.13 gets released or at the beginning of kernel-2.1. codefreeze */ -#define NCP_IOC_GETMOUNTUID_INT _IOW('n', 2, unsigned int) -#endif -#endif +#define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t) +#define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long) #define NCP_IOC_CONN_LOGGED_IN _IO('n', 3) -#define NCP_GET_FS_INFO_VERSION (1) +#define NCP_GET_FS_INFO_VERSION (1) #define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info) +#define NCP_GET_FS_INFO_VERSION_V2 (2) +#define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2) #define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init) #define NCP_IOC_SIGN_WANTED _IOR('n', 6, int) @@ -124,8 +134,6 @@ struct ncp_nls_ioctl #define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32) #define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32) -#define NCP_IOC_GETMOUNTUID32 _IOW('n', 13, __kernel_uid32_t) - /* * The packet size to allocate. One page should be enough. */ diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 46f100eb4426..fbb1537b3fc2 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h @@ -18,7 +18,7 @@ struct ncp_server { - struct ncp_mount_data m; /* Nearly all of the mount data is of + struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of interest for us later, so we store it completely. */ diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h index a276ab1e40fa..d74092d08dac 100644 --- a/include/linux/ncp_mount.h +++ b/include/linux/ncp_mount.h @@ -40,4 +40,50 @@ struct ncp_mount_data { __kernel_mode_t dir_mode; }; +#define NCP_MOUNT_VERSION_V4 (4) + +struct ncp_mount_data_v4 { + int version; + unsigned long flags; /* NCP_MOUNT_* flags */ + /* MIPS uses long __kernel_uid_t, but... */ + /* we neever pass -1, so it is safe */ + unsigned long mounted_uid; /* Who may umount() this filesystem? */ + /* MIPS uses long __kernel_pid_t */ + long wdog_pid; /* Who cares for our watchdog packets? */ + + unsigned int ncp_fd; /* The socket to the ncp port */ + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ + + /* MIPS uses long __kernel_uid_t... */ + /* we never pass -1, so it is safe */ + unsigned long uid; + unsigned long gid; + /* MIPS uses unsigned long __kernel_mode_t */ + unsigned long file_mode; + unsigned long dir_mode; +}; + +#ifdef __KERNEL__ + +struct ncp_mount_data_kernel { + unsigned long flags; /* NCP_MOUNT_* flags */ + unsigned int int_flags; /* internal flags */ +#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 + __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ + __kernel_pid_t wdog_pid; /* Who cares for our watchdog packets? */ + unsigned int ncp_fd; /* The socket to the ncp port */ + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ + unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_mode_t file_mode; + __kernel_mode_t dir_mode; +}; + +#endif /* __KERNEL__ */ + #endif diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index 9cd35f66b1e8..451ff761a86e 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -14,7 +14,7 @@ /* * ioctl commands */ -#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_uid_t) +#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t) #define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) /* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */ diff --git a/include/linux/types.h b/include/linux/types.h index c96e510f3fec..196c5f4e0ca1 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,6 +1,7 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#include #include #include @@ -23,9 +24,11 @@ typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_t uid16_t; typedef __kernel_gid16_t gid16_t; +#ifdef CONFIG_UID16 /* This is defined by include/asm-{arch}/posix_types.h */ typedef __kernel_old_uid_t old_uid_t; typedef __kernel_old_gid_t old_gid_t; +#endif /* CONFIG_UID16 */ /* libc5 includes this file to define uid_t, thus uid_t can never change * when it is included by non-kernel code diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 4decd70ea08a..cb4cfbbccd3c 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -262,7 +262,7 @@ EXPORT_SYMBOL(blkdev_get); EXPORT_SYMBOL(blkdev_put); EXPORT_SYMBOL(ioctl_by_bdev); EXPORT_SYMBOL(gendisk_head); -EXPORT_SYMBOL(resetup_one_dev); +EXPORT_SYMBOL(grok_partitions); EXPORT_SYMBOL(unplug_device); EXPORT_SYMBOL(make_request); EXPORT_SYMBOL(tq_disk); @@ -431,10 +431,8 @@ EXPORT_SYMBOL(__down_trylock); EXPORT_SYMBOL(__up); EXPORT_SYMBOL(brw_page); -#ifdef CONFIG_UID16 EXPORT_SYMBOL(fs_overflowuid); EXPORT_SYMBOL(fs_overflowgid); -#endif /* all busmice */ EXPORT_SYMBOL(add_mouse_randomness); diff --git a/kernel/signal.c b/kernel/signal.c index 6e0730512a91..772b248e82ea 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -132,56 +132,41 @@ printk("SIG dequeue (%s:%d): %d ", current->comm, current->pid, int reset = 1; /* Collect the siginfo appropriate to this signal. */ - if (sig < SIGRTMIN) { - /* XXX: As an extension, support queueing exactly - one non-rt signal if SA_SIGINFO is set, so that - we can get more detailed information about the - cause of the signal. */ - /* Deciding not to init these couple of fields is - more expensive that just initializing them. */ + struct signal_queue *q, **pp; + pp = ¤t->sigqueue; + q = current->sigqueue; + + /* Find the one we're interested in ... */ + for ( ; q ; pp = &q->next, q = q->next) + if (q->info.si_signo == sig) + break; + if (q) { + if ((*pp = q->next) == NULL) + current->sigqueue_tail = pp; + *info = q->info; + kmem_cache_free(signal_queue_cachep,q); + atomic_dec(&nr_queued_signals); + + /* then see if this signal is still pending. */ + q = *pp; + while (q) { + if (q->info.si_signo == sig) { + reset = 0; + break; + } + q = q->next; + } + } else { + /* Ok, it wasn't in the queue. It must have + been sent either by a non-rt mechanism and + we ran out of queue space. So zero out the + info. */ info->si_signo = sig; info->si_errno = 0; info->si_code = 0; info->si_pid = 0; info->si_uid = 0; SET_SIGINFO_UID16(info->si_uid16, 0); - } else { - struct signal_queue *q, **pp; - pp = ¤t->sigqueue; - q = current->sigqueue; - - /* Find the one we're interested in ... */ - for ( ; q ; pp = &q->next, q = q->next) - if (q->info.si_signo == sig) - break; - if (q) { - if ((*pp = q->next) == NULL) - current->sigqueue_tail = pp; - *info = q->info; - kmem_cache_free(signal_queue_cachep,q); - atomic_dec(&nr_queued_signals); - - /* then see if this signal is still pending. */ - q = *pp; - while (q) { - if (q->info.si_signo == sig) { - reset = 0; - break; - } - q = q->next; - } - } else { - /* Ok, it wasn't in the queue. It must have - been sent either by a non-rt mechanism and - we ran out of queue space. So zero out the - info. */ - info->si_signo = sig; - info->si_errno = 0; - info->si_code = 0; - info->si_pid = 0; - info->si_uid = 0; - SET_SIGINFO_UID16(info->si_uid16, 0); - } } if (reset) @@ -255,6 +240,8 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *t) { unsigned long flags; int ret; + struct signal_queue *q = 0; + #if DEBUG_SIG printk("SIG queue (%s:%d): %d ", t->comm, t->pid, sig); @@ -307,36 +294,31 @@ printk("SIG queue (%s:%d): %d ", t->comm, t->pid, sig); if (ignored_signal(sig, t)) goto out; - if (sig < SIGRTMIN) { - /* Non-real-time signals are not queued. */ - /* XXX: As an extension, support queueing exactly one - non-rt signal if SA_SIGINFO is set, so that we can - get more detailed information about the cause of - the signal. */ - if (sigismember(&t->signal, sig)) - goto out; - } else { - /* Real-time signals must be queued if sent by sigqueue, or - some other real-time mechanism. It is implementation - defined whether kill() does so. We attempt to do so, on - the principle of least surprise, but since kill is not - allowed to fail with EAGAIN when low on memory we just - make sure at least one signal gets delivered and don't - pass on the info struct. */ - - struct signal_queue *q = 0; - - if (atomic_read(&nr_queued_signals) < max_queued_signals) { - q = (struct signal_queue *) - kmem_cache_alloc(signal_queue_cachep, GFP_ATOMIC); - } - - if (q) { - atomic_inc(&nr_queued_signals); - q->next = NULL; - *t->sigqueue_tail = q; - t->sigqueue_tail = &q->next; - switch ((unsigned long) info) { + /* Support queueing exactly one non-rt signal, so that we + can get more detailed information about the cause of + the signal. */ + if (sig < SIGRTMIN && sigismember(&t->signal, sig)) + goto out; + + /* Real-time signals must be queued if sent by sigqueue, or + some other real-time mechanism. It is implementation + defined whether kill() does so. We attempt to do so, on + the principle of least surprise, but since kill is not + allowed to fail with EAGAIN when low on memory we just + make sure at least one signal gets delivered and don't + pass on the info struct. */ + + if (atomic_read(&nr_queued_signals) < max_queued_signals) { + q = (struct signal_queue *) + kmem_cache_alloc(signal_queue_cachep, GFP_ATOMIC); + } + + if (q) { + atomic_inc(&nr_queued_signals); + q->next = NULL; + *t->sigqueue_tail = q; + t->sigqueue_tail = &q->next; + switch ((unsigned long) info) { case 0: q->info.si_signo = sig; q->info.si_errno = 0; @@ -356,12 +338,11 @@ printk("SIG queue (%s:%d): %d ", t->comm, t->pid, sig); default: q->info = *info; break; - } - } else { - /* Queue overflow, we have to abort. */ - ret = -EAGAIN; - goto out; } + } else { + /* Queue overflow, we have to abort. */ + ret = -EAGAIN; + goto out; } sigaddset(&t->signal, sig); diff --git a/kernel/sys.c b/kernel/sys.c index b32516614d5f..e7472128f5b4 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -18,8 +18,6 @@ #include #include -#ifdef CONFIG_UID16 - /* * this is where the system-wide overflow UID and GID are defined, for * architectures that now have 32-bit UID/GID but didn't in the past @@ -28,8 +26,6 @@ int overflowuid = DEFAULT_OVERFLOWUID; int overflowgid = DEFAULT_OVERFLOWGID; -#endif /* CONFIG_UID16 */ - /* * the same as above, but for filesystems which can only store a 16-bit * UID and GID. as such, this is needed on all architectures diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 28f881570dcc..fd4970e582eb 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -247,14 +247,12 @@ static ctl_table kern_table[] = { {KERN_MAX_THREADS, "threads-max", &max_threads, sizeof(int), 0644, NULL, &proc_dointvec}, {KERN_RANDOM, "random", NULL, 0, 0555, random_table}, -#ifdef CONFIG_UID16 {KERN_OVERFLOWUID, "overflowuid", &overflowuid, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &minolduid, &maxolduid}, {KERN_OVERFLOWGID, "overflowgid", &overflowgid, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &minolduid, &maxolduid}, -#endif /* CONFIG_UID16 */ {0} }; -- 2.39.5