diff -u --recursive --new-file v2.5.1/linux/Documentation/DocBook/kernel-hacking.tmpl linux/Documentation/DocBook/kernel-hacking.tmpl --- v2.5.1/linux/Documentation/DocBook/kernel-hacking.tmpl Fri Oct 5 12:06:51 2001 +++ linux/Documentation/DocBook/kernel-hacking.tmpl Thu Dec 20 08:54:23 2001 @@ -18,8 +18,8 @@ - 2000 - Paul Russell + 2001 + Rusty Russell @@ -651,6 +651,29 @@ + + <function>cpu_to_be32()</function>/<function>be32_to_cpu()</function>/<function>cpu_to_le32()</function>/<function>le32_to_cpu()</function> + <filename class=headerfile>include/asm/byteorder.h</filename> + + + + The cpu_to_be32() family (where the "32" can + be replaced by 64 or 16, and the "be" can be replaced by "le") are + the general way to do endian conversions in the kernel: they + return the converted value. All variations supply the reverse as + well: be32_to_cpu(), etc. + + + + There are two major variations of these functions: the pointer + variation, such as cpu_to_be32p(), which take + a pointer to the given type, and return the converted value. The + other variation is the "in-situ" family, such as + cpu_to_be32s(), which convert value referred + to by the pointer, and return void. + + + <function>local_irq_save()</function>/<function>local_irq_restore()</function> <filename class=headerfile>include/asm/system.h</filename> diff -u --recursive --new-file v2.5.1/linux/Documentation/filesystems/devfs/ChangeLog linux/Documentation/filesystems/devfs/ChangeLog --- v2.5.1/linux/Documentation/filesystems/devfs/ChangeLog Tue Dec 18 14:56:34 2001 +++ linux/Documentation/filesystems/devfs/ChangeLog Thu Dec 27 08:29:14 2001 @@ -1794,3 +1794,72 @@ - Use "existing" directory in <_devfs_make_parent_for_leaf> - Use slab cache rather than fixed buffer for devfsd events +=============================================================================== +Changes for patch v199 + +- Removed obsolete usage of DEVFS_FL_NO_PERSISTENCE + +- Send DEVFSD_NOTIFY_REGISTERED events in <devfs_mk_dir> + +- Fixed locking bug in <devfs_d_revalidate_wait> due to typo + +- Do not send CREATE, CHANGE, ASYNC_OPEN or DELETE events from devfsd + or children +=============================================================================== +Changes for patch v200 + +- Ported to kernel 2.5.1-pre2 +=============================================================================== +Changes for patch v201 + +- Fixed bug in <devfsd_read>: was dereferencing freed pointer +=============================================================================== +Changes for patch v202 + +- Fixed bug in <devfsd_close>: was dereferencing freed pointer + +- Added process group check for devfsd privileges +=============================================================================== +Changes for patch v203 + +- Use SLAB_ATOMIC in <devfsd_notify_de> from <devfs_d_delete> +=============================================================================== +Changes for patch v204 + +- Removed long obsolete rc.devfs + +- Return old entry in <devfs_mk_dir> for 2.4.x kernels + +- Updated README from master HTML file + +- Increment refcount on module in <check_disc_changed> + +- Created <devfs_get_handle> and exported <devfs_put> + +- Increment refcount on module in <devfs_get_ops> + +- Created <devfs_put_ops> and used where needed to fix races + +- Added clarifying comments in response to preliminary EMC code review + +- Added poisoning to <devfs_put> + +- Improved debugging messages + +- Fixed unregister bugs in drivers/md/lvm-fs.c +=============================================================================== +Changes for patch v205 + +- Corrected (made useful) debugging message in <unregister> + +- Moved <kmem_cache_create> in <mount_devfs_fs> to <init_devfs_fs> + +- Fixed drivers/md/lvm-fs.c to create "lvm" entry + +- Added magic number to guard against scribbling drivers + +- Only return old entry in <devfs_mk_dir> if a directory + +- Defined macros for error and debug messages + +- Updated README from master HTML file diff -u --recursive --new-file v2.5.1/linux/Documentation/filesystems/devfs/README linux/Documentation/filesystems/devfs/README --- v2.5.1/linux/Documentation/filesystems/devfs/README Tue Dec 18 14:56:34 2001 +++ linux/Documentation/filesystems/devfs/README Thu Dec 27 08:29:14 2001 @@ -3,7 +3,7 @@ Linux Devfs (Device File System) FAQ Richard Gooch -9-NOV-2001 +21-DEC-2001 ----------------------------------------------------------------------------- @@ -66,6 +66,9 @@ Making things work Alternatives to devfs +What I don't like about devfs +How to report bugs +Strange kernel messages Other resources @@ -557,8 +560,10 @@ Devfsd OK, if you're reading this, I assume you want to play with -devfs. First you need to compile devfsd, the device management daemon, -available at +devfs. First you should ensure that /usr/src/linux contains a +recent kernel source tree. Then you need to compile devfsd, the device +management daemon, available at + http://www.atnf.csiro.au/~rgooch/linux/. Because the kernel has a naming scheme which is quite different from the old naming scheme, you need to @@ -1470,6 +1475,8 @@ Making things work Alternatives to devfs What I don't like about devfs +How to report bugs +Strange kernel messages @@ -1733,6 +1740,93 @@ This is not even remotely true. As shown above, both code and data size are quite modest. + + +How to report bugs + +If you have (or think you have) a bug with devfs, please follow the +steps below: + + + +please make sure you have the latest devfs patches applied. The +latest kernel version might not have the latest devfs patches applied +yet (Linus is very busy) + + +save a copy of your complete kernel logs (preferably by +using the dmesg programme) for later inclusion in your bug +report. You may need to use the -s switch to increase the +internal buffer size so you can capture all the boot messages + + +try booting with devfs=dall passed to the kernel boot +command line (read the documentation on your bootloader on how to do +this), and save the result to a file. This may be quite verbose, and +it may overflow the messages buffer, but try to get as much of it as +you can + + +if you get an Oops, run ksymoops to decode it so that the +names of the offending functions are provided. A non-decoded Oops is +pretty useless + + +send a copy of your devfsd configuration file(s) + +send the bug report to me first. +Don't expect that I will see it if you post it to the linux-kernel +mailing list. Include all the information listed above, plus +anything else that you think might be relevant. Put the string +devfs somewhere in the subject line, so my mail filters mark +it as urgent + + + + +Here is a general guide on how to ask questions in a way that greatly +improves your chances of getting a reply: + +http://www.tuxedo.org/~esr/faqs/smart-questions.html. If you have +a bug to report, you should also read + +http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. + + +Strange kernel messages + +You may see devfs-related messages in your kernel logs. Below are some +messages and what they mean (and what you should do about them, if +anything). + + + +devfs_register(fred): could not append to parent, err: -17 + +You need to check what the error code means, but usually 17 means +EEXIST. This means that a driver attempted to create an entry +fred in a directory, but there already was an entry with that +name. This is often caused by flawed boot scripts which untar a bunch +of inodes into /dev, as a way to restore permissions. This +message is harmless, as the device nodes will still +provide access to the driver (unless you use the devfs=only +boot option, which is only for dedicated souls:-). If you want to get +rid of these annoying messages, upgrade to devfsd-v1.3.20 and use the +recommended RESTORE directive to restore permissions. + + +devfs_mk_dir(bill): using old entry in dir: c1808724 "" + +This is similar to the message above, except that a driver attempted +to create a directory named bill, and the parent directory +has an entry with the same name. In this case, to ensure that drivers +continue to work properly, the old entry is re-used and given to the +driver. In 2.5 kernels, the driver is given a NULL entry, and thus, +under rare circumstances, may not create the require device nodes. +The solution is the same as above. + + + ----------------------------------------------------------------------------- diff -u --recursive --new-file v2.5.1/linux/Documentation/filesystems/devfs/rc.devfs linux/Documentation/filesystems/devfs/rc.devfs --- v2.5.1/linux/Documentation/filesystems/devfs/rc.devfs Wed Feb 16 15:42:05 2000 +++ linux/Documentation/filesystems/devfs/rc.devfs Wed Dec 31 16:00:00 1969 @@ -1,104 +0,0 @@ -#! /bin/sh -# -# /etc/rc.d/rc.devfs -# -# Linux Boot Scripts by Richard Gooch <rgooch@atnf.csiro.au> -# Copyright 1993-1999 under GNU Copyleft version 2.0. See /etc/rc for -# copyright notice. -# -# Save and restore devfs ownerships and permissions -# -# Written by Richard Gooch 11-JAN-1998 -# -# Updated by Richard Gooch 23-JAN-1998: Added "start" and "stop". -# -# Updated by Richard Gooch 5-AUG-1998: Robustness improvements by -# Roderich Schupp. -# -# Updated by Richard Gooch 9-AUG-1998: Took account of change from -# ".epoch" to ".devfsd". -# -# Updated by Richard Gooch 19-AUG-1998: Test and tty pattern patch -# by Roderich Schupp. -# -# Updated by Richard Gooch 24-MAY-1999: Use sed instead of tr. -# -# Last updated by Richard Gooch 25-MAY-1999: Don't save /dev/log. -# -# -# Usage: rc.devfs save|restore [savedir] [devfsdir] -# -# Note: "start" is a synonym for "restore" and "stop" is a synonym for "save". - -# Set VERBOSE to "no" if you would like a more quiet operation. -VERBOSE=yes - -# Set TAROPTS to "v" or even "vv" to see which files get saved/restored. -TAROPTS= - -option="$1" - -case "$option" in - save|restore) ;; - start) option=restore ;; - stop) option=save ;; - *) echo "No save or restore option given" ; exit 1 ;; -esac - -if [ "$2" = "" ]; then - savedir=/var/state -else - savedir=$2 -fi - -if [ ! -d $savedir ]; then - echo "Directory: $savedir does not exist" - exit 1 -fi - -if [ "$3" = "" ]; then - if [ -d /devfs ]; then - devfs=/devfs - else - devfs=/dev - fi -else - devfs=$3 -fi - -grep devfs /proc/filesystems >/dev/null || exit 0 - -if [ ! -d $devfs ]; then - echo "Directory: $devfs does not exist" - exit 1 -elif [ ! -c $devfs/.devfsd ]; then - echo "Directory: $devfs is not the root of a devfs filesystem" - exit 1 -fi - -savefile=`echo $devfs | sed 's*/*_*g'` -tarfile=${savedir}/devfssave.${savefile}.tar.gz - -cd $devfs - -case "$option" in - save) - [ "$VERBOSE" != no ] && echo "Saving $devfs permissions..." - - # You might want to adjust the pattern below to control - # which file's permissions will be saved. - # The sample pattern exludes all virtual consoles - # as well as old and new style pseudo terminals. - files=`find * -noleaf -cnewer .devfsd \ - ! -regex 'tty[0-9]+\|vc/.*\|vcsa?[0-9]+\|vcc/.*\|[pt]ty[a-z][0-9a-f]\|pt[ms]/.*\|log' -print` - rm -f $tarfile - [ -n "$files" ] && tar cz${TAROPTS}f $tarfile $files - ;; - - restore) - [ "$VERBOSE" != no ] && echo "Restoring $devfs permissions..." - [ -f $tarfile ] && tar xpz${TAROPTS}f $tarfile - ;; -esac - -exit 0 diff -u --recursive --new-file v2.5.1/linux/MAINTAINERS linux/MAINTAINERS --- v2.5.1/linux/MAINTAINERS Tue Dec 18 14:56:34 2001 +++ linux/MAINTAINERS Thu Dec 27 08:38:57 2001 @@ -843,7 +843,7 @@ M: vojtech@suse.cz L: linux-joystick@atrey.karlin.mff.cuni.cz W: http://www.suse.cz/development/joystick/ -S: Supported +S: Maintained KERNEL AUTOMOUNTER (AUTOFS) P: H. Peter Anvin @@ -1322,8 +1322,10 @@ S: Maintained SCSI SUBSYSTEM +P: Jens Axboe +M: axboe@suse.de L: linux-scsi@vger.kernel.org -S: Unmaintained +S: Maintained SCSI TAPE DRIVER P: Kai Mäkisara @@ -1538,7 +1540,7 @@ M: vojtech@suse.cz L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net -S: Supported +S: Maintained USB BLUETOOTH DRIVER P: Greg Kroah-Hartman @@ -1561,7 +1563,7 @@ L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net W: http://www.suse.cz/development/input/ -S: Supported +S: Maintained USB HUB P: Johannes Erdfelt @@ -1612,7 +1614,7 @@ M: vojtech@suse.cz L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net -S: Supported +S: Maintained USB SE401 DRIVER P: Jeroen Vreeken diff -u --recursive --new-file v2.5.1/linux/Makefile linux/Makefile --- v2.5.1/linux/Makefile Tue Dec 18 14:56:34 2001 +++ linux/Makefile Sat Dec 29 11:31:36 2001 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 1 -EXTRAVERSION = +SUBLEVEL = 2 +EXTRAVERSION =-pre4 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) diff -u --recursive --new-file v2.5.1/linux/arch/alpha/kernel/alpha_ksyms.c linux/arch/alpha/kernel/alpha_ksyms.c --- v2.5.1/linux/arch/alpha/kernel/alpha_ksyms.c Tue Dec 18 14:56:34 2001 +++ linux/arch/alpha/kernel/alpha_ksyms.c Sun Dec 30 10:06:16 2001 @@ -259,3 +259,8 @@ EXPORT_SYMBOL_NOVERS(memchr); EXPORT_SYMBOL(get_wchan); + +#ifdef CONFIG_ALPHA_IRONGATE +EXPORT_SYMBOL(irongate_ioremap); +EXPORT_SYMBOL(irongate_iounmap); +#endif diff -u --recursive --new-file v2.5.1/linux/arch/alpha/kernel/pci-noop.c linux/arch/alpha/kernel/pci-noop.c --- v2.5.1/linux/arch/alpha/kernel/pci-noop.c Thu Sep 13 15:21:32 2001 +++ linux/arch/alpha/kernel/pci-noop.c Sun Dec 30 10:06:16 2001 @@ -104,21 +104,21 @@ } /* stubs for the routines in pci_iommu.c */ void * -pci_alloc_consistent(struct pci_dev *pdev, long size, dma_addr_t *dma_addrp) +pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) { } void -pci_free_consistent(struct pci_dev *pdev, long size, void *cpu_addr, +pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu_addr, dma_addr_t dma_addr) { } dma_addr_t -pci_map_single(struct pci_dev *pdev, void *cpu_addr, long size, +pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size, int direction) { } void -pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, long size, +pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size, int direction) { } diff -u --recursive --new-file v2.5.1/linux/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c --- v2.5.1/linux/arch/alpha/kernel/process.c Sun Sep 30 12:26:08 2001 +++ linux/arch/alpha/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -75,7 +75,6 @@ { /* An endless idle loop with no priority at all. */ current->nice = 20; - current->counter = -100; while (1) { /* FIXME -- EV6 and LCA45 know how to power down diff -u --recursive --new-file v2.5.1/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c --- v2.5.1/linux/arch/alpha/kernel/setup.c Fri Nov 16 18:38:39 2001 +++ linux/arch/alpha/kernel/setup.c Tue Dec 25 15:39:20 2001 @@ -440,12 +440,6 @@ return MKDEV(TTY_MAJOR, 64 + c->index); } -static int srm_console_wait_key(struct console *co) -{ - /* Huh? */ - return 1; -} - static int __init srm_console_setup(struct console *co, char *options) { return 1; @@ -455,7 +449,6 @@ name: "srm0", write: srm_console_write, device: srm_console_device, - wait_key: srm_console_wait_key, setup: srm_console_setup, flags: CON_PRINTBUFFER | CON_ENABLED, /* fake it out */ index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/alpha/kernel/smp.c linux/arch/alpha/kernel/smp.c --- v2.5.1/linux/arch/alpha/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/alpha/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -23,6 +23,7 @@ #include <linux/delay.h> #include <linux/spinlock.h> #include <linux/irq.h> +#include <linux/cache.h> #include <asm/hwrpb.h> #include <asm/ptrace.h> @@ -65,7 +66,7 @@ IPI_CPU_STOP, }; -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; /* Set to a secondary's cpuid when it comes online. */ static unsigned long smp_secondary_alive; diff -u --recursive --new-file v2.5.1/linux/arch/arm/kernel/process.c linux/arch/arm/kernel/process.c --- v2.5.1/linux/arch/arm/kernel/process.c Sun Sep 30 12:26:08 2001 +++ linux/arch/arm/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -85,7 +85,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; while (1) { void (*idle)(void) = pm_idle; diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/changebit.S linux/arch/arm/lib/changebit.S --- v2.5.1/linux/arch/arm/lib/changebit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/changebit.S Tue Dec 25 21:43:32 2001 @@ -14,7 +14,9 @@ /* Purpose : Function to change a bit * Prototype: int change_bit(int bit, void *addr) */ -ENTRY(change_bit) +ENTRY(_change_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_change_bit_le) and r2, r0, #7 mov r3, #1 mov r3, r3, lsl r2 diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/clearbit.S linux/arch/arm/lib/clearbit.S --- v2.5.1/linux/arch/arm/lib/clearbit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/clearbit.S Tue Dec 25 21:43:32 2001 @@ -15,8 +15,9 @@ * Purpose : Function to clear a bit * Prototype: int clear_bit(int bit, void *addr) */ - -ENTRY(clear_bit) +ENTRY(_clear_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_clear_bit_le) and r2, r0, #7 mov r3, #1 mov r3, r3, lsl r2 diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/findbit.S linux/arch/arm/lib/findbit.S --- v2.5.1/linux/arch/arm/lib/findbit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/findbit.S Tue Dec 25 21:43:32 2001 @@ -15,14 +15,14 @@ * Purpose : Find a 'zero' bit * Prototype: int find_first_zero_bit(void *addr, int maxbit); */ -ENTRY(find_first_zero_bit) +ENTRY(_find_first_zero_bit_le) mov r2, #0 -.bytelp: ldrb r3, [r0, r2, lsr #3] +1: ldrb r3, [r0, r2, lsr #3] eors r3, r3, #0xff @ invert bits bne .found @ any now set - found zero bit add r2, r2, #8 @ next bit pointer cmp r2, r1 @ any more? - bcc .bytelp + bcc 1b add r0, r1, #1 @ no free bits RETINSTR(mov,pc,lr) @@ -30,15 +30,43 @@ * Purpose : Find next 'zero' bit * Prototype: int find_next_zero_bit(void *addr, int maxbit, int offset) */ -ENTRY(find_next_zero_bit) +ENTRY(_find_next_zero_bit_le) ands ip, r2, #7 - beq .bytelp @ If new byte, goto old routine + beq 1b @ If new byte, goto old routine ldrb r3, [r0, r2, lsr#3] eor r3, r3, #0xff @ now looking for a 1 bit movs r3, r3, lsr ip @ shift off unused bits + bne .found + orr r2, r2, #7 @ if zero, then no bits here + add r2, r2, #1 @ align bit pointer + b 1b @ loop for next bit + +#ifdef __ARMEB__ + +ENTRY(_find_first_zero_bit_be) + mov r2, #0 +1: eor r3, r2, #0x18 @ big endian byte ordering + ldrb r3, [r0, r3, lsr #3] + eors r3, r3, #0xff @ invert bits + bne .found @ any now set - found zero bit + add r2, r2, #8 @ next bit pointer + cmp r2, r1 @ any more? + bcc 1b + add r0, r1, #1 @ no free bits + RETINSTR(mov,pc,lr) + +ENTRY(_find_next_zero_bit_be) + ands ip, r2, #7 + beq 1b @ If new byte, goto old routine + eor r3, r2, #0x18 @ big endian byte ordering + ldrb r3, [r0, r3, lsr#3] + eor r3, r3, #0xff @ now looking for a 1 bit + movs r3, r3, lsr ip @ shift off unused bits orreq r2, r2, #7 @ if zero, then no bits here addeq r2, r2, #1 @ align bit pointer - beq .bytelp @ loop for next bit + beq 1b @ loop for next bit + +#endif /* * One or more bits in the LSB of r3 are assumed to be set. diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/setbit.S linux/arch/arm/lib/setbit.S --- v2.5.1/linux/arch/arm/lib/setbit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/setbit.S Tue Dec 25 21:43:32 2001 @@ -9,22 +9,21 @@ */ #include <linux/linkage.h> #include <asm/assembler.h> - .text + .text /* * Purpose : Function to set a bit * Prototype: int set_bit(int bit, void *addr) */ - -ENTRY(set_bit) - and r2, r0, #7 - mov r3, #1 - mov r3, r3, lsl r2 +ENTRY(_set_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_set_bit_le) + and r2, r0, #7 + mov r3, #1 + mov r3, r3, lsl r2 save_and_disable_irqs ip, r2 ldrb r2, [r1, r0, lsr #3] orr r2, r2, r3 strb r2, [r1, r0, lsr #3] restore_irqs ip RETINSTR(mov,pc,lr) - - diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/testchangebit.S linux/arch/arm/lib/testchangebit.S --- v2.5.1/linux/arch/arm/lib/testchangebit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/testchangebit.S Tue Dec 25 21:43:32 2001 @@ -11,7 +11,9 @@ #include <asm/assembler.h> .text -ENTRY(test_and_change_bit) +ENTRY(_test_and_change_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_test_and_change_bit_le) add r1, r1, r0, lsr #3 and r3, r0, #7 mov r0, #1 diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/testclearbit.S linux/arch/arm/lib/testclearbit.S --- v2.5.1/linux/arch/arm/lib/testclearbit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/testclearbit.S Tue Dec 25 21:43:32 2001 @@ -11,7 +11,9 @@ #include <asm/assembler.h> .text -ENTRY(test_and_clear_bit) +ENTRY(_test_and_clear_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_test_and_clear_bit_le) add r1, r1, r0, lsr #3 @ Get byte offset and r3, r0, #7 @ Get bit offset mov r0, #1 diff -u --recursive --new-file v2.5.1/linux/arch/arm/lib/testsetbit.S linux/arch/arm/lib/testsetbit.S --- v2.5.1/linux/arch/arm/lib/testsetbit.S Mon Sep 18 15:15:25 2000 +++ linux/arch/arm/lib/testsetbit.S Tue Dec 25 21:43:32 2001 @@ -11,7 +11,9 @@ #include <asm/assembler.h> .text -ENTRY(test_and_set_bit) +ENTRY(_test_and_set_bit_be) + eor r0, r0, #0x18 @ big endian byte ordering +ENTRY(_test_and_set_bit_le) add r1, r1, r0, lsr #3 @ Get byte offset and r3, r0, #7 @ Get bit offset mov r0, #1 diff -u --recursive --new-file v2.5.1/linux/arch/arm/nwfpe/ARM-gcc.h linux/arch/arm/nwfpe/ARM-gcc.h --- v2.5.1/linux/arch/arm/nwfpe/ARM-gcc.h Thu Jun 17 01:11:35 1999 +++ linux/arch/arm/nwfpe/ARM-gcc.h Tue Dec 25 21:43:32 2001 @@ -1,11 +1,3 @@ - -/* -------------------------------------------------------------------------------- -One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. -------------------------------------------------------------------------------- -*/ -#define LITTLEENDIAN - /* ------------------------------------------------------------------------------- The macro `BITS64' can be defined to indicate that 64-bit integer types are diff -u --recursive --new-file v2.5.1/linux/arch/arm/nwfpe/entry.S linux/arch/arm/nwfpe/entry.S --- v2.5.1/linux/arch/arm/nwfpe/entry.S Sun Aug 12 11:13:59 2001 +++ linux/arch/arm/nwfpe/entry.S Tue Dec 25 21:43:32 2001 @@ -50,11 +50,10 @@ This routine does three things: -1) It saves SP into a variable called userRegisters. The kernel has -created a struct pt_regs on the stack and saved the user registers -into it. See /usr/include/asm/proc/ptrace.h for details. The -emulator code uses userRegisters as the base of an array of words from -which the contents of the registers can be extracted. +1) The kernel has created a struct pt_regs on the stack and saved the +user registers into it. See /usr/include/asm/proc/ptrace.h for details. +The emulator code uses userRegisters as the base of an array of words +from which the contents of the registers can be extracted. 2) It calls EmulateAll to emulate a floating point instruction. EmulateAll returns 1 if the emulation was successful, or 0 if not. @@ -78,16 +77,18 @@ of stealing two regs from the register allocator. Not sure if it's worth it. */ str sp, [r10] @ Store the user registers pointer in the fpa11 structure. - mov r4, sp @ use r4 for local pointer - mov r10, lr @ save the failure-return addresses + mov r4, lr @ save the failure-return addresses - ldr r5, [r4, #60] @ get contents of PC; + mov r0, r10 + bl FPA11_CheckInit @ check to see if we are initialised + + ldr r5, [sp, #60] @ get contents of PC; sub r8, r5, #4 .Lx2: ldrt r0, [r8] @ get actual instruction into r0 emulate: bl EmulateAll @ emulate the instruction cmp r0, #0 @ was emulation successful - moveq pc, r10 @ no, return failure + moveq pc, r4 @ no, return failure next: .Lx1: ldrt r6, [r5], #4 @ get the next instruction and @@ -99,10 +100,10 @@ teqne r2, #0x0E000000 movne pc, r9 @ return ok if not a fp insn - str r5, [r4, #60] @ update PC copy in regs + str r5, [sp, #60] @ update PC copy in regs mov r0, r6 @ save a copy - ldr r1, [r4, #64] @ fetch the condition codes + ldr r1, [sp, #64] @ fetch the condition codes bl checkCondition @ check the condition cmp r0, #0 @ r0 = 0 ==> condition failed diff -u --recursive --new-file v2.5.1/linux/arch/arm/nwfpe/fpa11.c linux/arch/arm/nwfpe/fpa11.c --- v2.5.1/linux/arch/arm/nwfpe/fpa11.c Sun Aug 12 11:13:59 2001 +++ linux/arch/arm/nwfpe/fpa11.c Tue Dec 25 21:43:32 2001 @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - +#include <linux/compiler.h> #include <asm/system.h> #include "fpa11.h" @@ -123,47 +123,58 @@ } } -/* Emulate the instruction in the opcode. */ -unsigned int EmulateAll(unsigned int opcode) +void FPA11_CheckInit(FPA11 *fpa11) { - unsigned int nRc = 0; - unsigned long flags; - FPA11 *fpa11; - save_flags(flags); sti(); - - fpa11 = GET_FPA11(); - - if (fpa11->initflag == 0) /* good place for __builtin_expect */ + if (unlikely(fpa11->initflag == 0)) { resetFPA11(); SetRoundingMode(ROUND_TO_NEAREST); SetRoundingPrecision(ROUND_EXTENDED); fpa11->initflag = 1; } +} - if (TEST_OPCODE(opcode,MASK_CPRT)) - { - /* Emulate conversion opcodes. */ - /* Emulate register transfer opcodes. */ - /* Emulate comparison opcodes. */ - nRc = EmulateCPRT(opcode); - } - else if (TEST_OPCODE(opcode,MASK_CPDO)) - { - /* Emulate monadic arithmetic opcodes. */ - /* Emulate dyadic arithmetic opcodes. */ - nRc = EmulateCPDO(opcode); - } - else if (TEST_OPCODE(opcode,MASK_CPDT)) - { - /* Emulate load/store opcodes. */ - /* Emulate load/store multiple opcodes. */ - nRc = EmulateCPDT(opcode); - } - else +/* Emulate the instruction in the opcode. */ +unsigned int EmulateAll(unsigned int opcode) +{ + unsigned int nRc = 1, code; + unsigned long flags; + FPA11 *fpa11; + + save_flags(flags); sti(); + + code = opcode & 0x00000f00; + if (code == 0x00000100 || code == 0x00000200) { - /* Invalid instruction detected. Return FALSE. */ - nRc = 0; + /* For coprocessor 1 or 2 (FPA11) */ + code = opcode & 0x0e000000; + if (code == 0x0e000000) + { + if (opcode & 0x00000010) + { + /* Emulate conversion opcodes. */ + /* Emulate register transfer opcodes. */ + /* Emulate comparison opcodes. */ + nRc = EmulateCPRT(opcode); + } + else + { + /* Emulate monadic arithmetic opcodes. */ + /* Emulate dyadic arithmetic opcodes. */ + nRc = EmulateCPDO(opcode); + } + } + else if (code == 0x0c000000) + { + /* Emulate load/store opcodes. */ + /* Emulate load/store multiple opcodes. */ + nRc = EmulateCPDT(opcode); + } + else + { + /* Invalid instruction detected. Return FALSE. */ + nRc = 0; + } } restore_flags(flags); diff -u --recursive --new-file v2.5.1/linux/arch/arm/nwfpe/fpa11_cpdt.c linux/arch/arm/nwfpe/fpa11_cpdt.c --- v2.5.1/linux/arch/arm/nwfpe/fpa11_cpdt.c Sun Aug 12 11:13:59 2001 +++ linux/arch/arm/nwfpe/fpa11_cpdt.c Tue Dec 25 21:43:32 2001 @@ -45,7 +45,7 @@ fpa11->fType[Fn] = typeDouble; get_user(p[0], &pMem[1]); get_user(p[1], &pMem[0]); /* sign & exponent */ -} +} static inline void loadExtended(const unsigned int Fn,const unsigned int *pMem) @@ -57,7 +57,7 @@ get_user(p[0], &pMem[0]); /* sign & exponent */ get_user(p[1], &pMem[2]); /* ls bits */ get_user(p[2], &pMem[1]); /* ms bits */ -} +} static inline void loadMultiple(const unsigned int Fn,const unsigned int *pMem) @@ -69,7 +69,7 @@ p = (unsigned int*)&(fpa11->fpreg[Fn]); get_user(x, &pMem[0]); fpa11->fType[Fn] = (x >> 14) & 0x00000003; - + switch (fpa11->fType[Fn]) { case typeSingle: @@ -79,13 +79,13 @@ get_user(p[1], &pMem[1]); /* double msw */ p[2] = 0; /* empty */ } - break; - + break; + case typeExtended: { get_user(p[1], &pMem[2]); get_user(p[2], &pMem[1]); /* msw */ - p[0] = (x & 0x80003fff); + p[0] = (x & 0x80003fff); } break; } @@ -95,82 +95,92 @@ void storeSingle(const unsigned int Fn,unsigned int *pMem) { FPA11 *fpa11 = GET_FPA11(); - float32 val; - register unsigned int *p = (unsigned int*)&val; - + union + { + float32 f; + unsigned int i[1]; + } val; + switch (fpa11->fType[Fn]) { - case typeDouble: - val = float64_to_float32(fpa11->fpreg[Fn].fDouble); + case typeDouble: + val.f = float64_to_float32(fpa11->fpreg[Fn].fDouble); break; - case typeExtended: - val = floatx80_to_float32(fpa11->fpreg[Fn].fExtended); + case typeExtended: + val.f = floatx80_to_float32(fpa11->fpreg[Fn].fExtended); break; - default: val = fpa11->fpreg[Fn].fSingle; + default: val.f = fpa11->fpreg[Fn].fSingle; } - - put_user(p[0], pMem); -} + + put_user(val.i[0], pMem); +} static inline void storeDouble(const unsigned int Fn,unsigned int *pMem) { FPA11 *fpa11 = GET_FPA11(); - float64 val; - register unsigned int *p = (unsigned int*)&val; + union + { + float64 f; + unsigned int i[2]; + } val; switch (fpa11->fType[Fn]) { - case typeSingle: - val = float32_to_float64(fpa11->fpreg[Fn].fSingle); + case typeSingle: + val.f = float32_to_float64(fpa11->fpreg[Fn].fSingle); break; case typeExtended: - val = floatx80_to_float64(fpa11->fpreg[Fn].fExtended); + val.f = floatx80_to_float64(fpa11->fpreg[Fn].fExtended); break; - default: val = fpa11->fpreg[Fn].fDouble; + default: val.f = fpa11->fpreg[Fn].fDouble; } - put_user(p[1], &pMem[0]); /* msw */ - put_user(p[0], &pMem[1]); /* lsw */ -} + + put_user(val.i[1], &pMem[0]); /* msw */ + put_user(val.i[0], &pMem[1]); /* lsw */ +} static inline void storeExtended(const unsigned int Fn,unsigned int *pMem) { FPA11 *fpa11 = GET_FPA11(); - floatx80 val; - register unsigned int *p = (unsigned int*)&val; - + union + { + floatx80 f; + unsigned int i[3]; + } val; + switch (fpa11->fType[Fn]) { - case typeSingle: - val = float32_to_floatx80(fpa11->fpreg[Fn].fSingle); + case typeSingle: + val.f = float32_to_floatx80(fpa11->fpreg[Fn].fSingle); break; - case typeDouble: - val = float64_to_floatx80(fpa11->fpreg[Fn].fDouble); + case typeDouble: + val.f = float64_to_floatx80(fpa11->fpreg[Fn].fDouble); break; - default: val = fpa11->fpreg[Fn].fExtended; + default: val.f = fpa11->fpreg[Fn].fExtended; } - - put_user(p[0], &pMem[0]); /* sign & exp */ - put_user(p[1], &pMem[2]); - put_user(p[2], &pMem[1]); /* msw */ -} + + put_user(val.i[0], &pMem[0]); /* sign & exp */ + put_user(val.i[1], &pMem[2]); + put_user(val.i[2], &pMem[1]); /* msw */ +} static inline void storeMultiple(const unsigned int Fn,unsigned int *pMem) { FPA11 *fpa11 = GET_FPA11(); register unsigned int nType, *p; - + p = (unsigned int*)&(fpa11->fpreg[Fn]); nType = fpa11->fType[Fn]; - + switch (nType) { case typeSingle: @@ -180,8 +190,8 @@ put_user(p[1], &pMem[1]); /* double msw */ put_user(nType << 14, &pMem[0]); } - break; - + break; + case typeExtended: { put_user(p[2], &pMem[1]); /* msw */ @@ -221,7 +231,7 @@ case TRANSFER_EXTENDED: loadExtended(getFd(opcode),pAddress); break; default: nRc = 0; } - + if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal); return nRc; } @@ -230,10 +240,10 @@ { unsigned int *pBase, *pAddress, *pFinal, nRc = 1, write_back = WRITE_BACK(opcode); - + //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); SetRoundingMode(ROUND_TO_NEAREST); - + pBase = (unsigned int*)readRegister(getRn(opcode)); if (REG_PC == getRn(opcode)) { @@ -256,7 +266,7 @@ case TRANSFER_EXTENDED: storeExtended(getFd(opcode),pAddress); break; default: nRc = 0; } - + if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal); return nRc; } @@ -297,14 +307,14 @@ { unsigned int i, Fd, *pBase, *pAddress, *pFinal, write_back = WRITE_BACK(opcode); - + pBase = (unsigned int*)readRegister(getRn(opcode)); if (REG_PC == getRn(opcode)) { pBase += 2; write_back = 0; } - + pFinal = pBase; if (BIT_UP_SET(opcode)) pFinal += getOffset(opcode); @@ -331,7 +341,7 @@ unsigned int nRc = 0; //printk("EmulateCPDT(0x%08x)\n",opcode); - + if (LDF_OP(opcode)) { nRc = PerformLDF(opcode); @@ -343,7 +353,7 @@ else if (STF_OP(opcode)) { nRc = PerformSTF(opcode); - } + } else if (SFM_OP(opcode)) { nRc = PerformSFM(opcode); @@ -352,7 +362,7 @@ { nRc = 0; } - + return nRc; } #endif diff -u --recursive --new-file v2.5.1/linux/arch/cris/kernel/process.c linux/arch/cris/kernel/process.c --- v2.5.1/linux/arch/cris/kernel/process.c Fri Nov 9 13:58:02 2001 +++ linux/arch/cris/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -119,7 +119,6 @@ int cpu_idle(void *unused) { while(1) { - current->counter = -100; schedule(); } } diff -u --recursive --new-file v2.5.1/linux/arch/i386/config.in linux/arch/i386/config.in --- v2.5.1/linux/arch/i386/config.in Mon Nov 12 11:58:08 2001 +++ linux/arch/i386/config.in Sun Dec 30 10:38:45 2001 @@ -52,6 +52,7 @@ define_int CONFIG_X86_L1_CACHE_SHIFT 4 define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n + define_bool CONFIG_X86_PPRO_FENCE y else define_bool CONFIG_X86_WP_WORKS_OK y define_bool CONFIG_X86_INVLPG y @@ -66,17 +67,20 @@ define_int CONFIG_X86_L1_CACHE_SHIFT 4 define_bool CONFIG_X86_USE_STRING_486 y define_bool CONFIG_X86_ALIGNMENT_16 y + define_bool CONFIG_X86_PPRO_FENCE y fi if [ "$CONFIG_M586" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 define_bool CONFIG_X86_USE_STRING_486 y define_bool CONFIG_X86_ALIGNMENT_16 y + define_bool CONFIG_X86_PPRO_FENCE y fi if [ "$CONFIG_M586TSC" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 define_bool CONFIG_X86_USE_STRING_486 y define_bool CONFIG_X86_ALIGNMENT_16 y define_bool CONFIG_X86_TSC y + define_bool CONFIG_X86_PPRO_FENCE y fi if [ "$CONFIG_M586MMX" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 @@ -84,6 +88,7 @@ define_bool CONFIG_X86_ALIGNMENT_16 y define_bool CONFIG_X86_TSC y define_bool CONFIG_X86_GOOD_APIC y + define_bool CONFIG_X86_PPRO_FENCE y fi if [ "$CONFIG_M686" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 @@ -91,6 +96,7 @@ define_bool CONFIG_X86_GOOD_APIC y define_bool CONFIG_X86_PGE y define_bool CONFIG_X86_USE_PPRO_CHECKSUM y + define_bool CONFIG_X86_PPRO_FENCE y fi if [ "$CONFIG_MPENTIUMIII" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 @@ -135,21 +141,24 @@ define_int CONFIG_X86_L1_CACHE_SHIFT 5 define_bool CONFIG_X86_ALIGNMENT_16 y define_bool CONFIG_X86_USE_PPRO_CHECKSUM y + define_bool CONFIG_X86_OOSTORE y fi if [ "$CONFIG_MWINCHIP2" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 define_bool CONFIG_X86_ALIGNMENT_16 y define_bool CONFIG_X86_TSC y define_bool CONFIG_X86_USE_PPRO_CHECKSUM y + define_bool CONFIG_X86_OOSTORE y fi if [ "$CONFIG_MWINCHIP3D" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 define_bool CONFIG_X86_ALIGNMENT_16 y define_bool CONFIG_X86_TSC y define_bool CONFIG_X86_USE_PPRO_CHECKSUM y + define_bool CONFIG_X86_OOSTORE y fi tristate 'Toshiba Laptop support' CONFIG_TOSHIBA -tristate 'Dell Inspiron 8000 support' CONFIG_I8K +tristate 'Dell laptop support' CONFIG_I8K tristate '/dev/cpu/microcode - Intel IA32 CPU microcode support' CONFIG_MICROCODE tristate '/dev/cpu/*/msr - Model-specific register support' CONFIG_X86_MSR diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/apic.c linux/arch/i386/kernel/apic.c --- v2.5.1/linux/arch/i386/kernel/apic.c Fri Nov 9 14:12:55 2001 +++ linux/arch/i386/kernel/apic.c Tue Dec 25 17:04:40 2001 @@ -56,6 +56,14 @@ maxlvt = get_maxlvt(); /* + * Masking an LVT entry on a P6 can trigger a local APIC error + * if the vector is zero. Mask LVTERR first to prevent this. + */ + if (maxlvt >= 3) { + v = ERROR_APIC_VECTOR; /* any non-zero vector will do */ + apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED); + } + /* * Careful: we have to set masks only first to deassert * any level-triggered sources. */ @@ -65,10 +73,6 @@ apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); v = apic_read(APIC_LVT1); apic_write_around(APIC_LVT1, v | APIC_LVT_MASKED); - if (maxlvt >= 3) { - v = apic_read(APIC_LVTERR); - apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED); - } if (maxlvt >= 4) { v = apic_read(APIC_LVTPC); apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED); @@ -84,6 +88,8 @@ apic_write_around(APIC_LVTERR, APIC_LVT_MASKED); if (maxlvt >= 4) apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); + apic_write(APIC_ESR, 0); + v = apic_read(APIC_ESR); } void __init connect_bsp_APIC(void) @@ -480,6 +486,7 @@ l &= ~MSR_IA32_APICBASE_BASE; l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; wrmsr(MSR_IA32_APICBASE, l, h); + apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); apic_write(APIC_ID, apic_pm_state.apic_id); apic_write(APIC_DFR, apic_pm_state.apic_dfr); apic_write(APIC_LDR, apic_pm_state.apic_ldr); @@ -487,15 +494,15 @@ apic_write(APIC_SPIV, apic_pm_state.apic_spiv); apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); + apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc); + apic_write(APIC_LVTT, apic_pm_state.apic_lvtt); + apic_write(APIC_TDCR, apic_pm_state.apic_tdcr); + apic_write(APIC_TMICT, apic_pm_state.apic_tmict); apic_write(APIC_ESR, 0); apic_read(APIC_ESR); apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr); apic_write(APIC_ESR, 0); apic_read(APIC_ESR); - apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc); - apic_write(APIC_LVTT, apic_pm_state.apic_lvtt); - apic_write(APIC_TDCR, apic_pm_state.apic_tdcr); - apic_write(APIC_TMICT, apic_pm_state.apic_tmict); __restore_flags(flags); if (apic_pm_state.perfctr_pmdev) pm_send(apic_pm_state.perfctr_pmdev, PM_RESUME, data); diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/dmi_scan.c linux/arch/i386/kernel/dmi_scan.c --- v2.5.1/linux/arch/i386/kernel/dmi_scan.c Tue Dec 18 14:56:34 2001 +++ linux/arch/i386/kernel/dmi_scan.c Sun Dec 30 09:44:51 2001 @@ -572,6 +572,11 @@ MATCH(DMI_BIOS_VERSION,"L440GX0.86B.0094.P10"), NO_MATCH, NO_MATCH } }, + { broken_pirq, "l44GX Bios", { /* Bad $PIR */ + MATCH(DMI_BIOS_VENDOR, "Intel Corporation"), + MATCH(DMI_BIOS_VERSION,"L440GX0.86B.0120.P12"), + NO_MATCH, NO_MATCH + } }, { broken_pirq, "l44GX Bios", { /* Bad $PIR */ MATCH(DMI_BIOS_VENDOR, "Intel Corporation"), MATCH(DMI_BIOS_VERSION,"L440GX0.86B.0125.P13"), diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/pci-pc.c linux/arch/i386/kernel/pci-pc.c --- v2.5.1/linux/arch/i386/kernel/pci-pc.c Tue Dec 18 14:56:34 2001 +++ linux/arch/i386/kernel/pci-pc.c Sun Dec 30 09:44:51 2001 @@ -30,7 +30,7 @@ * This interrupt-safe spinlock protects all accesses to PCI * configuration space. */ -spinlock_t pci_config_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t pci_config_lock = SPIN_LOCK_UNLOCKED; /* @@ -1109,17 +1109,15 @@ } /* - * Nobody seems to know what this does. Damn. - * - * But it does seem to fix some unspecified problem - * with 'movntq' copies on Athlons. + * Addresses issues with problems in the memory write queue timer in + * certain VIA Northbridges. This bugfix is per VIA's specifications. * * VIA 8363,8622,8361 Northbridges: * - bits 5, 6, 7 at offset 0x55 need to be turned off * VIA 8367 (KT266x) Northbridges: * - bits 5, 6, 7 at offset 0x95 need to be turned off */ -static void __init pci_fixup_via_athlon_bug(struct pci_dev *d) +static void __init pci_fixup_via_northbridge_bug(struct pci_dev *d) { u8 v; int where = 0x55; @@ -1131,7 +1129,7 @@ pci_read_config_byte(d, where, &v); if (v & 0xe0) { - printk("Trying to stomp on Athlon bug...\n"); + printk("Disabling broken memory write queue.\n"); v &= 0x1f; /* clear bits 5, 6, 7 */ pci_write_config_byte(d, where, v); } @@ -1146,10 +1144,10 @@ { PCI_FIXUP_HEADER, PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, pci_fixup_latency }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5598, pci_fixup_latency }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci_fixup_piix4_acpi }, - { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_via_athlon_bug }, - { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_athlon_bug }, - { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_athlon_bug }, - { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_athlon_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_via_northbridge_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug }, { 0 } }; diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c --- v2.5.1/linux/arch/i386/kernel/process.c Thu Oct 4 18:42:54 2001 +++ linux/arch/i386/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -125,7 +125,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; while (1) { void (*idle)(void) = pm_idle; diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c --- v2.5.1/linux/arch/i386/kernel/setup.c Tue Dec 18 14:56:34 2001 +++ linux/arch/i386/kernel/setup.c Sun Dec 30 09:44:51 2001 @@ -1290,7 +1290,6 @@ break; case 6: /* An Athlon/Duron. We can trust the BIOS probably */ - mcheck_init(c); break; } @@ -1918,7 +1917,6 @@ c->x86_cache_size = (cc>>24)+(dd>>24); } sprintf( c->x86_model_id, "WinChip %s", name ); - mcheck_init(c); break; case 6: @@ -2202,9 +2200,6 @@ if ( p ) strcpy(c->x86_model_id, p); - - /* Enable MCA if available */ - mcheck_init(c); } void __init get_cpu_vendor(struct cpuinfo_x86 *c) @@ -2584,7 +2579,7 @@ init_rise(c); break; } - + printk(KERN_DEBUG "CPU: After vendor init, caps: %08x %08x %08x %08x\n", c->x86_capability[0], c->x86_capability[1], @@ -2610,6 +2605,9 @@ /* Disable the PN if appropriate */ squash_the_stupid_serial_number(c); + + /* Init Machine Check Exception if available. */ + mcheck_init(c); /* If the model name is still unset, do table lookup. */ if ( !c->x86_model_id[0] ) { diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/signal.c linux/arch/i386/kernel/signal.c --- v2.5.1/linux/arch/i386/kernel/signal.c Fri Sep 14 14:15:40 2001 +++ linux/arch/i386/kernel/signal.c Wed Dec 19 15:27:12 2001 @@ -28,7 +28,7 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) -asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); +int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from) { diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/smp.c linux/arch/i386/kernel/smp.c --- v2.5.1/linux/arch/i386/kernel/smp.c Tue Oct 23 14:17:10 2001 +++ linux/arch/i386/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -17,6 +17,7 @@ #include <linux/smp_lock.h> #include <linux/kernel_stat.h> #include <linux/mc146818rtc.h> +#include <linux/cache.h> #include <asm/mtrr.h> #include <asm/pgalloc.h> @@ -102,7 +103,7 @@ */ /* The 'big kernel lock' */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; struct tlb_state cpu_tlbstate[NR_CPUS] = {[0 ... NR_CPUS-1] = { &init_mm, 0 }}; diff -u --recursive --new-file v2.5.1/linux/arch/i386/kernel/vm86.c linux/arch/i386/kernel/vm86.c --- v2.5.1/linux/arch/i386/kernel/vm86.c Fri Jul 6 17:05:07 2001 +++ linux/arch/i386/kernel/vm86.c Wed Dec 19 15:27:12 2001 @@ -62,7 +62,7 @@ ( (unsigned)( & (((struct kernel_vm86_regs *)0)->VM86_REGS_PART2) ) ) #define VM86_REGS_SIZE2 (sizeof(struct kernel_vm86_regs) - VM86_REGS_SIZE1) -asmlinkage struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs)); +struct pt_regs * FASTCALL(save_v86_state(struct kernel_vm86_regs * regs)); struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs) { struct tss_struct *tss; diff -u --recursive --new-file v2.5.1/linux/arch/ia64/hp/hpsim_console.c linux/arch/ia64/hp/hpsim_console.c --- v2.5.1/linux/arch/ia64/hp/hpsim_console.c Thu Oct 12 14:20:48 2000 +++ linux/arch/ia64/hp/hpsim_console.c Tue Dec 25 15:39:20 2001 @@ -24,14 +24,12 @@ static int simcons_init (struct console *, char *); static void simcons_write (struct console *, const char *, unsigned); -static int simcons_wait_key (struct console *); static kdev_t simcons_console_device (struct console *); struct console hpsim_cons = { name: "simcons", write: simcons_write, device: simcons_console_device, - wait_key: simcons_wait_key, setup: simcons_init, flags: CON_PRINTBUFFER, index: -1, @@ -54,17 +52,6 @@ if (ch == '\n') ia64_ssc('\r', 0, 0, 0, SSC_PUTCHAR); } -} - -static int -simcons_wait_key (struct console *cons) -{ - char ch; - - do { - ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR); - } while (ch == '\0'); - return ch; } static kdev_t diff -u --recursive --new-file v2.5.1/linux/arch/ia64/kernel/process.c linux/arch/ia64/kernel/process.c --- v2.5.1/linux/arch/ia64/kernel/process.c Fri Nov 9 14:26:17 2001 +++ linux/arch/ia64/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -114,8 +114,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; - while (1) { #ifdef CONFIG_SMP diff -u --recursive --new-file v2.5.1/linux/arch/ia64/kernel/smp.c linux/arch/ia64/kernel/smp.c --- v2.5.1/linux/arch/ia64/kernel/smp.c Fri Nov 9 14:26:17 2001 +++ linux/arch/ia64/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -30,6 +30,7 @@ #include <linux/kernel_stat.h> #include <linux/mm.h> #include <linux/delay.h> +#include <linux/cache.h> #include <asm/atomic.h> #include <asm/bitops.h> @@ -51,7 +52,7 @@ #include <asm/mca.h> /* The 'big kernel lock' */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; /* * Structure and data for smp_call_function(). This is designed to minimise static memory diff -u --recursive --new-file v2.5.1/linux/arch/ia64/sn/io/hcl.c linux/arch/ia64/sn/io/hcl.c --- v2.5.1/linux/arch/ia64/sn/io/hcl.c Thu Apr 5 12:51:47 2001 +++ linux/arch/ia64/sn/io/hcl.c Thu Dec 27 08:29:14 2001 @@ -1049,16 +1049,22 @@ struct file_operations * hwgraph_cdevsw_get(devfs_handle_t de) { - return(devfs_get_ops(de)); + struct file_operations *fops = devfs_get_ops(de); + + devfs_put_ops(de); /* FIXME: this may need to be moved to callers */ + return(fops); } /* * hwgraph_bdevsw_get - returns the fops of the given devfs entry. */ -struct file_operations * +struct file_operations * /* FIXME: shouldn't this be a blkdev? */ hwgraph_bdevsw_get(devfs_handle_t de) { - return(devfs_get_ops(de)); + struct file_operations *fops = devfs_get_ops(de); + + devfs_put_ops(de); /* FIXME: this may need to be moved to callers */ + return(fops); } /* diff -u --recursive --new-file v2.5.1/linux/arch/m68k/amiga/config.c linux/arch/m68k/amiga/config.c --- v2.5.1/linux/arch/m68k/amiga/config.c Tue Dec 18 14:56:34 2001 +++ linux/arch/m68k/amiga/config.c Tue Dec 25 15:39:20 2001 @@ -98,7 +98,6 @@ extern void amiga_floppy_setup(char *, int *); #endif static void amiga_reset (void); -static int amiga_wait_key (struct console *co); extern void amiga_init_sound(void); static void amiga_savekmsg_init(void); static void amiga_mem_console_write(struct console *co, const char *b, @@ -112,7 +111,6 @@ static struct console amiga_console_driver = { name: "debug", - wait_key: amiga_wait_key, flags: CON_PRINTBUFFER, index: -1, }; @@ -740,33 +738,6 @@ } return 0; -} - -static int amiga_wait_key (struct console *co) -{ - int i; - - while (1) { - while (ciaa.pra & 0x40); - - /* debounce */ - for (i = 0; i < 1000; i++); - - if (!(ciaa.pra & 0x40)) - break; - } - - /* wait for button up */ - while (1) { - while (!(ciaa.pra & 0x40)); - - /* debounce */ - for (i = 0; i < 1000; i++); - - if (ciaa.pra & 0x40) - break; - } - return 0; } static NORET_TYPE void amiga_reset( void ) diff -u --recursive --new-file v2.5.1/linux/arch/m68k/kernel/process.c linux/arch/m68k/kernel/process.c --- v2.5.1/linux/arch/m68k/kernel/process.c Sun Sep 30 12:26:08 2001 +++ linux/arch/m68k/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -81,7 +81,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; idle(); } diff -u --recursive --new-file v2.5.1/linux/arch/m68k/mac/debug.c linux/arch/m68k/mac/debug.c --- v2.5.1/linux/arch/m68k/mac/debug.c Mon Jun 11 19:15:27 2001 +++ linux/arch/m68k/mac/debug.c Tue Dec 25 15:39:20 2001 @@ -248,17 +248,6 @@ return( scc.cha_b_data ); } -int mac_scca_console_wait_key(struct console *co) -{ - int i; - do { - for( i = uSEC; i > 0; --i ) - barrier(); - } while( !(scc.cha_a_ctrl & 0x01) ); /* wait for rx buf filled */ - for( i = uSEC; i > 0; --i ) - barrier(); - return( scc.cha_a_data ); -} #endif /* The following two functions do a quick'n'dirty initialization of the MFP or @@ -395,9 +384,6 @@ /* Mac modem port */ mac_init_scc_port( B9600|CS8, 0 ); mac_console_driver.write = mac_scca_console_write; -#ifdef CONFIG_SERIAL_CONSOLE - mac_console_driver.wait_key = mac_scca_console_wait_key; -#endif scc_port = 0; } else if (!strcmp( m68k_debug_device, "ser2" )) { diff -u --recursive --new-file v2.5.1/linux/arch/m68k/mvme147/config.c linux/arch/m68k/mvme147/config.c --- v2.5.1/linux/arch/m68k/mvme147/config.c Tue Dec 18 14:56:34 2001 +++ linux/arch/m68k/mvme147/config.c Tue Dec 25 15:39:20 2001 @@ -241,31 +241,7 @@ restore_flags(flags); } - -static int m147_scc_wait_key (struct console *co) -{ - volatile unsigned char *p = (volatile char *)M147_SCC_A_ADDR; - unsigned long flags; - int c; - - /* wait for rx buf filled */ - while ((*p & 0x01) == 0) - ; - - save_flags(flags); - cli(); - - *p = 8; - scc_delay(); - c = *p; - - restore_flags(flags); - return c; -} - - void mvme147_init_console_port (struct console *co, int cflag) { co->write = m147_scc_write; - co->wait_key = m147_scc_wait_key; } diff -u --recursive --new-file v2.5.1/linux/arch/m68k/q40/config.c linux/arch/m68k/q40/config.c --- v2.5.1/linux/arch/m68k/q40/config.c Tue Dec 18 14:56:34 2001 +++ linux/arch/m68k/q40/config.c Tue Dec 25 15:39:20 2001 @@ -72,10 +72,8 @@ extern int ql_ticks; -static int q40_wait_key(struct console *co){return 0;} static struct console q40_console_driver = { name: "debug", - wait_key: q40_wait_key, flags: CON_PRINTBUFFER, index: -1, }; diff -u --recursive --new-file v2.5.1/linux/arch/m68k/sun3x/prom.c linux/arch/m68k/sun3x/prom.c --- v2.5.1/linux/arch/m68k/sun3x/prom.c Mon Jun 11 19:15:27 2001 +++ linux/arch/m68k/sun3x/prom.c Tue Dec 25 15:39:20 2001 @@ -96,7 +96,6 @@ sun3x_prom_write, /* write */ NULL, /* read */ NULL, /* device */ - NULL, /* wait_key */ NULL, /* unblank */ NULL, /* setup */ CON_PRINTBUFFER, diff -u --recursive --new-file v2.5.1/linux/arch/mips/au1000/common/serial.c linux/arch/mips/au1000/common/serial.c --- v2.5.1/linux/arch/mips/au1000/common/serial.c Fri Oct 5 12:06:51 2001 +++ linux/arch/mips/au1000/common/serial.c Tue Dec 25 15:39:20 2001 @@ -2922,35 +2922,6 @@ serial_out(info, UART_IER, ier); } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - static struct async_struct *info; - int ier, c; - - info = &async_sercons; - - /* - * First save the IER then disable the interrupts so - * that the real driver for the port does not get the - * character. - */ - ier = serial_in(info, UART_IER); - serial_out(info, UART_IER, 0x00); - - while ((serial_in(info, UART_LSR) & UART_LSR_DR) == 0); - c = serial_in(info, UART_RX); - - /* - * Restore the interrupts - */ - serial_out(info, UART_IER, ier); - - return c; -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -3075,7 +3046,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/mips/baget/vacserial.c linux/arch/mips/baget/vacserial.c --- v2.5.1/linux/arch/mips/baget/vacserial.c Sun Sep 9 10:43:01 2001 +++ linux/arch/mips/baget/vacserial.c Tue Dec 25 15:39:20 2001 @@ -2622,43 +2622,6 @@ serial_outp(&scr_info, VAC_UART_INT_MASK, ier); } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - struct serial_state *ser; - int ier; - int lsr; - int c; - struct async_struct scr_info; /* serial_{in,out} because HUB6 */ - - ser = rs_table + co->index; - scr_info.magic = SERIAL_MAGIC; - scr_info.port = ser->port; - scr_info.flags = ser->flags; - - /* - * First save the IER then disable the interrupts so - * that the real driver for the port does not get the - * character. - */ - ier = serial_inp(&scr_info, VAC_UART_INT_MASK); - serial_outp(&scr_info, VAC_UART_INT_MASK, 0x00); - - do { - lsr = serial_inp(&scr_info, VAC_UART_INT_STATUS); - } while (!(lsr & VAC_UART_STATUS_RX_READY)); - c = serial_inp(&scr_info, VAC_UART_RX); - - /* - * Restore the interrupts - */ - serial_outp(&scr_info, VAC_UART_INT_MASK, ier); - - return c; -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -2812,7 +2775,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/mips/dec/promcon.c linux/arch/mips/dec/promcon.c --- v2.5.1/linux/arch/mips/dec/promcon.c Thu Oct 12 14:20:48 2000 +++ linux/arch/mips/dec/promcon.c Tue Dec 25 15:39:20 2001 @@ -30,11 +30,6 @@ } } -static int prom_console_wait_key(struct console *co) -{ - return prom_getchar(); -} - static int __init prom_console_setup(struct console *co, char *options) { return 0; @@ -50,7 +45,6 @@ name: "ttyS", write: prom_console_write, device: prom_console_device, - wait_key: prom_console_wait_key, setup: prom_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/mips/kernel/process.c linux/arch/mips/kernel/process.c --- v2.5.1/linux/arch/mips/kernel/process.c Sun Sep 9 10:43:01 2001 +++ linux/arch/mips/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -36,7 +36,6 @@ { /* endless idle loop with no priority at all */ current->nice = 20; - current->counter = -100; init_idle(); while (1) { diff -u --recursive --new-file v2.5.1/linux/arch/mips/kernel/smp.c linux/arch/mips/kernel/smp.c --- v2.5.1/linux/arch/mips/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/mips/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -31,6 +31,7 @@ #include <linux/timex.h> #include <linux/sched.h> #include <linux/interrupt.h> +#include <linux/cache.h> #include <asm/atomic.h> #include <asm/processor.h> @@ -52,7 +53,7 @@ /* Ze Big Kernel Lock! */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; int smp_threads_ready; /* Not used */ int smp_num_cpus; int global_irq_holder = NO_PROC_ID; diff -u --recursive --new-file v2.5.1/linux/arch/mips64/kernel/process.c linux/arch/mips64/kernel/process.c --- v2.5.1/linux/arch/mips64/kernel/process.c Fri Feb 9 11:29:44 2001 +++ linux/arch/mips64/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -34,7 +34,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; while (1) { while (!current->need_resched) if (wait_available) diff -u --recursive --new-file v2.5.1/linux/arch/mips64/kernel/smp.c linux/arch/mips64/kernel/smp.c --- v2.5.1/linux/arch/mips64/kernel/smp.c Wed Jul 4 11:50:39 2001 +++ linux/arch/mips64/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -5,6 +5,7 @@ #include <linux/time.h> #include <linux/timex.h> #include <linux/sched.h> +#include <linux/cache.h> #include <asm/atomic.h> #include <asm/processor.h> @@ -52,7 +53,7 @@ #endif /* CONFIG_SGI_IP27 */ /* The 'big kernel lock' */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; int smp_threads_ready; /* Not used */ atomic_t smp_commenced = ATOMIC_INIT(0); struct cpuinfo_mips cpu_data[NR_CPUS]; diff -u --recursive --new-file v2.5.1/linux/arch/parisc/kernel/pdc_cons.c linux/arch/parisc/kernel/pdc_cons.c --- v2.5.1/linux/arch/parisc/kernel/pdc_cons.c Sun Sep 16 21:23:15 2001 +++ linux/arch/parisc/kernel/pdc_cons.c Tue Dec 25 15:39:20 2001 @@ -105,10 +105,6 @@ static struct console pdc_cons = { name: "ttyB", write: pdc_console_write, - read: NULL, - device: NULL, - wait_key: pdc_console_wait_key, - unblank: NULL, setup: pdc_console_setup, flags: CON_PRINTBUFFER|CON_ENABLED, // |CON_CONSDEV, index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/parisc/kernel/process.c linux/arch/parisc/kernel/process.c --- v2.5.1/linux/arch/parisc/kernel/process.c Fri Feb 9 11:29:44 2001 +++ linux/arch/parisc/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -71,7 +71,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; while (1) { while (!current->need_resched) { diff -u --recursive --new-file v2.5.1/linux/arch/ppc/8260_io/uart.c linux/arch/ppc/8260_io/uart.c --- v2.5.1/linux/arch/ppc/8260_io/uart.c Mon May 21 17:04:46 2001 +++ linux/arch/ppc/8260_io/uart.c Thu Dec 27 08:21:28 2001 @@ -1732,7 +1732,7 @@ printk("lsr = %d (jiff=%lu)...", lsr, jiffies); #endif current->state = TASK_INTERRUPTIBLE; -/* current->counter = 0; make us low-priority */ +/* current->dyn_prio = 0; make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; @@ -2216,54 +2216,6 @@ info->tx_cur = (cbd_t *)bdp; } -/* - * Receive character from the serial port. This only works well - * before the port is initialize for real use. - */ -static int serial_console_wait_key(struct console *co) -{ - struct serial_state *ser; - u_char c, *cp; - ser_info_t *info; - volatile cbd_t *bdp; - volatile smc_uart_t *up; - - ser = rs_table + co->index; - - /* Pointer to UART in parameter ram. - */ - up = (smc_uart_t *)&immr->im_dprambase[ser->port]; - - /* Get the address of the host memory buffer. - * If the port has been initialized for general use, we must - * use information from the port structure. - */ - if ((info = (ser_info_t *)ser->info)) - bdp = info->rx_cur; - else - bdp = (cbd_t *)&immr->im_dprambase[up->smc_rbase]; - - /* - * We need to gracefully shut down the receiver, disable - * interrupts, then read the input. - */ - while (bdp->cbd_sc & BD_SC_EMPTY); /* Wait for a character */ - cp = __va(bdp->cbd_bufaddr); - - if (info) { - if (bdp->cbd_sc & BD_SC_WRAP) { - bdp = info->rx_bd_base; - } - else { - bdp++; - } - info->rx_cur = (cbd_t *)bdp; - } - - c = *cp; - return((int)c); -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTYAUX_MAJOR, 64 + c->index); @@ -2274,7 +2226,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: CONFIG_SERIAL_CONSOLE_PORT, diff -u --recursive --new-file v2.5.1/linux/arch/ppc/8xx_io/uart.c linux/arch/ppc/8xx_io/uart.c --- v2.5.1/linux/arch/ppc/8xx_io/uart.c Fri Nov 2 17:43:54 2001 +++ linux/arch/ppc/8xx_io/uart.c Thu Dec 27 08:21:28 2001 @@ -97,7 +97,6 @@ static void serial_console_write(struct console *c, const char *s, unsigned count); static kdev_t serial_console_device(struct console *c); -static int serial_console_wait_key(struct console *co); #if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) static unsigned long break_pressed; /* break, really ... */ @@ -218,7 +217,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: CONFIG_SERIAL_CONSOLE_PORT, @@ -1798,7 +1796,7 @@ printk("lsr = %d (jiff=%lu)...", lsr, jiffies); #endif current->state = TASK_INTERRUPTIBLE; -/* current->counter = 0; make us low-priority */ +/* current->dyn_prio = 0; make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; @@ -2400,11 +2398,6 @@ } return((int)c); -} - -static int serial_console_wait_key(struct console *co) -{ - return(my_console_wait_key(co->index, 0, NULL)); } #ifdef CONFIG_XMON diff -u --recursive --new-file v2.5.1/linux/arch/ppc/amiga/config.c linux/arch/ppc/amiga/config.c --- v2.5.1/linux/arch/ppc/amiga/config.c Tue Dec 18 14:56:34 2001 +++ linux/arch/ppc/amiga/config.c Tue Dec 25 15:39:20 2001 @@ -104,7 +104,6 @@ extern void amiga_floppy_setup(char *, int *); #endif static void amiga_reset (void); -static int amiga_wait_key (struct console *co); extern void amiga_init_sound(void); static void amiga_savekmsg_init(void); static void amiga_mem_console_write(struct console *co, const char *b, @@ -118,7 +117,6 @@ static struct console amiga_console_driver = { name: "debug", - wait_key: amiga_wait_key, flags: CON_PRINTBUFFER, index: -1, }; @@ -734,33 +732,6 @@ } return 0; -} - -static int amiga_wait_key (struct console *co) -{ - int i; - - while (1) { - while (ciaa.pra & 0x40); - - /* debounce */ - for (i = 0; i < 1000; i++); - - if (!(ciaa.pra & 0x40)) - break; - } - - /* wait for button up */ - while (1) { - while (!(ciaa.pra & 0x40)); - - /* debounce */ - for (i = 0; i < 1000; i++); - - if (ciaa.pra & 0x40) - break; - } - return 0; } static NORET_TYPE void amiga_reset( void ) diff -u --recursive --new-file v2.5.1/linux/arch/ppc/kernel/idle.c linux/arch/ppc/kernel/idle.c --- v2.5.1/linux/arch/ppc/kernel/idle.c Fri Nov 2 17:43:54 2001 +++ linux/arch/ppc/kernel/idle.c Thu Dec 27 08:21:28 2001 @@ -54,7 +54,6 @@ /* endless loop with no priority at all */ current->nice = 20; - current->counter = -100; init_idle(); for (;;) { #ifdef CONFIG_SMP diff -u --recursive --new-file v2.5.1/linux/arch/ppc/kernel/m8xx_setup.c linux/arch/ppc/kernel/m8xx_setup.c --- v2.5.1/linux/arch/ppc/kernel/m8xx_setup.c Fri Nov 16 10:10:08 2001 +++ linux/arch/ppc/kernel/m8xx_setup.c Mon Dec 17 11:12:05 2001 @@ -55,12 +55,6 @@ extern void m8xx_ide_init(void); -#ifdef CONFIG_BLK_DEV_RAM -extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ -extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ -extern int rd_image_start; /* starting block # of image */ -#endif - extern unsigned long find_available_memory(void); extern void m8xx_cpm_reset(uint); diff -u --recursive --new-file v2.5.1/linux/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c --- v2.5.1/linux/arch/ppc/kernel/prep_setup.c Fri Nov 16 10:10:08 2001 +++ linux/arch/ppc/kernel/prep_setup.c Mon Dec 17 11:12:05 2001 @@ -111,12 +111,6 @@ extern int probingmem; extern unsigned long loops_per_jiffy; -#ifdef CONFIG_BLK_DEV_RAM -extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ -extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ -extern int rd_image_start; /* starting block # of image */ -#endif - #ifdef CONFIG_SOUND_MODULE EXPORT_SYMBOL(ppc_cs4232_dma); EXPORT_SYMBOL(ppc_cs4232_dma2); diff -u --recursive --new-file v2.5.1/linux/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c --- v2.5.1/linux/arch/ppc/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/ppc/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -23,6 +23,7 @@ #include <linux/unistd.h> #include <linux/init.h> #include <linux/spinlock.h> +#include <linux/cache.h> #include <asm/ptrace.h> #include <asm/atomic.h> @@ -47,7 +48,7 @@ struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 }; atomic_t ipi_recv; atomic_t ipi_sent; -spinlock_t kernel_flag __cacheline_aligned = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; unsigned int prof_multiplier[NR_CPUS]; unsigned int prof_counter[NR_CPUS]; cycles_t cacheflush_time; diff -u --recursive --new-file v2.5.1/linux/arch/s390/kernel/process.c linux/arch/s390/kernel/process.c --- v2.5.1/linux/arch/s390/kernel/process.c Thu Oct 11 09:04:57 2001 +++ linux/arch/s390/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -57,7 +57,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; wait_psw.mask = _WAIT_PSW_MASK; wait_psw.addr = (unsigned long) &&idle_wakeup | 0x80000000L; while(1) { diff -u --recursive --new-file v2.5.1/linux/arch/s390/kernel/smp.c linux/arch/s390/kernel/smp.c --- v2.5.1/linux/arch/s390/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/s390/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -29,6 +29,7 @@ #include <linux/smp_lock.h> #include <linux/delay.h> +#include <linux/cache.h> #include <asm/sigp.h> #include <asm/pgalloc.h> @@ -55,7 +56,7 @@ int smp_threads_ready=0; /* Set when the idlers are all forked. */ static atomic_t smp_commenced = ATOMIC_INIT(0); -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; unsigned long cpu_online_map; diff -u --recursive --new-file v2.5.1/linux/arch/s390x/kernel/process.c linux/arch/s390x/kernel/process.c --- v2.5.1/linux/arch/s390x/kernel/process.c Thu Oct 11 09:04:57 2001 +++ linux/arch/s390x/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -57,7 +57,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; wait_psw.mask = _WAIT_PSW_MASK; wait_psw.addr = (unsigned long) &&idle_wakeup; while(1) { diff -u --recursive --new-file v2.5.1/linux/arch/s390x/kernel/smp.c linux/arch/s390x/kernel/smp.c --- v2.5.1/linux/arch/s390x/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/s390x/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -29,6 +29,7 @@ #include <linux/smp_lock.h> #include <linux/delay.h> +#include <linux/cache.h> #include <asm/sigp.h> #include <asm/pgalloc.h> @@ -55,7 +56,7 @@ int smp_threads_ready=0; /* Set when the idlers are all forked. */ static atomic_t smp_commenced = ATOMIC_INIT(0); -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; unsigned long cpu_online_map; diff -u --recursive --new-file v2.5.1/linux/arch/sh/kernel/process.c linux/arch/sh/kernel/process.c --- v2.5.1/linux/arch/sh/kernel/process.c Mon Oct 15 13:36:48 2001 +++ linux/arch/sh/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -41,7 +41,6 @@ /* endless idle loop with no priority at all */ init_idle(); current->nice = 20; - current->counter = -100; while (1) { if (hlt_counter) { diff -u --recursive --new-file v2.5.1/linux/arch/sh/kernel/setup.c linux/arch/sh/kernel/setup.c --- v2.5.1/linux/arch/sh/kernel/setup.c Fri Nov 16 18:38:39 2001 +++ linux/arch/sh/kernel/setup.c Tue Dec 25 15:39:20 2001 @@ -140,15 +140,6 @@ sh_bios_console_write(s, count); } -/* - * Receive character from the serial port - */ -static int sh_console_wait_key(struct console *co) -{ - /* Not implemented yet */ - return 0; -} - static kdev_t sh_console_device(struct console *c) { /* TODO: this is totally bogus */ @@ -183,7 +174,6 @@ name: "bios", write: sh_console_write, device: sh_console_device, - wait_key: sh_console_wait_key, setup: sh_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/arch/sparc/kernel/process.c linux/arch/sparc/kernel/process.c --- v2.5.1/linux/arch/sparc/kernel/process.c Tue Nov 13 09:16:05 2001 +++ linux/arch/sparc/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -61,7 +61,6 @@ /* endless idle loop with no priority at all */ current->nice = 20; - current->counter = -100; init_idle(); for (;;) { @@ -110,7 +109,6 @@ { /* endless idle loop with no priority at all */ current->nice = 20; - current->counter = -100; init_idle(); while(1) { diff -u --recursive --new-file v2.5.1/linux/arch/sparc/kernel/smp.c linux/arch/sparc/kernel/smp.c --- v2.5.1/linux/arch/sparc/kernel/smp.c Tue Nov 13 09:16:05 2001 +++ linux/arch/sparc/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -18,6 +18,7 @@ #include <linux/mm.h> #include <linux/fs.h> #include <linux/seq_file.h> +#include <linux/cache.h> #include <asm/ptrace.h> #include <asm/atomic.h> @@ -66,7 +67,7 @@ */ /* Kernel spinlock */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; /* Used to make bitops atomic */ unsigned char bitops_spinlock = 0; diff -u --recursive --new-file v2.5.1/linux/arch/sparc64/kernel/process.c linux/arch/sparc64/kernel/process.c --- v2.5.1/linux/arch/sparc64/kernel/process.c Sun Oct 21 10:36:54 2001 +++ linux/arch/sparc64/kernel/process.c Thu Dec 27 08:21:28 2001 @@ -54,7 +54,6 @@ /* endless idle loop with no priority at all */ current->nice = 20; - current->counter = -100; init_idle(); for (;;) { @@ -84,7 +83,6 @@ int cpu_idle(void) { current->nice = 20; - current->counter = -100; init_idle(); while(1) { diff -u --recursive --new-file v2.5.1/linux/arch/sparc64/kernel/smp.c linux/arch/sparc64/kernel/smp.c --- v2.5.1/linux/arch/sparc64/kernel/smp.c Wed Nov 21 10:31:09 2001 +++ linux/arch/sparc64/kernel/smp.c Sun Dec 30 10:02:19 2001 @@ -17,6 +17,7 @@ #include <linux/spinlock.h> #include <linux/fs.h> #include <linux/seq_file.h> +#include <linux/cache.h> #include <asm/head.h> #include <asm/ptrace.h> @@ -39,17 +40,17 @@ extern void calibrate_delay(void); extern unsigned prom_cpu_nodes[]; -struct cpuinfo_sparc cpu_data[NR_CPUS] __attribute__ ((aligned (64))); +cpuinfo_sparc cpu_data[NR_CPUS]; -volatile int __cpu_number_map[NR_CPUS] __attribute__ ((aligned (64))); -volatile int __cpu_logical_map[NR_CPUS] __attribute__ ((aligned (64))); +volatile int __cpu_number_map[NR_CPUS] __attribute__ ((aligned (SMP_CACHE_BYTES))); +volatile int __cpu_logical_map[NR_CPUS] __attribute__ ((aligned (SMP_CACHE_BYTES))); /* Please don't make this stuff initdata!!! --DaveM */ static unsigned char boot_cpu_id = 0; static int smp_activated = 0; /* Kernel spinlock */ -spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED; +spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; volatile int smp_processors_ready = 0; unsigned long cpu_present_map = 0; diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/acornscsi.c linux/drivers/acorn/scsi/acornscsi.c --- v2.5.1/linux/drivers/acorn/scsi/acornscsi.c Thu Oct 11 09:04:57 2001 +++ linux/drivers/acorn/scsi/acornscsi.c Tue Dec 25 17:04:40 2001 @@ -3142,18 +3142,17 @@ static int __init acornscsi_init(void) { - acornscsi_template.module = THIS_MODULE; - scsi_register_module(MODULE_SCSI_HA, &acornscsi_template); + scsi_register_host(&acornscsi_template); if (acornscsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &acornscsi_template); + scsi_unregister_host(&acornscsi_template); return -ENODEV; } static void __exit acornscsi_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &acornscsi_template); + scsi_unregister_host(&acornscsi_template); } module_init(acornscsi_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/arxescsi.c linux/drivers/acorn/scsi/arxescsi.c --- v2.5.1/linux/drivers/acorn/scsi/arxescsi.c Thu Oct 11 09:04:57 2001 +++ linux/drivers/acorn/scsi/arxescsi.c Tue Dec 25 17:04:40 2001 @@ -423,17 +423,17 @@ static int __init init_arxe_scsi_driver(void) { arxescsi_template.module = THIS_MODULE; - scsi_register_module(MODULE_SCSI_HA, &arxescsi_template); + scsi_register_host(&arxescsi_template); if (arxescsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &arxescsi_template); + scsi_unregister_host(&arxescsi_template); return -ENODEV; } static void __exit exit_arxe_scsi_driver(void) { - scsi_unregister_module(MODULE_SCSI_HA, &arxescsi_template); + scsi_unregister_host(&arxescsi_template); } module_init(init_arxe_scsi_driver); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/cumana_1.c linux/drivers/acorn/scsi/cumana_1.c --- v2.5.1/linux/drivers/acorn/scsi/cumana_1.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/acorn/scsi/cumana_1.c Tue Dec 25 17:04:40 2001 @@ -409,17 +409,17 @@ static int __init cumanascsi_init(void) { - scsi_register_module(MODULE_SCSI_HA, &cumanascsi_template); + scsi_register_host(&cumanascsi_template); if (cumanascsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi_template); + scsi_unregister_host(&cumanascsi_template); return -ENODEV; } static void __exit cumanascsi_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi_template); + scsi_unregister_host(&cumanascsi_template); } module_init(cumanascsi_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/cumana_2.c linux/drivers/acorn/scsi/cumana_2.c --- v2.5.1/linux/drivers/acorn/scsi/cumana_2.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/acorn/scsi/cumana_2.c Tue Dec 25 17:04:40 2001 @@ -579,17 +579,17 @@ static int __init cumanascsi2_init(void) { - scsi_register_module(MODULE_SCSI_HA, &cumanascsi2_template); + scsi_register_host(&cumanascsi2_template); if (cumanascsi2_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi2_template); + scsi_unregister_host(&cumanascsi2_template); return -ENODEV; } static void __exit cumanascsi2_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi2_template); + scsi_unregister_host(&cumanascsi2_template); } module_init(cumanascsi2_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/ecoscsi.c linux/drivers/acorn/scsi/ecoscsi.c --- v2.5.1/linux/drivers/acorn/scsi/ecoscsi.c Thu Oct 25 13:53:46 2001 +++ linux/drivers/acorn/scsi/ecoscsi.c Tue Dec 25 17:04:40 2001 @@ -276,17 +276,17 @@ static int __init ecoscsi_init(void) { - scsi_register_module(MODULE_SCSI_HA, &ecoscsi_template); + scsi_register_host(&ecoscsi_template); if (ecoscsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &ecoscsi_template); + scsi_unregister_host(&ecoscsi_template); return -ENODEV; } static void __exit ecoscsi_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &ecoscsi_template); + scsi_unregister_host(&ecoscsi_template); } module_init(ecoscsi_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/eesox.c linux/drivers/acorn/scsi/eesox.c --- v2.5.1/linux/drivers/acorn/scsi/eesox.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/acorn/scsi/eesox.c Tue Dec 25 17:04:40 2001 @@ -581,17 +581,17 @@ static int __init eesox_init(void) { - scsi_register_module(MODULE_SCSI_HA, &eesox_template); + scsi_register_host(&eesox_template); if (eesox_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &eesox_template); + scsi_unregister_host(&eesox_template); return -ENODEV; } static void __exit eesox_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &eesox_template); + scsi_unregister_host(&eesox_template); } module_init(eesox_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/oak.c linux/drivers/acorn/scsi/oak.c --- v2.5.1/linux/drivers/acorn/scsi/oak.c Thu Oct 11 09:04:57 2001 +++ linux/drivers/acorn/scsi/oak.c Tue Dec 25 17:04:40 2001 @@ -270,17 +270,17 @@ static int __init oakscsi_init(void) { - scsi_register_module(MODULE_SCSI_HA, &oakscsi_template); + scsi_register_host(&oakscsi_template); if (oakscsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &oakscsi_template); + scsi_unregister_host(&oakscsi_template); return -ENODEV; } static void __exit oakscsi_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &oakscsi_template); + scsi_unregister_host(&oakscsi_template); } module_init(oakscsi_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acorn/scsi/powertec.c linux/drivers/acorn/scsi/powertec.c --- v2.5.1/linux/drivers/acorn/scsi/powertec.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/acorn/scsi/powertec.c Tue Dec 25 17:04:40 2001 @@ -481,17 +481,17 @@ static int __init powertecscsi_init(void) { - scsi_register_module(MODULE_SCSI_HA, &powertecscsi_template); + scsi_register_host(&powertecscsi_template); if (powertecscsi_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &powertecscsi_template); + scsi_unregister_host(&powertecscsi_template); return -ENODEV; } static void __exit powertecscsi_exit(void) { - scsi_unregister_module(MODULE_SCSI_HA, &powertecscsi_template); + scsi_unregister_host(&powertecscsi_template); } module_init(powertecscsi_init); diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/ac_adapter/ac_osl.c linux/drivers/acpi/ospm/ac_adapter/ac_osl.c --- v2.5.1/linux/drivers/acpi/ospm/ac_adapter/ac_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/ac_adapter/ac_osl.c Sun Dec 30 09:40:59 2001 @@ -35,6 +35,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - AC Adapter Driver"); +MODULE_LICENSE("GPL"); #define AC_PROC_ROOT "ac_adapter" diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/battery/bt_osl.c linux/drivers/acpi/ospm/battery/bt_osl.c --- v2.5.1/linux/drivers/acpi/ospm/battery/bt_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/battery/bt_osl.c Sun Dec 30 09:40:59 2001 @@ -44,6 +44,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Control Method Battery Driver"); +MODULE_LICENSE("GPL"); #define BT_PROC_ROOT "battery" diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/busmgr/bm_osl.c linux/drivers/acpi/ospm/busmgr/bm_osl.c --- v2.5.1/linux/drivers/acpi/ospm/busmgr/bm_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/busmgr/bm_osl.c Sun Dec 30 09:40:59 2001 @@ -38,6 +38,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI Bus Manager"); +MODULE_LICENSE("GPL"); /***************************************************************************** diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/button/bn_osl.c linux/drivers/acpi/ospm/button/bn_osl.c --- v2.5.1/linux/drivers/acpi/ospm/button/bn_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/button/bn_osl.c Sun Dec 30 09:40:59 2001 @@ -35,6 +35,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Button Driver"); +MODULE_LICENSE("GPL"); #define BN_PROC_ROOT "button" diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/ec/ec_osl.c linux/drivers/acpi/ospm/ec/ec_osl.c --- v2.5.1/linux/drivers/acpi/ospm/ec/ec_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/ec/ec_osl.c Sun Dec 30 09:40:59 2001 @@ -36,6 +36,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Embedded Controller Driver"); +MODULE_LICENSE("GPL"); extern struct proc_dir_entry *bm_proc_root; diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/processor/pr_osl.c linux/drivers/acpi/ospm/processor/pr_osl.c --- v2.5.1/linux/drivers/acpi/ospm/processor/pr_osl.c Fri Nov 9 13:58:02 2001 +++ linux/drivers/acpi/ospm/processor/pr_osl.c Sun Dec 30 09:40:59 2001 @@ -37,6 +37,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - IA32 Processor Driver"); +MODULE_LICENSE("GPL"); #define PR_PROC_ROOT "processor" diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/system/sm_osl.c linux/drivers/acpi/ospm/system/sm_osl.c --- v2.5.1/linux/drivers/acpi/ospm/system/sm_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/system/sm_osl.c Sun Dec 30 09:40:59 2001 @@ -42,6 +42,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI System Driver"); +MODULE_LICENSE("GPL"); #define SM_PROC_INFO "info" diff -u --recursive --new-file v2.5.1/linux/drivers/acpi/ospm/thermal/tz_osl.c linux/drivers/acpi/ospm/thermal/tz_osl.c --- v2.5.1/linux/drivers/acpi/ospm/thermal/tz_osl.c Wed Oct 24 14:06:22 2001 +++ linux/drivers/acpi/ospm/thermal/tz_osl.c Sun Dec 30 09:40:59 2001 @@ -35,6 +35,7 @@ MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Thermal Zone Driver"); +MODULE_LICENSE("GPL"); int TZP = 0; MODULE_PARM(TZP, "i"); diff -u --recursive --new-file v2.5.1/linux/drivers/atm/fore200e.c linux/drivers/atm/fore200e.c --- v2.5.1/linux/drivers/atm/fore200e.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/atm/fore200e.c Sun Dec 30 10:31:51 2001 @@ -39,7 +39,6 @@ #include <linux/atm_suni.h> #include <asm/io.h> #include <asm/string.h> -#include <asm/segment.h> #include <asm/page.h> #include <asm/irq.h> #include <asm/dma.h> diff -u --recursive --new-file v2.5.1/linux/drivers/block/DAC960.c linux/drivers/block/DAC960.c --- v2.5.1/linux/drivers/block/DAC960.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/DAC960.c Sun Dec 30 10:31:51 2001 @@ -45,7 +45,6 @@ #include <linux/pci.h> #include <linux/init.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include "DAC960.h" diff -u --recursive --new-file v2.5.1/linux/drivers/block/blkpg.c linux/drivers/block/blkpg.c --- v2.5.1/linux/drivers/block/blkpg.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/blkpg.c Thu Dec 27 08:17:43 2001 @@ -201,6 +201,7 @@ struct gendisk *g; u64 ullval = 0; int intval, *iptr; + unsigned short usval; if (!dev) return -EINVAL; @@ -247,9 +248,12 @@ return put_user(iptr[MINOR(dev)], (long *) arg); case BLKSECTGET: - if ((q = blk_get_queue(dev))) - return put_user(q->max_sectors, (unsigned short *)arg); - return -EINVAL; + if ((q = blk_get_queue(dev)) == NULL) + return -EINVAL; + + usval = q->max_sectors; + blk_put_queue(q); + return put_user(usval, (unsigned short *)arg); case BLKFLSBUF: if (!capable(CAP_SYS_ADMIN)) @@ -291,9 +295,7 @@ case BLKBSZGET: /* get the logical block size (cf. BLKSSZGET) */ - intval = BLOCK_SIZE; - if (blksize_size[MAJOR(dev)]) - intval = blksize_size[MAJOR(dev)][MINOR(dev)]; + intval = block_size(dev); return put_user(intval, (int *) arg); case BLKBSZSET: diff -u --recursive --new-file v2.5.1/linux/drivers/block/block_ioctl.c linux/drivers/block/block_ioctl.c --- v2.5.1/linux/drivers/block/block_ioctl.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/block_ioctl.c Thu Dec 27 08:15:15 2001 @@ -35,7 +35,7 @@ DECLARE_COMPLETION(wait); int err = 0; - rq->flags |= REQ_BARRIER; + rq->flags |= REQ_NOMERGE; rq->waiting = &wait; elv_add_request(q, rq, 1); generic_unplug_device(q); @@ -76,8 +76,8 @@ err = -ENOTTY; } -#if 0 blk_put_queue(q); -#endif return err; } + +EXPORT_SYMBOL(block_ioctl); diff -u --recursive --new-file v2.5.1/linux/drivers/block/elevator.c linux/drivers/block/elevator.c --- v2.5.1/linux/drivers/block/elevator.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/elevator.c Sat Dec 29 11:17:37 2001 @@ -53,7 +53,7 @@ * if .next is a valid request */ next = rq->queuelist.next; - if (next == head) + if (unlikely(next == head)) return 0; next_rq = list_entry(next, struct request, queuelist); @@ -101,7 +101,7 @@ */ inline int elv_rq_merge_ok(struct request *rq, struct bio *bio) { - if (!(rq->flags & REQ_CMD)) + if (!rq_mergeable(rq)) return 0; /* @@ -109,8 +109,6 @@ */ if (bio_data_dir(bio) != rq_data_dir(rq)) return 0; - if (rq->flags & REQ_NOMERGE) - return 0; /* * same device and no special stuff set, merge is ok @@ -121,49 +119,71 @@ return 0; } -int elevator_linus_merge(request_queue_t *q, struct request **req, - struct list_head *head, struct bio *bio) +inline int elv_try_merge(struct request *__rq, struct bio *bio) { unsigned int count = bio_sectors(bio); - struct list_head *entry = &q->queue_head; int ret = ELEVATOR_NO_MERGE; + + /* + * we can merge and sequence is ok, check if it's possible + */ + if (elv_rq_merge_ok(__rq, bio)) { + if (__rq->sector + __rq->nr_sectors == bio->bi_sector) { + ret = ELEVATOR_BACK_MERGE; + } else if (__rq->sector - count == bio->bi_sector) { + __rq->elevator_sequence -= count; + ret = ELEVATOR_FRONT_MERGE; + } + } + + return ret; +} + +int elevator_linus_merge(request_queue_t *q, struct request **req, + struct bio *bio) +{ + struct list_head *entry; struct request *__rq; + int ret; + + /* + * give a one-shot try to merging with the last touched + * request + */ + if (q->last_merge) { + __rq = list_entry_rq(q->last_merge); + BUG_ON(__rq->flags & REQ_STARTED); + + if ((ret = elv_try_merge(__rq, bio))) { + *req = __rq; + return ret; + } + } entry = &q->queue_head; - while ((entry = entry->prev) != head) { + ret = ELEVATOR_NO_MERGE; + while ((entry = entry->prev) != &q->queue_head) { __rq = list_entry_rq(entry); - prefetch(list_entry_rq(entry->prev)); + if (__rq->flags & (REQ_BARRIER | REQ_STARTED)) + break; /* * simply "aging" of requests in queue */ if (__rq->elevator_sequence-- <= 0) break; - if (__rq->flags & (REQ_BARRIER | REQ_STARTED)) - break; if (!(__rq->flags & REQ_CMD)) continue; + if (__rq->elevator_sequence < bio_sectors(bio)) + break; if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head)) *req = __rq; - if (!elv_rq_merge_ok(__rq, bio)) - continue; - - if (__rq->elevator_sequence < count) - break; - /* - * we can merge and sequence is ok, check if it's possible - */ - if (__rq->sector + __rq->nr_sectors == bio->bi_sector) { - ret = ELEVATOR_BACK_MERGE; - *req = __rq; - break; - } else if (__rq->sector - count == bio->bi_sector) { - ret = ELEVATOR_FRONT_MERGE; - __rq->elevator_sequence -= count; + if ((ret = elv_try_merge(__rq, bio))) { *req = __rq; + q->last_merge = &__rq->queuelist; break; } } @@ -183,7 +203,6 @@ entry = &req->queuelist; while ((entry = entry->next) != &q->queue_head) { struct request *tmp; - prefetch(list_entry_rq(entry->next)); tmp = list_entry_rq(entry); tmp->elevator_sequence -= count; } @@ -199,12 +218,20 @@ struct list_head *insert_here) { list_add(&rq->queuelist, insert_here); + + /* + * new merges must not precede this barrier + */ + if (rq->flags & REQ_BARRIER) + q->last_merge = NULL; + else if (!q->last_merge) + q->last_merge = &rq->queuelist; } struct request *elv_next_request_fn(request_queue_t *q) { if (!blk_queue_empty(q)) - return list_entry(q->queue_head.next, struct request, queuelist); + return list_entry_rq(q->queue_head.next); return NULL; } @@ -222,17 +249,24 @@ * See if we can find a request that this buffer can be coalesced with. */ int elevator_noop_merge(request_queue_t *q, struct request **req, - struct list_head *head, struct bio *bio) + struct bio *bio) { - unsigned int count = bio_sectors(bio); struct list_head *entry = &q->queue_head; struct request *__rq; + int ret; - entry = &q->queue_head; - while ((entry = entry->prev) != head) { - __rq = list_entry_rq(entry); + if (q->last_merge) { + __rq = list_entry_rq(q->last_merge); + BUG_ON(__rq->flags & REQ_STARTED); + + if ((ret = elv_try_merge(__rq, bio))) { + *req = __rq; + return ret; + } + } - prefetch(list_entry_rq(entry->prev)); + while ((entry = entry->prev) != &q->queue_head) { + __rq = list_entry_rq(entry); if (__rq->flags & (REQ_BARRIER | REQ_STARTED)) break; @@ -240,18 +274,10 @@ if (!(__rq->flags & REQ_CMD)) continue; - if (!elv_rq_merge_ok(__rq, bio)) - continue; - - /* - * we can merge and sequence is ok, check if it's possible - */ - if (__rq->sector + __rq->nr_sectors == bio->bi_sector) { - *req = __rq; - return ELEVATOR_BACK_MERGE; - } else if (__rq->sector - count == bio->bi_sector) { + if ((ret = elv_try_merge(__rq, bio))) { *req = __rq; - return ELEVATOR_FRONT_MERGE; + q->last_merge = &__rq->queuelist; + return ret; } } @@ -267,6 +293,7 @@ *e = type; INIT_LIST_HEAD(&q->queue_head); + q->last_merge = NULL; if (e->elevator_init_fn) return e->elevator_init_fn(q, e); diff -u --recursive --new-file v2.5.1/linux/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c --- v2.5.1/linux/drivers/block/ll_rw_blk.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/ll_rw_blk.c Sat Dec 29 11:17:37 2001 @@ -117,6 +117,11 @@ return &blk_dev[MAJOR(dev)].request_queue; } +void blk_queue_prep_rq(request_queue_t *q, prep_rq_fn *pfn) +{ + q->prep_rq_fn = pfn; +} + /** * blk_queue_make_request - define an alternate make_request function for a device * @q: the request queue for the device to be affected @@ -150,6 +155,11 @@ blk_queue_max_sectors(q, MAX_SECTORS); blk_queue_hardsect_size(q, 512); + /* + * by default assume old behaviour and bounce for any highmem page + */ + blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); + init_waitqueue_head(&q->queue_wait); } @@ -179,7 +189,6 @@ if (dma_addr == BLK_BOUNCE_ISA) { init_emergency_isa_pool(); q->bounce_gfp = GFP_NOIO | GFP_DMA; - printk("isa pfn %lu, max low %lu, max %lu\n", bounce_pfn, blk_max_low_pfn, blk_max_pfn); } else q->bounce_gfp = GFP_NOHIGHIO; @@ -319,7 +328,7 @@ /* * standard prep_rq_fn that builds 10 byte cmds */ -static int ll_10byte_cmd_build(request_queue_t *q, struct request *rq) +int ll_10byte_cmd_build(request_queue_t *q, struct request *rq) { int hard_sect = get_hardsect_size(rq->rq_dev); sector_t block = rq->hard_sector / (hard_sect >> 9); @@ -477,7 +486,7 @@ sg[nsegs - 1].length += nbytes; } else { new_segment: - sg[nsegs].address = NULL; + memset(&sg[nsegs],0,sizeof(struct scatterlist)); sg[nsegs].page = bvec->bv_page; sg[nsegs].length = nbytes; sg[nsegs].offset = bvec->bv_offset; @@ -504,6 +513,7 @@ if (req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) { req->flags |= REQ_NOMERGE; + q->last_merge = NULL; return 0; } @@ -523,6 +533,7 @@ if (req->nr_hw_segments + nr_hw_segs > q->max_hw_segments) { req->flags |= REQ_NOMERGE; + q->last_merge = NULL; return 0; } @@ -540,11 +551,11 @@ { if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) { req->flags |= REQ_NOMERGE; + q->last_merge = NULL; return 0; } - if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), - __BVEC_START(bio))) + if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio))) return ll_new_mergeable(q, req, bio); return ll_new_hw_segment(q, req, bio); @@ -555,11 +566,11 @@ { if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) { req->flags |= REQ_NOMERGE; + q->last_merge = NULL; return 0; } - if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), - __BVEC_START(req->bio))) + if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(req->bio))) return ll_new_mergeable(q, req, bio); return ll_new_hw_segment(q, req, bio); @@ -568,7 +579,7 @@ static int ll_merge_requests_fn(request_queue_t *q, struct request *req, struct request *next) { - int total_phys_segments = req->nr_phys_segments + next->nr_phys_segments; + int total_phys_segments = req->nr_phys_segments +next->nr_phys_segments; int total_hw_segments = req->nr_hw_segments + next->nr_hw_segments; /* @@ -799,18 +810,14 @@ q->back_merge_fn = ll_back_merge_fn; q->front_merge_fn = ll_front_merge_fn; q->merge_requests_fn = ll_merge_requests_fn; - q->prep_rq_fn = ll_10byte_cmd_build; + q->prep_rq_fn = NULL; q->plug_tq.sync = 0; q->plug_tq.routine = &generic_unplug_device; q->plug_tq.data = q; q->queue_flags = (1 << QUEUE_FLAG_CLUSTER); q->queue_lock = lock; + q->last_merge = NULL; - /* - * by default assume old behaviour and bounce for any highmem page - */ - blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); - blk_queue_segment_boundary(q, 0xffffffff); blk_queue_make_request(q, __make_request); @@ -874,11 +881,19 @@ BUG_ON(rw != READ && rw != WRITE); + spin_lock_irq(q->queue_lock); rq = get_request(q, rw); + spin_unlock_irq(q->queue_lock); if (!rq && (gfp_mask & __GFP_WAIT)) rq = get_request_wait(q, rw); + if (rq) { + rq->flags = 0; + rq->buffer = NULL; + rq->bio = rq->biotail = NULL; + rq->waiting = NULL; + } return rq; } @@ -944,13 +959,10 @@ drive_stat_acct(req, req->nr_sectors, 1); /* - * debug stuff... + * it's a bug to let this rq preempt an already started request */ - if (insert_here == &q->queue_head) { - struct request *__rq = __elv_next_request(q); - - BUG_ON(__rq && (__rq->flags & REQ_STARTED)); - } + if (insert_here->next != &q->queue_head) + BUG_ON(list_entry_rq(insert_here->next)->flags & REQ_STARTED); /* * elevator indicated where it wants this request to be @@ -965,11 +977,17 @@ void blkdev_release_request(struct request *req) { struct request_list *rl = req->rl; + request_queue_t *q = req->q; req->rq_status = RQ_INACTIVE; req->q = NULL; req->rl = NULL; + if (q) { + if (q->last_merge == &req->queuelist) + q->last_merge = NULL; + } + /* * Request may not have originated from ll_rw_blk. if not, * it didn't come out of our reserved rq pools @@ -985,14 +1003,10 @@ /* * Has to be called with the request spinlock acquired */ -static void attempt_merge(request_queue_t *q, struct request *req) +static void attempt_merge(request_queue_t *q, struct request *req, + struct request *next) { - struct request *next = blkdev_next_request(req); - - /* - * not a rw command - */ - if (!(next->flags & REQ_CMD)) + if (!rq_mergeable(req) || !rq_mergeable(next)) return; /* @@ -1001,12 +1015,6 @@ if (req->sector + req->nr_sectors != next->sector) return; - /* - * don't touch NOMERGE rq, or one that has been started by driver - */ - if (next->flags & (REQ_NOMERGE | REQ_STARTED)) - return; - if (rq_data_dir(req) != rq_data_dir(next) || req->rq_dev != next->rq_dev || req->nr_sectors + next->nr_sectors > q->max_sectors @@ -1014,10 +1022,10 @@ return; /* - * If we are not allowed to merge these requests, then - * return. If we are allowed to merge, then the count - * will have been updated to the appropriate number, - * and we shouldn't do it here too. + * If we are allowed to merge, then append bio list + * from next to rq and release next. merge_requests_fn + * will have updated segment counts, update sector + * counts here. */ if (q->merge_requests_fn(q, req, next)) { q->elevator.elevator_merge_req_fn(req, next); @@ -1035,24 +1043,18 @@ static inline void attempt_back_merge(request_queue_t *q, struct request *rq) { - if (&rq->queuelist != q->queue_head.prev) - attempt_merge(q, rq); + struct list_head *next = rq->queuelist.next; + + if (next != &q->queue_head) + attempt_merge(q, rq, list_entry_rq(next)); } -static inline void attempt_front_merge(request_queue_t *q, - struct list_head *head, - struct request *rq) +static inline void attempt_front_merge(request_queue_t *q, struct request *rq) { struct list_head *prev = rq->queuelist.prev; - if (prev != head) - attempt_merge(q, blkdev_entry_to_request(prev)); -} - -static inline void __blk_attempt_remerge(request_queue_t *q, struct request *rq) -{ - if (rq->queuelist.next != &q->queue_head) - attempt_merge(q, rq); + if (prev != &q->queue_head) + attempt_merge(q, list_entry_rq(prev), rq); } /** @@ -1073,7 +1075,7 @@ unsigned long flags; spin_lock_irqsave(q->queue_lock, flags); - __blk_attempt_remerge(q, rq); + attempt_back_merge(q, rq); spin_unlock_irqrestore(q->queue_lock, flags); } @@ -1081,7 +1083,7 @@ { struct request *req, *freereq = NULL; int el_ret, latency = 0, rw, nr_sectors, cur_nr_sectors, barrier; - struct list_head *head, *insert_here; + struct list_head *insert_here; elevator_t *elevator = &q->elevator; sector_t sector; @@ -1102,28 +1104,20 @@ latency = elevator_request_latency(elevator, rw); barrier = test_bit(BIO_RW_BARRIER, &bio->bi_rw); + spin_lock_irq(q->queue_lock); again: req = NULL; - head = &q->queue_head; - - spin_lock_irq(q->queue_lock); + insert_here = q->queue_head.prev; - insert_here = head->prev; if (blk_queue_empty(q) || barrier) { blk_plug_device(q); goto get_rq; - } else if ((req = __elv_next_request(q))) { - if (req->flags & REQ_STARTED) - head = head->next; - - req = NULL; } - el_ret = elevator->elevator_merge_fn(q, &req, head, bio); + el_ret = elevator->elevator_merge_fn(q, &req, bio); switch (el_ret) { case ELEVATOR_BACK_MERGE: - BUG_ON(req->flags & REQ_STARTED); - BUG_ON(req->flags & REQ_NOMERGE); + BUG_ON(!rq_mergeable(req)); if (!q->back_merge_fn(q, req, bio)) break; @@ -1137,8 +1131,7 @@ goto out; case ELEVATOR_FRONT_MERGE: - BUG_ON(req->flags & REQ_STARTED); - BUG_ON(req->flags & REQ_NOMERGE); + BUG_ON(!rq_mergeable(req)); if (!q->front_merge_fn(q, req, bio)) break; @@ -1157,7 +1150,7 @@ req->sector = req->hard_sector = sector; req->nr_sectors = req->hard_nr_sectors += nr_sectors; drive_stat_acct(req, nr_sectors, 0); - attempt_front_merge(q, head, req); + attempt_front_merge(q, req); goto out; /* @@ -1188,7 +1181,6 @@ req = freereq; freereq = NULL; } else if ((req = get_request(q, rw)) == NULL) { - spin_unlock_irq(q->queue_lock); /* @@ -1200,6 +1192,7 @@ } freereq = get_request_wait(q, rw); + spin_lock_irq(q->queue_lock); goto again; } @@ -1298,7 +1291,7 @@ int minor = MINOR(bio->bi_dev); request_queue_t *q; sector_t minorsize = 0; - int nr_sectors = bio_sectors(bio); + int ret, nr_sectors = bio_sectors(bio); /* Test device or partition size, when known. */ if (blk_size[major]) @@ -1352,7 +1345,10 @@ */ blk_partition_remap(bio); - } while (q->make_request_fn(q, bio)); + ret = q->make_request_fn(q, bio); + blk_put_queue(q); + + } while (ret); } /* @@ -1572,21 +1568,23 @@ inline void blk_recalc_rq_sectors(struct request *rq, int nsect) { - rq->hard_sector += nsect; - rq->hard_nr_sectors -= nsect; - rq->sector = rq->hard_sector; - rq->nr_sectors = rq->hard_nr_sectors; + if (rq->flags & REQ_CMD) { + rq->hard_sector += nsect; + rq->hard_nr_sectors -= nsect; + rq->sector = rq->hard_sector; + rq->nr_sectors = rq->hard_nr_sectors; - rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9; - rq->hard_cur_sectors = rq->current_nr_sectors; + rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9; + rq->hard_cur_sectors = rq->current_nr_sectors; - /* - * if total number of sectors is less than the first segment - * size, something has gone terribly wrong - */ - if (rq->nr_sectors < rq->current_nr_sectors) { - printk("blk: request botched\n"); - rq->nr_sectors = rq->current_nr_sectors; + /* + * if total number of sectors is less than the first segment + * size, something has gone terribly wrong + */ + if (rq->nr_sectors < rq->current_nr_sectors) { + printk("blk: request botched\n"); + rq->nr_sectors = rq->current_nr_sectors; + } } } @@ -1755,3 +1753,6 @@ EXPORT_SYMBOL(blk_queue_assign_lock); EXPORT_SYMBOL(blk_phys_contig_segment); EXPORT_SYMBOL(blk_hw_contig_segment); + +EXPORT_SYMBOL(ll_10byte_cmd_build); +EXPORT_SYMBOL(blk_queue_prep_rq); diff -u --recursive --new-file v2.5.1/linux/drivers/block/loop.c linux/drivers/block/loop.c --- v2.5.1/linux/drivers/block/loop.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/loop.c Sun Dec 30 10:19:58 2001 @@ -284,14 +284,7 @@ static inline int loop_get_bs(struct loop_device *lo) { - int bs = 0; - - if (blksize_size[MAJOR(lo->lo_device)]) - bs = blksize_size[MAJOR(lo->lo_device)][MINOR(lo->lo_device)]; - if (!bs) - bs = BLOCK_SIZE; - - return bs; + return block_size(lo->lo_device); } static inline unsigned long loop_get_iv(struct loop_device *lo, @@ -559,6 +552,8 @@ atomic_inc(&lo->lo_pending); spin_unlock_irq(&lo->lo_lock); + current->flags |= PF_NOIO; + /* * up sem, we are running */ @@ -600,7 +595,6 @@ kdev_t lo_device; int lo_flags = 0; int error; - int bs; MOD_INC_USE_COUNT; @@ -621,6 +615,10 @@ if (S_ISBLK(inode->i_mode)) { lo_device = inode->i_rdev; + if (lo_device == dev) { + error = -EBUSY; + goto out; + } } else if (S_ISREG(inode->i_mode)) { struct address_space_operations *aops = inode->i_mapping->a_ops; /* @@ -656,13 +654,7 @@ lo->old_gfp_mask = inode->i_mapping->gfp_mask; inode->i_mapping->gfp_mask = GFP_NOIO; - bs = 0; - if (blksize_size[MAJOR(lo_device)]) - bs = blksize_size[MAJOR(lo_device)][MINOR(lo_device)]; - if (!bs) - bs = BLOCK_SIZE; - - set_blocksize(dev, bs); + set_blocksize(dev, block_size(lo_device)); lo->lo_bio = lo->lo_biotail = NULL; kernel_thread(loop_thread, lo, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); @@ -1007,6 +999,7 @@ goto out_mem; blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), loop_make_request); + blk_queue_bounce_limit(BLK_DEFAULT_QUEUE(MAJOR_NR), BLK_BOUNCE_HIGH); for (i = 0; i < max_loop; i++) { struct loop_device *lo = &loop_dev[i]; diff -u --recursive --new-file v2.5.1/linux/drivers/block/nbd.c linux/drivers/block/nbd.c --- v2.5.1/linux/drivers/block/nbd.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/nbd.c Sun Dec 30 10:31:51 2001 @@ -45,7 +45,6 @@ #include <linux/devfs_fs_kernel.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <asm/types.h> diff -u --recursive --new-file v2.5.1/linux/drivers/block/paride/Config.in linux/drivers/block/paride/Config.in --- v2.5.1/linux/drivers/block/paride/Config.in Thu Oct 25 00:07:39 2001 +++ linux/drivers/block/paride/Config.in Sun Dec 30 10:19:58 2001 @@ -29,7 +29,7 @@ dep_tristate ' Shuttle EPAT/EPEZ protocol' CONFIG_PARIDE_EPAT $CONFIG_PARIDE if [ "$CONFIG_PARIDE_EPAT" != "n" ]; then if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' Support c7/c8 chips (EXPERIMENTAL)' CONFIG_PARIDE_EPATC8 $CONFIG_PARIDE + bool ' Support c7/c8 chips (EXPERIMENTAL)' CONFIG_PARIDE_EPATC8 fi fi diff -u --recursive --new-file v2.5.1/linux/drivers/block/ps2esdi.c linux/drivers/block/ps2esdi.c --- v2.5.1/linux/drivers/block/ps2esdi.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/ps2esdi.c Sun Dec 30 10:31:51 2001 @@ -51,7 +51,6 @@ #include <asm/system.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/dma.h> #include <asm/mca_dma.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/drivers/block/rd.c linux/drivers/block/rd.c --- v2.5.1/linux/drivers/block/rd.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/block/rd.c Mon Dec 17 11:12:05 2001 @@ -43,26 +43,12 @@ */ #include <linux/config.h> -#include <linux/sched.h> -#include <linux/fs.h> -#include <linux/kernel.h> -#include <linux/hdreg.h> #include <linux/string.h> -#include <linux/mm.h> -#include <linux/mman.h> #include <linux/slab.h> -#include <linux/ioctl.h> -#include <linux/fd.h> #include <linux/module.h> #include <linux/init.h> #include <linux/devfs_fs_kernel.h> -#include <linux/smp_lock.h> - -#include <asm/system.h> #include <asm/uaccess.h> -#include <asm/byteorder.h> - -extern void wait_for_keypress(void); /* * 35 has been officially registered as the RAMDISK major number, but @@ -79,6 +65,8 @@ #ifdef CONFIG_BLK_DEV_INITRD static int initrd_users; static spinlock_t initrd_users_lock = SPIN_LOCK_UNLOCKED; +unsigned long initrd_start, initrd_end; +int initrd_below_start_ok; #endif /* Various static variables go here. Most are used only in the RAM disk code. @@ -111,70 +99,6 @@ */ int rd_blocksize = BLOCK_SIZE; /* blocksize of the RAM disks */ -#ifndef MODULE - -int rd_doload; /* 1 = load RAM disk, 0 = don't load */ -int rd_prompt = 1; /* 1 = prompt for RAM disk, 0 = don't prompt */ -int rd_image_start; /* starting block # of image */ -#ifdef CONFIG_BLK_DEV_INITRD -unsigned long initrd_start, initrd_end; -int mount_initrd = 1; /* zero if initrd should not be mounted */ -int initrd_below_start_ok; - -static int __init no_initrd(char *str) -{ - mount_initrd = 0; - return 1; -} - -__setup("noinitrd", no_initrd); - -#endif - -static int __init ramdisk_start_setup(char *str) -{ - rd_image_start = simple_strtol(str,NULL,0); - return 1; -} - -static int __init load_ramdisk(char *str) -{ - rd_doload = simple_strtol(str,NULL,0) & 3; - return 1; -} - -static int __init prompt_ramdisk(char *str) -{ - rd_prompt = simple_strtol(str,NULL,0) & 1; - return 1; -} - -static int __init ramdisk_size(char *str) -{ - rd_size = simple_strtol(str,NULL,0); - return 1; -} - -static int __init ramdisk_size2(char *str) -{ - return ramdisk_size(str); -} - -static int __init ramdisk_blocksize(char *str) -{ - rd_blocksize = simple_strtol(str,NULL,0); - return 1; -} - -__setup("ramdisk_start=", ramdisk_start_setup); -__setup("load_ramdisk=", load_ramdisk); -__setup("prompt_ramdisk=", prompt_ramdisk); -__setup("ramdisk=", ramdisk_size); -__setup("ramdisk_size=", ramdisk_size2); -__setup("ramdisk_blocksize=", ramdisk_blocksize); - -#endif - /* * Copyright (C) 2000 Linus Torvalds. * 2000 Transmeta Corp. @@ -492,7 +416,7 @@ } /* This is the registration and initialization section of the RAM disk driver */ -int __init rd_init (void) +static int __init rd_init (void) { int i; @@ -548,7 +472,28 @@ module_init(rd_init); module_exit(rd_cleanup); -/* loadable module support */ +/* options - nonmodular */ +#ifndef MODULE +static int __init ramdisk_size(char *str) +{ + rd_size = simple_strtol(str,NULL,0); + return 1; +} +static int __init ramdisk_size2(char *str) /* kludge */ +{ + return ramdisk_size(str); +} +static int __init ramdisk_blocksize(char *str) +{ + rd_blocksize = simple_strtol(str,NULL,0); + return 1; +} +__setup("ramdisk=", ramdisk_size); +__setup("ramdisk_size=", ramdisk_size2); +__setup("ramdisk_blocksize=", ramdisk_blocksize); +#endif + +/* options - modular */ MODULE_PARM (rd_size, "1i"); MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); MODULE_PARM (rd_blocksize, "i"); diff -u --recursive --new-file v2.5.1/linux/drivers/cdrom/cdrom.c linux/drivers/cdrom/cdrom.c --- v2.5.1/linux/drivers/cdrom/cdrom.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/cdrom/cdrom.c Sun Dec 30 10:31:51 2001 @@ -266,7 +266,6 @@ #include <linux/init.h> #include <asm/fcntl.h> -#include <asm/segment.h> #include <asm/uaccess.h> /* used to tell the module to turn on full debugging messages */ diff -u --recursive --new-file v2.5.1/linux/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c --- v2.5.1/linux/drivers/cdrom/cdu31a.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/cdrom/cdu31a.c Sat Dec 29 11:17:37 2001 @@ -237,6 +237,7 @@ static volatile unsigned short sony_cd_read_reg; static volatile unsigned short sony_cd_fifost_reg; +static spinlock_t cdu31a_lock = SPIN_LOCK_UNLOCKED; /* queue lock */ static int sony_spun_up = 0; /* Has the drive been spun up? */ @@ -1605,17 +1606,7 @@ scd_spinup(); } - /* I don't use INIT_REQUEST because it calls return, which would - return without unlocking the device. It shouldn't matter, - but just to be safe... */ - if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) { - panic(DEVICE_NAME ": request list destroyed"); - } - if (CURRENT->bh) { - if (!buffer_locked(CURRENT->bh)) { - panic(DEVICE_NAME ": block not locked"); - } - } + INIT_REQUEST; block = CURRENT->sector; nblock = CURRENT->nr_sectors; @@ -1626,112 +1617,105 @@ goto cdu31a_request_startover; } - switch (CURRENT->cmd) { - case READ: - /* - * If the block address is invalid or the request goes beyond the end of - * the media, return an error. - */ -#if 0 - if ((block / 4) < sony_toc.start_track_lba) { - printk - ("CDU31A: Request before beginning of media\n"); - end_request(0); - goto cdu31a_request_startover; - } -#endif - if ((block / 4) >= sony_toc.lead_out_start_lba) { - printk - ("CDU31A: Request past end of media\n"); - end_request(0); - goto cdu31a_request_startover; - } - if (((block + nblock) / 4) >= - sony_toc.lead_out_start_lba) { - printk - ("CDU31A: Request past end of media\n"); - end_request(0); - goto cdu31a_request_startover; - } - - num_retries = 0; - - try_read_again: - while (handle_sony_cd_attention()); - - if (!sony_toc_read) { - printk("CDU31A: TOC not read\n"); - end_request(0); - goto cdu31a_request_startover; - } - - /* If no data is left to be read from the drive, start the - next request. */ - if (sony_blocks_left == 0) { - if (start_request - (block / 4, CDU31A_READAHEAD / 4, 0)) { - end_request(0); - goto cdu31a_request_startover; - } - } - /* If the requested block is not the next one waiting in - the driver, abort the current operation and start a - new one. */ - else if (block != sony_next_block) { -#if DEBUG - printk - ("CDU31A Warning: Read for block %d, expected %d\n", - block, sony_next_block); -#endif - abort_read(); - if (!sony_toc_read) { - printk("CDU31A: TOC not read\n"); + if(CURRENT->flags & REQ_CMD) { + switch (rq_data_dir(CURRENT)) { + case READ: + /* + * If the block address is invalid or the request goes beyond the end of + * the media, return an error. + */ + if ((block / 4) >= sony_toc.lead_out_start_lba) { + printk + ("CDU31A: Request past end of media\n"); end_request(0); goto cdu31a_request_startover; } - if (start_request - (block / 4, CDU31A_READAHEAD / 4, 0)) { + if (((block + nblock) / 4) >= + sony_toc.lead_out_start_lba) { printk - ("CDU31a: start request failed\n"); + ("CDU31A: Request past end of media\n"); end_request(0); goto cdu31a_request_startover; } - } - read_data_block(CURRENT->buffer, block, nblock, - res_reg, &res_size); - if (res_reg[0] == 0x20) { - if (num_retries > MAX_CDU31A_RETRIES) { + num_retries = 0; + + try_read_again: + while (handle_sony_cd_attention()); + + if (!sony_toc_read) { + printk("CDU31A: TOC not read\n"); end_request(0); goto cdu31a_request_startover; } - num_retries++; - if (res_reg[1] == SONY_NOT_SPIN_ERR) { - do_sony_cd_cmd(SONY_SPIN_UP_CMD, - NULL, 0, res_reg, - &res_size); - } else { + /* If no data is left to be read from the drive, start the + next request. */ + if (sony_blocks_left == 0) { + if (start_request + (block / 4, CDU31A_READAHEAD / 4, 0)) { + end_request(0); + goto cdu31a_request_startover; + } + } + /* If the requested block is not the next one waiting in + the driver, abort the current operation and start a + new one. */ + else if (block != sony_next_block) { +#if DEBUG printk - ("CDU31A: %s error for block %d, nblock %d\n", - translate_error(res_reg[1]), - block, nblock); + ("CDU31A Warning: Read for block %d, expected %d\n", + block, sony_next_block); +#endif + abort_read(); + if (!sony_toc_read) { + printk("CDU31A: TOC not read\n"); + end_request(0); + goto cdu31a_request_startover; + } + if (start_request + (block / 4, CDU31A_READAHEAD / 4, 0)) { + printk + ("CDU31a: start request failed\n"); + end_request(0); + goto cdu31a_request_startover; + } } - goto try_read_again; - } else { - end_request(1); - } - break; - case WRITE: - end_request(0); - break; + read_data_block(CURRENT->buffer, block, nblock, + res_reg, &res_size); + if (res_reg[0] == 0x20) { + if (num_retries > MAX_CDU31A_RETRIES) { + end_request(0); + goto cdu31a_request_startover; + } - default: - panic("CDU31A: Unknown cmd"); + num_retries++; + if (res_reg[1] == SONY_NOT_SPIN_ERR) { + do_sony_cd_cmd(SONY_SPIN_UP_CMD, + NULL, 0, res_reg, + &res_size); + } else { + printk + ("CDU31A: %s error for block %d, nblock %d\n", + translate_error(res_reg[1]), + block, nblock); + } + goto try_read_again; + } else { + end_request(1); + } + break; + + case WRITE: + end_request(0); + break; + + default: + panic("CDU31A: Unknown cmd"); + } } } - end_do_cdu31a_request: spin_lock_irq(&q->queue_lock); #if 0 @@ -3456,7 +3440,8 @@ strcmp("CD-ROM CDU31A", drive_config.product_id) == 0; blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), - DEVICE_REQUEST); + DEVICE_REQUEST, + &cdu31a_lock); read_ahead[MAJOR_NR] = CDU31A_READAHEAD; cdu31a_block_size = 1024; /* 1kB default block size */ /* use 'mount -o block=2048' */ diff -u --recursive --new-file v2.5.1/linux/drivers/char/Config.in linux/drivers/char/Config.in --- v2.5.1/linux/drivers/char/Config.in Mon Nov 12 09:34:16 2001 +++ linux/drivers/char/Config.in Sun Dec 30 10:32:43 2001 @@ -16,7 +16,7 @@ tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL fi fi -if [ "$CONFIG_ACPI" = "y" ]; then +if [ "$CONFIG_ACPI" = "y" -a "$CONFIG_IA64" = "y" ]; then bool ' Support for serial ports defined by ACPI tables' CONFIG_SERIAL_ACPI fi dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL diff -u --recursive --new-file v2.5.1/linux/drivers/char/console.c linux/drivers/char/console.c --- v2.5.1/linux/drivers/char/console.c Mon Oct 15 14:00:43 2001 +++ linux/drivers/char/console.c Tue Dec 25 15:39:20 2001 @@ -2178,7 +2178,6 @@ name: "tty", write: vt_console_print, device: vt_console_device, - wait_key: keyboard_wait_for_keypress, unblank: unblank_screen, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/dsp56k.c linux/drivers/char/dsp56k.c --- v2.5.1/linux/drivers/char/dsp56k.c Mon Sep 10 08:06:32 2001 +++ linux/drivers/char/dsp56k.c Sun Dec 30 10:31:51 2001 @@ -37,7 +37,6 @@ #include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> -#include <asm/segment.h> #include <asm/atarihw.h> #include <asm/traps.h> #include <asm/uaccess.h> /* For put_user and get_user */ diff -u --recursive --new-file v2.5.1/linux/drivers/char/dtlk.c linux/drivers/char/dtlk.c --- v2.5.1/linux/drivers/char/dtlk.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/dtlk.c Sun Dec 30 10:31:51 2001 @@ -57,7 +57,6 @@ #include <linux/errno.h> /* for -EBUSY */ #include <linux/ioport.h> /* for check_region, request_region */ #include <linux/delay.h> /* for loops_per_jiffy */ -#include <asm/segment.h> /* for put_user_byte */ #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ #include <asm/uaccess.h> /* for get_user, etc. */ #include <linux/wait.h> /* for wait_queue */ diff -u --recursive --new-file v2.5.1/linux/drivers/char/dz.c linux/drivers/char/dz.c --- v2.5.1/linux/drivers/char/dz.c Sun Sep 9 10:43:02 2001 +++ linux/drivers/char/dz.c Tue Dec 25 15:39:20 2001 @@ -75,7 +75,6 @@ DECLARE_TASK_QUEUE(tq_serial); -extern wait_queue_head_t keypress_wait; static struct dz_serial *lines[4]; static unsigned char tmp_buffer[256]; @@ -228,8 +227,6 @@ if (info->is_console) { if (ch == 0) return; /* it's a break ... */ - - wake_up (&keypress_wait); /* It is a 'keyboard interrupt' ;-) */ } #endif @@ -1509,11 +1506,6 @@ } } -static int dz_console_wait_key(struct console *co) -{ - return 0; -} - static kdev_t dz_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -1614,7 +1606,6 @@ name: "ttyS", write: dz_console_print, device: dz_console_device, - wait_key: dz_console_wait_key, setup: dz_console_setup, flags: CON_CONSDEV | CON_PRINTBUFFER, index: CONSOLE_LINE, diff -u --recursive --new-file v2.5.1/linux/drivers/char/epca.c linux/drivers/char/epca.c --- v2.5.1/linux/drivers/char/epca.c Fri Oct 12 13:48:42 2001 +++ linux/drivers/char/epca.c Sun Dec 30 10:31:51 2001 @@ -897,7 +897,6 @@ inline void copy_from_user(void * to, const void * from, unsigned long count); - You must include <asm/segment.h> I also think (Check hackers guide) that optimization must be turned ON. (Which sounds strange to me...) diff -u --recursive --new-file v2.5.1/linux/drivers/char/esp.c linux/drivers/char/esp.c --- v2.5.1/linux/drivers/char/esp.c Fri Nov 9 14:01:21 2001 +++ linux/drivers/char/esp.c Sun Dec 30 10:31:51 2001 @@ -60,7 +60,6 @@ #include <asm/system.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/dma.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/RELEASE-NOTES linux/drivers/char/ftape/RELEASE-NOTES --- v2.5.1/linux/drivers/char/ftape/RELEASE-NOTES Tue Dec 29 11:27:38 1998 +++ linux/drivers/char/ftape/RELEASE-NOTES Sun Dec 30 10:31:51 2001 @@ -838,7 +838,6 @@ - Split ftape-io.c into ftape-io.c and ftape-ctl.c files. - Corrected too high media error count after writing to a bad tape. -- Added #include <asm/segment.h> again because old kernel versions need it. - Fixed fdc not being disabled when open failed because no tape drive was found. diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/compressor/zftape-compress.c linux/drivers/char/ftape/compressor/zftape-compress.c --- v2.5.1/linux/drivers/char/ftape/compressor/zftape-compress.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/char/ftape/compressor/zftape-compress.c Sun Dec 30 10:31:51 2001 @@ -40,7 +40,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else -#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-buffer.c linux/drivers/char/ftape/lowlevel/ftape-buffer.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-buffer.c Fri Feb 9 11:30:22 2001 +++ linux/drivers/char/ftape/lowlevel/ftape-buffer.c Sun Dec 30 10:31:51 2001 @@ -24,7 +24,6 @@ * buffer. */ -#include <asm/segment.h> #include <linux/slab.h> #include <linux/mm.h> #include <linux/mman.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-ctl.c linux/drivers/char/ftape/lowlevel/ftape-ctl.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-ctl.c Tue Nov 7 11:09:19 2000 +++ linux/drivers/char/ftape/lowlevel/ftape-ctl.c Sun Dec 30 10:31:51 2001 @@ -36,7 +36,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else -#include <asm/segment.h> #endif #include <asm/io.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-io.c linux/drivers/char/ftape/lowlevel/ftape-io.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-io.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/lowlevel/ftape-io.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <linux/errno.h> #include <linux/sched.h> #include <linux/mm.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/ioctl.h> #include <linux/mtio.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-read.c linux/drivers/char/ftape/lowlevel/ftape-read.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-read.c Tue Nov 25 14:45:27 1997 +++ linux/drivers/char/ftape/lowlevel/ftape-read.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <linux/string.h> #include <linux/errno.h> #include <linux/mm.h> -#include <asm/segment.h> #include <linux/ftape.h> #include <linux/qic117.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-setup.c linux/drivers/char/ftape/lowlevel/ftape-setup.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-setup.c Thu Aug 12 11:53:22 1999 +++ linux/drivers/char/ftape/lowlevel/ftape-setup.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <linux/string.h> #include <linux/errno.h> #include <linux/mm.h> -#include <asm/segment.h> #include <linux/ftape.h> #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,16) diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-write.c linux/drivers/char/ftape/lowlevel/ftape-write.c --- v2.5.1/linux/drivers/char/ftape/lowlevel/ftape-write.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/lowlevel/ftape-write.c Sun Dec 30 10:31:51 2001 @@ -28,7 +28,6 @@ #include <linux/string.h> #include <linux/errno.h> #include <linux/mm.h> -#include <asm/segment.h> #include <linux/ftape.h> #include <linux/qic117.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-buffers.c linux/drivers/char/ftape/zftape/zftape-buffers.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-buffers.c Fri Feb 9 11:30:22 2001 +++ linux/drivers/char/ftape/zftape/zftape-buffers.c Sun Dec 30 10:31:51 2001 @@ -27,7 +27,6 @@ #include <linux/errno.h> #include <linux/mm.h> #include <linux/slab.h> -#include <asm/segment.h> #include <linux/zftape.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-ctl.c linux/drivers/char/ftape/zftape/zftape-ctl.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-ctl.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/zftape/zftape-ctl.c Sun Dec 30 10:31:51 2001 @@ -36,7 +36,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else -#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-init.c linux/drivers/char/ftape/zftape/zftape-init.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-init.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/ftape/zftape/zftape-init.c Sun Dec 30 10:31:51 2001 @@ -25,7 +25,6 @@ #include <linux/errno.h> #include <linux/version.h> #include <linux/fs.h> -#include <asm/segment.h> #include <linux/kernel.h> #include <linux/signal.h> #include <linux/major.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-read.c linux/drivers/char/ftape/zftape/zftape-read.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-read.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/zftape/zftape-read.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else -#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-rw.c linux/drivers/char/ftape/zftape/zftape-rw.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-rw.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/zftape/zftape-rw.c Sun Dec 30 10:31:51 2001 @@ -27,7 +27,6 @@ #include <linux/config.h> /* for CONFIG_ZFT_DFLT_BLK_SZ */ #include <linux/errno.h> #include <linux/mm.h> -#include <asm/segment.h> #include <linux/zftape.h> #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-vtbl.c linux/drivers/char/ftape/zftape/zftape-vtbl.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-vtbl.c Fri Apr 6 10:42:55 2001 +++ linux/drivers/char/ftape/zftape/zftape-vtbl.c Sun Dec 30 10:31:51 2001 @@ -31,7 +31,6 @@ #include <linux/errno.h> #include <linux/mm.h> #include <linux/slab.h> -#include <asm/segment.h> #include <linux/zftape.h> #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/ftape/zftape/zftape-write.c linux/drivers/char/ftape/zftape/zftape-write.c --- v2.5.1/linux/drivers/char/ftape/zftape/zftape-write.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/char/ftape/zftape/zftape-write.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VER(2,1,6) #include <asm/uaccess.h> #else -#include <asm/segment.h> #endif #include "../zftape/zftape-init.h" diff -u --recursive --new-file v2.5.1/linux/drivers/char/h8.c linux/drivers/char/h8.c --- v2.5.1/linux/drivers/char/h8.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/char/h8.c Sun Dec 30 10:31:51 2001 @@ -14,7 +14,6 @@ #include <linux/module.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/types.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/i8k.c linux/drivers/char/i8k.c --- v2.5.1/linux/drivers/char/i8k.c Fri Nov 2 17:46:47 2001 +++ linux/drivers/char/i8k.c Sun Dec 30 10:38:45 2001 @@ -1,5 +1,7 @@ /* - * i8k.c -- Linux driver for accessing the SMM BIOS on Dell I8000 laptops + * i8k.c -- Linux driver for accessing the SMM BIOS on Dell laptops. + * See http://www.debian.org/~dz/i8k/ for more information + * and for latest version of this driver. * * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> * @@ -19,15 +21,13 @@ #include <linux/types.h> #include <linux/init.h> #include <linux/proc_fs.h> -#include <asm/io.h> +#include <linux/apm_bios.h> #include <asm/uaccess.h> +#include <asm/io.h> #include <linux/i8k.h> -#define I8K_VERSION "1.1 02/11/2001" -#define I8K_BIOS_SIGNATURE "Dell System Inspiron 8000" -#define I8K_BIOS_SIGNATURE_ADDR 0x000ec000 -#define I8K_BIOS_VERSION_OFFSET 32 +#define I8K_VERSION "1.7 21/11/2001" #define I8K_SMM_FN_STATUS 0x0025 #define I8K_SMM_POWER_STATUS 0x0069 @@ -35,31 +35,47 @@ #define I8K_SMM_GET_FAN 0x00a3 #define I8K_SMM_GET_SPEED 0x02a3 #define I8K_SMM_GET_TEMP 0x10a3 +#define I8K_SMM_GET_DELL_SIG 0xffa3 #define I8K_SMM_BIOS_VERSION 0x00a6 #define I8K_FAN_MULT 30 #define I8K_MAX_TEMP 127 -#define I8K_FN_NONE 0x08 -#define I8K_FN_UP 0x09 -#define I8K_FN_DOWN 0x0a -#define I8K_FN_MUTE 0x0c +#define I8K_FN_NONE 0x00 +#define I8K_FN_UP 0x01 +#define I8K_FN_DOWN 0x02 +#define I8K_FN_MUTE 0x04 +#define I8K_FN_MASK 0x07 +#define I8K_FN_SHIFT 8 #define I8K_POWER_AC 0x05 #define I8K_POWER_BATTERY 0x01 #define I8K_TEMPERATURE_BUG 1 -static char bios_version[4] = "?"; -static char bios_machine_id[16] = "?"; +#define DELL_SIGNATURE "Dell Computer" + +static char *supported_models[] = { + "Inspiron", + "Latitude", + NULL +}; + +static char system_vendor[48] = "?"; +static char product_name [48] = "?"; +static char bios_version [4] = "?"; +static char serial_number[16] = "?"; int force = 0; +int power_status = 0; MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); -MODULE_DESCRIPTION("Driver for accessing the SMM BIOS on Dell I8000 laptops"); +MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops"); MODULE_LICENSE("GPL"); MODULE_PARM(force, "i"); -MODULE_PARM_DESC(force, "Force loading without checking for an Inspiron 8000"); +MODULE_PARM(power_status, "i"); +MODULE_PARM_DESC(force, "Force loading without checking for supported models"); +MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); static ssize_t i8k_read(struct file *, char *, size_t, loff_t *); static int i8k_ioctl(struct inode *, struct file *, unsigned int, @@ -79,12 +95,19 @@ unsigned int edi __attribute__ ((packed)); } SMMRegisters; +typedef struct { + u8 type; + u8 length; + u16 handle; +} DMIHeader; + /* - * Call the System Management Mode BIOS. + * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard. */ static int i8k_smm(SMMRegisters *regs) { int rc; + int eax = regs->eax; asm("pushl %%eax\n\t" \ "movl 0(%%eax),%%edx\n\t" \ @@ -112,7 +135,7 @@ : "a" (regs) : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); - if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff)) { + if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) { return -EINVAL; } @@ -137,11 +160,12 @@ } /* - * Read the machine id. Not yet implemented. + * Read the machine id. */ -static int i8k_get_machine_id(unsigned char *buff) +static int i8k_get_serial_number(unsigned char *buff) { - return -EINVAL; + strncpy(buff, serial_number, 16); + return 0; } /* @@ -157,7 +181,7 @@ return rc; } - switch ((regs.eax & 0xff00) >> 8) { + switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) { case I8K_FN_UP: return I8K_VOL_UP; case I8K_FN_DOWN: @@ -281,6 +305,23 @@ return temp; } +static int i8k_get_dell_signature(void) +{ + SMMRegisters regs = { 0, 0, 0, 0, 0, 0 }; + int rc; + + regs.eax = I8K_SMM_GET_DELL_SIG; + if ((rc=i8k_smm(®s)) < 0) { + return rc; + } + + if ((regs.eax == 1145651527) && (regs.edx == 1145392204)) { + return 0; + } else { + return -1; + } +} + static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { @@ -299,7 +340,7 @@ case I8K_MACHINE_ID: memset(buff, 0, 16); - val = i8k_get_machine_id(buff); + val = i8k_get_serial_number(buff); break; case I8K_FN_STATUS: @@ -375,13 +416,17 @@ int n, fn_key, cpu_temp, ac_power; int left_fan, right_fan, left_speed, right_speed; - cpu_temp = i8k_get_cpu_temp(); - left_fan = i8k_get_fan_status(I8K_FAN_LEFT); - right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); - left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); - right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); - ac_power = i8k_get_power_status(); - fn_key = i8k_get_fn_status(); + cpu_temp = i8k_get_cpu_temp(); /* 11100 µs */ + left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */ + right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */ + left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */ + right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */ + fn_key = i8k_get_fn_status(); /* 750 µs */ + if (power_status) { + ac_power = i8k_get_power_status(); /* 14700 µs */ + } else { + ac_power = -1; + } /* * Info: @@ -400,7 +445,7 @@ n = sprintf(buffer, "%s %s %s %d %d %d %d %d %d %d\n", I8K_PROC_FMT, bios_version, - bios_machine_id, + serial_number, cpu_temp, left_fan, right_fan, @@ -438,76 +483,253 @@ return len; } +static char* __init string_trim(char *s, int size) +{ + int len; + char *p; + + if ((len = strlen(s)) > size) { + len = size; + } + + for (p=s+len-1; len && (*p==' '); len--,p--) { + *p = '\0'; + } + + return s; +} + +/* DMI code, stolen from arch/i386/kernel/dmi_scan.c */ + /* - * Probe for the presence of an Inspiron I8000. + * |<-- dmi->length -->| + * | | + * |dmi header s=N | string1,\0, ..., stringN,\0, ..., \0 + * | | + * +-----------------------+ */ -static int i8k_probe(void) +static char* __init dmi_string(DMIHeader *dmi, u8 s) { - unsigned char *buff, *p; - unsigned char bios_vers[4]; - int version; + u8 *p; + + if (!s) { + return ""; + } + s--; + + p = (u8 *)dmi + dmi->length; + while (s > 0) { + p += strlen(p); + p++; + s--; + } + + return p; +} + +static void __init dmi_decode(DMIHeader *dmi) +{ + u8 *data = (u8 *) dmi; + char *p; + +#ifdef I8K_DEBUG + int i; + printk("%08x ", (int)data); + for (i=0; i<data[1] && i<64; i++) { + printk("%02x ", data[i]); + } + printk("\n"); +#endif + + switch (dmi->type) { + case 0: /* BIOS Information */ + p = dmi_string(dmi,data[5]); + if (*p) { + strncpy(bios_version, p, sizeof(bios_version)); + string_trim(bios_version, sizeof(bios_version)); + } + break; + case 1: /* System Information */ + p = dmi_string(dmi,data[4]); + if (*p) { + strncpy(system_vendor, p, sizeof(system_vendor)); + string_trim(system_vendor, sizeof(system_vendor)); + } + p = dmi_string(dmi,data[5]); + if (*p) { + strncpy(product_name, p, sizeof(product_name)); + string_trim(product_name, sizeof(product_name)); + } + p = dmi_string(dmi,data[7]); + if (*p) { + strncpy(serial_number, p, sizeof(serial_number)); + string_trim(serial_number, sizeof(serial_number)); + } + break; + } +} + +static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*)) +{ + u8 *buf; + u8 *data; + DMIHeader *dmi; + int i = 1; + + buf = ioremap(base, len); + if (buf == NULL) { + return -1; + } + data = buf; /* - * Until Dell tell us how to reliably check for an Inspiron system - * look for a signature at a fixed location in the BIOS memory. - * Ugly but safe. + * Stop when we see al the items the table claimed to have + * or we run off the end of the table (also happens) */ - if (!force) { - buff = ioremap(I8K_BIOS_SIGNATURE_ADDR, I8K_BIOS_VERSION_OFFSET+4); - if (buff == NULL) { - printk("i8k: ioremap failed\n"); - return -ENODEV; + while ((i<num) && ((data-buf) < len)) { + dmi = (DMIHeader *)data; + /* + * Avoid misparsing crud if the length of the last + * record is crap + */ + if ((data-buf+dmi->length) >= len) { + break; + } + fn(dmi); + data += dmi->length; + /* + * Don't go off the end of the data if there is + * stuff looking like string fill past the end + */ + while (((data-buf) < len) && (*data || data[1])) { + data++; } - if (strncmp(buff,I8K_BIOS_SIGNATURE,sizeof(I8K_BIOS_SIGNATURE)) != 0) { - printk("i8k: Inspiron 8000 BIOS signature not found\n"); - iounmap(buff); - return -ENODEV; + data += 2; + i++; + } + iounmap(buf); + + return 0; +} + +static int __init dmi_iterate(void (*decode)(DMIHeader *)) +{ + unsigned char buf[20]; + long fp = 0x000e0000L; + fp -= 16; + + while (fp < 0x000fffffL) { + fp += 16; + isa_memcpy_fromio(buf, fp, 20); + if (memcmp(buf, "_DMI_", 5)==0) { + u16 num = buf[13]<<8 | buf[12]; + u16 len = buf [7]<<8 | buf [6]; + u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]; +#ifdef I8K_DEBUG + printk(KERN_INFO "DMI %d.%d present.\n", + buf[14]>>4, buf[14]&0x0F); + printk(KERN_INFO "%d structures occupying %d bytes.\n", + buf[13]<<8 | buf[12], + buf [7]<<8 | buf[6]); + printk(KERN_INFO "DMI table at 0x%08X.\n", + buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]); +#endif + if (dmi_table(base, len, num, decode)==0) { + return 0; + } } - strncpy(bios_vers, buff+I8K_BIOS_VERSION_OFFSET, 3); - bios_vers[3] = '\0'; - iounmap(buff); - } - if (force >= 2) { - buff = ioremap(0x000c0000, 0x00100000-0x000c0000); - if (buff == NULL) { - printk("i8k: ioremap failed\n"); + } + return -1; +} +/* end of DMI code */ + +/* + * Get DMI information. + */ +static int __init i8k_dmi_probe(void) +{ + char **p; + + if (dmi_iterate(dmi_decode) != 0) { + printk(KERN_INFO "i8k: unable to get DMI information\n"); + return -ENODEV; + } + + if (strncmp(system_vendor,DELL_SIGNATURE,strlen(DELL_SIGNATURE)) != 0) { + printk(KERN_INFO "i8k: not running on a Dell system\n"); + return -ENODEV; + } + + for (p=supported_models; ; p++) { + if (!*p) { + printk(KERN_INFO "i8k: unsupported model: %s\n", product_name); return -ENODEV; } - for (p=buff; (p-buff)<(0x00100000-0x000c0000); p+=16) { - if (strncmp(p,I8K_BIOS_SIGNATURE,sizeof(I8K_BIOS_SIGNATURE))==0) { - printk("i8k: Inspiron 8000 BIOS signature found at %08x\n", - 0x000c0000+(p-buff)); - break; - } + if (strncmp(product_name,*p,strlen(*p)) == 0) { + break; } - iounmap(buff); } + return 0; +} + +/* + * Probe for the presence of a supported laptop. + */ +static int __init i8k_probe(void) +{ + char buff[4]; + int version; + int smm_found = 0; + /* - * Next try to get the BIOS version with an SMM call. If this - * fails SMM can't be reliably used on this system. + * Get DMI information */ - version = i8k_get_bios_version(); - if (version <= 0) { - printk("i8k: unable to get BIOS version\n"); - return -ENODEV; + if (i8k_dmi_probe() != 0) { + printk(KERN_INFO "i8k: vendor=%s, model=%s, version=%s\n", + system_vendor, product_name, bios_version); } - bios_version[0] = (version >> 16) & 0xff; - bios_version[1] = (version >> 8) & 0xff; - bios_version[2] = (version) & 0xff; - bios_version[3] = '\0'; /* - * Finally check if the two versions match. + * Get SMM Dell signature */ - if (!force) { - if (strncmp(bios_version,bios_vers,sizeof(bios_version)) != 0) { - printk("i8k: BIOS version mismatch: %s != %s\n", - bios_version, bios_vers); - return -ENODEV; + if (i8k_get_dell_signature() != 0) { + printk(KERN_INFO "i8k: unable to get SMM Dell signature\n"); + } else { + smm_found = 1; + } + + /* + * Get SMM BIOS version. + */ + version = i8k_get_bios_version(); + if (version <= 0) { + printk(KERN_INFO "i8k: unable to get SMM BIOS version\n"); + } else { + smm_found = 1; + buff[0] = (version >> 16) & 0xff; + buff[1] = (version >> 8) & 0xff; + buff[2] = (version) & 0xff; + buff[3] = '\0'; + /* + * If DMI BIOS version is unknown use SMM BIOS version. + */ + if (bios_version[0] == '?') { + strcpy(bios_version, buff); + } + /* + * Check if the two versions match. + */ + if (strncmp(buff,bios_version,sizeof(bios_version)) != 0) { + printk(KERN_INFO "i8k: BIOS version mismatch: %s != %s\n", + buff, bios_version); } } + if (!smm_found && !force) { + return -ENODEV; + } + return 0; } @@ -518,7 +740,7 @@ { struct proc_dir_entry *proc_i8k; - /* Are we running on an Inspiron 8000 laptop? */ + /* Are we running on an supported laptop? */ if (i8k_probe() != 0) { return -ENODEV; } @@ -532,7 +754,7 @@ SET_MODULE_OWNER(proc_i8k); printk(KERN_INFO - "Inspiron 8000 SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n", + "Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n", I8K_VERSION); return 0; diff -u --recursive --new-file v2.5.1/linux/drivers/char/ip2main.c linux/drivers/char/ip2main.c --- v2.5.1/linux/drivers/char/ip2main.c Fri Nov 2 17:26:17 2001 +++ linux/drivers/char/ip2main.c Sun Dec 30 10:31:51 2001 @@ -142,7 +142,6 @@ // so blame them. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,4) -# include <asm/segment.h> # define GET_USER(error,value,addr) error = get_user(value,addr) # define COPY_FROM_USER(error,dest,src,size) error = copy_from_user(dest,src,size) ? -EFAULT : 0 # define PUT_USER(error,value,addr) error = put_user(value,addr) diff -u --recursive --new-file v2.5.1/linux/drivers/char/isicom.c linux/drivers/char/isicom.c --- v2.5.1/linux/drivers/char/isicom.c Fri Nov 9 14:01:21 2001 +++ linux/drivers/char/isicom.c Sun Dec 30 10:31:51 2001 @@ -51,7 +51,6 @@ #include <linux/timer.h> #include <linux/ioport.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <asm/io.h> #include <asm/system.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/keyboard.c linux/drivers/char/keyboard.c --- v2.5.1/linux/drivers/char/keyboard.c Tue Sep 18 13:39:51 2001 +++ linux/drivers/char/keyboard.c Tue Dec 25 15:39:20 2001 @@ -67,15 +67,8 @@ extern void ctrl_alt_del(void); -DECLARE_WAIT_QUEUE_HEAD(keypress_wait); struct console; -int keyboard_wait_for_keypress(struct console *co) -{ - sleep_on(&keypress_wait); - return 0; -} - /* * global state includes the following, and various static variables * in this module: prev_scancode, shift_state, diacr, npadch, dead_key_next. @@ -334,7 +327,6 @@ void put_queue(int ch) { - wake_up(&keypress_wait); if (tty) { tty_insert_flip_char(tty, ch, 0); con_schedule_flip(tty); @@ -343,7 +335,6 @@ static void puts_queue(char *cp) { - wake_up(&keypress_wait); if (!tty) return; diff -u --recursive --new-file v2.5.1/linux/drivers/char/moxa.c linux/drivers/char/moxa.c --- v2.5.1/linux/drivers/char/moxa.c Thu Oct 25 13:53:47 2001 +++ linux/drivers/char/moxa.c Sun Dec 30 10:31:51 2001 @@ -53,7 +53,6 @@ #include <asm/system.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/mxser.c linux/drivers/char/mxser.c --- v2.5.1/linux/drivers/char/mxser.c Thu Oct 25 13:53:47 2001 +++ linux/drivers/char/mxser.c Sun Dec 30 10:31:51 2001 @@ -58,7 +58,6 @@ #include <asm/system.h> #include <asm/io.h> #include <asm/irq.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/drivers/char/n_hdlc.c linux/drivers/char/n_hdlc.c --- v2.5.1/linux/drivers/char/n_hdlc.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/char/n_hdlc.c Sun Dec 30 10:31:51 2001 @@ -112,7 +112,6 @@ #include <linux/kerneld.h> #endif -#include <asm/segment.h> #define GET_USER(error,value,addr) error = get_user(value,addr) #define COPY_FROM_USER(error,dest,src,size) error = copy_from_user(dest,src,size) ? -EFAULT : 0 #define PUT_USER(error,value,addr) error = put_user(value,addr) diff -u --recursive --new-file v2.5.1/linux/drivers/char/pc110pad.c linux/drivers/char/pc110pad.c --- v2.5.1/linux/drivers/char/pc110pad.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/pc110pad.c Sun Dec 30 09:08:06 2001 @@ -590,7 +590,7 @@ spin_lock_irqsave(&pc110_lock, flags); if (!--active_count) outb(0x30, current_params.io+2); /* switch off digitiser */ - spin_unlock_irqrestore(&active_lock, flags); + spin_unlock_irqrestore(&pc110_lock, flags); return 0; } diff -u --recursive --new-file v2.5.1/linux/drivers/char/pty.c linux/drivers/char/pty.c --- v2.5.1/linux/drivers/char/pty.c Fri Sep 21 10:55:22 2001 +++ linux/drivers/char/pty.c Thu Dec 27 08:29:14 2001 @@ -334,8 +334,7 @@ /* Register a slave for the master */ if (tty->driver.major == PTY_MASTER_MAJOR) tty_register_devfs(&tty->link->driver, - DEVFS_FL_CURRENT_OWNER | - DEVFS_FL_NO_PERSISTENCE | DEVFS_FL_WAIT, + DEVFS_FL_CURRENT_OWNER | DEVFS_FL_WAIT, tty->link->driver.minor_start + MINOR(tty->device)-tty->driver.minor_start); retval = 0; diff -u --recursive --new-file v2.5.1/linux/drivers/char/raw.c linux/drivers/char/raw.c --- v2.5.1/linux/drivers/char/raw.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/raw.c Thu Dec 27 08:17:43 2001 @@ -117,21 +117,8 @@ if (raw_devices[minor].inuse++) goto out; - /* - * Don't interfere with mounted devices: we cannot safely set - * the blocksize on a device which is already mounted. - */ - - sector_size = 512; - if (is_mounted(rdev)) { - if (blksize_size[MAJOR(rdev)]) - sector_size = blksize_size[MAJOR(rdev)][MINOR(rdev)]; - } else - sector_size = get_hardsect_size(rdev); - - set_blocksize(rdev, sector_size); + sector_size = get_hardsect_size(rdev); raw_devices[minor].sector_size = sector_size; - for (sector_bits = 0; !(sector_size & 1); ) sector_size>>=1, sector_bits++; raw_devices[minor].sector_bits = sector_bits; diff -u --recursive --new-file v2.5.1/linux/drivers/char/serial.c linux/drivers/char/serial.c --- v2.5.1/linux/drivers/char/serial.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/serial.c Tue Dec 25 15:39:20 2001 @@ -5825,35 +5825,6 @@ serial_out(info, UART_IER, ier); } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - static struct async_struct *info; - int ier, c; - - info = &async_sercons; - - /* - * First save the IER then disable the interrupts so - * that the real driver for the port does not get the - * character. - */ - ier = serial_in(info, UART_IER); - serial_out(info, UART_IER, 0x00); - - while ((serial_in(info, UART_LSR) & UART_LSR_DR) == 0); - c = serial_in(info, UART_RX); - - /* - * Restore the interrupts - */ - serial_out(info, UART_IER, ier); - - return c; -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -5994,7 +5965,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/serial167.c linux/drivers/char/serial167.c --- v2.5.1/linux/drivers/char/serial167.c Sun Sep 16 21:23:07 2001 +++ linux/drivers/char/serial167.c Sun Dec 30 10:31:51 2001 @@ -65,7 +65,6 @@ #include <asm/system.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/mvme16xhw.h> #include <asm/bootinfo.h> @@ -2806,58 +2805,6 @@ restore_flags(flags); } -/* This is a hack; if there are multiple chars waiting in the chip we - * discard all but the last one, and return that. The cd2401 is not really - * designed to be driven in polled mode. - */ - -int serial167_console_wait_key(struct console *co) -{ - volatile unsigned char *base_addr = (u_char *)BASE_ADDR; - unsigned long flags; - volatile u_char sink; - u_char ier; - int port; - int keypress = 0; - - save_flags(flags); cli(); - - /* Ensure receiver is enabled! */ - - port = 0; - base_addr[CyCAR] = (u_char)port; - while (base_addr[CyCCR]) - ; - base_addr[CyCCR] = CyENB_RCVR; - ier = base_addr[CyIER]; - base_addr[CyIER] = CyRxData; - - while (!keypress) { - if (pcc2chip[PccSCCRICR] & 0x20) - { - /* We have an Rx int. Acknowledge it */ - sink = pcc2chip[PccRPIACKR]; - if ((base_addr[CyLICR] >> 2) == port) { - int cnt = base_addr[CyRFOC]; - while (cnt-- > 0) - { - keypress = base_addr[CyRDR]; - } - base_addr[CyREOIR] = 0; - } - else - base_addr[CyREOIR] = CyNOTRANS; - } - } - - base_addr[CyIER] = ier; - - restore_flags(flags); - - return keypress; -} - - static kdev_t serial167_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -2874,7 +2821,6 @@ name: "ttyS", write: serial167_console_write, device: serial167_console_device, - wait_key: serial167_console_wait_key, setup: serial167_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/serial_21285.c linux/drivers/char/serial_21285.c --- v2.5.1/linux/drivers/char/serial_21285.c Thu Sep 13 15:21:32 2001 +++ linux/drivers/char/serial_21285.c Tue Dec 25 15:39:20 2001 @@ -389,17 +389,6 @@ enable_irq(IRQ_CONTX); } -static int rs285_console_wait_key(struct console *co) -{ - int c; - - disable_irq(IRQ_CONRX); - while (*CSR_UARTFLG & 0x10); - c = *CSR_UARTDR; - enable_irq(IRQ_CONRX); - return c; -} - static kdev_t rs285_console_device(struct console *c) { return MKDEV(SERIAL_21285_MAJOR, SERIAL_21285_MINOR); @@ -493,7 +482,6 @@ name: SERIAL_21285_NAME, write: rs285_console_write, device: rs285_console_device, - wait_key: rs285_console_wait_key, setup: rs285_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/serial_amba.c linux/drivers/char/serial_amba.c --- v2.5.1/linux/drivers/char/serial_amba.c Sun Sep 16 21:23:14 2001 +++ linux/drivers/char/serial_amba.c Tue Dec 25 15:39:20 2001 @@ -1921,22 +1921,6 @@ UART_PUT_CR(port, old_cr); } -/* - * Receive character from the serial port - */ -static int ambauart_console_wait_key(struct console *co) -{ - struct amba_port *port = &amba_ports[co->index]; - unsigned int status; - int c; - - do { - status = UART_GET_FR(port); - } while (!UART_RX_DATA(status)); - c = UART_GET_CHAR(port); - return c; -} - static kdev_t ambauart_console_device(struct console *c) { return MKDEV(SERIAL_AMBA_MAJOR, SERIAL_AMBA_MINOR + c->index); @@ -2015,7 +1999,6 @@ read: ambauart_console_read, #endif device: ambauart_console_device, - wait_key: ambauart_console_wait_key, setup: ambauart_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/serial_tx3912.c linux/drivers/char/serial_tx3912.c --- v2.5.1/linux/drivers/char/serial_tx3912.c Fri Nov 9 14:01:21 2001 +++ linux/drivers/char/serial_tx3912.c Tue Dec 25 15:39:20 2001 @@ -993,21 +993,6 @@ IntEnable2 = int2; } -static int serial_console_wait_key(struct console *co) -{ - unsigned int int2, res; - - int2 = IntEnable2; - IntEnable2 = 0; - - while (!(UartA_Ctrl1 & UART_RX_HOLD_FULL)); - res = UartA_Data; - udelay(10); - - IntEnable2 = int2; - return res; -} - static void serial_console_write(struct console *co, const char *s, unsigned count) { @@ -1065,7 +1050,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1 diff -u --recursive --new-file v2.5.1/linux/drivers/char/sh-sci.c linux/drivers/char/sh-sci.c --- v2.5.1/linux/drivers/char/sh-sci.c Mon Oct 15 13:36:48 2001 +++ linux/drivers/char/sh-sci.c Tue Dec 25 15:39:20 2001 @@ -1181,15 +1181,6 @@ put_string(sercons_port, s, count); } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - /* Not implemented yet */ - return 0; -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(SCI_MAJOR, SCI_MINOR_START + c->index); @@ -1273,7 +1264,6 @@ name: "ttySC", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/char/synclink.c linux/drivers/char/synclink.c --- v2.5.1/linux/drivers/char/synclink.c Fri Sep 14 14:39:59 2001 +++ linux/drivers/char/synclink.c Sun Dec 30 10:31:51 2001 @@ -114,7 +114,6 @@ #endif #endif -#include <asm/segment.h> #define GET_USER(error,value,addr) error = get_user(value,addr) #define COPY_FROM_USER(error,dest,src,size) error = copy_from_user(dest,src,size) ? -EFAULT : 0 #define PUT_USER(error,value,addr) error = put_user(value,addr) diff -u --recursive --new-file v2.5.1/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c --- v2.5.1/linux/drivers/char/tty_io.c Tue Dec 18 14:56:35 2001 +++ linux/drivers/char/tty_io.c Thu Dec 27 08:29:14 2001 @@ -597,12 +597,6 @@ read_unlock(&tasklist_lock); } -void wait_for_keypress(void) -{ - struct console *c = console_drivers; - if (c) c->wait_key(c); -} - void stop_tty(struct tty_struct *tty) { if (tty->stopped) @@ -1339,7 +1333,7 @@ set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ minor -= driver->minor_start; devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->other->major, minor + driver->other->minor_start)); - tty_register_devfs(&pts_driver[major], DEVFS_FL_NO_PERSISTENCE, + tty_register_devfs(&pts_driver[major], DEVFS_FL_DEFAULT, pts_driver[major].minor_start + minor); noctty = 1; goto init_dev_done; diff -u --recursive --new-file v2.5.1/linux/drivers/char/vme_scc.c linux/drivers/char/vme_scc.c --- v2.5.1/linux/drivers/char/vme_scc.c Sun Sep 16 21:22:50 2001 +++ linux/drivers/char/vme_scc.c Tue Dec 25 15:39:20 2001 @@ -1065,41 +1065,6 @@ restore_flags(flags); } - -static int scc_console_wait_key(struct console *co) -{ - unsigned long flags; - volatile char *p = NULL; - int c; - -#ifdef CONFIG_MVME147_SCC - if (MACH_IS_MVME147) - p = (volatile char *)M147_SCC_A_ADDR; -#endif -#ifdef CONFIG_MVME162_SCC - if (MACH_IS_MVME16x) - p = (volatile char *)MVME_SCC_A_ADDR; -#endif -#ifdef CONFIG_BVME6000_SCC - if (MACH_IS_BVME6000) - p = (volatile char *)BVME_SCC_A_ADDR; -#endif - - save_flags(flags); - cli(); - - /* wait for rx buf filled */ - while ((*p & 0x01) == 0) - ; - - *p = 8; - scc_delay(); - c = *p; - restore_flags(flags); - return c; -} - - static kdev_t scc_console_device(struct console *c) { return MKDEV(TTY_MAJOR, SCC_MINOR_BASE + c->index); @@ -1116,7 +1081,6 @@ name: "ttyS", write: scc_console_write, device: scc_console_device, - wait_key: scc_console_wait_key, setup: scc_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c --- v2.5.1/linux/drivers/ide/amd74xx.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/ide/amd74xx.c Mon Dec 17 10:49:31 2001 @@ -459,6 +459,8 @@ hwif->tuneproc = &amd74xx_tune_drive; hwif->speedproc = &amd74xx_tune_chipset; + hwif->highmem = 1; + #ifndef CONFIG_BLK_DEV_IDEDMA hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; diff -u --recursive --new-file v2.5.1/linux/drivers/ide/hptraid.c linux/drivers/ide/hptraid.c --- v2.5.1/linux/drivers/ide/hptraid.c Mon Oct 15 13:27:42 2001 +++ linux/drivers/ide/hptraid.c Thu Dec 27 08:17:43 2001 @@ -226,32 +226,20 @@ #include "hptraid.h" -static int read_disk_sb (int major, int minor, unsigned char *buffer,int bufsize) +static int __init read_disk_sb(struct block_device *bdev, + struct highpoint_raid_conf *buf) { - int ret = -EINVAL; - struct buffer_head *bh = NULL; - kdev_t dev = MKDEV(major,minor); - - if (blksize_size[major]==NULL) /* device doesn't exist */ - return -EINVAL; - - - /* Superblock is at 4096+412 bytes */ - set_blocksize (dev, 4096); - bh = bread (dev, 1, 4096); - - - if (bh) { - memcpy (buffer, bh->b_data, bufsize); - } else { - printk(KERN_ERR "hptraid: Error reading superblock.\n"); - goto abort; + /* Superblock is at 9*512 bytes */ + Sector sect; + unsigned char *p = read_dev_sector(bdev, 9, §); + + if (p) { + memcpy(buf, p, 512); + put_dev_sector(§); + return 0; } - ret = 0; -abort: - if (bh) - brelse (bh); - return ret; + printk(KERN_ERR "hptraid: Error reading superblock.\n"); + return -1; } static unsigned long maxsectors (int major,int minor) @@ -276,55 +264,58 @@ return lba; } +static struct highpoint_raid_conf __initdata prom; static void __init probedisk(int major, int minor,int device) { int i; - struct highpoint_raid_conf *prom; - static unsigned char block[4096]; - struct block_device *bdev; - - if (maxsectors(major,minor)==0) + struct block_device *bdev = bdget(MKDEV(major,minor)); + struct gendisk *gd; + + if (!bdev) return; - - if (read_disk_sb(major,minor,(unsigned char*)&block,sizeof(block))) - return; - - prom = (struct highpoint_raid_conf*)&block[512]; - - if (prom->magic!= 0x5a7816f0) - return; - if (prom->type) { + + if (blkdev_get(bdev,FMODE_READ|FMODE_WRITE,0,BDEV_RAW) < 0) + return; + + if (maxsectors(major,minor)==0) + goto out; + + if (read_disk_sb(bdev, &prom)) + goto out; + + if (prom.magic!= 0x5a7816f0) + goto out; + if (prom.type) { printk(KERN_INFO "hptraid: only RAID0 is supported currently\n"); - return; + goto out; } - i = prom->disk_number; + i = prom.disk_number; if (i<0) - return; + goto out; if (i>8) - return; + goto out; + + raid[device].disk[i].bdev = bdev; + /* This is supposed to prevent others from stealing our underlying disks */ + /* now blank the /proc/partitions table for the wrong partition table, + so that scripts don't accidentally mount it and crash the kernel */ + /* XXX: the 0 is an utter hack --hch */ + gd=get_gendisk(MKDEV(major, 0)); + if (gd!=NULL) { + int j; + for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++) + gd->part[j].nr_sects=0; + } - bdev = bdget(MKDEV(major,minor)); - if (bdev && blkdev_get(bdev,FMODE_READ|FMODE_WRITE,0,BDEV_RAW) == 0) { - int j=0; - struct gendisk *gd; - raid[device].disk[i].bdev = bdev; - /* This is supposed to prevent others from stealing our underlying disks */ - /* now blank the /proc/partitions table for the wrong partition table, - so that scripts don't accidentally mount it and crash the kernel */ - /* XXX: the 0 is an utter hack --hch */ - gd=get_gendisk(MKDEV(major, 0)); - if (gd!=NULL) { - for (j=1+(minor<<gd->minor_shift);j<((minor+1)<<gd->minor_shift);j++) - gd->part[j].nr_sects=0; - } - } raid[device].disk[i].device = MKDEV(major,minor); raid[device].disk[i].sectors = maxsectors(major,minor); - raid[device].stride = (1<<prom->raid0_shift); - raid[device].disks = prom->raid_disks; - raid[device].sectors = prom->total_secs; - + raid[device].stride = (1<<prom.raid0_shift); + raid[device].disks = prom.raid_disks; + raid[device].sectors = prom.total_secs; + return; +out: + blkdev_put(bdev); } static void __init fill_cutoff(int device) diff -u --recursive --new-file v2.5.1/linux/drivers/ide/icside.c linux/drivers/ide/icside.c --- v2.5.1/linux/drivers/ide/icside.c Thu Oct 25 13:53:47 2001 +++ linux/drivers/ide/icside.c Tue Dec 25 21:43:32 2001 @@ -27,6 +27,7 @@ #include <asm/io.h> extern char *ide_xfer_verbose (byte xfer_rate); +extern char *ide_dmafunc_verbose(ide_dma_action_t dmafunc); /* * Maximum number of interfaces per card @@ -225,29 +226,18 @@ static int ide_build_sglist(ide_hwif_t *hwif, struct request *rq) { - struct buffer_head *bh; + request_queue_t *q = &hwif->drives[DEVICE_NR(rq->rq_dev) & 1].queue; struct scatterlist *sg = hwif->sg_table; - int nents = 0; + int nents = blk_rq_map_sg(q, rq, sg); - if (rq->cmd == READ) + if (rq->q && nents > rq->nr_phys_segments) + printk("icside: received %d segments, build %d\n", + rq->nr_phys_segments, nents); + + if (rq_data_dir(rq) == READ) hwif->sg_dma_direction = PCI_DMA_FROMDEVICE; else hwif->sg_dma_direction = PCI_DMA_TODEVICE; - bh = rq->bh; - do { - unsigned char *virt_addr = bh->b_data; - unsigned int size = bh->b_size; - - while ((bh = bh->b_reqnext) != NULL) { - if ((virt_addr + size) != (unsigned char *)bh->b_data) - break; - size += bh->b_size; - } - memset(&sg[nents], 0, sizeof(*sg)); - sg[nents].address = virt_addr; - sg[nents].length = size; - nents++; - } while (bh != NULL); return pci_map_sg(NULL, sg, nents, hwif->sg_dma_direction); } @@ -267,39 +257,56 @@ pci_unmap_sg(NULL, sg, nents, HWIF(drive)->sg_dma_direction); } +/* + * Configure the IOMD to give the appropriate timings for the transfer + * mode being requested. We take the advice of the ATA standards, and + * calculate the cycle time based on the transfer mode, and the EIDE + * MW DMA specs that the drive provides in the IDENTIFY command. + * + * We have the following IOMD DMA modes to choose from: + * + * Type Active Recovery Cycle + * A 250 (250) 312 (550) 562 (800) + * B 187 250 437 + * C 125 (125) 125 (375) 250 (500) + * D 62 125 187 + * + * (figures in brackets are actual measured timings) + * + * However, we also need to take care of the read/write active and + * recovery timings: + * + * Read Write + * Mode Active -- Recovery -- Cycle IOMD type + * MW0 215 50 215 480 A + * MW1 80 50 50 150 C + * MW2 70 25 25 120 C + */ static int icside_config_if(ide_drive_t *drive, int xfer_mode) { int func = ide_dma_off; + int cycle_time = 0, use_dma_info = 0; switch (xfer_mode) { - case XFER_MW_DMA_2: - /* - * The cycle time is limited to 250ns by the r/w - * pulse width (90ns), however we should still - * have a maximum burst transfer rate of 8MB/s. - */ - drive->drive_data = 250; - break; - - case XFER_MW_DMA_1: - drive->drive_data = 250; - break; + case XFER_MW_DMA_2: cycle_time = 250; use_dma_info = 1; break; + case XFER_MW_DMA_1: cycle_time = 250; use_dma_info = 1; break; + case XFER_MW_DMA_0: cycle_time = 480; break; + } - case XFER_MW_DMA_0: - drive->drive_data = 480; - break; + /* + * If we're going to be doing MW_DMA_1 or MW_DMA_2, we should + * take care to note the values in the ID... + */ + if (use_dma_info && drive->id->eide_dma_time > cycle_time) + cycle_time = drive->id->eide_dma_time; - default: - drive->drive_data = 0; - break; - } + drive->drive_data = cycle_time; if (!drive->init_speed) - drive->init_speed = (byte) xfer_mode; + drive->init_speed = xfer_mode; - if (drive->drive_data && - ide_config_drive_speed(drive, (byte) xfer_mode) == 0) + if (cycle_time && ide_config_drive_speed(drive, xfer_mode) == 0) func = ide_dma_on; else drive->drive_data = 480; @@ -307,7 +314,7 @@ printk("%s: %s selected (peak %dMB/s)\n", drive->name, ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); - drive->current_speed = (byte) xfer_mode; + drive->current_speed = xfer_mode; return func; } @@ -414,7 +421,7 @@ * This is setup to be called as an extern for future support * to other special driver code. */ -static int check_drive_lists(ide_drive_t *drive, int good_bad) +static int icside_check_drive_lists(ide_drive_t *drive, int good_bad) { struct hd_driveid *id = drive->id; @@ -444,7 +451,7 @@ /* * Consult the list of known "bad" drives */ - if (check_drive_lists(drive, 0)) { + if (icside_check_drive_lists(drive, 0)) { func = ide_dma_off; goto out; } @@ -469,7 +476,7 @@ /* * Consult the list of known "good" drives */ - if (check_drive_lists(drive, 1)) { + if (icside_check_drive_lists(drive, 1)) { if (id->eide_dma_time > 150) goto out; xfer_mode = XFER_MW_DMA_1; @@ -502,6 +509,11 @@ case ide_dma_off_quietly: case ide_dma_on: + /* + * We don't need any bouncing. Yes, this looks the + * wrong way around, but it is correct. + */ + blk_queue_bounce_limit(&drive->queue, BLK_BOUNCE_ANY); drive->using_dma = (func == ide_dma_on); return 0; @@ -553,7 +565,8 @@ case ide_dma_bad_drive: case ide_dma_good_drive: - return check_drive_lists(drive, (func == ide_dma_good_drive)); + return icside_check_drive_lists(drive, (func == + ide_dma_good_drive)); case ide_dma_verbose: return icside_dma_verbose(drive); @@ -590,6 +603,15 @@ failed: printk(" -- ERROR, unable to allocate DMA table\n"); return 0; +} + +int ide_release_dma(ide_hwif_t *hwif) +{ + if (hwif->sg_table) { + kfree(hwif->sg_table); + hwif->sg_table = NULL; + } + return 1; } #endif diff -u --recursive --new-file v2.5.1/linux/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c --- v2.5.1/linux/drivers/ide/ide-cd.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/ide/ide-cd.c Thu Dec 20 08:50:13 2001 @@ -594,7 +594,7 @@ cdrom_end_request (1, drive); *startstop = ide_error (drive, "request sense failure", stat); return 1; - } else if (rq->flags & REQ_PC) { + } else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) { /* All other functions, except for READ. */ struct completion *wait = NULL; pc = (struct packet_command *) rq->special; @@ -2674,6 +2674,8 @@ set_device_ro(MKDEV(HWIF(drive)->major, minor), 1); set_blocksize(MKDEV(HWIF(drive)->major, minor), CD_FRAMESIZE); blk_queue_hardsect_size(&drive->queue, CD_FRAMESIZE); + + blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build); drive->special.all = 0; drive->ready_stat = 0; diff -u --recursive --new-file v2.5.1/linux/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c --- v2.5.1/linux/drivers/ide/ide-floppy.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/ide/ide-floppy.c Mon Dec 17 10:49:31 2001 @@ -336,23 +336,7 @@ #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 -/* - * Special requests for our block device strategy routine. - */ -#define IDEFLOPPY_FIRST_RQ 90 - -/* - * IDEFLOPPY_PC_RQ is used to queue a packet command in the request queue. - */ -#define IDEFLOPPY_PC_RQ 90 - -#define IDEFLOPPY_LAST_RQ 90 - -/* - * A macro which can be used to check if a given request command - * originated in the driver or in the buffer cache layer. - */ -#define IDEFLOPPY_RQ_CMD(cmd) ((cmd >= IDEFLOPPY_FIRST_RQ) && (cmd <= IDEFLOPPY_LAST_RQ)) +#define IDEFLOPPY_RQ (REQ_SPECIAL) /* * Error codes which are returned in rq->errors to the higher part @@ -696,7 +680,7 @@ /* Why does this happen? */ if (!rq) return; - if (!IDEFLOPPY_RQ_CMD (rq->cmd)) { + if (rq->flags & IDEFLOPPY_RQ) { ide_end_request (uptodate, hwgroup); return; } @@ -776,7 +760,7 @@ { ide_init_drive_cmd (rq); rq->buffer = (char *) pc; - rq->cmd = IDEFLOPPY_PC_RQ; + rq->flags = IDEFLOPPY_RQ; (void) ide_do_drive_cmd (drive, rq, ide_preempt); } @@ -1192,6 +1176,7 @@ { int block = sector / floppy->bs_factor; int blocks = rq->nr_sectors / floppy->bs_factor; + int cmd = rq_data_dir(rq); #if IDEFLOPPY_DEBUG_LOG printk ("create_rw1%d_cmd: block == %d, blocks == %d\n", @@ -1200,18 +1185,18 @@ idefloppy_init_pc (pc); if (test_bit (IDEFLOPPY_USE_READ12, &floppy->flags)) { - pc->c[0] = rq->cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD; + pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD; put_unaligned (htonl (blocks), (unsigned int *) &pc->c[6]); } else { - pc->c[0] = rq->cmd == READ ? IDEFLOPPY_READ10_CMD : IDEFLOPPY_WRITE10_CMD; + pc->c[0] = cmd == READ ? IDEFLOPPY_READ10_CMD : IDEFLOPPY_WRITE10_CMD; put_unaligned (htons (blocks), (unsigned short *) &pc->c[7]); } put_unaligned (htonl (block), (unsigned int *) &pc->c[2]); pc->callback = &idefloppy_rw_callback; pc->rq = rq; pc->b_data = rq->buffer; - pc->b_count = rq->cmd == READ ? 0 : rq->bio->bi_size; - if (rq->cmd == WRITE) + pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; + if (rq->flags & REQ_RW) set_bit (PC_WRITING, &pc->flags); pc->buffer = NULL; pc->request_transfer = pc->buffer_size = blocks * floppy->block_size; @@ -1227,8 +1212,8 @@ idefloppy_pc_t *pc; #if IDEFLOPPY_DEBUG_LOG - printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); - printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); + printk (KERN_INFO "rq_status: %d, rq_dev: %u, flags: %lx, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->flags,rq->errors); + printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); #endif /* IDEFLOPPY_DEBUG_LOG */ if (rq->errors >= ERROR_MAX) { @@ -1240,24 +1225,20 @@ idefloppy_end_request (0, HWGROUP(drive)); return ide_stopped; } - switch (rq->cmd) { - case READ: - case WRITE: - if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { - printk ("%s: unsupported r/w request size\n", drive->name); - idefloppy_end_request (0, HWGROUP(drive)); - return ide_stopped; - } - pc = idefloppy_next_pc_storage (drive); - idefloppy_create_rw_cmd (floppy, pc, rq, block); - break; - case IDEFLOPPY_PC_RQ: - pc = (idefloppy_pc_t *) rq->buffer; - break; - default: - printk (KERN_ERR "ide-floppy: unsupported command %x in request queue\n", rq->cmd); - idefloppy_end_request (0,HWGROUP (drive)); + if (rq->flags & REQ_CMD) { + if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { + printk ("%s: unsupported r/w request size\n", drive->name); + idefloppy_end_request (0, HWGROUP(drive)); return ide_stopped; + } + pc = idefloppy_next_pc_storage (drive); + idefloppy_create_rw_cmd (floppy, pc, rq, block); + } else if (rq->flags & IDEFLOPPY_RQ) { + pc = (idefloppy_pc_t *) rq->buffer; + } else { + blk_dump_rq_flags(rq, "ide-floppy: unsupported command in queue"); + idefloppy_end_request (0,HWGROUP (drive)); + return ide_stopped; } pc->rq = rq; return idefloppy_issue_pc (drive, pc); @@ -1273,7 +1254,7 @@ ide_init_drive_cmd (&rq); rq.buffer = (char *) pc; - rq.cmd = IDEFLOPPY_PC_RQ; + rq.flags = IDEFLOPPY_RQ; return ide_do_drive_cmd (drive, &rq, ide_wait); } diff -u --recursive --new-file v2.5.1/linux/drivers/ide/ide-timing.h linux/drivers/ide/ide-timing.h --- v2.5.1/linux/drivers/ide/ide-timing.h Sat Feb 3 11:27:43 2001 +++ linux/drivers/ide/ide-timing.h Thu Dec 27 08:38:57 2001 @@ -2,11 +2,9 @@ #define _IDE_TIMING_H /* - * $Id: ide-timing.h,v 1.5 2001/01/15 21:48:56 vojtech Exp $ + * $Id: ide-timing.h,v 1.6 2001/12/23 22:47:56 vojtech Exp $ * - * Copyright (c) 1999-2000 Vojtech Pavlik - * - * Sponsored by SuSE + * Copyright (c) 1999-2001 Vojtech Pavlik */ /* @@ -25,16 +23,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: - * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: + * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ #include <linux/hdreg.h> -#ifndef XFER_PIO_5 #define XFER_PIO_5 0x0d #define XFER_UDMA_SLOW 0x4f -#endif struct ide_timing { short mode; @@ -49,13 +45,15 @@ }; /* - * PIO 0-5, MWDMA 0-2 and UDMA 0-5 timings (in nanoseconds). + * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). * These were taken from ATA/ATAPI-6 standard, rev 0a, except - * for PIO 5, which is a nonstandard extension. + * for PIO 5, which is a nonstandard extension and UDMA6, which + * is currently supported only by Maxtor drives. */ static struct ide_timing ide_timing[] = { + { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 }, { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 }, { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, @@ -105,6 +103,7 @@ #define EZ(v,unit) ((v)?ENOUGH(v,unit):0) #define XFER_MODE 0xf0 +#define XFER_UDMA_133 0x48 #define XFER_UDMA_100 0x44 #define XFER_UDMA_66 0x42 #define XFER_UDMA 0x40 @@ -123,6 +122,9 @@ if ((map & XFER_UDMA) && (id->field_valid & 4)) { /* Want UDMA and UDMA bitmap valid */ + if ((map & XFER_UDMA_133) == XFER_UDMA_133) + if ((best = (id->dma_ultra & 0x0040) ? XFER_UDMA_6 : 0)) return best; + if ((map & XFER_UDMA_100) == XFER_UDMA_100) if ((best = (id->dma_ultra & 0x0020) ? XFER_UDMA_5 : 0)) return best; @@ -174,14 +176,14 @@ static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) { - q->setup = EZ(t->setup, T); - q->act8b = EZ(t->act8b, T); - q->rec8b = EZ(t->rec8b, T); - q->cyc8b = EZ(t->cyc8b, T); - q->active = EZ(t->active, T); - q->recover = EZ(t->recover, T); - q->cycle = EZ(t->cycle, T); - q->udma = EZ(t->udma, UT); + q->setup = EZ(t->setup * 1000, T); + q->act8b = EZ(t->act8b * 1000, T); + q->rec8b = EZ(t->rec8b * 1000, T); + q->cyc8b = EZ(t->cyc8b * 1000, T); + q->active = EZ(t->active * 1000, T); + q->recover = EZ(t->recover * 1000, T); + q->cycle = EZ(t->cycle * 1000, T); + q->udma = EZ(t->udma * 1000, UT); } static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, struct ide_timing *m, unsigned int what) diff -u --recursive --new-file v2.5.1/linux/drivers/ide/pdcraid.c linux/drivers/ide/pdcraid.c --- v2.5.1/linux/drivers/ide/pdcraid.c Tue Nov 13 09:19:41 2001 +++ linux/drivers/ide/pdcraid.c Thu Dec 27 08:17:43 2001 @@ -387,18 +387,14 @@ #include "pdcraid.h" -static unsigned long calc_pdcblock_offset (int major,int minor) +static unsigned long calc_pdcblock_offset(struct block_device *bdev) { unsigned long lba = 0; - kdev_t dev; - ide_drive_t *ideinfo; - - dev = MKDEV(major,minor); - ideinfo = get_info_ptr (dev); + ide_drive_t *ideinfo = get_info_ptr(to_kdev_t(bdev->bd_dev)); + if (ideinfo==NULL) return 0; - - + /* first sector of the last cluster */ if (ideinfo->head==0) return 0; @@ -412,42 +408,32 @@ } -static int read_disk_sb (int major, int minor, unsigned char *buffer,int bufsize) +static int read_disk_sb(struct block_device *bdev, struct promise_raid_conf *p) { - int ret = -EINVAL; - struct buffer_head *bh = NULL; - kdev_t dev = MKDEV(major,minor); unsigned long sb_offset; + char *buffer; + int i; - if (blksize_size[major]==NULL) /* device doesn't exist */ - return -EINVAL; - - /* * Calculate the position of the superblock, * it's at first sector of the last cylinder */ - sb_offset = calc_pdcblock_offset(major,minor)/8; - /* The /8 transforms sectors into 4Kb blocks */ + sb_offset = calc_pdcblock_offset(bdev); if (sb_offset==0) return -1; - - set_blocksize (dev, 4096); - bh = bread (dev, sb_offset, 4096); - - if (bh) { - memcpy (buffer, bh->b_data, bufsize); - } else { - printk(KERN_ERR "pdcraid: Error reading superblock.\n"); - goto abort; + for (i = 0, buffer = (char*)p; i < 4; i++, buffer += 512) { + Sector sect; + char *q = read_dev_sector(bdev, sb_offset + i, §); + if (!p) { + printk(KERN_ERR "pdcraid: Error reading superblock.\n"); + return -1; + } + memcpy(buffer, q, 512); + put_dev_sector(§); } - ret = 0; -abort: - if (bh) - brelse (bh); - return ret; + return 0; } static unsigned int calc_sb_csum (unsigned int* ptr) @@ -464,12 +450,11 @@ static int cookie = 0; +static struct promise_raid_conf __initdata prom; static void __init probedisk(int devindex,int device, int raidlevel) { int i; int major, minor; - struct promise_raid_conf *prom; - static unsigned char block[4096]; struct block_device *bdev; if (devlist[devindex].device!=-1) /* already assigned to another array */ @@ -478,44 +463,48 @@ major = devlist[devindex].major; minor = devlist[devindex].minor; - if (read_disk_sb(major,minor,(unsigned char*)&block,sizeof(block))) - return; - - prom = (struct promise_raid_conf*)&block[512]; - - /* the checksums must match */ - if (prom->checksum != calc_sb_csum((unsigned int*)prom)) - return; - if (prom->raid.type!=raidlevel) /* different raidlevel */ + bdev = bdget(MKDEV(major,minor)); + if (!bdev) return; - if ((cookie!=0) && (cookie != prom->raid.magic_1)) /* different array */ + if (blkdev_get(bdev, FMODE_READ|FMODE_WRITE, 0, BDEV_RAW) != 0) return; + + if (read_disk_sb(bdev, &prom)) + goto out; + + /* the checksums must match */ + if (prom.checksum != calc_sb_csum((unsigned int*)&prom)) + goto out; + if (prom.raid.type!=raidlevel) /* different raidlevel */ + goto out; + + if ((cookie!=0) && (cookie != prom.raid.magic_1)) /* different array */ + goto out; - cookie = prom->raid.magic_1; + cookie = prom.raid.magic_1; /* This looks evil. But basically, we have to search for our adapternumber in the arraydefinition, both of which are in the superblock */ - for (i=0;(i<prom->raid.total_disks)&&(i<8);i++) { - if ( (prom->raid.disk[i].channel== prom->raid.channel) && - (prom->raid.disk[i].device == prom->raid.device) ) { - - bdev = bdget(MKDEV(major,minor)); - if (bdev && blkdev_get(bdev, FMODE_READ|FMODE_WRITE, 0, BDEV_RAW) == 0) { - raid[device].disk[i].bdev = bdev; - } + for (i=0;(i<prom.raid.total_disks)&&(i<8);i++) { + if ( (prom.raid.disk[i].channel== prom.raid.channel) && + (prom.raid.disk[i].device == prom.raid.device) ) { + + raid[device].disk[i].bdev = bdev; raid[device].disk[i].device = MKDEV(major,minor); - raid[device].disk[i].sectors = prom->raid.disk_secs; - raid[device].stride = (1<<prom->raid.raid0_shift); - raid[device].disks = prom->raid.total_disks; - raid[device].sectors = prom->raid.total_secs; - raid[device].geom.heads = prom->raid.heads+1; - raid[device].geom.sectors = prom->raid.sectors; - raid[device].geom.cylinders = prom->raid.cylinders+1; + raid[device].disk[i].sectors = prom.raid.disk_secs; + raid[device].stride = (1<<prom.raid.raid0_shift); + raid[device].disks = prom.raid.total_disks; + raid[device].sectors = prom.raid.total_secs; + raid[device].geom.heads = prom.raid.heads+1; + raid[device].geom.sectors = prom.raid.sectors; + raid[device].geom.cylinders = prom.raid.cylinders+1; devlist[devindex].device=device; - } + return; + } } - +out: + blkdev_put(bdev, BDEV_RAW); } static void __init fill_cutoff(int device) diff -u --recursive --new-file v2.5.1/linux/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c --- v2.5.1/linux/drivers/ide/via82cxxx.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/ide/via82cxxx.c Thu Dec 27 08:38:57 2001 @@ -1,5 +1,5 @@ /* - * $Id: via82cxxx.c,v 3.29 2001/09/10 10:06:00 vojtech Exp $ + * $Id: via82cxxx.c,v 3.33 2001/12/23 22:46:12 vojtech Exp $ * * Copyright (c) 2000-2001 Vojtech Pavlik * @@ -7,23 +7,21 @@ * Michel Aubry * Jeff Garzik * Andre Hedrick - * - * Sponsored by SuSE */ /* * VIA IDE driver for Linux. Supports * * vt82c576, vt82c586, vt82c586a, vt82c586b, vt82c596a, vt82c596b, - * vt82c686, vt82c686a, vt82c686b, vt8231, vt8233 + * vt82c686, vt82c686a, vt82c686b, vt8231, vt8233, vt8233c, vt8233a * * southbridges, which can be found in * * VIA Apollo Master, VP, VP2, VP2/97, VP3, VPX, VPX/97, MVP3, MVP4, P6, Pro, * ProII, ProPlus, Pro133, Pro133+, Pro133A, Pro133A Dual, Pro133T, Pro133Z, * PLE133, PLE133T, Pro266, Pro266T, ProP4X266, PM601, PM133, PN133, PL133T, - * PX266, PM266, KX133, KT133, KT133A, KLE133, KT266, KX266, KM133, KM133A, - * KL133, KN133, KM266 + * PX266, PM266, KX133, KT133, KT133A, KT133E, KLE133, KT266, KX266, KM133, + * KM133A, KL133, KN133, KM266 * PC-Chips VXPro, VXPro+, VXTwo, TXPro-III, TXPro-AGP, AGPPro, ViaGra, BXToo, * BXTel, BXpert * AMD 640, 640 AGP, 750 IronGate, 760, 760MP @@ -32,9 +30,9 @@ * * chipsets. Supports * - * PIO 0-5, MWDMA 0-2, SWDMA 0-2 and UDMA 0-5 + * PIO 0-5, MWDMA 0-2, SWDMA 0-2 and UDMA 0-6 * - * (this includes UDMA33, 66 and 100) modes. UDMA66 and higher modes are + * (this includes UDMA33, 66, 100 and 133) modes. UDMA66 and higher modes are * autoenabled only in case the BIOS has detected a 80 wire cable. To ignore * the BIOS data and assume the cable is present, use 'ide0=ata66' or * 'ide1=ata66' on the kernel command line. @@ -56,8 +54,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: - * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: + * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ #include <linux/config.h> @@ -87,10 +85,12 @@ #define VIA_UDMA_33 0x001 #define VIA_UDMA_66 0x002 #define VIA_UDMA_100 0x003 +#define VIA_UDMA_133 0x004 #define VIA_BAD_PREQ 0x010 /* Crashes if PREQ# till DDACK# set */ #define VIA_BAD_CLK66 0x020 /* 66 MHz clock doesn't work correctly */ #define VIA_SET_FIFO 0x040 /* Needs to have FIFO split set */ #define VIA_NO_UNMASK 0x080 /* Doesn't work with IRQ unmasking on */ +#define VIA_BAD_ID 0x100 /* Has wrong vendor ID (0x1107) */ /* * VIA SouthBridge chips. @@ -104,10 +104,11 @@ unsigned short flags; } via_isa_bridges[] = { #ifdef FUTURE_BRIDGES - { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_100 }, - { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_100 }, - { "vt8233c", PCI_DEVICE_ID_VIA_8233C, 0x00, 0x2f, VIA_UDMA_100 }, + { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 }, + { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 }, #endif + { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 }, + { "vt8233c", PCI_DEVICE_ID_VIA_8233C_0, 0x00, 0x2f, VIA_UDMA_100 }, { "vt8233", PCI_DEVICE_ID_VIA_8233_0, 0x00, 0x2f, VIA_UDMA_100 }, { "vt8231", PCI_DEVICE_ID_VIA_8231, 0x00, 0x2f, VIA_UDMA_100 }, { "vt82c686b", PCI_DEVICE_ID_VIA_82C686, 0x40, 0x4f, VIA_UDMA_100 }, @@ -121,6 +122,7 @@ { "vt82c586a", PCI_DEVICE_ID_VIA_82C586_0, 0x20, 0x2f, VIA_UDMA_33 | VIA_SET_FIFO }, { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, + { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, { NULL } }; @@ -128,7 +130,7 @@ static unsigned char via_enabled; static unsigned int via_80w; static unsigned int via_clock; -static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100" }; +static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; /* * VIA /proc entry. @@ -151,7 +153,7 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count) { - short speed[4], cycle[4], setup[4], active[4], recover[4], den[4], + int speed[4], cycle[4], setup[4], active[4], recover[4], den[4], uen[4], udma[4], umul[4], active8b[4], recover8b[4]; struct pci_dev *dev = bmide_dev; unsigned int v, u, i; @@ -161,7 +163,7 @@ via_print("----------VIA BusMastering IDE Configuration----------------"); - via_print("Driver Version: 3.29"); + via_print("Driver Version: 3.33"); via_print("South Bridge: VIA %s", via_config->name); pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t); @@ -170,7 +172,7 @@ via_print("Highest DMA rate: %s", via_dma[via_config->flags & VIA_UDMA]); via_print("BM-DMA base: %#x", via_base); - via_print("PCI clock: %dMHz", via_clock); + via_print("PCI clock: %d.%dMHz", via_clock / 1000, via_clock / 100 % 10); pci_read_config_byte(dev, VIA_MISC_1, &t); via_print("Master Read Cycle IRDY: %dws", (t & 64) >> 6); @@ -218,40 +220,45 @@ uen[i] = ((u >> ((3 - i) << 3)) & 0x20); den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2)); - speed[i] = 20 * via_clock / (active[i] + recover[i]); - cycle[i] = 1000 / via_clock * (active[i] + recover[i]); + speed[i] = 2 * via_clock / (active[i] + recover[i]); + cycle[i] = 1000000 * (active[i] + recover[i]) / via_clock; if (!uen[i] || !den[i]) continue; switch (via_config->flags & VIA_UDMA) { - - case VIA_UDMA_100: - speed[i] = 60 * via_clock / udma[i]; - cycle[i] = 333 / via_clock * udma[i]; + + case VIA_UDMA_33: + speed[i] = 2 * via_clock / udma[i]; + cycle[i] = 1000000 * udma[i] / via_clock; break; case VIA_UDMA_66: - speed[i] = 40 * via_clock / (udma[i] * umul[i]); - cycle[i] = 500 / via_clock * (udma[i] * umul[i]); + speed[i] = 4 * via_clock / (udma[i] * umul[i]); + cycle[i] = 500000 * (udma[i] * umul[i]) / via_clock; break; - case VIA_UDMA_33: - speed[i] = 20 * via_clock / udma[i]; - cycle[i] = 1000 / via_clock * udma[i]; + case VIA_UDMA_100: + speed[i] = 6 * via_clock / udma[i]; + cycle[i] = 333333 * udma[i] / via_clock; + break; + + case VIA_UDMA_133: + speed[i] = 8 * via_clock / udma[i]; + cycle[i] = 250000 * udma[i] / via_clock; break; } } via_print_drive("Transfer Mode: ", "%10s", den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO"); - via_print_drive("Address Setup: ", "%8dns", (1000 / via_clock) * setup[i]); - via_print_drive("Cmd Active: ", "%8dns", (1000 / via_clock) * active8b[i]); - via_print_drive("Cmd Recovery: ", "%8dns", (1000 / via_clock) * recover8b[i]); - via_print_drive("Data Active: ", "%8dns", (1000 / via_clock) * active[i]); - via_print_drive("Data Recovery: ", "%8dns", (1000 / via_clock) * recover[i]); + via_print_drive("Address Setup: ", "%8dns", 1000000 * setup[i] / via_clock); + via_print_drive("Cmd Active: ", "%8dns", 1000000 * active8b[i] / via_clock); + via_print_drive("Cmd Recovery: ", "%8dns", 1000000 * recover8b[i] / via_clock); + via_print_drive("Data Active: ", "%8dns", 1000000 * active[i] / via_clock); + via_print_drive("Data Recovery: ", "%8dns", 1000000 * recover[i] / via_clock); via_print_drive("Cycle Time: ", "%8dns", cycle[i]); - via_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 10, speed[i] % 10); + via_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 1000, speed[i] / 100 % 10); return p - buffer; /* hoping it is less than 4K... */ } @@ -280,6 +287,7 @@ case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; + case VIA_UDMA_133: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; default: return; } @@ -296,20 +304,21 @@ { ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); struct ide_timing t, p; - int T, UT; + unsigned int T, UT; if (speed != XFER_PIO_SLOW && speed != drive->current_speed) if (ide_config_drive_speed(drive, speed)) printk(KERN_WARNING "ide%d: Drive %d didn't accept speed setting. Oh, well.\n", drive->dn >> 1, drive->dn & 1); - T = 1000 / via_clock; + T = 1000000000 / via_clock; switch (via_config->flags & VIA_UDMA) { case VIA_UDMA_33: UT = T; break; case VIA_UDMA_66: UT = T/2; break; case VIA_UDMA_100: UT = T/3; break; - default: UT = T; break; + case VIA_UDMA_133: UT = T/4; break; + default: UT = T; } ide_timing_compute(drive, speed, &t, T, UT); @@ -365,7 +374,8 @@ XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0)); + (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | + (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); via_set_drive(drive, speed); @@ -395,14 +405,16 @@ */ for (via_config = via_isa_bridges; via_config->id; via_config++) - if ((isa = pci_find_device(PCI_VENDOR_ID_VIA, via_config->id, NULL))) { + if ((isa = pci_find_device(PCI_VENDOR_ID_VIA + + !!(via_config->flags & VIA_BAD_ID), via_config->id, NULL))) { + pci_read_config_byte(isa, PCI_REVISION_ID, &t); if (t >= via_config->rev_min && t <= via_config->rev_max) break; } if (!via_config->id) { - printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, contact Vojtech Pavlik <vojtech@suse.cz>\n"); + printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, contact Vojtech Pavlik <vojtech@ucw.cz>\n"); return -ENODEV; } @@ -412,22 +424,28 @@ switch (via_config->flags & VIA_UDMA) { - case VIA_UDMA_100: - - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - for (i = 24; i >= 0; i -= 8) - if (((u >> i) & 0x10) || (((u >> i) & 0x20) && (((u >> i) & 7) < 3))) - via_80w |= (1 << (1 - (i >> 4))); /* BIOS 80-wire bit or UDMA w/ < 50ns/cycle */ - break; - case VIA_UDMA_66: - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); /* Enable Clk66 */ pci_write_config_dword(dev, VIA_UDMA_TIMING, u | 0x80008); for (i = 24; i >= 0; i -= 8) if (((u >> (i & 16)) & 8) && ((u >> i) & 0x20) && (((u >> i) & 7) < 2)) via_80w |= (1 << (1 - (i >> 4))); /* 2x PCI clock and UDMA w/ < 3T/cycle */ break; + + case VIA_UDMA_100: + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || (((u >> i) & 0x20) && (((u >> i) & 7) < 4))) + via_80w |= (1 << (1 - (i >> 4))); /* BIOS 80-wire bit or UDMA w/ < 60ns/cycle */ + break; + + case VIA_UDMA_133: + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || (((u >> i) & 0x20) && (((u >> i) & 7) < 8))) + via_80w |= (1 << (1 - (i >> 4))); /* BIOS 80-wire bit or UDMA w/ < 60ns/cycle */ + break; + } if (via_config->flags & VIA_BAD_CLK66) { /* Disable Clk66 */ @@ -466,10 +484,17 @@ * Determine system bus clock. */ - via_clock = system_bus_clock(); - if (via_clock < 20 || via_clock > 50) { + via_clock = system_bus_clock() * 1000; + + switch (via_clock) { + case 33000: via_clock = 33333; break; + case 37000: via_clock = 37500; break; + case 41000: via_clock = 41666; break; + } + + if (via_clock < 20000 || via_clock > 50000) { printk(KERN_WARNING "VP_IDE: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", via_clock); - printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want to force UDMA66/UDMA100.\n"); + printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want to assume 80-wire cable.\n"); via_clock = 33; } diff -u --recursive --new-file v2.5.1/linux/drivers/ieee1394/ohci1394.c linux/drivers/ieee1394/ohci1394.c --- v2.5.1/linux/drivers/ieee1394/ohci1394.c Mon Oct 1 21:24:24 2001 +++ linux/drivers/ieee1394/ohci1394.c Sun Dec 30 10:31:51 2001 @@ -99,7 +99,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> #include <linux/vmalloc.h> diff -u --recursive --new-file v2.5.1/linux/drivers/ieee1394/video1394.c linux/drivers/ieee1394/video1394.c --- v2.5.1/linux/drivers/ieee1394/video1394.c Mon Oct 1 21:24:25 2001 +++ linux/drivers/ieee1394/video1394.c Sun Dec 30 10:31:51 2001 @@ -43,7 +43,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> #include <linux/vmalloc.h> diff -u --recursive --new-file v2.5.1/linux/drivers/input/joydev.c linux/drivers/input/joydev.c --- v2.5.1/linux/drivers/input/joydev.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/input/joydev.c Sun Dec 30 10:31:51 2001 @@ -31,7 +31,6 @@ #include <asm/io.h> #include <asm/system.h> -#include <asm/segment.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/joystick.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/act2000/act2000.h linux/drivers/isdn/act2000/act2000.h --- v2.5.1/linux/drivers/isdn/act2000/act2000.h Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/act2000/act2000.h Sun Dec 30 10:31:51 2001 @@ -68,7 +68,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/kernel.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/avmb1/capidrv.c linux/drivers/isdn/avmb1/capidrv.c --- v2.5.1/linux/drivers/isdn/avmb1/capidrv.c Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/avmb1/capidrv.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <linux/kernelcapi.h> #include <linux/ctype.h> #include <linux/init.h> -#include <asm/segment.h> #include "capiutil.h" #include "capicmd.h" diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/avmb1/capiutil.c linux/drivers/isdn/avmb1/capiutil.c --- v2.5.1/linux/drivers/isdn/avmb1/capiutil.c Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/avmb1/capiutil.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/init.h> -#include <asm/segment.h> #include <linux/config.h> #include "capiutil.h" diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/avmb1/kcapi.c linux/drivers/isdn/avmb1/kcapi.c --- v2.5.1/linux/drivers/isdn/avmb1/kcapi.c Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/avmb1/kcapi.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <asm/segment.h> #include <linux/proc_fs.h> #include <linux/skbuff.h> #include <linux/tqueue.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/eicon/eicon.h linux/drivers/isdn/eicon/eicon.h --- v2.5.1/linux/drivers/isdn/eicon/eicon.h Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/eicon/eicon.h Sun Dec 30 10:31:51 2001 @@ -123,7 +123,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/kernel.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/eicon/lincfg.c linux/drivers/isdn/eicon/lincfg.c --- v2.5.1/linux/drivers/isdn/eicon/lincfg.c Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/eicon/lincfg.c Sun Dec 30 10:31:51 2001 @@ -11,7 +11,6 @@ #include <linux/fs.h> #undef N_DATA /* Because we have our own definition */ -#include <asm/segment.h> #include <asm/io.h> #include "sys.h" diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/hisax/hisax.h linux/drivers/isdn/hisax/hisax.h --- v2.5.1/linux/drivers/isdn/hisax/hisax.h Sun Sep 30 12:26:05 2001 +++ linux/drivers/isdn/hisax/hisax.h Sun Dec 30 10:31:51 2001 @@ -10,7 +10,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/delay.h> #include <linux/kernel.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/icn/icn.h linux/drivers/isdn/icn/icn.h --- v2.5.1/linux/drivers/isdn/icn/icn.h Sun Sep 30 12:26:06 2001 +++ linux/drivers/isdn/icn/icn.h Sun Dec 30 10:31:51 2001 @@ -39,7 +39,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/kernel.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/isdn_bsdcomp.c linux/drivers/isdn/isdn_bsdcomp.c --- v2.5.1/linux/drivers/isdn/isdn_bsdcomp.c Sun Sep 30 12:26:06 2001 +++ linux/drivers/isdn/isdn_bsdcomp.c Sun Dec 30 10:31:51 2001 @@ -71,7 +71,6 @@ #include <asm/system.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/byteorder.h> #include <asm/types.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/isdnloop/isdnloop.h linux/drivers/isdn/isdnloop/isdnloop.h --- v2.5.1/linux/drivers/isdn/isdnloop/isdnloop.h Sun Sep 30 12:26:06 2001 +++ linux/drivers/isdn/isdnloop/isdnloop.h Sun Dec 30 10:31:51 2001 @@ -37,7 +37,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/kernel.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/drivers/isdn/sc/includes.h linux/drivers/isdn/sc/includes.h --- v2.5.1/linux/drivers/isdn/sc/includes.h Sun Sep 30 12:26:06 2001 +++ linux/drivers/isdn/sc/includes.h Sun Dec 30 10:31:51 2001 @@ -6,7 +6,6 @@ #include <linux/version.h> #include <linux/errno.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/delay.h> #include <linux/kernel.h> diff -u --recursive --new-file v2.5.1/linux/drivers/macintosh/mac_keyb.c linux/drivers/macintosh/mac_keyb.c --- v2.5.1/linux/drivers/macintosh/mac_keyb.c Tue Sep 18 14:23:14 2001 +++ linux/drivers/macintosh/mac_keyb.c Tue Dec 25 15:39:20 2001 @@ -256,7 +256,6 @@ #endif extern struct kbd_struct kbd_table[]; -extern wait_queue_head_t keypress_wait; extern void handle_scancode(unsigned char, int); @@ -423,7 +422,6 @@ struct tty_struct *tty; tty = console_driver.table? console_driver.table[fg_console]: NULL; - wake_up(&keypress_wait); if (tty) { tty_insert_flip_char(tty, ch, 0); con_schedule_flip(tty); diff -u --recursive --new-file v2.5.1/linux/drivers/macintosh/macserial.c linux/drivers/macintosh/macserial.c --- v2.5.1/linux/drivers/macintosh/macserial.c Mon Oct 15 13:43:24 2001 +++ linux/drivers/macintosh/macserial.c Sun Dec 30 10:31:51 2001 @@ -38,7 +38,6 @@ #include <asm/irq.h> #include <asm/prom.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/feature.h> #include <linux/adb.h> @@ -2792,30 +2791,6 @@ /* Don't disable the transmitter. */ } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - struct mac_serial *info = zs_soft + co->index; - int val; - - /* Turn of interrupts and enable the transmitter. */ - write_zsreg(info->zs_channel, R1, info->curregs[1] & ~INT_ALL_Rx); - write_zsreg(info->zs_channel, R3, info->curregs[3] | RxENABLE); - - /* Wait for something in the receive buffer. */ - while((read_zsreg(info->zs_channel, 0) & Rx_CH_AV) == 0) - eieio(); - val = read_zsdata(info->zs_channel); - - /* Restore the values in the registers. */ - write_zsreg(info->zs_channel, R1, info->curregs[1]); - write_zsreg(info->zs_channel, R3, info->curregs[3]); - - return val; -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -3006,7 +2981,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/md/lvm-fs.c linux/drivers/md/lvm-fs.c --- v2.5.1/linux/drivers/md/lvm-fs.c Sun Nov 11 10:09:32 2001 +++ linux/drivers/md/lvm-fs.c Thu Dec 27 08:29:15 2001 @@ -30,6 +30,7 @@ * 04/10/2001 - corrected devfs_register() call in lvm_init_fs() * 11/04/2001 - don't devfs_register("lvm") as user-space always does it * 10/05/2001 - show more of PV name in /proc/lvm/global + * 16/12/2001 - fix devfs unregister order and prevent duplicate unreg (REG) * */ @@ -64,9 +65,7 @@ static void _show_uuid(const char *src, char *b, char *e); -#if 0 static devfs_handle_t lvm_devfs_handle; -#endif static devfs_handle_t vg_devfs_handle[MAX_VG]; static devfs_handle_t ch_devfs_handle[MAX_VG]; static devfs_handle_t lv_devfs_handle[MAX_LV]; @@ -80,13 +79,11 @@ void __init lvm_init_fs() { struct proc_dir_entry *pde; -/* User-space has already registered this */ -#if 0 + /* Must create device node. Think about "devfs=only" situation */ lvm_devfs_handle = devfs_register( 0 , "lvm", 0, LVM_CHAR_MAJOR, 0, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP, &lvm_chr_fops, NULL); -#endif lvm_proc_dir = create_proc_entry(LVM_DIR, S_IFDIR, &proc_root); if (lvm_proc_dir) { @@ -98,9 +95,7 @@ } void lvm_fin_fs() { -#if 0 devfs_unregister (lvm_devfs_handle); -#endif remove_proc_entry(LVM_GLOBAL, lvm_proc_dir); remove_proc_entry(LVM_VG_SUBDIR, lvm_proc_dir); @@ -138,7 +133,7 @@ int i; devfs_unregister(ch_devfs_handle[vg_ptr->vg_number]); - devfs_unregister(vg_devfs_handle[vg_ptr->vg_number]); + ch_devfs_handle[vg_ptr->vg_number] = NULL; /* remove lv's */ for(i = 0; i < vg_ptr->lv_max; i++) @@ -148,6 +143,10 @@ for(i = 0; i < vg_ptr->pv_max; i++) if(vg_ptr->pv[i]) lvm_fs_remove_pv(vg_ptr, vg_ptr->pv[i]); + /* must not remove directory before leaf nodes */ + devfs_unregister(vg_devfs_handle[vg_ptr->vg_number]); + vg_devfs_handle[vg_ptr->vg_number] = NULL; + if(vg_ptr->vg_dir_pde) { remove_proc_entry(LVM_LV_SUBDIR, vg_ptr->vg_dir_pde); vg_ptr->lv_subdir_pde = NULL; @@ -189,6 +188,7 @@ void lvm_fs_remove_lv(vg_t *vg_ptr, lv_t *lv) { devfs_unregister(lv_devfs_handle[MINOR(lv->lv_dev)]); + lv_devfs_handle[MINOR(lv->lv_dev)] = NULL; if(vg_ptr->lv_subdir_pde) { const char *name = _basename(lv->lv_name); diff -u --recursive --new-file v2.5.1/linux/drivers/md/lvm-snap.c linux/drivers/md/lvm-snap.c --- v2.5.1/linux/drivers/md/lvm-snap.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/md/lvm-snap.c Thu Dec 27 08:17:43 2001 @@ -206,20 +206,6 @@ return 1; } -inline int lvm_get_blksize(kdev_t dev) -{ - int correct_size = BLOCK_SIZE, i, major; - - major = MAJOR(dev); - if (blksize_size[major]) - { - i = blksize_size[major][MINOR(dev)]; - if (i) - correct_size = i; - } - return correct_size; -} - #ifdef DEBUG_SNAPSHOT static inline void invalidate_snap_cache(unsigned long start, unsigned long nr, kdev_t dev) @@ -256,7 +242,7 @@ is--; blksize_snap = - lvm_get_blksize(lv_snap->lv_block_exception[is].rdev_new); + block_size(lv_snap->lv_block_exception[is].rdev_new); is -= is % (blksize_snap / sizeof(lv_COW_table_disk_t)); memset(lv_COW_table, 0, blksize_snap); @@ -347,8 +333,8 @@ iobuf = lv_snap->lv_iobuf; - blksize_org = lvm_get_blksize(org_phys_dev); - blksize_snap = lvm_get_blksize(snap_phys_dev); + blksize_org = block_size(org_phys_dev); + blksize_snap = block_size(snap_phys_dev); max_blksize = max(blksize_org, blksize_snap); min_blksize = min(blksize_org, blksize_snap); max_sectors = LVM_MAX_SECTORS * (min_blksize>>9); @@ -592,7 +578,7 @@ snap_phys_dev = lv_snap->lv_block_exception[idx].rdev_new; snap_pe_start = lv_snap->lv_block_exception[idx - (idx % COW_entries_per_pe)].rsector_new - lv_snap->lv_chunk_size; - blksize_snap = lvm_get_blksize(snap_phys_dev); + blksize_snap = block_size(snap_phys_dev); COW_entries_per_block = blksize_snap / sizeof(lv_COW_table_disk_t); idx_COW_table = idx % COW_entries_per_pe % COW_entries_per_block; @@ -640,7 +626,7 @@ idx++; snap_phys_dev = lv_snap->lv_block_exception[idx].rdev_new; snap_pe_start = lv_snap->lv_block_exception[idx - (idx % COW_entries_per_pe)].rsector_new - lv_snap->lv_chunk_size; - blksize_snap = lvm_get_blksize(snap_phys_dev); + blksize_snap = block_size(snap_phys_dev); blocks[0] = snap_pe_start >> (blksize_snap >> 10); } else blocks[0]++; diff -u --recursive --new-file v2.5.1/linux/drivers/md/lvm.c linux/drivers/md/lvm.c --- v2.5.1/linux/drivers/md/lvm.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/md/lvm.c Sun Dec 30 10:31:51 2001 @@ -179,6 +179,9 @@ * (Jens Axboe) * - Defer writes to an extent that is being moved [JT + AD] * 28/05/2001 - implemented missing BLKSSZGET ioctl [AD] + * 28/12/2001 - buffer_head -> bio + * removed huge allocation of a lv_t on stack + * (Anders Gustafsson) * */ @@ -209,7 +212,6 @@ #include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #include <asm/ioctl.h> -#include <asm/segment.h> #include <asm/uaccess.h> #ifdef CONFIG_KERNELD @@ -1043,7 +1045,7 @@ memset(&bio,0,sizeof(bio)); bio.bi_dev = inode->i_rdev; - bio.bi_io_vec.bv_len = lvm_get_blksize(bio.bi_dev); + bio.bi_size = lvm_get_blksize(bio.bi_dev); /* NEEDED by bio_sectors */ bio.bi_sector = block * bio_sectors(&bio); bio.bi_rw = READ; if ((err=lvm_map(&bio)) < 0) { @@ -1119,19 +1121,18 @@ return 0; } -static int lvm_map(struct bio *bh) +static int lvm_map(struct bio *bi) { - int minor = MINOR(bh->bi_dev); + int minor = MINOR(bi->bi_dev); ulong index; ulong pe_start; - ulong size = bio_sectors(bh); - ulong rsector_org = bh->bi_sector; + ulong size = bio_sectors(bi); + ulong rsector_org = bi->bi_sector; ulong rsector_map; kdev_t rdev_map; vg_t *vg_this = vg[VG_BLK(minor)]; lv_t *lv = vg_this->lv[LV_BLK(minor)]; - int rw = bio_data_dir(bh); - + int rw = bio_rw(bi); down_read(&lv->lv_lock); if (!(lv->lv_status & LV_ACTIVE)) { @@ -1151,7 +1152,7 @@ P_MAP("%s - lvm_map minor: %d *rdev: %s *rsector: %lu size:%lu\n", lvm_name, minor, - kdevname(bh->bi_dev), + kdevname(bi->bi_dev), rsector_org, size); if (rsector_org + size > lv->lv_size) { @@ -1205,7 +1206,7 @@ * we need to queue this request, because this is in the fast path. */ if (rw == WRITE || rw == WRITEA) { - if(_defer_extent(bh, rw, rdev_map, + if(_defer_extent(bi, rw, rdev_map, rsector_map, vg_this->pe_size)) { up_read(&lv->lv_lock); @@ -1246,13 +1247,13 @@ } out: - bh->bi_dev = rdev_map; - bh->bi_sector = rsector_map; + bi->bi_dev = rdev_map; + bi->bi_sector = rsector_map; up_read(&lv->lv_lock); return 1; bad: - bio_io_error(bh); + bio_io_error(bi); up_read(&lv->lv_lock); return -1; } /* lvm_map() */ @@ -1436,9 +1437,9 @@ { int ret = 0; ulong l, ls = 0, p, size; - lv_t lv; vg_t *vg_ptr; lv_t **snap_lv_ptr; + lv_t *tmplv; if ((vg_ptr = kmalloc(sizeof(vg_t),GFP_KERNEL)) == NULL) { printk(KERN_CRIT @@ -1446,6 +1447,7 @@ lvm_name, __LINE__); return -ENOMEM; } + /* get the volume group structure */ if (copy_from_user(vg_ptr, arg, sizeof(vg_t)) != 0) { P_IOCTL("lvm_do_vg_create ERROR: copy VG ptr %p (%d bytes)\n", @@ -1454,6 +1456,8 @@ return -EFAULT; } + + /* VG_CREATE now uses minor number in VG structure */ if (minor == -1) minor = vg_ptr->vg_number; @@ -1513,19 +1517,30 @@ } memset(snap_lv_ptr, 0, size); + if ((tmplv = kmalloc(sizeof(lv_t),GFP_KERNEL)) == NULL) { + printk(KERN_CRIT + "%s -- VG_CREATE: kmalloc error LV at line %d\n", + lvm_name, __LINE__); + vfree(snap_lv_ptr); + return -ENOMEM; + } + /* get the logical volume structures */ vg_ptr->lv_cur = 0; for (l = 0; l < vg_ptr->lv_max; l++) { lv_t *lvp; + /* user space address */ if ((lvp = vg_ptr->lv[l]) != NULL) { - if (copy_from_user(&lv, lvp, sizeof(lv_t)) != 0) { + if (copy_from_user(tmplv, lvp, sizeof(lv_t)) != 0) { P_IOCTL("ERROR: copying LV ptr %p (%d bytes)\n", lvp, sizeof(lv_t)); lvm_do_vg_remove(minor); + vfree(snap_lv_ptr); + kfree(tmplv); return -EFAULT; } - if ( lv.lv_access & LV_SNAPSHOT) { + if ( tmplv->lv_access & LV_SNAPSHOT) { snap_lv_ptr[ls] = lvp; vg_ptr->lv[l] = NULL; ls++; @@ -1533,8 +1548,10 @@ } vg_ptr->lv[l] = NULL; /* only create original logical volumes for now */ - if (lvm_do_lv_create(minor, lv.lv_name, &lv) != 0) { + if (lvm_do_lv_create(minor, tmplv->lv_name, tmplv) != 0) { lvm_do_vg_remove(minor); + vfree(snap_lv_ptr); + kfree(tmplv); return -EFAULT; } } @@ -1544,18 +1561,22 @@ in place during first path above */ for (l = 0; l < ls; l++) { lv_t *lvp = snap_lv_ptr[l]; - if (copy_from_user(&lv, lvp, sizeof(lv_t)) != 0) { + if (copy_from_user(tmplv, lvp, sizeof(lv_t)) != 0) { lvm_do_vg_remove(minor); + vfree(snap_lv_ptr); + kfree(tmplv); return -EFAULT; } - if (lvm_do_lv_create(minor, lv.lv_name, &lv) != 0) { + if (lvm_do_lv_create(minor, tmplv->lv_name, tmplv) != 0) { lvm_do_vg_remove(minor); + vfree(snap_lv_ptr); + kfree(tmplv); return -EFAULT; } } vfree(snap_lv_ptr); - + kfree(tmplv); vg_count++; diff -u --recursive --new-file v2.5.1/linux/drivers/md/md.c linux/drivers/md/md.c --- v2.5.1/linux/drivers/md/md.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/md/md.c Sun Dec 30 09:40:59 2001 @@ -66,7 +66,7 @@ /* * Current RAID-1,4,5 parallel reconstruction 'guaranteed speed limit' - * is 100 KB/sec, so the extra system load does not show up that much. + * is 1000 KB/sec, so the extra system load does not show up that much. * Increase it if you want to have more _guaranteed_ speed. Note that * the RAID driver will use the maximum available bandwith if the IO * subsystem is idle. There is also an 'absolute maximum' reconstruction @@ -76,8 +76,8 @@ * you can change it via /proc/sys/dev/raid/speed_limit_min and _max. */ -static int sysctl_speed_limit_min = 100; -static int sysctl_speed_limit_max = 100000; +static int sysctl_speed_limit_min = 1000; +static int sysctl_speed_limit_max = 200000; static struct ctl_table_header *raid_table_header; @@ -469,40 +469,45 @@ static int read_disk_sb(mdk_rdev_t * rdev) { - int ret = -EINVAL; - struct buffer_head *bh = NULL; - kdev_t dev = rdev->dev; - mdp_super_t *sb; + struct address_space *mapping = rdev->bdev->bd_inode->i_mapping; + struct page *page; + char *p; unsigned long sb_offset; + int n = PAGE_CACHE_SIZE / BLOCK_SIZE; if (!rdev->sb) { MD_BUG(); - goto abort; + return -EINVAL; } /* * Calculate the position of the superblock, - * it's at the end of the disk + * it's at the end of the disk. + * + * It also happens to be a multiple of 4Kb. */ sb_offset = calc_dev_sboffset(rdev->dev, rdev->mddev, 1); rdev->sb_offset = sb_offset; - fsync_dev(dev); - set_blocksize (dev, MD_SB_BYTES); - bh = bread (dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES); - - if (bh) { - sb = (mdp_super_t *) bh->b_data; - memcpy (rdev->sb, sb, MD_SB_BYTES); - } else { - printk(NO_SB,partition_name(rdev->dev)); - goto abort; - } + page = read_cache_page(mapping, sb_offset/n, + (filler_t *)mapping->a_ops->readpage, NULL); + if (IS_ERR(page)) + goto out; + wait_on_page(page); + if (!Page_Uptodate(page)) + goto fail; + if (PageError(page)) + goto fail; + p = (char *)page_address(page) + BLOCK_SIZE * (sb_offset % n); + memcpy((char*)rdev->sb, p, MD_SB_BYTES); + page_cache_release(page); printk(KERN_INFO " [events: %08lx]\n", (unsigned long)rdev->sb->events_lo); - ret = 0; -abort: - if (bh) - brelse (bh); - return ret; + return 0; + +fail: + page_cache_release(page); +out: + printk(NO_SB,partition_name(rdev->dev)); + return -EINVAL; } static unsigned int calc_sb_csum(mdp_super_t * sb) @@ -884,15 +889,14 @@ return NULL; } -#define GETBLK_FAILED KERN_ERR \ -"md: getblk failed for device %s\n" - static int write_disk_sb(mdk_rdev_t * rdev) { - struct buffer_head *bh; - kdev_t dev; + struct address_space *mapping = rdev->bdev->bd_inode->i_mapping; + struct page *page; + unsigned offs; + int error; + kdev_t dev = rdev->dev; unsigned long sb_offset, size; - mdp_super_t *sb; if (!rdev->sb) { MD_BUG(); @@ -907,7 +911,6 @@ return 1; } - dev = rdev->dev; sb_offset = calc_dev_sboffset(dev, rdev->mddev, 1); if (rdev->sb_offset != sb_offset) { printk(KERN_INFO "%s's sb offset has changed from %ld to %ld, skipping\n", @@ -928,26 +931,32 @@ printk(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset); fsync_dev(dev); - set_blocksize(dev, MD_SB_BYTES); - bh = getblk(dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES); - if (!bh) { - printk(GETBLK_FAILED, partition_name(dev)); - return 1; - } - memset(bh->b_data,0,bh->b_size); - sb = (mdp_super_t *) bh->b_data; - memcpy(sb, rdev->sb, MD_SB_BYTES); - - mark_buffer_uptodate(bh, 1); - mark_buffer_dirty(bh); - ll_rw_block(WRITE, 1, &bh); - wait_on_buffer(bh); - brelse(bh); + page = grab_cache_page(mapping, sb_offset/(PAGE_CACHE_SIZE/BLOCK_SIZE)); + offs = sb_offset % (PAGE_CACHE_SIZE/BLOCK_SIZE); + if (!page) + goto fail; + error = mapping->a_ops->prepare_write(NULL, page, offs, + offs + MD_SB_BYTES); + if (error) + goto unlock; + memcpy((char *)page_address(page) + offs, rdev->sb, MD_SB_BYTES); + error = mapping->a_ops->commit_write(NULL, page, offs, + offs + MD_SB_BYTES); + if (error) + goto unlock; + UnlockPage(page); + wait_on_page(page); + page_cache_release(page); fsync_dev(dev); skip: return 0; +unlock: + UnlockPage(page); + page_cache_release(page); +fail: + printk("md: write_disk_sb failed for device %s\n", partition_name(dev)); + return 1; } -#undef GETBLK_FAILED static void set_this_disk(mddev_t *mddev, mdk_rdev_t *rdev) { @@ -3336,7 +3345,7 @@ int md_do_sync(mddev_t *mddev, mdp_disk_t *spare) { mddev_t *mddev2; - unsigned int max_sectors, currspeed, + unsigned int max_sectors, currspeed = 0, j, window, err, serialize; unsigned long mark[SYNC_MARKS]; unsigned long mark_cnt[SYNC_MARKS]; @@ -3376,8 +3385,7 @@ max_sectors = mddev->sb->size << 1; printk(KERN_INFO "md: syncing RAID array md%d\n", mdidx(mddev)); - printk(KERN_INFO "md: minimum _guaranteed_ reconstruction speed: %d KB/sec/disc.\n", - sysctl_speed_limit_min); + printk(KERN_INFO "md: minimum _guaranteed_ reconstruction speed: %d KB/sec/disc.\n", sysctl_speed_limit_min); printk(KERN_INFO "md: using maximum available idle IO bandwith " "(but not more than %d KB/sec) for reconstruction.\n", sysctl_speed_limit_max); @@ -3409,7 +3417,7 @@ for (j = 0; j < max_sectors;) { int sectors; - sectors = mddev->pers->sync_request(mddev, j); + sectors = mddev->pers->sync_request(mddev, j, currspeed < sysctl_speed_limit_min); if (sectors < 0) { err = sectors; goto out; @@ -4034,4 +4042,4 @@ EXPORT_SYMBOL(mddev_map); EXPORT_SYMBOL(md_check_ordering); EXPORT_SYMBOL(get_spare); - +MODULE_LICENSE("GPL"); diff -u --recursive --new-file v2.5.1/linux/drivers/md/raid1.c linux/drivers/md/raid1.c --- v2.5.1/linux/drivers/md/raid1.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/md/raid1.c Wed Dec 19 15:18:11 2001 @@ -28,7 +28,6 @@ #define MD_DRIVER #define MD_PERSONALITY -#define MAX_WORK_PER_DISK 128 /* * Number of guaranteed r1bios in case of extreme VM load: */ @@ -38,24 +37,6 @@ static spinlock_t retry_list_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(retry_list_head); -static inline void check_all_w_bios_empty(r1bio_t *r1_bio) -{ - int i; - - return; - for (i = 0; i < MD_SB_DISKS; i++) - if (r1_bio->write_bios[i]) - BUG(); -} - -static inline void check_all_bios_empty(r1bio_t *r1_bio) -{ - return; - if (r1_bio->read_bio) - BUG(); - check_all_w_bios_empty(r1_bio); -} - static void * r1bio_pool_alloc(int gfp_flags, void *data) { r1bio_t *r1_bio; @@ -69,11 +50,11 @@ static void r1bio_pool_free(void *r1_bio, void *data) { - check_all_bios_empty(r1_bio); kfree(r1_bio); } #define RESYNC_BLOCK_SIZE (64*1024) +#define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9) #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) #define RESYNC_WINDOW (2048*1024) @@ -86,7 +67,6 @@ int i, j; r1_bio = mempool_alloc(conf->r1bio_pool, gfp_flags); - check_all_bios_empty(r1_bio); bio = bio_alloc(gfp_flags, RESYNC_PAGES); if (!bio) @@ -131,7 +111,6 @@ r1bio_t *r1bio = __r1_bio; struct bio *bio = r1bio->master_bio; - check_all_bios_empty(r1bio); if (atomic_read(&bio->bi_cnt) != 1) BUG(); for (i = 0; i < RESYNC_PAGES; i++) { @@ -163,13 +142,25 @@ } *bio = NULL; } - check_all_bios_empty(r1_bio); } static inline void free_r1bio(r1bio_t *r1_bio) { + unsigned long flags; + conf_t *conf = mddev_to_conf(r1_bio->mddev); + /* + * Wake up any possible resync thread that waits for the device + * to go idle. + */ + spin_lock_irqsave(&conf->resync_lock, flags); + if (!--conf->nr_pending) { + wake_up(&conf->wait_idle); + wake_up(&conf->wait_resume); + } + spin_unlock_irqrestore(&conf->resync_lock, flags); + put_all_bios(conf, r1_bio); mempool_free(r1_bio, conf->r1bio_pool); } @@ -178,7 +169,14 @@ { conf_t *conf = mddev_to_conf(r1_bio->mddev); struct bio *bio = r1_bio->master_bio; + unsigned long flags; + spin_lock_irqsave(&conf->resync_lock, flags); + if (!--conf->nr_pending) { + wake_up(&conf->wait_idle); + wake_up(&conf->wait_resume); + } + spin_unlock_irqrestore(&conf->resync_lock, flags); /* * undo any possible partial request fixup magic: */ @@ -222,37 +220,6 @@ md_wakeup_thread(conf->thread); } - -static void inline raid_request_done(unsigned long sector, conf_t *conf, int phase) -{ - unsigned long flags; - spin_lock_irqsave(&conf->segment_lock, flags); - if (sector < conf->start_active) - conf->cnt_done--; - else if (sector >= conf->start_future && conf->phase == phase) - conf->cnt_future--; - else if (!--conf->cnt_pending) - wake_up(&conf->wait_ready); - - spin_unlock_irqrestore(&conf->segment_lock, flags); -} - -static void inline sync_request_done(sector_t sector, conf_t *conf) -{ - unsigned long flags; - - spin_lock_irqsave(&conf->segment_lock, flags); - if (sector >= conf->start_ready) - --conf->cnt_ready; - else if (sector >= conf->start_active) { - if (!--conf->cnt_active) { - conf->start_active = conf->start_ready; - wake_up(&conf->wait_done); - } - } - spin_unlock_irqrestore(&conf->segment_lock, flags); -} - /* * raid_end_bio_io() is called when we have finished servicing a mirrored * operation and are ready to return a success/failure code to the buffer @@ -262,19 +229,29 @@ { struct bio *bio = r1_bio->master_bio; - raid_request_done(bio->bi_sector, mddev_to_conf(r1_bio->mddev), - test_bit(R1BIO_SyncPhase, &r1_bio->state)); - bio_endio(bio, uptodate, nr_sectors); free_r1bio(r1_bio); return 0; } +/* + * Update disk head position estimator based on IRQ completion info. + */ +static void inline update_head_pos(int disk, r1bio_t *r1_bio) +{ + conf_t *conf = mddev_to_conf(r1_bio->mddev); + + conf->mirrors[disk].head_position = + r1_bio->sector + (r1_bio->master_bio->bi_size >> 9); + atomic_dec(&conf->mirrors[disk].nr_pending); +} + static int end_request(struct bio *bio, int nr_sectors) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); + int i; /* * this branch is our 'one mirror IO has finished' event handler: @@ -287,20 +264,16 @@ * we will return a good error code for to the higher * levels even if IO on some other mirrored buffer fails. * - * The 'master' represents the complex operation to + * The 'master' represents the composite IO operation to * user-side. So if something waits for IO, then it will * wait for the 'master' bio. */ set_bit(R1BIO_Uptodate, &r1_bio->state); - /* - * We split up the read and write side, imho they are - * conceptually different. - */ - if ((r1_bio->cmd == READ) || (r1_bio->cmd == READA)) { if (!r1_bio->read_bio) BUG(); + update_head_pos(r1_bio->read_disk, r1_bio); /* * we have only one bio on the read side */ @@ -322,6 +295,14 @@ /* * WRITE: * + * First, find the disk this bio belongs to. + */ + for (i = 0; i < MD_SB_DISKS; i++) + if (r1_bio->write_bios[i] == bio) { + update_head_pos(i, r1_bio); + break; + } + /* * Let's see if all mirrored write operations have finished * already. */ @@ -332,44 +313,49 @@ /* * This routine returns the disk from which the requested read should - * be done. It bookkeeps the last read position for every disk - * in array and when new read requests come, the disk which last - * position is nearest to the request, is chosen. + * be done. There is a per-array 'next expected sequential IO' sector + * number - if this matches on the next IO then we use the last disk. + * There is also a per-disk 'last know head position' sector that is + * maintained from IRQ contexts, both the normal and the resync IO + * completion handlers update this position correctly. If there is no + * perfect sequential match then we pick the disk whose head is closest. * - * TODO: now if there are 2 mirrors in the same 2 devices, performance - * degrades dramatically because position is mirror, not device based. - * This should be changed to be device based. Also atomic sequential - * reads should be somehow balanced. + * If there are 2 mirrors in the same 2 devices, performance degrades + * because position is mirror, not device based. */ - static int read_balance(conf_t *conf, struct bio *bio, r1bio_t *r1_bio) { - const int sectors = bio->bi_size >> 9; const unsigned long this_sector = r1_bio->sector; - unsigned long new_distance, current_distance; int new_disk = conf->last_used, disk = new_disk; + const int sectors = bio->bi_size >> 9; + sector_t new_distance, current_distance; /* - * Check if it is sane at all to balance - */ - - if (conf->resync_mirrors) + * Check if it if we can balance. We can balance on the whole + * device if no resync is going on, or below the resync window. + * We take the first readable disk when above the resync window. + */ + if (conf->resync_mirrors && (this_sector + sectors >= conf->next_resync)) { + /* make sure that disk is operational */ + new_disk = 0; + while (!conf->mirrors[new_disk].operational || conf->mirrors[new_disk].write_only) { + new_disk++; + if (new_disk == conf->raid_disks) { + new_disk = 0; + break; + } + } goto rb_out; + } - /* make sure that disk is operational */ - while( !conf->mirrors[new_disk].operational) { - if (new_disk <= 0) new_disk = conf->raid_disks; + /* make sure the disk is operational */ + while (!conf->mirrors[new_disk].operational) { + if (new_disk <= 0) + new_disk = conf->raid_disks; new_disk--; if (new_disk == disk) { - /* - * This means no working disk was found - * Nothing much to do, lets not change anything - * and hope for the best... - */ - new_disk = conf->last_used; - goto rb_out; } } @@ -377,36 +363,16 @@ /* now disk == new_disk == starting point for search */ /* - * Don't touch anything for sequential reads. + * Don't change to another disk for sequential reads: */ - if (this_sector == conf->mirrors[new_disk].head_position) + if (conf->next_seq_sect == this_sector) goto rb_out; - - /* - * If reads have been done only on a single disk - * for a time, lets give another disk a change. - * This is for kicking those idling disks so that - * they would find work near some hotspot. - */ - if (conf->sect_count >= conf->mirrors[new_disk].sect_limit) { - conf->sect_count = 0; - - do { - if (new_disk <= 0) - new_disk = conf->raid_disks; - new_disk--; - if (new_disk == disk) - break; - } while ((conf->mirrors[new_disk].write_only) || - (!conf->mirrors[new_disk].operational)); - + if (this_sector == conf->mirrors[new_disk].head_position) goto rb_out; - } - current_distance = abs(this_sector - - conf->mirrors[disk].head_position); + current_distance = abs(this_sector - conf->mirrors[disk].head_position); - /* Find the disk which is closest */ + /* Find the disk whose head is closest */ do { if (disk <= 0) @@ -417,44 +383,56 @@ (!conf->mirrors[disk].operational)) continue; - new_distance = abs(this_sector - - conf->mirrors[disk].head_position); - + if (!atomic_read(&conf->mirrors[disk].nr_pending)) { + new_disk = disk; + break; + } + new_distance = abs(this_sector - conf->mirrors[disk].head_position); if (new_distance < current_distance) { - conf->sect_count = 0; current_distance = new_distance; new_disk = disk; } } while (disk != conf->last_used); rb_out: - conf->mirrors[new_disk].head_position = this_sector + sectors; + r1_bio->read_disk = new_disk; + conf->next_seq_sect = this_sector + sectors; conf->last_used = new_disk; - conf->sect_count += sectors; return new_disk; } /* - * Wait if the reconstruction state machine puts up a bar for - * new requests in this sector range: + * Throttle resync depth, so that we can both get proper overlapping of + * requests, but are still able to handle normal requests quickly. */ -static inline void new_request(conf_t *conf, r1bio_t *r1_bio) +#define RESYNC_DEPTH 32 + +static void device_barrier(conf_t *conf, sector_t sect) { - spin_lock_irq(&conf->segment_lock); - wait_event_lock_irq(conf->wait_done, - r1_bio->sector < conf->start_active || - r1_bio->sector >= conf->start_future, - conf->segment_lock); - if (r1_bio->sector < conf->start_active) - conf->cnt_done++; - else { - conf->cnt_future++; - if (conf->phase) - set_bit(R1BIO_SyncPhase, &r1_bio->state); + spin_lock_irq(&conf->resync_lock); + wait_event_lock_irq(conf->wait_idle, !waitqueue_active(&conf->wait_resume), conf->resync_lock); + + if (!conf->barrier++) { + wait_event_lock_irq(conf->wait_idle, !conf->nr_pending, conf->resync_lock); + if (conf->nr_pending) + BUG(); } - spin_unlock_irq(&conf->segment_lock); + wait_event_lock_irq(conf->wait_resume, conf->barrier < RESYNC_DEPTH, conf->resync_lock); + conf->next_resync = sect; + spin_unlock_irq(&conf->resync_lock); +} + +static void resume_device(conf_t *conf) +{ + spin_lock_irq(&conf->resync_lock); + if (!conf->barrier) + BUG(); + --conf->barrier; + wake_up(&conf->wait_resume); + wake_up(&conf->wait_idle); + spin_unlock_irq(&conf->resync_lock); } static int make_request(mddev_t *mddev, int rw, struct bio * bio) @@ -466,6 +444,16 @@ int i, sum_bios = 0, disks = MD_SB_DISKS; /* + * Register the new request and wait if the reconstruction + * thread has put up a bar for new requests. + * Continue immediately if no resync is active currently. + */ + spin_lock_irq(&conf->resync_lock); + wait_event_lock_irq(conf->wait_resume, !conf->barrier, conf->resync_lock); + conf->nr_pending++; + spin_unlock_irq(&conf->resync_lock); + + /* * make_request() can abort the operation when READA is being * used and no empty request is available. * @@ -475,7 +463,6 @@ rw = READ; r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); - check_all_bios_empty(r1_bio); r1_bio->master_bio = bio; @@ -483,8 +470,6 @@ r1_bio->sector = bio->bi_sector; r1_bio->cmd = rw; - new_request(conf, r1_bio); - if (rw == READ) { /* * read balancing logic: @@ -503,15 +488,13 @@ read_bio->bi_private = r1_bio; generic_make_request(read_bio); + atomic_inc(&conf->mirrors[r1_bio->read_disk].nr_pending); return 0; } /* * WRITE: */ - - check_all_w_bios_empty(r1_bio); - for (i = 0; i < disks; i++) { struct bio *mbio; if (!conf->mirrors[i].operational) @@ -542,14 +525,13 @@ /* * We have to be a bit careful about the semaphore above, thats - * why we start the requests separately. Since kmalloc() could - * fail, sleep and make_request() can sleep too, this is the - * safer solution. Imagine, end_request decreasing the semaphore - * before we could have set it up ... We could play tricks with - * the semaphore (presetting it and correcting at the end if - * sum_bios is not 'n' but we have to do end_request by hand if - * all requests finish until we had a chance to set up the - * semaphore correctly ... lots of races). + * why we start the requests separately. Since generic_make_request() + * can sleep, this is the safer solution. Imagine, end_request + * decreasing the semaphore before we could have set it up ... + * We could play tricks with the semaphore (presetting it and + * correcting at the end if sum_bios is not 'n' but we have to + * do end_request by hand if all requests finish until we had a + * chance to set up the semaphore correctly ... lots of races). */ for (i = 0; i < disks; i++) { struct bio *mbio; @@ -558,6 +540,7 @@ continue; generic_make_request(mbio); + atomic_inc(&conf->mirrors[i].nr_pending); } return 0; } @@ -610,8 +593,7 @@ md_wakeup_thread(conf->thread); if (!mirror->write_only) conf->working_disks--; - printk(DISK_FAILED, partition_name(mirror->dev), - conf->working_disks); + printk(DISK_FAILED, partition_name(mirror->dev), conf->working_disks); } static int error(mddev_t *mddev, kdev_t dev) @@ -644,12 +626,6 @@ return 0; } -#undef LAST_DISK -#undef NO_SPARE_DISK -#undef DISK_FAILED -#undef START_SYNCING - - static void print_conf(conf_t *conf) { int i; @@ -674,29 +650,13 @@ static void close_sync(conf_t *conf) { - mddev_t *mddev = conf->mddev; - /* - * If reconstruction was interrupted, we need to close the "active" - * and "pending" holes. - * we know that there are no active rebuild requests, - * os cnt_active == cnt_ready == 0 - */ - spin_lock_irq(&conf->segment_lock); - conf->start_active = conf->start_pending; - conf->start_ready = conf->start_pending; - wait_event_lock_irq(conf->wait_ready, !conf->cnt_pending, conf->segment_lock); - conf->start_active = conf->start_ready = conf->start_pending = conf->start_future; - conf->start_future = mddev->sb->size+1; - conf->cnt_pending = conf->cnt_future; - conf->cnt_future = 0; - conf->phase = conf->phase ^1; - wait_event_lock_irq(conf->wait_ready, !conf->cnt_pending, conf->segment_lock); - conf->start_active = conf->start_ready = conf->start_pending = conf->start_future = 0; - conf->phase = 0; - conf->cnt_future = conf->cnt_done;; - conf->cnt_done = 0; - spin_unlock_irq(&conf->segment_lock); - wake_up(&conf->wait_done); + spin_lock_irq(&conf->resync_lock); + wait_event_lock_irq(conf->wait_resume, !conf->barrier, conf->resync_lock); + spin_unlock_irq(&conf->resync_lock); + + if (conf->barrier) BUG(); + if (waitqueue_active(&conf->wait_idle)) BUG(); + if (waitqueue_active(&conf->wait_resume)) BUG(); } static int diskop(mddev_t *mddev, mdp_disk_t **d, int state) @@ -975,9 +935,9 @@ int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); - check_all_w_bios_empty(r1_bio); if (r1_bio->read_bio != bio) BUG(); + update_head_pos(r1_bio->read_disk, r1_bio); /* * we have read a block, now it needs to be re-written, * or re-read if the read failed. @@ -997,13 +957,21 @@ int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); mddev_t *mddev = r1_bio->mddev; + int i; if (!uptodate) md_error(mddev, bio->bi_dev); + for (i = 0; i < MD_SB_DISKS; i++) + if (r1_bio->write_bios[i] == bio) { + update_head_pos(i, r1_bio); + break; + } + if (atomic_dec_and_test(&r1_bio->remaining)) { - sync_request_done(r1_bio->sector, mddev_to_conf(mddev)); + conf_t *conf = mddev_to_conf(mddev); md_done_sync(mddev, r1_bio->master_bio->bi_size >> 9, uptodate); + resume_device(conf); put_buf(r1_bio); } return 0; @@ -1029,11 +997,11 @@ */ printk(IO_ERROR, partition_name(bio->bi_dev), r1_bio->sector); md_done_sync(mddev, r1_bio->master_bio->bi_size >> 9, 0); + resume_device(conf); + put_buf(r1_bio); return; } - check_all_w_bios_empty(r1_bio); - for (i = 0; i < disks ; i++) { if (!conf->mirrors[i].operational) continue; @@ -1071,8 +1039,8 @@ * must be done */ printk(IO_ERROR, partition_name(bio->bi_dev), r1_bio->sector); - sync_request_done(r1_bio->sector, conf); md_done_sync(mddev, r1_bio->master_bio->bi_size >> 9, 0); + resume_device(conf); put_buf(r1_bio); return; } @@ -1083,6 +1051,7 @@ md_sync_acct(mbio->bi_dev, mbio->bi_size >> 9); generic_make_request(mbio); + atomic_inc(&conf->mirrors[i].nr_pending); } } @@ -1101,6 +1070,7 @@ struct bio *bio; unsigned long flags; mddev_t *mddev; + conf_t *conf; kdev_t dev; @@ -1111,9 +1081,9 @@ r1_bio = list_entry(head->prev, r1bio_t, retry_list); list_del(head->prev); spin_unlock_irqrestore(&retry_list_lock, flags); - check_all_w_bios_empty(r1_bio); mddev = r1_bio->mddev; + conf = mddev_to_conf(mddev); if (mddev->sb_dirty) { printk(KERN_INFO "raid1: dirty sb detected, updating.\n"); mddev->sb_dirty = 0; @@ -1139,13 +1109,12 @@ bio->bi_rw = r1_bio->cmd; generic_make_request(bio); + atomic_inc(&conf->mirrors[r1_bio->read_disk].nr_pending); break; } } spin_unlock_irqrestore(&retry_list_lock, flags); } -#undef IO_ERROR -#undef REDIRECT_SECTOR /* * Private kernel thread to reconstruct mirrors after an unclean @@ -1177,101 +1146,27 @@ { int buffs; - conf->start_active = 0; - conf->start_ready = 0; - conf->start_pending = 0; - conf->start_future = 0; - conf->phase = 0; - buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; if (conf->r1buf_pool) BUG(); conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, conf); if (!conf->r1buf_pool) return -ENOMEM; - conf->window = 2048; - conf->cnt_future += conf->cnt_done+conf->cnt_pending; - conf->cnt_done = conf->cnt_pending = 0; - if (conf->cnt_ready || conf->cnt_active) - MD_BUG(); + conf->next_resync = 0; return 0; } -static void wait_sync_pending(conf_t *conf, sector_t sector_nr) -{ - spin_lock_irq(&conf->segment_lock); - while (sector_nr >= conf->start_pending) { -// printk("wait .. sect=%lu start_active=%d ready=%d pending=%d future=%d, cnt_done=%d active=%d ready=%d pending=%d future=%d\n", sector_nr, conf->start_active, conf->start_ready, conf->start_pending, conf->start_future, conf->cnt_done, conf->cnt_active, conf->cnt_ready, conf->cnt_pending, conf->cnt_future); - wait_event_lock_irq(conf->wait_done, !conf->cnt_active, - conf->segment_lock); - wait_event_lock_irq(conf->wait_ready, !conf->cnt_pending, - conf->segment_lock); - conf->start_active = conf->start_ready; - conf->start_ready = conf->start_pending; - conf->start_pending = conf->start_future; - conf->start_future = conf->start_future+conf->window; - - // Note: falling off the end is not a problem - conf->phase = conf->phase ^1; - conf->cnt_active = conf->cnt_ready; - conf->cnt_ready = 0; - conf->cnt_pending = conf->cnt_future; - conf->cnt_future = 0; - wake_up(&conf->wait_done); - } - conf->cnt_ready++; - spin_unlock_irq(&conf->segment_lock); -} - /* * perform a "sync" on one "block" * * We need to make sure that no normal I/O request - particularly write * requests - conflict with active sync requests. - * This is achieved by conceptually dividing the block space into a - * number of sections: - * DONE: 0 .. a-1 These blocks are in-sync - * ACTIVE: a.. b-1 These blocks may have active sync requests, but - * no normal IO requests - * READY: b .. c-1 These blocks have no normal IO requests - sync - * request may be happening - * PENDING: c .. d-1 These blocks may have IO requests, but no new - * ones will be added - * FUTURE: d .. end These blocks are not to be considered yet. IO may - * be happening, but not sync - * - * We keep a - * phase which flips (0 or 1) each time d moves and - * a count of: - * z = active io requests in FUTURE since d moved - marked with - * current phase - * y = active io requests in FUTURE before d moved, or PENDING - - * marked with previous phase - * x = active sync requests in READY - * w = active sync requests in ACTIVE - * v = active io requests in DONE * - * Normally, a=b=c=d=0 and z= active io requests - * or a=b=c=d=END and v= active io requests - * Allowed changes to a,b,c,d: - * A: c==d && y==0 -> d+=window, y=z, z=0, phase=!phase - * B: y==0 -> c=d - * C: b=c, w+=x, x=0 - * D: w==0 -> a=b - * E: a==b==c==d==end -> a=b=c=d=0, z=v, v=0 - * - * At start of sync we apply A. - * When y reaches 0, we apply B then A then being sync requests - * When sync point reaches c-1, we wait for y==0, and W==0, and - * then apply apply B then A then D then C. - * Finally, we apply E - * - * The sync request simply issues a "read" against a working drive - * This is marked so that on completion the raid1d thread is woken to - * issue suitable write requests + * This is achieved by tracking pending requests and a 'barrier' concept + * that can be installed to exclude normal IO requests. */ -static int sync_request(mddev_t *mddev, sector_t sector_nr) +static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) { conf_t *conf = mddev_to_conf(mddev); mirror_info_t *mirror; @@ -1283,8 +1178,13 @@ if (!sector_nr) if (init_resync(conf)) return -ENOMEM; - - wait_sync_pending(conf, sector_nr); + /* + * If there is non-resync activity waiting for us then + * put in a delay to throttle resync. + */ + if (!go_faster && waitqueue_active(&conf->wait_resume)) + schedule_timeout(HZ); + device_barrier(conf, sector_nr + RESYNC_SECTORS); /* * If reconstructing, and >1 working disc, @@ -1302,10 +1202,13 @@ } conf->last_used = disk; - mirror = conf->mirrors+conf->last_used; + mirror = conf->mirrors + conf->last_used; r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); - check_all_bios_empty(r1_bio); + + spin_lock_irq(&conf->resync_lock); + conf->nr_pending++; + spin_unlock_irq(&conf->resync_lock); r1_bio->mddev = mddev; r1_bio->sector = sector_nr; @@ -1344,6 +1247,7 @@ md_sync_acct(read_bio->bi_dev, nr_sectors); generic_make_request(read_bio); + atomic_inc(&conf->mirrors[conf->last_used].nr_pending); return nr_sectors; } @@ -1447,7 +1351,6 @@ disk->number = descriptor->number; disk->raid_disk = disk_idx; disk->dev = rdev->dev; - disk->sect_limit = MAX_WORK_PER_DISK; disk->operational = 0; disk->write_only = 0; disk->spare = 0; @@ -1479,7 +1382,6 @@ disk->number = descriptor->number; disk->raid_disk = disk_idx; disk->dev = rdev->dev; - disk->sect_limit = MAX_WORK_PER_DISK; disk->operational = 1; disk->write_only = 0; disk->spare = 0; @@ -1494,7 +1396,6 @@ disk->number = descriptor->number; disk->raid_disk = disk_idx; disk->dev = rdev->dev; - disk->sect_limit = MAX_WORK_PER_DISK; disk->operational = 0; disk->write_only = 0; disk->spare = 1; @@ -1507,9 +1408,9 @@ conf->mddev = mddev; conf->device_lock = SPIN_LOCK_UNLOCKED; - conf->segment_lock = SPIN_LOCK_UNLOCKED; - init_waitqueue_head(&conf->wait_done); - init_waitqueue_head(&conf->wait_ready); + conf->resync_lock = SPIN_LOCK_UNLOCKED; + init_waitqueue_head(&conf->wait_idle); + init_waitqueue_head(&conf->wait_resume); if (!conf->working_disks) { printk(NONE_OPERATIONAL, mdidx(mddev)); @@ -1610,17 +1511,6 @@ MOD_DEC_USE_COUNT; return -EIO; } - -#undef INVALID_LEVEL -#undef NO_SB -#undef ERRORS -#undef NOT_IN_SYNC -#undef INCONSISTENT -#undef ALREADY_RUNNING -#undef OPERATIONAL -#undef SPARE -#undef NONE_OPERATIONAL -#undef ARRAY_IS_ACTIVE static int stop_resync(mddev_t *mddev) { diff -u --recursive --new-file v2.5.1/linux/drivers/md/raid5.c linux/drivers/md/raid5.c --- v2.5.1/linux/drivers/md/raid5.c Wed Oct 17 14:21:00 2001 +++ linux/drivers/md/raid5.c Thu Dec 27 08:17:43 2001 @@ -1226,23 +1226,6 @@ return 0; } -/* - * Determine correct block size for this device. - */ -unsigned int device_bsize (kdev_t dev) -{ - unsigned int i, correct_size; - - correct_size = BLOCK_SIZE; - if (blksize_size[MAJOR(dev)]) { - i = blksize_size[MAJOR(dev)][MINOR(dev)]; - if (i) - correct_size = i; - } - - return correct_size; -} - static int raid5_sync_request (mddev_t *mddev, unsigned long sector_nr) { raid5_conf_t *conf = (raid5_conf_t *) mddev->private; diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/adv7175.c linux/drivers/media/video/adv7175.c --- v2.5.1/linux/drivers/media/video/adv7175.c Sun Sep 30 12:26:06 2001 +++ linux/drivers/media/video/adv7175.c Sun Dec 30 10:31:51 2001 @@ -38,7 +38,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/bt856.c linux/drivers/media/video/bt856.c --- v2.5.1/linux/drivers/media/video/bt856.c Sun Sep 30 12:26:06 2001 +++ linux/drivers/media/video/bt856.c Sun Dec 30 10:31:51 2001 @@ -40,7 +40,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/bttv-driver.c linux/drivers/media/video/bttv-driver.c --- v2.5.1/linux/drivers/media/video/bttv-driver.c Wed Oct 17 14:19:20 2001 +++ linux/drivers/media/video/bttv-driver.c Sun Dec 30 10:31:51 2001 @@ -37,7 +37,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> #include <linux/interrupt.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/saa7185.c linux/drivers/media/video/saa7185.c --- v2.5.1/linux/drivers/media/video/saa7185.c Sun Sep 30 12:26:06 2001 +++ linux/drivers/media/video/saa7185.c Sun Dec 30 10:31:51 2001 @@ -36,7 +36,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/stradis.c linux/drivers/media/video/stradis.c --- v2.5.1/linux/drivers/media/video/stradis.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/media/video/stradis.c Sun Dec 30 10:31:51 2001 @@ -37,7 +37,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <asm/types.h> #include <linux/types.h> #include <linux/wrapper.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/zr36067.c linux/drivers/media/video/zr36067.c --- v2.5.1/linux/drivers/media/video/zr36067.c Fri Nov 9 14:01:22 2001 +++ linux/drivers/media/video/zr36067.c Sun Dec 30 10:31:51 2001 @@ -58,7 +58,6 @@ #include <asm/pgtable.h> #include <asm/page.h> #include <linux/sched.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/wrapper.h> diff -u --recursive --new-file v2.5.1/linux/drivers/media/video/zr36120.c linux/drivers/media/video/zr36120.c --- v2.5.1/linux/drivers/media/video/zr36120.c Fri Nov 9 14:01:22 2001 +++ linux/drivers/media/video/zr36120.c Sun Dec 30 10:31:51 2001 @@ -35,7 +35,6 @@ #include <asm/page.h> #include <linux/sched.h> #include <linux/video_decoder.h> -#include <asm/segment.h> #include <linux/version.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/drivers/mtd/devices/blkmtd.c linux/drivers/mtd/devices/blkmtd.c --- v2.5.1/linux/drivers/mtd/devices/blkmtd.c Fri Oct 5 12:06:51 2001 +++ linux/drivers/mtd/devices/blkmtd.c Thu Dec 27 08:17:43 2001 @@ -63,7 +63,6 @@ #define CONFIG_MTD_BLKDEV_ERASESIZE 128 #define VERSION "1.1" extern int *blk_size[]; -extern int *blksize_size[]; /* Info for the block device */ typedef struct mtd_raw_dev_data_s { @@ -905,14 +904,7 @@ DEBUG(1, "blkmtd: devname = %s\n", bdevname(rdev)); blocksize = BLOCK_SIZE; - if(bs) { - blocksize = bs; - } else { - if (blksize_size[maj] && blksize_size[maj][min]) { - DEBUG(2, "blkmtd: blksize_size = %d\n", blksize_size[maj][min]); - blocksize = blksize_size[maj][min]; - } - } + blocksize = bs ? bs : block_size(rdev); i = blocksize; blocksize_bits = 0; while(i != 1) { diff -u --recursive --new-file v2.5.1/linux/drivers/mtd/devices/doc1000.c linux/drivers/mtd/devices/doc1000.c --- v2.5.1/linux/drivers/mtd/devices/doc1000.c Thu Oct 4 15:14:59 2001 +++ linux/drivers/mtd/devices/doc1000.c Sun Dec 30 10:31:51 2001 @@ -20,7 +20,6 @@ #include <linux/ioctl.h> #include <asm/io.h> #include <asm/system.h> -#include <asm/segment.h> #include <stdarg.h> #include <linux/delay.h> #include <linux/init.h> diff -u --recursive --new-file v2.5.1/linux/drivers/mtd/devices/pmc551.c linux/drivers/mtd/devices/pmc551.c --- v2.5.1/linux/drivers/mtd/devices/pmc551.c Thu Oct 4 15:14:59 2001 +++ linux/drivers/mtd/devices/pmc551.c Sun Dec 30 10:31:51 2001 @@ -98,7 +98,6 @@ #include <linux/ioctl.h> #include <asm/io.h> #include <asm/system.h> -#include <asm/segment.h> #include <stdarg.h> #include <linux/pci.h> diff -u --recursive --new-file v2.5.1/linux/drivers/mtd/devices/slram.c linux/drivers/mtd/devices/slram.c --- v2.5.1/linux/drivers/mtd/devices/slram.c Thu Oct 4 15:14:59 2001 +++ linux/drivers/mtd/devices/slram.c Sun Dec 30 10:31:51 2001 @@ -20,7 +20,6 @@ #include <linux/init.h> #include <asm/io.h> #include <asm/system.h> -#include <asm/segment.h> #include <stdarg.h> #include <linux/mtd/mtd.h> diff -u --recursive --new-file v2.5.1/linux/drivers/mtd/nftlmount.c linux/drivers/mtd/nftlmount.c --- v2.5.1/linux/drivers/mtd/nftlmount.c Thu Oct 4 15:13:18 2001 +++ linux/drivers/mtd/nftlmount.c Thu Dec 20 08:53:28 2001 @@ -4,7 +4,7 @@ * Author: Fabrice Bellard (fabrice.bellard@netgem.com) * Copyright (C) 2000 Netgem S.A. * - * $Id: nftlmount.c,v 1.23 2001/09/19 21:42:32 dwmw2 Exp $ + * $Id: nftlmount.c,v 1.25 2001/11/30 16:46:27 dwmw2 Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ #define SECTORSIZE 512 -char nftlmountrev[]="$Revision: 1.23 $"; +char nftlmountrev[]="$Revision: 1.25 $"; /* find_boot_record: Find the NFTL Media Header and its Spare copy which contains the * various device information of the NFTL partition and Bad Unit Table. Update @@ -94,11 +94,11 @@ continue; } -#if 1 /* Some people seem to have devices without ECC or erase marks +#if 0 /* Some people seem to have devices without ECC or erase marks on the Media Header blocks. There are enough other sanity checks in here that we can probably do without it. */ - if (le16_to_cpu ((h1.EraseMark | h1.EraseMark1) != ERASE_MARK)) { + if (le16_to_cpu(h1.EraseMark | h1.EraseMark1) != ERASE_MARK) { printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but erase mark not present (0x%04x,0x%04x instead)\n", block * nftl->EraseSize, nftl->mtd->index, le16_to_cpu(h1.EraseMark), le16_to_cpu(h1.EraseMark1)); diff -u --recursive --new-file v2.5.1/linux/drivers/net/fc/iph5526.c linux/drivers/net/fc/iph5526.c --- v2.5.1/linux/drivers/net/fc/iph5526.c Tue Dec 18 14:56:36 2001 +++ linux/drivers/net/fc/iph5526.c Tue Dec 25 17:04:40 2001 @@ -4534,14 +4534,14 @@ { int i = 0; - driver_template.module = &__this_module; - scsi_register_module(MODULE_SCSI_HA, &driver_template); + driver_template.module = THIS_MODULE; + scsi_register_host(&driver_template); if (driver_template.present) scsi_registered = TRUE; else { printk("iph5526: SCSI registeration failed!!!\n"); scsi_registered = FALSE; - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); } while(fc[i] != NULL) { @@ -4590,7 +4590,7 @@ i++; } if (scsi_registered == TRUE) - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); } #endif /* MODULE */ diff -u --recursive --new-file v2.5.1/linux/drivers/net/hamradio/bpqether.c linux/drivers/net/hamradio/bpqether.c --- v2.5.1/linux/drivers/net/hamradio/bpqether.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/hamradio/bpqether.c Sun Dec 30 10:31:51 2001 @@ -69,7 +69,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/hamradio/dmascc.c linux/drivers/net/hamradio/dmascc.c --- v2.5.1/linux/drivers/net/hamradio/dmascc.c Wed Apr 18 14:40:06 2001 +++ linux/drivers/net/hamradio/dmascc.c Sun Dec 30 10:31:51 2001 @@ -43,7 +43,6 @@ #include <asm/dma.h> #include <asm/io.h> #include <asm/irq.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <net/ax25.h> #include "z8530.h" diff -u --recursive --new-file v2.5.1/linux/drivers/net/hamradio/mkiss.c linux/drivers/net/hamradio/mkiss.c --- v2.5.1/linux/drivers/net/hamradio/mkiss.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/hamradio/mkiss.c Sun Dec 30 10:31:51 2001 @@ -27,7 +27,6 @@ #include <linux/config.h> #include <linux/module.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/uaccess.h> #include <linux/string.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/hamradio/soundmodem/sm_sbc.c linux/drivers/net/hamradio/soundmodem/sm_sbc.c --- v2.5.1/linux/drivers/net/hamradio/soundmodem/sm_sbc.c Tue Jul 18 16:55:19 2000 +++ linux/drivers/net/hamradio/soundmodem/sm_sbc.c Sun Dec 30 10:31:51 2001 @@ -50,7 +50,6 @@ #if LINUX_VERSION_CODE >= 0x20100 #include <asm/uaccess.h> #else -#include <asm/segment.h> #include <linux/mm.h> #undef put_user diff -u --recursive --new-file v2.5.1/linux/drivers/net/hamradio/soundmodem/sm_wss.c linux/drivers/net/hamradio/soundmodem/sm_wss.c --- v2.5.1/linux/drivers/net/hamradio/soundmodem/sm_wss.c Wed Jun 27 17:10:55 2001 +++ linux/drivers/net/hamradio/soundmodem/sm_wss.c Sun Dec 30 10:31:51 2001 @@ -49,7 +49,6 @@ #if LINUX_VERSION_CODE >= 0x20100 #include <asm/uaccess.h> #else -#include <asm/segment.h> #include <linux/mm.h> #undef put_user diff -u --recursive --new-file v2.5.1/linux/drivers/net/irda/irtty.c linux/drivers/net/irda/irtty.c --- v2.5.1/linux/drivers/net/irda/irtty.c Sun Sep 30 12:26:06 2001 +++ linux/drivers/net/irda/irtty.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #include <linux/if_arp.h> #include <linux/rtnetlink.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <net/irda/irda.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/jazzsonic.c linux/drivers/net/jazzsonic.c --- v2.5.1/linux/drivers/net/jazzsonic.c Sun Sep 9 10:43:01 2001 +++ linux/drivers/net/jazzsonic.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <asm/system.h> #include <asm/bitops.h> #include <asm/pgtable.h> -#include <asm/segment.h> #include <asm/io.h> #include <asm/dma.h> #include <asm/jazz.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/macsonic.c linux/drivers/net/macsonic.c --- v2.5.1/linux/drivers/net/macsonic.c Tue Oct 16 21:56:29 2001 +++ linux/drivers/net/macsonic.c Sun Dec 30 10:31:51 2001 @@ -40,7 +40,6 @@ #include <asm/system.h> #include <asm/bitops.h> #include <asm/pgtable.h> -#include <asm/segment.h> #include <asm/io.h> #include <asm/hwtest.h> #include <asm/dma.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/pcmcia/fmvj18x_cs.c linux/drivers/net/pcmcia/fmvj18x_cs.c --- v2.5.1/linux/drivers/net/pcmcia/fmvj18x_cs.c Tue Nov 13 09:02:30 2001 +++ linux/drivers/net/pcmcia/fmvj18x_cs.c Sun Dec 30 09:40:59 2001 @@ -1247,3 +1247,4 @@ } restore_flags(flags); } +MODULE_LICENSE("GPL"); diff -u --recursive --new-file v2.5.1/linux/drivers/net/sgiseeq.c linux/drivers/net/sgiseeq.c --- v2.5.1/linux/drivers/net/sgiseeq.c Thu Apr 12 12:15:25 2001 +++ linux/drivers/net/sgiseeq.c Sun Dec 30 10:31:51 2001 @@ -16,7 +16,6 @@ #include <linux/delay.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/bitops.h> #include <asm/page.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/slip.c linux/drivers/net/slip.c --- v2.5.1/linux/drivers/net/slip.c Sun Sep 30 12:26:07 2001 +++ linux/drivers/net/slip.c Thu Dec 27 08:21:28 2001 @@ -1394,7 +1394,7 @@ */ do { if (busy) { - current->counter = 0; + current->time_slice = 0; schedule(); } diff -u --recursive --new-file v2.5.1/linux/drivers/net/strip.c linux/drivers/net/strip.c --- v2.5.1/linux/drivers/net/strip.c Fri Nov 9 14:02:24 2001 +++ linux/drivers/net/strip.c Sun Dec 30 10:31:51 2001 @@ -87,7 +87,6 @@ #include <linux/init.h> #include <asm/system.h> #include <asm/uaccess.h> -#include <asm/segment.h> #include <asm/bitops.h> /* diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/lapbether.c linux/drivers/net/wan/lapbether.c --- v2.5.1/linux/drivers/net/wan/lapbether.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/lapbether.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/lmc/lmc_main.c linux/drivers/net/wan/lmc/lmc_main.c --- v2.5.1/linux/drivers/net/wan/lmc/lmc_main.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/lmc/lmc_main.c Sun Dec 30 10:31:51 2001 @@ -50,7 +50,6 @@ #include <linux/interrupt.h> #include <linux/pci.h> #include <linux/delay.h> -#include <asm/segment.h> #include <linux/init.h> #if LINUX_VERSION_CODE < 0x20155 diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/lmc/lmc_media.c linux/drivers/net/wan/lmc/lmc_media.c --- v2.5.1/linux/drivers/net/wan/lmc/lmc_media.c Tue Mar 6 19:44:36 2001 +++ linux/drivers/net/wan/lmc/lmc_media.c Sun Dec 30 10:31:51 2001 @@ -12,7 +12,6 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/pci.h> -#include <asm/segment.h> //#include <asm/smp.h> #if LINUX_VERSION_CODE < 0x20155 diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/lmc/lmc_proto.c linux/drivers/net/wan/lmc/lmc_proto.c --- v2.5.1/linux/drivers/net/wan/lmc/lmc_proto.c Tue Mar 6 19:44:36 2001 +++ linux/drivers/net/wan/lmc/lmc_proto.c Sun Dec 30 10:31:51 2001 @@ -30,7 +30,6 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/pci.h> -#include <asm/segment.h> #include <asm/smp.h> #include <linux/in.h> diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/sdla_chdlc.c linux/drivers/net/wan/sdla_chdlc.c --- v2.5.1/linux/drivers/net/wan/sdla_chdlc.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/sdla_chdlc.c Sun Dec 30 10:31:51 2001 @@ -65,7 +65,6 @@ #include <linux/inetdevice.h> #include <linux/netdevice.h> #else - #include <asm/segment.h> #include <net/route.h> /* Adding new route entries : 2.0.X kernels */ #endif diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/sdla_fr.c linux/drivers/net/wan/sdla_fr.c --- v2.5.1/linux/drivers/net/wan/sdla_fr.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/sdla_fr.c Sun Dec 30 10:31:51 2001 @@ -169,7 +169,6 @@ #include <linux/netdevice.h> #else - #include <asm/segment.h> #endif #include <net/route.h> /* Dynamic Route Creation */ diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/sdla_ppp.c linux/drivers/net/wan/sdla_ppp.c --- v2.5.1/linux/drivers/net/wan/sdla_ppp.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/sdla_ppp.c Sun Dec 30 10:31:51 2001 @@ -111,7 +111,6 @@ #include <linux/inetdevice.h> #include <linux/netdevice.h> #else - #include <asm/segment.h> #include <net/route.h> /* Adding new route entries : 2.0.X kernels */ #endif diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/sdla_x25.c linux/drivers/net/wan/sdla_x25.c --- v2.5.1/linux/drivers/net/wan/sdla_x25.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/sdla_x25.c Sun Dec 30 10:31:51 2001 @@ -98,7 +98,6 @@ #if defined(LINUX_2_1) || defined(LINUX_2_4) #include <asm/uaccess.h> #else - #include <asm/segment.h> #include <net/route.h> #endif diff -u --recursive --new-file v2.5.1/linux/drivers/net/wan/sdlamain.c linux/drivers/net/wan/sdlamain.c --- v2.5.1/linux/drivers/net/wan/sdlamain.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/net/wan/sdlamain.c Sun Dec 30 10:31:51 2001 @@ -78,7 +78,6 @@ #else - #include <asm/segment.h> #define devinet_ioctl(x,y) dev_ioctl(x,y) #define netdevice_t struct device #define test_and_set_bit set_bit diff -u --recursive --new-file v2.5.1/linux/drivers/net/wireless/airo.c linux/drivers/net/wireless/airo.c --- v2.5.1/linux/drivers/net/wireless/airo.c Fri Nov 9 13:41:42 2001 +++ linux/drivers/net/wireless/airo.c Sun Dec 30 10:31:51 2001 @@ -19,7 +19,6 @@ #include <linux/config.h> #include <linux/version.h> -#include <asm/segment.h> #include <linux/init.h> #include <linux/kernel.h> diff -u --recursive --new-file v2.5.1/linux/drivers/pcmcia/i82365.c linux/drivers/pcmcia/i82365.c --- v2.5.1/linux/drivers/pcmcia/i82365.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/pcmcia/i82365.c Sun Dec 30 10:31:51 2001 @@ -49,7 +49,6 @@ #include <asm/irq.h> #include <asm/io.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/system.h> #include <pcmcia/version.h> diff -u --recursive --new-file v2.5.1/linux/drivers/pcmcia/tcic.c linux/drivers/pcmcia/tcic.c --- v2.5.1/linux/drivers/pcmcia/tcic.c Sun Sep 30 12:26:07 2001 +++ linux/drivers/pcmcia/tcic.c Sun Dec 30 10:31:51 2001 @@ -39,7 +39,6 @@ #include <asm/io.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/kernel.h> diff -u --recursive --new-file v2.5.1/linux/drivers/s390/char/tuball.c linux/drivers/s390/char/tuball.c --- v2.5.1/linux/drivers/s390/char/tuball.c Thu Oct 11 09:43:29 2001 +++ linux/drivers/s390/char/tuball.c Tue Dec 25 15:39:20 2001 @@ -84,7 +84,6 @@ tub3270_con_write, /* write */ NULL, /* read */ tub3270_con_device, /* device */ - NULL, /* wait_key */ tub3270_con_unblank, /* unblank */ NULL, /* setup */ CON_PRINTBUFFER, /* flags */ diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/aurora.c linux/drivers/sbus/char/aurora.c --- v2.5.1/linux/drivers/sbus/char/aurora.c Tue Oct 30 15:08:11 2001 +++ linux/drivers/sbus/char/aurora.c Sun Dec 30 10:31:51 2001 @@ -66,7 +66,6 @@ #include <asm/irq.h> #include <asm/oplib.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/kdebug.h> #include <asm/sbus.h> diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/bpp.c linux/drivers/sbus/char/bpp.c --- v2.5.1/linux/drivers/sbus/char/bpp.c Thu Oct 11 09:43:29 2001 +++ linux/drivers/sbus/char/bpp.c Sun Dec 30 10:31:51 2001 @@ -28,7 +28,6 @@ #if defined(__i386__) # include <asm/system.h> -# include <asm/segment.h> #endif #if defined(__sparc__) diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/sab82532.c linux/drivers/sbus/char/sab82532.c --- v2.5.1/linux/drivers/sbus/char/sab82532.c Wed Oct 17 14:16:39 2001 +++ linux/drivers/sbus/char/sab82532.c Tue Dec 25 15:39:20 2001 @@ -361,10 +361,6 @@ writeb(SAB82532_CMDR_RMC, &info->regs->w.cmdr); } -#ifdef CONFIG_SERIAL_CONSOLE - if (info->is_console) - wake_up(&keypress_wait); -#endif if (!tty) return; @@ -2541,13 +2537,6 @@ sab82532_tec_wait(info); } -static int -sab82532_console_wait_key(struct console *con) -{ - sleep_on(&keypress_wait); - return 0; -} - static kdev_t sab82532_console_device(struct console *con) { @@ -2622,7 +2611,6 @@ name: "ttyS", write: sab82532_console_write, device: sab82532_console_device, - wait_key: sab82532_console_wait_key, setup: sab82532_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/su.c linux/drivers/sbus/char/su.c --- v2.5.1/linux/drivers/sbus/char/su.c Tue Nov 13 09:16:05 2001 +++ linux/drivers/sbus/char/su.c Tue Dec 25 15:39:20 2001 @@ -2854,40 +2854,6 @@ su_outb(info, UART_IER, ier); } -/* - * Receive character from the serial port - */ -static int -serial_console_wait_key(struct console *co) -{ - struct su_struct *info; - int ier; - int lsr; - int c; - - info = su_table + co->index; - - /* - * First save the IER then disable the interrupts so - * that the real driver for the port does not get the - * character. - */ - ier = su_inb(info, UART_IER); - su_outb(info, UART_IER, 0x00); - - do { - lsr = su_inb(info, UART_LSR); - } while (!(lsr & UART_LSR_DR)); - c = su_inb(info, UART_RX); - - /* - * Restore the interrupts - */ - su_outb(info, UART_IER, ier); - - return c; -} - static kdev_t serial_console_device(struct console *c) { @@ -3013,7 +2979,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/sunkbd.c linux/drivers/sbus/char/sunkbd.c --- v2.5.1/linux/drivers/sbus/char/sunkbd.c Sun Sep 16 21:22:50 2001 +++ linux/drivers/sbus/char/sunkbd.c Tue Dec 25 15:39:20 2001 @@ -82,16 +82,6 @@ struct l1a_kbd_state l1a_state; -#ifndef CONFIG_PCI -DECLARE_WAIT_QUEUE_HEAD(keypress_wait); -#endif - -int keyboard_wait_for_keypress(struct console *co) -{ - sleep_on(&keypress_wait); - return 0; -} - static spinlock_t sunkbd_lock = SPIN_LOCK_UNLOCKED; /* @@ -629,7 +619,6 @@ static void put_queue(int ch) { - wake_up(&keypress_wait); if (tty) { tty_insert_flip_char(tty, ch, 0); con_schedule_flip(tty); @@ -638,7 +627,6 @@ static void puts_queue(char *cp) { - wake_up(&keypress_wait); if (!tty) return; diff -u --recursive --new-file v2.5.1/linux/drivers/sbus/char/zs.c linux/drivers/sbus/char/zs.c --- v2.5.1/linux/drivers/sbus/char/zs.c Tue Oct 30 15:08:11 2001 +++ linux/drivers/sbus/char/zs.c Tue Dec 25 15:39:20 2001 @@ -532,8 +532,6 @@ /* Continue execution... */ return; } - /* It is a 'keyboard interrupt' ;-) */ - wake_up(&keypress_wait); } #ifndef __sparc_v9__ /* Look for kgdb 'stop' character, consult the gdb @@ -2761,13 +2759,6 @@ #endif } -static int -zs_console_wait_key(struct console *con) -{ - sleep_on(&keypress_wait); - return 0; -} - static kdev_t zs_console_device(struct console *con) { return MKDEV(TTY_MAJOR, 64 + con->index); @@ -2845,7 +2836,6 @@ name: "ttyS", write: zs_console_write, device: zs_console_device, - wait_key: zs_console_wait_key, setup: zs_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/BusLogic.c linux/drivers/scsi/BusLogic.c --- v2.5.1/linux/drivers/scsi/BusLogic.c Sun Sep 30 12:26:07 2001 +++ linux/drivers/scsi/BusLogic.c Thu Dec 27 08:17:43 2001 @@ -4106,7 +4106,7 @@ BusLogic_HostAdapter_T *HostAdapter = (BusLogic_HostAdapter_T *) Disk->device->host->hostdata; BIOS_DiskParameters_T *DiskParameters = (BIOS_DiskParameters_T *) Parameters; - struct buffer_head *BufferHead; + unsigned char *buf; if (HostAdapter->ExtendedTranslationEnabled && Disk->capacity >= 2*1024*1024 /* 1 GB in 512 byte sectors */) { @@ -4128,20 +4128,16 @@ } DiskParameters->Cylinders = Disk->capacity / (DiskParameters->Heads * DiskParameters->Sectors); - /* - Attempt to read the first 1024 bytes from the disk device. - */ - BufferHead = bread(MKDEV(MAJOR(Device), MINOR(Device) & ~0x0F), 0, 1024); - if (BufferHead == NULL) return 0; + buf = scsi_bios_ptable(Device); + if (buf == NULL) return 0; /* If the boot sector partition table flag is valid, search for a partition table entry whose end_head matches one of the standard BusLogic geometry translations (64/32, 128/32, or 255/63). */ - if (*(unsigned short *) (BufferHead->b_data + 0x1FE) == 0xAA55) + if (*(unsigned short *) (buf+64) == 0xAA55) { - PartitionTable_T *FirstPartitionEntry = - (PartitionTable_T *) (BufferHead->b_data + 0x1BE); + PartitionTable_T *FirstPartitionEntry = (PartitionTable_T *) buf; PartitionTable_T *PartitionEntry = FirstPartitionEntry; int SavedCylinders = DiskParameters->Cylinders, PartitionNumber; unsigned char PartitionEntryEndHead, PartitionEntryEndSector; @@ -4195,7 +4191,7 @@ DiskParameters->Heads, DiskParameters->Sectors); } } - brelse(BufferHead); + kfree(buf); return 0; } diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c --- v2.5.1/linux/drivers/scsi/aha1542.c Fri Oct 12 15:35:53 2001 +++ linux/drivers/scsi/aha1542.c Sat Dec 29 11:17:37 2001 @@ -67,10 +67,10 @@ int nseg, int badseg) { - printk(KERN_CRIT "sgpnt[%d:%d] addr %p/0x%lx length %d\n", + printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%lx length %d\n", badseg, nseg, - sgpnt[badseg].address, - SCSI_PA(sgpnt[badseg].address), + page_address(sgpnt[badseg].page) + sgpnt[badseg].offset, + (unsigned long)page_to_bus(sgpnt[badseg].page) + sgpnt[badseg].offset, sgpnt[badseg].length); /* @@ -176,7 +176,7 @@ static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt); static int aha1542_restart(struct Scsi_Host *shost); -static void aha1542_intr_handle(int irq, void *dev_id, struct pt_regs *regs); +static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt_regs *regs); static void do_aha1542_intr_handle(int irq, void *dev_id, struct pt_regs *regs); #define aha1542_intr_reset(base) outb(IRST, CONTROL(base)) @@ -419,30 +419,30 @@ static void do_aha1542_intr_handle(int irq, void *dev_id, struct pt_regs *regs) { unsigned long flags; + struct Scsi_Host *shost; + + shost = aha_host[irq - 9]; + if (!shost) + panic("Splunge!"); - spin_lock_irqsave(&io_request_lock, flags); - aha1542_intr_handle(irq, dev_id, regs); - spin_unlock_irqrestore(&io_request_lock, flags); + spin_lock_irqsave(&shost->host_lock, flags); + aha1542_intr_handle(shost, dev_id, regs); + spin_unlock_irqrestore(&shost->host_lock, flags); } /* A "high" level interrupt handler */ -static void aha1542_intr_handle(int irq, void *dev_id, struct pt_regs *regs) +static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt_regs *regs) { void (*my_done) (Scsi_Cmnd *) = NULL; int errstatus, mbi, mbo, mbistatus; int number_serviced; unsigned long flags; - struct Scsi_Host *shost; Scsi_Cmnd *SCtmp; int flag; int needs_restart; struct mailbox *mb; struct ccb *ccb; - shost = aha_host[irq - 9]; - if (!shost) - panic("Splunge!"); - mb = HOSTDATA(shost)->mb; ccb = HOSTDATA(shost)->ccb; @@ -542,7 +542,7 @@ } my_done = SCtmp->scsi_done; if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = 0; } /* Fetch the sense data, and tuck it away, in the required slot. The @@ -703,18 +703,19 @@ #endif int i; ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ - SCpnt->host_scribble = (unsigned char *) scsi_malloc(512); + SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_DMA); sgpnt = (struct scatterlist *) SCpnt->request_buffer; cptr = (struct chain *) SCpnt->host_scribble; if (cptr == NULL) panic("aha1542.c: unable to allocate DMA memory\n"); for (i = 0; i < SCpnt->use_sg; i++) { if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 || - (((int) sgpnt[i].address) & 1) || (sgpnt[i].length & 1)) { + (((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) { unsigned char *ptr; printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); for (i = 0; i < SCpnt->use_sg; i++) { - printk(KERN_CRIT "%d: %p %d\n", i, sgpnt[i].address, + printk(KERN_CRIT "%d: %p %d\n", i, + page_address(sgpnt[i].page) + sgpnt[i].offset, sgpnt[i].length); }; printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); @@ -723,8 +724,8 @@ printk("%02x ", ptr[i]); panic("Foooooooood fight!"); }; - any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].address)); - if (SCSI_PA(sgpnt[i].address + sgpnt[i].length - 1) > ISA_DMA_THRESHOLD) + any2scsi(cptr[i].dataptr, page_to_bus(sgpnt[i].page) + sgpnt[i].offset); + if (page_to_bus(sgpnt[i].page) + sgpnt[i].offset + sgpnt[i].length - 1 > ISA_DMA_THRESHOLD) BAD_SG_DMA(SCpnt, sgpnt, SCpnt->use_sg, i); any2scsi(cptr[i].datalen, sgpnt[i].length); }; @@ -1442,7 +1443,7 @@ Scsi_Cmnd *SCtmp; SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } HOSTDATA(SCpnt->host)->SCint[i] = NULL; @@ -1474,9 +1475,9 @@ * check for timeout, and if we are doing something like this * we are pretty desperate anyways. */ - spin_unlock_irq(&io_request_lock); + spin_unlock_irq(&SCpnt->host->host_lock); scsi_sleep(4 * HZ); - spin_lock_irq(&io_request_lock); + spin_lock_irq(&SCpnt->host->host_lock); WAIT(STATUS(SCpnt->host->io_port), STATMASK, INIT | IDLE, STST | DIAGF | INVDCMD | DF | CDF); @@ -1505,7 +1506,7 @@ continue; } if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } HOSTDATA(SCpnt->host)->SCint[i] = NULL; @@ -1538,9 +1539,9 @@ * check for timeout, and if we are doing something like this * we are pretty desperate anyways. */ - spin_unlock_irq(&io_request_lock); + spin_unlock_irq(&SCpnt->host->host_lock); scsi_sleep(4 * HZ); - spin_lock_irq(&io_request_lock); + spin_lock_irq(&SCpnt->host->host_lock); WAIT(STATUS(SCpnt->host->io_port), STATMASK, INIT | IDLE, STST | DIAGF | INVDCMD | DF | CDF); @@ -1574,7 +1575,7 @@ continue; } if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } HOSTDATA(SCpnt->host)->SCint[i] = NULL; @@ -1623,7 +1624,7 @@ if (mb[mbi].status) { printk(KERN_ERR "Lost interrupt discovered on irq %d - attempting to recover\n", SCpnt->host->irq); - aha1542_intr_handle(SCpnt->host->irq, NULL); + aha1542_intr_handle(SCpnt->host, NULL); return 0; } /* OK, no lost interrupt. Try looking to see how many pending commands @@ -1712,7 +1713,7 @@ SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; SCtmp->result = DID_RESET << 16; if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); @@ -1758,7 +1759,7 @@ SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; SCtmp->result = DID_RESET << 16; if (SCtmp->host_scribble) { - scsi_free(SCtmp->host_scribble, 512); + kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/aic7xxx/aic7xxx_linux.c linux/drivers/scsi/aic7xxx/aic7xxx_linux.c --- v2.5.1/linux/drivers/scsi/aic7xxx/aic7xxx_linux.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/aic7xxx/aic7xxx_linux.c Thu Dec 27 08:17:43 2001 @@ -2727,15 +2727,15 @@ int ret; int extended; struct ahc_softc *ahc; - struct buffer_head *bh; + unsigned char *buf; ahc = *((struct ahc_softc **)disk->device->host->hostdata); - bh = bread(MKDEV(MAJOR(dev), MINOR(dev) & ~0xf), 0, block_size(dev)); + buf = scsi_bios_ptable(dev); - if (bh) { - ret = scsi_partsize(bh, disk->capacity, + if (buf) { + ret = scsi_partsize(buf, disk->capacity, &geom[2], &geom[0], &geom[1]); - brelse(bh); + kfree(buf); if (ret != -1) return (ret); } diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/aic7xxx_old.c linux/drivers/scsi/aic7xxx_old.c --- v2.5.1/linux/drivers/scsi/aic7xxx_old.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/aic7xxx_old.c Thu Dec 27 08:17:43 2001 @@ -11737,15 +11737,15 @@ { int heads, sectors, cylinders, ret; struct aic7xxx_host *p; - struct buffer_head *bh; + unsigned char *buf; p = (struct aic7xxx_host *) disk->device->host->hostdata; - bh = bread(MKDEV(MAJOR(dev), MINOR(dev)&~0xf), 0, block_size(dev)); + buf = scsi_bios_ptable(dev); - if ( bh ) + if ( buf ) { - ret = scsi_partsize(bh, disk->capacity, &geom[2], &geom[0], &geom[1]); - brelse(bh); + ret = scsi_partsize(buf, disk->capacity, &geom[2], &geom[0], &geom[1]); + kfree(buf); if ( ret != -1 ) return(ret); } diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/cpqfcTSworker.c linux/drivers/scsi/cpqfcTSworker.c --- v2.5.1/linux/drivers/scsi/cpqfcTSworker.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/cpqfcTSworker.c Sat Dec 29 17:28:11 2001 @@ -159,7 +159,6 @@ #ifdef PCI_KERNEL_TRACE PTACHYON fcChip = &cpqfcHBAdata->fcChip; #endif - struct fs_struct *fs; DECLARE_MUTEX_LOCKED(fcQueReady); DECLARE_MUTEX_LOCKED(fcTYOBcomplete); DECLARE_MUTEX_LOCKED(TachFrozen); @@ -168,33 +167,7 @@ ENTER("WorkerThread"); lock_kernel(); - /* - * If we were started as result of loading a module, close all of the - * user space pages. We don't need them, and if we didn't close them - * they would be locked into memory. - */ - exit_mm(current); - - current->session = 1; - current->pgrp = 1; - - /* Become as one with the init task */ - - exit_fs(current); /* current->fs->count--; */ - fs = init_task.fs; - // Some kernels compiled for SMP, while actually running - // on a uniproc machine, will return NULL for this call - if( !fs) - { - printk(" cpqfcTS FATAL: fs is NULL! Is this an SMP kernel on uniproc machine?\n "); - } - - else - { - current->fs = fs; - atomic_inc(&fs->count); - } - + daemonize(); siginitsetinv(¤t->blocked, SHUTDOWN_SIGS); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c --- v2.5.1/linux/drivers/scsi/hosts.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/hosts.c Tue Dec 25 17:04:40 2001 @@ -270,15 +270,6 @@ return retval; } -int -scsi_register_device(struct Scsi_Device_Template * sdpnt) -{ - if(sdpnt->next) panic("Device already registered"); - sdpnt->next = scsi_devicelist; - scsi_devicelist = sdpnt; - return 0; -} - /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/hosts.h linux/drivers/scsi/hosts.h --- v2.5.1/linux/drivers/scsi/hosts.h Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/hosts.h Sun Dec 30 11:02:03 2001 @@ -521,17 +521,14 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt); -int scsi_register_device(struct Scsi_Device_Template * sdpnt); -/* These are used by loadable modules */ -extern int scsi_register_module(int, void *); -extern int scsi_unregister_module(int, void *); - -/* The different types of modules that we can load and unload */ -#define MODULE_SCSI_HA 1 -#define MODULE_SCSI_CONST 2 -#define MODULE_SCSI_IOCTL 3 -#define MODULE_SCSI_DEV 4 +/* + * Driver registration/unregistration. + */ +extern int scsi_register_device(struct Scsi_Device_Template *); +extern int scsi_unregister_device(struct Scsi_Device_Template *); +extern int scsi_register_host(Scsi_Host_Template *); +extern int scsi_unregister_host(Scsi_Host_Template *); /* diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c --- v2.5.1/linux/drivers/scsi/ide-scsi.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/ide-scsi.c Sat Dec 29 11:17:37 2001 @@ -50,7 +50,6 @@ #include "scsi.h" #include "hosts.h" #include "sd.h" -#include "ide-scsi.h" #include <scsi/sg.h> #define IDESCSI_DEBUG_LOG 0 @@ -840,13 +839,29 @@ return 0; } -static Scsi_Host_Template idescsi_template = IDESCSI; +static Scsi_Host_Template idescsi_template = { + module: THIS_MODULE, + name: "idescsi", + detect: idescsi_detect, + release: idescsi_release, + info: idescsi_info, + ioctl: idescsi_ioctl, + queuecommand: idescsi_queue, + abort: idescsi_abort, + reset: idescsi_reset, + bios_param: idescsi_bios, + can_queue: 10, + this_id: -1, + sg_tablesize: 256, + cmd_per_lun: 5, + use_clustering: DISABLE_CLUSTERING, + emulated: 1, +}; static int __init init_idescsi_module(void) { idescsi_init(); - idescsi_template.module = THIS_MODULE; - scsi_register_module (MODULE_SCSI_HA, &idescsi_template); + scsi_register_host(&idescsi_template); return 0; } @@ -856,7 +871,7 @@ byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255}; int i, failed; - scsi_unregister_module (MODULE_SCSI_HA, &idescsi_template); + scsi_unregister_host(&idescsi_template); for (i = 0; media[i] != 255; i++) { failed = 0; while ((drive = ide_scan_devices (media[i], idescsi_driver.name, &idescsi_driver, failed)) != NULL) diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/ide-scsi.h linux/drivers/scsi/ide-scsi.h --- v2.5.1/linux/drivers/scsi/ide-scsi.h Fri Apr 10 15:22:21 1998 +++ linux/drivers/scsi/ide-scsi.h Wed Dec 31 16:00:00 1969 @@ -1,37 +0,0 @@ -/* - * linux/drivers/scsi/ide-scsi.h - * - * Copyright (C) 1996, 1997 Gadi Oxman <gadio@netvision.net.il> - */ - -#ifndef IDESCSI_H -#define IDESCSI_H - -extern int idescsi_detect (Scsi_Host_Template *host_template); -extern int idescsi_release (struct Scsi_Host *host); -extern const char *idescsi_info (struct Scsi_Host *host); -extern int idescsi_ioctl (Scsi_Device *dev, int cmd, void *arg); -extern int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)); -extern int idescsi_abort (Scsi_Cmnd *cmd); -extern int idescsi_reset (Scsi_Cmnd *cmd, unsigned int resetflags); -extern int idescsi_bios (Disk *disk, kdev_t dev, int *parm); - -#define IDESCSI { \ - name: "idescsi", /* name */ \ - detect: idescsi_detect, /* detect */ \ - release: idescsi_release, /* release */ \ - info: idescsi_info, /* info */ \ - ioctl: idescsi_ioctl, /* ioctl */ \ - queuecommand: idescsi_queue, /* queuecommand */ \ - abort: idescsi_abort, /* abort */ \ - reset: idescsi_reset, /* reset */ \ - bios_param: idescsi_bios, /* bios_param */ \ - can_queue: 10, /* can_queue */ \ - this_id: -1, /* this_id */ \ - sg_tablesize: 256, /* sg_tablesize */ \ - cmd_per_lun: 5, /* cmd_per_lun */ \ - use_clustering: DISABLE_CLUSTERING, /* clustering */ \ - emulated: 1 /* emulated */ \ -} - -#endif /* IDESCSI_H */ diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/mac_scsi.c linux/drivers/scsi/mac_scsi.c --- v2.5.1/linux/drivers/scsi/mac_scsi.c Sat Nov 11 19:01:11 2000 +++ linux/drivers/scsi/mac_scsi.c Sat Dec 29 12:08:55 2001 @@ -353,7 +353,7 @@ NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE ); NCR5380_read( RESET_PARITY_INTERRUPT_REG ); - for( end = jiffies + AFTER_RESET_DELAY; jiffies < end; ) + for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); ) barrier(); /* switch on SCSI IRQ again */ diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/megaraid.c linux/drivers/scsi/megaraid.c --- v2.5.1/linux/drivers/scsi/megaraid.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/megaraid.c Thu Dec 27 08:17:43 2001 @@ -4290,26 +4290,18 @@ static int mega_partsize(Disk * disk, kdev_t dev, int *geom) { - struct buffer_head *bh; struct partition *p, *largest = NULL; int i, largest_cyl; int heads, cyls, sectors; int capacity = disk->capacity; + unsigned char *buf; - int ma = MAJOR(dev); - int mi = (MINOR(dev) & ~0xf); - - int block = 1024; - - if(blksize_size[ma]) - block = blksize_size[ma][mi]; - - if(!(bh = bread(MKDEV(ma,mi), 0, block))) + if (!(buf = scsi_bios_ptable(dev))) return -1; - if( *(unsigned short *)(bh->b_data + 510) == 0xAA55 ) { + if( *(unsigned short *)(buf + 64) == 0xAA55 ) { - for( largest_cyl = -1, p = (struct partition *)(0x1BE + bh->b_data), + for( largest_cyl = -1, p = (struct partition *)buf, i = 0; i < 4; ++i, ++p) { if (!p->sys_ind) continue; @@ -4328,7 +4320,7 @@ sectors = largest->end_sector & 0x3f; if (heads == 0 || sectors == 0) { - brelse(bh); + kfree(buf); return -1; } @@ -4338,11 +4330,11 @@ geom[1] = sectors; geom[2] = cyls; - brelse(bh); + kfree(buf); return 0; } - brelse(bh); + kfree(buf); return -1; } diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/osst.c linux/drivers/scsi/osst.c --- v2.5.1/linux/drivers/scsi/osst.c Tue Nov 13 09:19:41 2001 +++ linux/drivers/scsi/osst.c Tue Dec 25 17:04:40 2001 @@ -159,6 +159,7 @@ struct Scsi_Device_Template osst_template = { + module: THIS_MODULE, name: "OnStream tape", tag: "osst", scsi_type: TYPE_TAPE, @@ -5583,8 +5584,7 @@ static int __init init_osst(void) { validate_options(); - osst_template.module = THIS_MODULE; - return scsi_register_module(MODULE_SCSI_DEV, &osst_template); + return scsi_register_device(&osst_template); } static void __exit exit_osst (void) @@ -5592,7 +5592,7 @@ int i; OS_Scsi_Tape * STp; - scsi_unregister_module(MODULE_SCSI_DEV, &osst_template); + scsi_unregister_device(&osst_template); #ifdef CONFIG_DEVFS_FS devfs_unregister_chrdev(MAJOR_NR, "osst"); #else diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/pcmcia/aha152x_stub.c linux/drivers/scsi/pcmcia/aha152x_stub.c --- v2.5.1/linux/drivers/scsi/pcmcia/aha152x_stub.c Sun Sep 30 12:26:07 2001 +++ linux/drivers/scsi/pcmcia/aha152x_stub.c Tue Dec 25 17:04:40 2001 @@ -290,7 +290,7 @@ } aha152x_setup("PCMCIA setup", ints); - scsi_register_module(MODULE_SCSI_HA, &driver_template); + scsi_register_host(&driver_template); tail = &link->dev; info->ndev = 0; @@ -356,7 +356,7 @@ return; } - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); link->dev = NULL; CardServices(ReleaseConfiguration, link->handle); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/pcmcia/fdomain_stub.c linux/drivers/scsi/pcmcia/fdomain_stub.c --- v2.5.1/linux/drivers/scsi/pcmcia/fdomain_stub.c Fri Mar 2 18:38:39 2001 +++ linux/drivers/scsi/pcmcia/fdomain_stub.c Tue Dec 25 17:04:40 2001 @@ -254,7 +254,7 @@ ints[2] = link->irq.AssignedIRQ; fdomain_setup("PCMCIA setup", ints); - scsi_register_module(MODULE_SCSI_HA, &driver_template); + scsi_register_host(&driver_template); tail = &link->dev; info->ndev = 0; @@ -319,7 +319,7 @@ return; } - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); link->dev = NULL; CardServices(ReleaseConfiguration, link->handle); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/pcmcia/nsp_cs.c linux/drivers/scsi/pcmcia/nsp_cs.c --- v2.5.1/linux/drivers/scsi/pcmcia/nsp_cs.c Tue Dec 18 14:56:37 2001 +++ linux/drivers/scsi/pcmcia/nsp_cs.c Tue Dec 25 17:04:40 2001 @@ -1515,7 +1515,7 @@ goto cs_failed; } - scsi_register_module(MODULE_SCSI_HA, &driver_template); + scsi_register_host(&driver_template); DEBUG(0, "GET_SCSI_INFO\n"); tail = &link->dev; @@ -1611,7 +1611,7 @@ } /* Unlink the device chain */ - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); link->dev = NULL; if (link->win) { diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/pcmcia/qlogic_stub.c linux/drivers/scsi/pcmcia/qlogic_stub.c --- v2.5.1/linux/drivers/scsi/pcmcia/qlogic_stub.c Fri Mar 2 18:38:39 2001 +++ linux/drivers/scsi/pcmcia/qlogic_stub.c Tue Dec 25 17:04:40 2001 @@ -277,7 +277,7 @@ else qlogicfas_preset(link->io.BasePort1, link->irq.AssignedIRQ); - scsi_register_module(MODULE_SCSI_HA, &driver_template); + scsi_register_host(&driver_template); tail = &link->dev; info->ndev = 0; @@ -341,7 +341,7 @@ return; } - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); link->dev = NULL; CardServices(ReleaseConfiguration, link->handle); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/qla1280.c linux/drivers/scsi/qla1280.c --- v2.5.1/linux/drivers/scsi/qla1280.c Sun Sep 30 12:26:07 2001 +++ linux/drivers/scsi/qla1280.c Sun Dec 30 10:31:51 2001 @@ -192,7 +192,6 @@ #include <stdarg.h> #include <asm/io.h> #include <asm/irq.h> -#include <asm/segment.h> #include <asm/byteorder.h> #include <linux/version.h> #include <linux/types.h> diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/qlogicfas.c linux/drivers/scsi/qlogicfas.c --- v2.5.1/linux/drivers/scsi/qlogicfas.c Thu Oct 25 13:53:51 2001 +++ linux/drivers/scsi/qlogicfas.c Mon Dec 17 10:49:31 2001 @@ -467,10 +467,11 @@ static void do_ql_ihandl(int irq, void *dev_id, struct pt_regs * regs) { unsigned long flags; + struct Scsi_Host *host = dev_id; - spin_lock_irqsave(&io_request_lock, flags); + spin_lock_irqsave(&host->host_lock, flags); ql_ihandl(irq, dev_id, regs); - spin_unlock_irqrestore(&io_request_lock, flags); + spin_unlock_irqrestore(&host->host_lock, flags); } #endif diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v2.5.1/linux/drivers/scsi/scsi.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/scsi.c Thu Dec 27 08:30:10 2001 @@ -1405,9 +1405,6 @@ SCpnt->done(SCpnt); } -static int scsi_register_host(Scsi_Host_Template *); -static int scsi_unregister_host(Scsi_Host_Template *); - /* * Function: scsi_release_commandblocks() * @@ -1842,7 +1839,7 @@ * This entry point should be called by a driver if it is trying * to add a low level scsi driver to the system. */ -static int scsi_register_host(Scsi_Host_Template * tpnt) +int scsi_register_host(Scsi_Host_Template * tpnt) { int pcount; struct Scsi_Host *shpnt; @@ -1992,7 +1989,7 @@ * Similarly, this entry point should be called by a loadable module if it * is trying to remove a low level scsi driver from the system. */ -static int scsi_unregister_host(Scsi_Host_Template * tpnt) +int scsi_unregister_host(Scsi_Host_Template * tpnt) { int online_status; int pcount0, pcount; @@ -2203,22 +2200,27 @@ return -1; } -static int scsi_unregister_device(struct Scsi_Device_Template *tpnt); - /* * This entry point should be called by a loadable module if it is trying * add a high level scsi driver to the system. */ -static int scsi_register_device_module(struct Scsi_Device_Template *tpnt) +int scsi_register_device(struct Scsi_Device_Template *tpnt) { Scsi_Device *SDpnt; struct Scsi_Host *shpnt; int out_of_space = 0; +#ifdef CONFIG_KMOD + if (scsi_hosts == NULL) + request_module("scsi_hostadapter"); +#endif + if (tpnt->next) return 1; - scsi_register_device(tpnt); + tpnt->next = scsi_devicelist; + scsi_devicelist = tpnt; + /* * First scan the devices that we know about, and see if we notice them. */ @@ -2274,7 +2276,7 @@ return 0; } -static int scsi_unregister_device(struct Scsi_Device_Template *tpnt) +int scsi_unregister_device(struct Scsi_Device_Template *tpnt) { Scsi_Device *SDpnt; struct Scsi_Host *shpnt; @@ -2332,60 +2334,6 @@ error_out: unlock_kernel(); return -1; -} - - -/* This function should be called by drivers which needs to register - * with the midlevel scsi system. As of 2.4.0-test9pre3 this is our - * main device/hosts register function /mathiasen - */ -int scsi_register_module(int module_type, void *ptr) -{ - switch (module_type) { - case MODULE_SCSI_HA: - return scsi_register_host((Scsi_Host_Template *) ptr); - - /* Load upper level device handler of some kind */ - case MODULE_SCSI_DEV: -#ifdef CONFIG_KMOD - if (scsi_hosts == NULL) - request_module("scsi_hostadapter"); -#endif - return scsi_register_device_module((struct Scsi_Device_Template *) ptr); - /* The rest of these are not yet implemented */ - - /* Load constants.o */ - case MODULE_SCSI_CONST: - - /* Load specialized ioctl handler for some device. Intended for - * cdroms that have non-SCSI2 audio command sets. */ - case MODULE_SCSI_IOCTL: - - default: - return 1; - } -} - -/* Reverse the actions taken above - */ -int scsi_unregister_module(int module_type, void *ptr) -{ - int retval = 0; - - switch (module_type) { - case MODULE_SCSI_HA: - retval = scsi_unregister_host((Scsi_Host_Template *) ptr); - break; - case MODULE_SCSI_DEV: - retval = scsi_unregister_device((struct Scsi_Device_Template *)ptr); - break; - /* The rest of these are not yet implemented. */ - case MODULE_SCSI_CONST: - case MODULE_SCSI_IOCTL: - break; - default:; - } - return retval; } #ifdef CONFIG_PROC_FS diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h --- v2.5.1/linux/drivers/scsi/scsi.h Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/scsi.h Sun Dec 30 11:02:03 2001 @@ -434,7 +434,7 @@ /* * Prototypes for functions in scsicam.c */ -extern int scsi_partsize(struct buffer_head *bh, unsigned long capacity, +extern int scsi_partsize(unsigned char *buf, unsigned long capacity, unsigned int *cyls, unsigned int *hds, unsigned int *secs); @@ -548,10 +548,8 @@ */ struct scsi_device { -/* private: */ /* - * This information is private to the scsi mid-layer. Wrapping it in a - * struct private is a way of marking it in a sort of C++ type of way. + * This information is private to the scsi mid-layer. */ struct scsi_device *next; /* Used for linked list */ struct scsi_device *prev; /* Used for linked list */ @@ -563,7 +561,6 @@ volatile unsigned short device_busy; /* commands actually active on low-level */ Scsi_Cmnd *device_queue; /* queue of SCSI Command structures */ -/* public: */ unsigned int id, lun, channel; unsigned int manufacturer; /* Manufacturer of device, for using @@ -681,11 +678,7 @@ */ struct scsi_cmnd { int sc_magic; -/* private: */ - /* - * This information is private to the scsi mid-layer. Wrapping it in a - * struct private is a way of marking it in a sort of C++ type of way. - */ + struct Scsi_Host *host; unsigned short state; unsigned short owner; @@ -726,8 +719,6 @@ unsigned volatile char internal_timeout; struct scsi_cmnd *bh_next; /* To enumerate the commands waiting to be processed. */ - -/* public: */ unsigned int target; unsigned int lun; diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsi_merge.c linux/drivers/scsi/scsi_merge.c --- v2.5.1/linux/drivers/scsi/scsi_merge.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/scsi_merge.c Thu Dec 20 08:50:13 2001 @@ -59,12 +59,10 @@ */ int scsi_init_io(Scsi_Cmnd *SCpnt) { - struct request *req; + struct request *req = &SCpnt->request; struct scatterlist *sgpnt; int count, gfp_mask; - req = &SCpnt->request; - /* * First we need to know how many scatter gather segments are needed. */ @@ -85,14 +83,13 @@ BUG_ON(!sgpnt); SCpnt->request_buffer = (char *) sgpnt; - SCpnt->request_bufflen = 0; + SCpnt->request_bufflen = req->nr_sectors << 9; req->buffer = NULL; /* * Next, walk the list, and fill in the addresses and sizes of * each segment. */ - SCpnt->request_bufflen = req->nr_sectors << 9; count = blk_rq_map_sg(req->q, req, SCpnt->request_buffer); /* @@ -142,8 +139,7 @@ bounce_limit = BLK_BOUNCE_ANY; else bounce_limit = SHpnt->pci_dev->dma_mask; - } - if (SHpnt->unchecked_isa_dma) + } else if (SHpnt->unchecked_isa_dma) bounce_limit = BLK_BOUNCE_ISA; blk_queue_bounce_limit(q, bounce_limit); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsi_module.c linux/drivers/scsi/scsi_module.c --- v2.5.1/linux/drivers/scsi/scsi_module.c Wed Sep 20 13:11:53 2000 +++ linux/drivers/scsi/scsi_module.c Tue Dec 25 17:04:40 2001 @@ -35,17 +35,17 @@ static int __init init_this_scsi_driver(void) { driver_template.module = THIS_MODULE; - scsi_register_module(MODULE_SCSI_HA, &driver_template); + scsi_register_host(&driver_template); if (driver_template.present) return 0; - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); return -ENODEV; } static void __exit exit_this_scsi_driver(void) { - scsi_unregister_module(MODULE_SCSI_HA, &driver_template); + scsi_unregister_host(&driver_template); } module_init(init_this_scsi_driver); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsi_syms.c linux/drivers/scsi/scsi_syms.c --- v2.5.1/linux/drivers/scsi/scsi_syms.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/scsi_syms.c Thu Dec 27 08:17:43 2001 @@ -31,12 +31,15 @@ * This source file contains the symbol table used by scsi loadable * modules. */ -EXPORT_SYMBOL(scsi_register_module); -EXPORT_SYMBOL(scsi_unregister_module); +EXPORT_SYMBOL(scsi_register_device); +EXPORT_SYMBOL(scsi_unregister_device); +EXPORT_SYMBOL(scsi_register_host); +EXPORT_SYMBOL(scsi_unregister_host); EXPORT_SYMBOL(scsi_register); EXPORT_SYMBOL(scsi_unregister); EXPORT_SYMBOL(scsicam_bios_param); EXPORT_SYMBOL(scsi_partsize); +EXPORT_SYMBOL(scsi_bios_ptable); EXPORT_SYMBOL(scsi_allocate_device); EXPORT_SYMBOL(scsi_do_cmd); EXPORT_SYMBOL(scsi_command_size); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/scsicam.c linux/drivers/scsi/scsicam.c --- v2.5.1/linux/drivers/scsi/scsicam.c Thu Nov 18 19:09:14 1999 +++ linux/drivers/scsi/scsicam.c Thu Dec 27 08:17:43 2001 @@ -26,6 +26,22 @@ static int setsize(unsigned long capacity, unsigned int *cyls, unsigned int *hds, unsigned int *secs); +unsigned char *scsi_bios_ptable(kdev_t dev) +{ + unsigned char *res = kmalloc(66, GFP_KERNEL); + kdev_t rdev = MKDEV(MAJOR(dev), MINOR(dev) & ~0xf); + + if (res) { + struct buffer_head *bh = bread(rdev, 0, block_size(rdev)); + if (bh) { + memcpy(res, bh->b_data + 0x1be, 66); + } else { + kfree(res); + res = NULL; + } + } + return res; +} /* * Function : int scsicam_bios_param (Disk *disk, int dev, int *ip) @@ -42,26 +58,18 @@ kdev_t dev, /* Device major, minor */ int *ip /* Heads, sectors, cylinders in that order */ ) { - struct buffer_head *bh; int ret_code; int size = disk->capacity; unsigned long temp_cyl; + unsigned char *p = scsi_bios_ptable(dev); - int ma = MAJOR(dev); - int mi = (MINOR(dev) & ~0xf); - - int block = 1024; - - if(blksize_size[ma]) - block = blksize_size[ma][mi]; - - if (!(bh = bread(MKDEV(ma,mi), 0, block))) + if (!p) return -1; /* try to infer mapping from partition table */ - ret_code = scsi_partsize(bh, (unsigned long) size, (unsigned int *) ip + 2, + ret_code = scsi_partsize(p, (unsigned long) size, (unsigned int *) ip + 2, (unsigned int *) ip + 0, (unsigned int *) ip + 1); - brelse(bh); + kfree(p); if (ret_code == -1) { /* pick some standard mapping with at most 1024 cylinders, @@ -86,7 +94,7 @@ } /* - * Function : static int scsi_partsize(struct buffer_head *bh, unsigned long + * Function : static int scsi_partsize(unsigned char *buf, unsigned long * capacity,unsigned int *cyls, unsigned int *hds, unsigned int *secs); * * Purpose : to determine the BIOS mapping used to create the partition @@ -96,18 +104,17 @@ * */ -int scsi_partsize(struct buffer_head *bh, unsigned long capacity, +int scsi_partsize(unsigned char *buf, unsigned long capacity, unsigned int *cyls, unsigned int *hds, unsigned int *secs) { - struct partition *p, *largest = NULL; + struct partition *p = (struct partition *)buf, *largest = NULL; int i, largest_cyl; int cyl, ext_cyl, end_head, end_cyl, end_sector; unsigned int logical_end, physical_end, ext_physical_end; - if (*(unsigned short *) (bh->b_data + 510) == 0xAA55) { - for (largest_cyl = -1, p = (struct partition *) - (0x1BE + bh->b_data), i = 0; i < 4; ++i, ++p) { + if (*(unsigned short *) (buf + 66) == 0xAA55) { + for (largest_cyl = -1, i = 0; i < 4; ++i, ++p) { if (!p->sys_ind) continue; #ifdef DEBUG diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c --- v2.5.1/linux/drivers/scsi/sd.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/sd.c Sun Dec 30 10:18:25 2001 @@ -99,6 +99,7 @@ static int sd_init_command(Scsi_Cmnd *); static struct Scsi_Device_Template sd_template = { + module:THIS_MODULE, name:"disk", tag:"sd", scsi_type:TYPE_DISK, @@ -968,9 +969,9 @@ */ int hard_sector = sector_size; int sz = rscsi_disks[i].capacity * (hard_sector/256); + request_queue_t *queue = &rscsi_disks[i].device->request_queue; - /* There are 16 minors allocated for each major device */ - blk_queue_hardsect_size(blk_get_queue(SD_MAJOR(i)), hard_sector); + blk_queue_hardsect_size(queue, hard_sector); printk("SCSI device %s: " "%d %d-byte hdwr sectors (%d MB)\n", nbuff, rscsi_disks[i].capacity, @@ -1332,14 +1333,14 @@ static int __init init_sd(void) { sd_template.module = THIS_MODULE; - return scsi_register_module(MODULE_SCSI_DEV, &sd_template); + return scsi_register_device(&sd_template); } static void __exit exit_sd(void) { int i; - scsi_unregister_module(MODULE_SCSI_DEV, &sd_template); + scsi_unregister_device(&sd_template); for (i = 0; i < N_USED_SD_MAJORS; i++) devfs_unregister_blkdev(SD_MAJOR(i), "sd"); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/sg.c linux/drivers/scsi/sg.c --- v2.5.1/linux/drivers/scsi/sg.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/sg.c Tue Dec 25 17:04:40 2001 @@ -121,6 +121,7 @@ static struct Scsi_Device_Template sg_template = { + module:THIS_MODULE, tag:"sg", scsi_type:0xff, major:SCSI_GENERIC_MAJOR, @@ -1378,8 +1379,7 @@ static int __init init_sg(void) { if (def_reserved_size >= 0) sg_big_buff = def_reserved_size; - sg_template.module = THIS_MODULE; - return scsi_register_module(MODULE_SCSI_DEV, &sg_template); + return scsi_register_device(&sg_template); } static void __exit exit_sg( void) @@ -1387,7 +1387,7 @@ #ifdef CONFIG_PROC_FS sg_proc_cleanup(); #endif /* CONFIG_PROC_FS */ - scsi_unregister_module(MODULE_SCSI_DEV, &sg_template); + scsi_unregister_device(&sg_template); devfs_unregister_chrdev(SCSI_GENERIC_MAJOR, "sg"); if(sg_dev_arr != NULL) { kfree((char *)sg_dev_arr); diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v2.5.1/linux/drivers/scsi/sr.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/scsi/sr.c Sun Dec 30 10:10:05 2001 @@ -71,6 +71,7 @@ static struct Scsi_Device_Template sr_template = { + module:THIS_MODULE, name:"cdrom", tag:"sr", scsi_type:TYPE_ROM, @@ -287,9 +288,6 @@ return 0; } - if (rq_data_dir(&SCpnt->request) == WRITE && !scsi_CDs[dev].device->writeable) - return 0; - /* * we do lazy blocksize switching (when reading XA sectors, * see CDROMREADMODE2 ioctl) @@ -477,6 +475,7 @@ int the_result, retries; int sector_size; Scsi_Request *SRpnt; + request_queue_t *queue; buffer = (unsigned char *) kmalloc(512, GFP_DMA); SRpnt = scsi_allocate_request(scsi_CDs[i].device); @@ -566,8 +565,9 @@ */ scsi_CDs[i].needs_sector_size = 0; sr_sizes[i] = scsi_CDs[i].capacity >> (BLOCK_SIZE_BITS - 9); - }; - blk_queue_hardsect_size(blk_get_queue(MAJOR_NR), sector_size); + } + queue = &scsi_CDs[i].device->request_queue; + blk_queue_hardsect_size(queue, sector_size); kfree(buffer); } @@ -829,13 +829,12 @@ static int __init init_sr(void) { - sr_template.module = THIS_MODULE; - return scsi_register_module(MODULE_SCSI_DEV, &sr_template); + return scsi_register_device(&sr_template); } static void __exit exit_sr(void) { - scsi_unregister_module(MODULE_SCSI_DEV, &sr_template); + scsi_unregister_device(&sr_template); devfs_unregister_blkdev(MAJOR_NR, "sr"); sr_registered--; if (scsi_CDs != NULL) { diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/st.c linux/drivers/scsi/st.c --- v2.5.1/linux/drivers/scsi/st.c Fri Nov 9 13:52:21 2001 +++ linux/drivers/scsi/st.c Tue Dec 25 17:04:40 2001 @@ -3867,14 +3867,14 @@ validate_options(); st_template.module = THIS_MODULE; - return scsi_register_module(MODULE_SCSI_DEV, &st_template); + return scsi_register_device(&st_template); } static void __exit exit_st(void) { int i; - scsi_unregister_module(MODULE_SCSI_DEV, &st_template); + scsi_unregister_device(&st_template); devfs_unregister_chrdev(SCSI_TAPE_MAJOR, "st"); st_registered--; if (scsi_tapes != NULL) { diff -u --recursive --new-file v2.5.1/linux/drivers/scsi/tmscsim.c linux/drivers/scsi/tmscsim.c --- v2.5.1/linux/drivers/scsi/tmscsim.c Sun Sep 30 12:26:08 2001 +++ linux/drivers/scsi/tmscsim.c Thu Dec 27 08:17:43 2001 @@ -1371,7 +1371,7 @@ #include <asm/unaligned.h> /* - * Function : static int partsize(struct buffer_head *bh, unsigned long + * Function : static int partsize(unsigned char *buf, unsigned long * capacity,unsigned int *cyls, unsigned int *hds, unsigned int *secs); * * Purpose : to determine the BIOS mapping used to create the partition @@ -1381,7 +1381,7 @@ * */ -static int partsize(struct buffer_head *bh, unsigned long capacity, +static int partsize(unsigned char *buf, unsigned long capacity, unsigned int *cyls, unsigned int *hds, unsigned int *secs) { struct partition *p, *largest = NULL; int i, largest_cyl; @@ -1389,9 +1389,9 @@ unsigned int logical_end, physical_end, ext_physical_end; - if (*(unsigned short *) (bh->b_data+510) == 0xAA55) { - for (largest_cyl = -1, p = (struct partition *) - (0x1BE + bh->b_data), i = 0; i < 4; ++i, ++p) { + if (*(unsigned short *) (buf+64) == 0xAA55) { + for (largest_cyl = -1, p = (struct partition *) buf, + i = 0; i < 4; ++i, ++p) { if (!p->sys_ind) continue; cyl = p->cyl + ((p->sector & 0xc0) << 2); @@ -1446,16 +1446,16 @@ { int heads, sectors, cylinders; PACB pACB = (PACB) disk->device->host->hostdata; - struct buffer_head *bh; int ret_code = -1; int size = disk->capacity; + unsigned char *buf; - if ((bh = bread(MKDEV(MAJOR(devno), MINOR(devno)&~0xf), 0, 1024))) + if ((buf = scsi_bios_ptable(devno))) { /* try to infer mapping from partition table */ - ret_code = partsize (bh, (unsigned long) size, (unsigned int *) geom + 2, + ret_code = partsize (buf, (unsigned long) size, (unsigned int *) geom + 2, (unsigned int *) geom + 0, (unsigned int *) geom + 1); - brelse (bh); + kfree (buf); } if (ret_code == -1) { diff -u --recursive --new-file v2.5.1/linux/drivers/sgi/char/sgiserial.c linux/drivers/sgi/char/sgiserial.c --- v2.5.1/linux/drivers/sgi/char/sgiserial.c Mon Aug 27 08:56:31 2001 +++ linux/drivers/sgi/char/sgiserial.c Tue Dec 25 15:39:20 2001 @@ -49,8 +49,6 @@ #define NUM_SERIAL 1 /* One chip on board. */ #define NUM_CHANNELS (NUM_SERIAL * 2) -extern wait_queue_head_t keypress_wait; - struct sgi_zslayout *zs_chips[NUM_SERIAL] = { 0, }; struct sgi_zschannel *zs_channels[NUM_CHANNELS] = { 0, 0, }; struct sgi_zschannel *zs_conschan; @@ -428,8 +426,6 @@ show_buffers(); return; } - /* It is a 'keyboard interrupt' ;-) */ - wake_up(&keypress_wait); } /* Look for kgdb 'stop' character, consult the gdb documentation * for remote target debugging and arch/sparc/kernel/sparc-stub.c @@ -2117,12 +2113,6 @@ rs_fair_output(); } -static int zs_console_wait_key(struct console *con) -{ - sleep_on(&keypress_wait); - return 0; -} - static kdev_t zs_console_device(struct console *con) { return MKDEV(TTY_MAJOR, 64 + con->index); @@ -2274,7 +2264,6 @@ name: "ttyS", write: zs_console_write, device: zs_console_device, - wait_key: zs_console_wait_key, setup: zs_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/sound/msnd.c linux/drivers/sound/msnd.c --- v2.5.1/linux/drivers/sound/msnd.c Sun Sep 30 12:26:08 2001 +++ linux/drivers/sound/msnd.c Sun Dec 30 10:31:51 2001 @@ -39,7 +39,6 @@ # include <linux/major.h> # include <linux/fs.h> # include <linux/sound.h> -# include <asm/segment.h> # include "sound_config.h" #else # include <linux/init.h> diff -u --recursive --new-file v2.5.1/linux/drivers/sound/os.h linux/drivers/sound/os.h --- v2.5.1/linux/drivers/sound/os.h Thu Nov 22 11:49:20 2001 +++ linux/drivers/sound/os.h Sun Dec 30 11:02:55 2001 @@ -25,7 +25,6 @@ #include <asm/page.h> #include <asm/system.h> #ifdef __alpha__ -#include <asm/segment.h> #endif #include <linux/vmalloc.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c --- v2.5.1/linux/drivers/sound/soundcard.c Sun Sep 30 12:26:08 2001 +++ linux/drivers/sound/soundcard.c Sun Dec 30 10:31:51 2001 @@ -35,7 +35,6 @@ #include <linux/kmod.h> #include <asm/dma.h> #include <asm/io.h> -#include <asm/segment.h> #include <linux/wait.h> #include <linux/slab.h> #include <linux/ioport.h> diff -u --recursive --new-file v2.5.1/linux/drivers/sound/sscape.c linux/drivers/sound/sscape.c --- v2.5.1/linux/drivers/sound/sscape.c Sun Sep 30 12:26:08 2001 +++ linux/drivers/sound/sscape.c Sun Dec 30 10:31:51 2001 @@ -34,7 +34,6 @@ #include <linux/kmod.h> #include <asm/dma.h> #include <asm/io.h> -#include <asm/segment.h> #include <linux/wait.h> #include <linux/slab.h> #include <linux/ioport.h> diff -u --recursive --new-file v2.5.1/linux/drivers/tc/zs.c linux/drivers/tc/zs.c --- v2.5.1/linux/drivers/tc/zs.c Mon Aug 27 08:56:31 2001 +++ linux/drivers/tc/zs.c Sun Dec 30 10:31:51 2001 @@ -64,7 +64,6 @@ #include <asm/pgtable.h> #include <asm/irq.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/uaccess.h> #include <asm/wbflush.h> @@ -2125,18 +2124,6 @@ } } -/* - * Receive character from the serial port - */ -static int serial_console_wait_key(struct console *co) -{ - struct dec_serial *info; - - info = zs_soft + co->index; - - return zs_poll_rx_char(info); -} - static kdev_t serial_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); @@ -2271,7 +2258,6 @@ name: "ttyS", write: serial_console_write, device: serial_console_device, - wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, diff -u --recursive --new-file v2.5.1/linux/drivers/telephony/ixj.c linux/drivers/telephony/ixj.c --- v2.5.1/linux/drivers/telephony/ixj.c Thu Oct 25 13:53:52 2001 +++ linux/drivers/telephony/ixj.c Sun Dec 30 10:31:51 2001 @@ -268,7 +268,6 @@ #include <linux/pci.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/isapnp.h> diff -u --recursive --new-file v2.5.1/linux/drivers/usb/hpusbscsi.c linux/drivers/usb/hpusbscsi.c --- v2.5.1/linux/drivers/usb/hpusbscsi.c Tue Oct 9 15:15:02 2001 +++ linux/drivers/usb/hpusbscsi.c Tue Dec 25 17:04:40 2001 @@ -117,7 +117,7 @@ (struct hpusbscsi *) new->ctempl.proc_dir = new; new->ctempl.module = THIS_MODULE; - if (scsi_register_module (MODULE_SCSI_HA, &(new->ctempl))) + if (scsi_register_host(&new->ctempl)) goto err_out; /* adding to list for module unload */ @@ -185,7 +185,7 @@ tmp = tmp->next; o = (struct hpusbscsi *)old; usb_unlink_urb(&o->controlurb); - scsi_unregister_module(MODULE_SCSI_HA,&o->ctempl); + scsi_unregister_host(&o->ctempl); kfree(old); } diff -u --recursive --new-file v2.5.1/linux/drivers/usb/microtek.c linux/drivers/usb/microtek.c --- v2.5.1/linux/drivers/usb/microtek.c Tue Dec 18 14:56:38 2001 +++ linux/drivers/usb/microtek.c Tue Dec 25 17:04:40 2001 @@ -367,7 +367,7 @@ } MTS_DEBUG_GOT_HERE(); - scsi_unregister_module(MODULE_SCSI_HA, &(to_remove->ctempl)); + scsi_unregister_host(&to_remove->ctempl); unlock_kernel(); kfree( to_remove ); @@ -982,11 +982,11 @@ MTS_DEBUG("registering SCSI module\n"); new_desc->ctempl.module = THIS_MODULE; - result = scsi_register_module(MODULE_SCSI_HA, &(new_desc->ctempl)); + result = scsi_register_host(&new_desc->ctempl); /* Will get hit back in microtek_detect by this func */ if ( result ) { - MTS_ERROR( "error %d from scsi_register_module! Help!\n", + MTS_ERROR( "error %d from scsi_register_host! Help!\n", (int)result ); /* FIXME: need more cleanup? */ diff -u --recursive --new-file v2.5.1/linux/drivers/usb/storage/usb.c linux/drivers/usb/storage/usb.c --- v2.5.1/linux/drivers/usb/storage/usb.c Sun Nov 11 10:01:32 2001 +++ linux/drivers/usb/storage/usb.c Tue Dec 25 17:04:40 2001 @@ -1002,7 +1002,7 @@ /* now register - our detect function will be called */ ss->htmplt.module = THIS_MODULE; - scsi_register_module(MODULE_SCSI_HA, &(ss->htmplt)); + scsi_register_host(&ss->htmplt); /* lock access to the data structures */ down(&us_list_semaphore); @@ -1107,8 +1107,8 @@ * interface */ for (next = us_list; next; next = next->next) { - US_DEBUGP("-- calling scsi_unregister_module()\n"); - scsi_unregister_module(MODULE_SCSI_HA, &(next->htmplt)); + US_DEBUGP("-- calling scsi_unregister_host()\n"); + scsi_unregister_host(&next->htmplt); } /* While there are still structures, free them. Note that we are diff -u --recursive --new-file v2.5.1/linux/drivers/video/aty/atyfb_base.c linux/drivers/video/aty/atyfb_base.c --- v2.5.1/linux/drivers/video/aty/atyfb_base.c Tue Oct 30 15:08:11 2001 +++ linux/drivers/video/aty/atyfb_base.c Sun Dec 30 09:40:59 2001 @@ -2891,3 +2891,4 @@ } #endif +MODULE_LICENSE("GPL"); diff -u --recursive --new-file v2.5.1/linux/drivers/video/dn_cfb4.c linux/drivers/video/dn_cfb4.c --- v2.5.1/linux/drivers/video/dn_cfb4.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/video/dn_cfb4.c Sun Dec 30 10:31:51 2001 @@ -7,7 +7,6 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <asm/setup.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/irq.h> #include <asm/amigahw.h> diff -u --recursive --new-file v2.5.1/linux/drivers/video/dn_cfb8.c linux/drivers/video/dn_cfb8.c --- v2.5.1/linux/drivers/video/dn_cfb8.c Mon Oct 15 13:47:13 2001 +++ linux/drivers/video/dn_cfb8.c Sun Dec 30 10:31:51 2001 @@ -7,7 +7,6 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <asm/setup.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/irq.h> #include <asm/amigahw.h> diff -u --recursive --new-file v2.5.1/linux/drivers/video/dnfb.c linux/drivers/video/dnfb.c --- v2.5.1/linux/drivers/video/dnfb.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/video/dnfb.c Sun Dec 30 10:31:51 2001 @@ -7,7 +7,6 @@ #include <linux/delay.h> #include <linux/interrupt.h> #include <asm/setup.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/irq.h> #include <asm/amigahw.h> diff -u --recursive --new-file v2.5.1/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c --- v2.5.1/linux/drivers/video/fbmem.c Wed Nov 14 15:41:37 2001 +++ linux/drivers/video/fbmem.c Sun Dec 30 09:40:59 2001 @@ -576,12 +576,13 @@ return -EINVAL; off += start; vma->vm_pgoff = off >> PAGE_SHIFT; + /* This is an IO map - tell maydump to skip this VMA */ + vma->vm_flags |= VM_IO; #if defined(__sparc_v9__) vma->vm_flags |= (VM_SHM | VM_LOCKED); if (io_remap_page_range(vma->vm_start, off, vma->vm_end - vma->vm_start, vma->vm_page_prot, 0)) return -EAGAIN; - vma->vm_flags |= VM_IO; #else #if defined(__mc68000__) #if defined(CONFIG_SUN3) @@ -607,8 +608,6 @@ pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED; #elif defined(__arm__) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - /* This is an IO map - tell maydump to skip this VMA */ - vma->vm_flags |= VM_IO; #elif defined(__sh__) pgprot_val(vma->vm_page_prot) &= ~_PAGE_CACHABLE; #else @@ -931,3 +930,5 @@ #if 1 /* to go away in 2.5.0 */ EXPORT_SYMBOL(GET_FB_IDX); #endif + +MODULE_LICENSE("GPL"); diff -u --recursive --new-file v2.5.1/linux/drivers/video/q40fb.c linux/drivers/video/q40fb.c --- v2.5.1/linux/drivers/video/q40fb.c Thu Sep 13 16:04:43 2001 +++ linux/drivers/video/q40fb.c Sun Dec 30 10:31:51 2001 @@ -9,7 +9,6 @@ #include <asm/uaccess.h> #include <asm/setup.h> -#include <asm/segment.h> #include <asm/system.h> /*#include <asm/irq.h>*/ #include <asm/q40_master.h> diff -u --recursive --new-file v2.5.1/linux/fs/Config.in linux/fs/Config.in --- v2.5.1/linux/fs/Config.in Mon Nov 12 09:34:16 2001 +++ linux/fs/Config.in Tue Dec 25 15:39:20 2001 @@ -45,7 +45,7 @@ fi tristate 'Compressed ROM file system support' CONFIG_CRAMFS bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS -tristate 'Simple RAM-based file system support' CONFIG_RAMFS +define_bool CONFIG_RAMFS y tristate 'ISO 9660 CDROM file system support' CONFIG_ISO9660_FS dep_mbool ' Microsoft Joliet CDROM extensions' CONFIG_JOLIET $CONFIG_ISO9660_FS diff -u --recursive --new-file v2.5.1/linux/fs/adfs/inode.c linux/fs/adfs/inode.c --- v2.5.1/linux/fs/adfs/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/adfs/inode.c Sun Dec 30 10:53:53 2001 @@ -37,11 +37,8 @@ goto abort_toobig; block = __adfs_block_map(inode->i_sb, inode->i_ino, block); - if (block) { - bh->b_dev = inode->i_dev; - bh->b_blocknr = block; - bh->b_state |= (1UL << BH_Mapped); - } + if (block) + map_bh(bh, inode->i_sb, block); return 0; } /* don't support allocation of blocks yet */ @@ -251,7 +248,6 @@ if (!inode) goto out; - inode->i_version = ++event; inode->i_uid = sb->u.adfs_sb.s_uid; inode->i_gid = sb->u.adfs_sb.s_gid; inode->i_ino = obj->file_id; diff -u --recursive --new-file v2.5.1/linux/fs/adfs/super.c linux/fs/adfs/super.c --- v2.5.1/linux/fs/adfs/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/adfs/super.c Tue Dec 25 15:39:20 2001 @@ -319,8 +319,7 @@ if (parse_options(sb, data)) goto error; - sb->s_blocksize = BLOCK_SIZE; - set_blocksize(dev, BLOCK_SIZE); + sb_set_blocksize(sb, BLOCK_SIZE); if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) { adfs_error(sb, "unable to read superblock"); goto error; @@ -347,14 +346,8 @@ goto error_free_bh; } - sb->s_blocksize_bits = dr->log2secsize; - sb->s_blocksize = 1 << sb->s_blocksize_bits; - if (sb->s_blocksize != BLOCK_SIZE && - (sb->s_blocksize == 512 || sb->s_blocksize == 1024 || - sb->s_blocksize == 2048 || sb->s_blocksize == 4096)) { - - brelse(bh); - set_blocksize(dev, sb->s_blocksize); + brelse(bh); + if (sb_set_blocksize(sb, 1 << dr->log2secsize)) { bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize); if (!bh) { adfs_error(sb, "couldn't read superblock on " @@ -367,12 +360,11 @@ goto error_free_bh; } dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); - } - if (sb->s_blocksize != bh->b_size) { + } else { if (!silent) printk(KERN_ERR "VFS: Unsupported blocksize on dev " "%s.\n", bdevname(dev)); - goto error_free_bh; + goto error; } /* diff -u --recursive --new-file v2.5.1/linux/fs/affs/file.c linux/fs/affs/file.c --- v2.5.1/linux/fs/affs/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/affs/file.c Thu Dec 27 08:17:43 2001 @@ -355,9 +355,7 @@ ext_bh = affs_get_extblock(inode, ext); if (IS_ERR(ext_bh)) goto err_ext; - bh_result->b_blocknr = be32_to_cpu(AFFS_BLOCK(sb, ext_bh, block)); - bh_result->b_dev = inode->i_dev; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, be32_to_cpu(AFFS_BLOCK(sb, ext_bh, block))); if (create) { u32 blocknr = affs_alloc_block(inode, ext_bh->b_blocknr); diff -u --recursive --new-file v2.5.1/linux/fs/affs/super.c linux/fs/affs/super.c --- v2.5.1/linux/fs/affs/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/affs/super.c Tue Dec 25 15:39:20 2001 @@ -327,10 +327,6 @@ got_root: root_block = AFFS_SB->s_root_block; - sb->s_blocksize_bits = blocksize == 512 ? 9 : - blocksize == 1024 ? 10 : - blocksize == 2048 ? 11 : 12; - /* Find out which kind of FS we have */ boot_bh = sb_bread(sb, 0); if (!boot_bh) { diff -u --recursive --new-file v2.5.1/linux/fs/autofs/inode.c linux/fs/autofs/inode.c --- v2.5.1/linux/fs/autofs/inode.c Thu Oct 25 00:02:26 2001 +++ linux/fs/autofs/inode.c Sat Dec 29 17:30:07 2001 @@ -11,6 +11,7 @@ * ------------------------------------------------------------------------- */ #include <linux/kernel.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/file.h> #include <linux/locks.h> diff -u --recursive --new-file v2.5.1/linux/fs/bfs/dir.c linux/fs/bfs/dir.c --- v2.5.1/linux/fs/bfs/dir.c Tue Dec 18 14:56:39 2001 +++ linux/fs/bfs/dir.c Sun Dec 30 10:53:53 2001 @@ -28,13 +28,12 @@ struct inode * dir = f->f_dentry->d_inode; struct buffer_head * bh; struct bfs_dirent * de; - kdev_t dev = dir->i_dev; unsigned int offset; int block; if (f->f_pos & (BFS_DIRENT_SIZE-1)) { printf("Bad f_pos=%08lx for %s:%08lx\n", (unsigned long)f->f_pos, - bdevname(dev), dir->i_ino); + bdevname(dir->i_dev), dir->i_ino); return -EBADF; } @@ -174,7 +173,6 @@ inode->i_nlink = 1; } de->ino = 0; - dir->i_version = ++event; mark_buffer_dirty(bh); dir->i_ctime = dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); @@ -227,7 +225,6 @@ } old_de->ino = 0; old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; - old_dir->i_version = ++event; mark_inode_dirty(old_dir); if (new_inode) { new_inode->i_nlink--; @@ -256,7 +253,6 @@ struct buffer_head * bh; struct bfs_dirent * de; int block, sblock, eblock, off; - kdev_t dev; int i; dprintf("name=%s, namelen=%d\n", name, namelen); @@ -266,7 +262,6 @@ if (namelen > BFS_NAMELEN) return -ENAMETOOLONG; - dev = dir->i_dev; sblock = dir->iu_sblock; eblock = dir->iu_eblock; for (block=sblock; block<=eblock; block++) { @@ -282,7 +277,6 @@ } dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); - dir->i_version = ++event; de->ino = ino; for (i=0; i<BFS_NAMELEN; i++) de->name[i] = (i < namelen) ? name[i] : 0; diff -u --recursive --new-file v2.5.1/linux/fs/bfs/file.c linux/fs/bfs/file.c --- v2.5.1/linux/fs/bfs/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/bfs/file.c Thu Dec 27 08:17:43 2001 @@ -25,14 +25,14 @@ mmap: generic_file_mmap, }; -static int bfs_move_block(unsigned long from, unsigned long to, kdev_t dev) +static int bfs_move_block(unsigned long from, unsigned long to, struct super_block *sb) { struct buffer_head *bh, *new; - bh = bread(dev, from, BFS_BSIZE); + bh = sb_bread(sb, from); if (!bh) return -EIO; - new = getblk(dev, to, BFS_BSIZE); + new = sb_getblk(sb, to); memcpy(new->b_data, bh->b_data, bh->b_size); mark_buffer_dirty(new); bforget(bh); @@ -40,14 +40,14 @@ return 0; } -static int bfs_move_blocks(kdev_t dev, unsigned long start, unsigned long end, +static int bfs_move_blocks(struct super_block *sb, unsigned long start, unsigned long end, unsigned long where) { unsigned long i; dprintf("%08lx-%08lx->%08lx\n", start, end, where); for (i = start; i <= end; i++) - if(bfs_move_block(i, where + i, dev)) { + if(bfs_move_block(i, where + i, sb)) { dprintf("failed to move block %08lx -> %08lx\n", i, where + i); return -EIO; } @@ -69,9 +69,7 @@ if (!create) { if (phys <= inode->iu_eblock) { dprintf("c=%d, b=%08lx, phys=%08lx (granted)\n", create, block, phys); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, phys); } return 0; } @@ -81,9 +79,7 @@ if (inode->i_size && phys <= inode->iu_eblock) { dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", create, block, phys); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, phys); return 0; } @@ -95,9 +91,7 @@ if (inode->iu_eblock == sb->su_lf_eblk) { dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", create, block, phys); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, phys); sb->su_freeb -= phys - inode->iu_eblock; sb->su_lf_eblk = inode->iu_eblock = phys; mark_inode_dirty(inode); @@ -109,7 +103,7 @@ /* Ok, we have to move this entire file to the next free block */ phys = sb->su_lf_eblk + 1; if (inode->iu_sblock) { /* if data starts on block 0 then there is no data */ - err = bfs_move_blocks(inode->i_dev, inode->iu_sblock, + err = bfs_move_blocks(inode->i_sb, inode->iu_sblock, inode->iu_eblock, phys); if (err) { dprintf("failed to move ino=%08lx -> fs corruption\n", inode->i_ino); @@ -128,9 +122,7 @@ sb->su_freeb -= inode->iu_eblock - inode->iu_sblock + 1 - inode->i_blocks; mark_inode_dirty(inode); mark_buffer_dirty(sbh); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, phys); out: unlock_kernel(); return err; diff -u --recursive --new-file v2.5.1/linux/fs/bfs/inode.c linux/fs/bfs/inode.c --- v2.5.1/linux/fs/bfs/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/bfs/inode.c Thu Dec 27 08:17:43 2001 @@ -35,13 +35,12 @@ static void bfs_read_inode(struct inode * inode) { unsigned long ino = inode->i_ino; - kdev_t dev = inode->i_dev; struct bfs_inode * di; struct buffer_head * bh; int block, off; if (ino < BFS_ROOT_INO || ino > inode->i_sb->su_lasti) { - printf("Bad inode number %s:%08lx\n", bdevname(dev), ino); + printf("Bad inode number %s:%08lx\n", bdevname(inode->i_dev), ino); make_bad_inode(inode); return; } @@ -49,7 +48,7 @@ block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; bh = sb_bread(inode->i_sb, block); if (!bh) { - printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino); + printf("Unable to read inode %s:%08lx\n", bdevname(inode->i_dev), ino); make_bad_inode(inode); return; } @@ -88,13 +87,12 @@ static void bfs_write_inode(struct inode * inode, int unused) { unsigned long ino = inode->i_ino; - kdev_t dev = inode->i_dev; struct bfs_inode * di; struct buffer_head * bh; int block, off; if (ino < BFS_ROOT_INO || ino > inode->i_sb->su_lasti) { - printf("Bad inode number %s:%08lx\n", bdevname(dev), ino); + printf("Bad inode number %s:%08lx\n", bdevname(inode->i_dev), ino); return; } @@ -102,7 +100,7 @@ block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; bh = sb_bread(inode->i_sb, block); if (!bh) { - printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino); + printf("Unable to read inode %s:%08lx\n", bdevname(inode->i_dev), ino); unlock_kernel(); return; } @@ -135,7 +133,6 @@ static void bfs_delete_inode(struct inode * inode) { unsigned long ino = inode->i_ino; - kdev_t dev = inode->i_dev; struct bfs_inode * di; struct buffer_head * bh; int block, off; @@ -155,7 +152,7 @@ block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; bh = sb_bread(s, block); if (!bh) { - printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino); + printf("Unable to read inode %s:%08lx\n", bdevname(inode->i_dev), ino); unlock_kernel(); return; } @@ -241,16 +238,12 @@ static struct super_block * bfs_read_super(struct super_block * s, void * data, int silent) { - kdev_t dev; struct buffer_head * bh; struct bfs_super_block * bfs_sb; struct inode * inode; int i, imap_len; - dev = s->s_dev; - set_blocksize(dev, BFS_BSIZE); - s->s_blocksize = BFS_BSIZE; - s->s_blocksize_bits = BFS_BSIZE_BITS; + sb_set_blocksize(s, BFS_BSIZE); bh = sb_bread(s, 0); if(!bh) @@ -259,11 +252,11 @@ if (bfs_sb->s_magic != BFS_MAGIC) { if (!silent) printf("No BFS filesystem on %s (magic=%08x)\n", - bdevname(dev), bfs_sb->s_magic); + bdevname(s->s_dev), bfs_sb->s_magic); goto out; } if (BFS_UNCLEAN(bfs_sb, s) && !silent) - printf("%s is unclean, continuing\n", bdevname(dev)); + printf("%s is unclean, continuing\n", bdevname(s->s_dev)); s->s_magic = BFS_MAGIC; s->su_bfs_sb = bfs_sb; diff -u --recursive --new-file v2.5.1/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c --- v2.5.1/linux/fs/binfmt_elf.c Sat Oct 20 19:16:59 2001 +++ linux/fs/binfmt_elf.c Sun Dec 30 10:51:45 2001 @@ -32,7 +32,7 @@ #include <linux/highuid.h> #include <linux/smp_lock.h> #include <linux/compiler.h> -#include <linux/limits.h> +#include <linux/highmem.h> #include <asm/uaccess.h> #include <asm/param.h> @@ -505,30 +505,10 @@ #if 0 printk("Using ELF interpreter %s\n", elf_interpreter); #endif -#ifdef __sparc__ - if (ibcs2_interpreter) { - unsigned long old_pers = current->personality; - struct exec_domain *old_domain = current->exec_domain; - struct exec_domain *new_domain; - struct fs_struct *old_fs = current->fs, *new_fs; - get_exec_domain(old_domain); - atomic_inc(&old_fs->count); - - set_personality(PER_SVR4); - interpreter = open_exec(elf_interpreter); - - new_domain = current->exec_domain; - new_fs = current->fs; - current->personality = old_pers; - current->exec_domain = old_domain; - current->fs = old_fs; - put_exec_domain(new_domain); - put_fs_struct(new_fs); - } else -#endif - { - interpreter = open_exec(elf_interpreter); - } + + SET_PERSONALITY(elf_ex, ibcs2_interpreter); + + interpreter = open_exec(elf_interpreter); retval = PTR_ERR(interpreter); if (IS_ERR(interpreter)) goto out_free_interp; @@ -602,10 +582,6 @@ current->flags &= ~PF_FORKNOEXEC; elf_entry = (unsigned long) elf_ex.e_entry; - /* Do this immediately, since STACK_TOP as used in setup_arg_pages - may depend on the personality. */ - SET_PERSONALITY(elf_ex, ibcs2_interpreter); - /* Do this so that we can load the interpreter, if need be. We will change some of these later */ current->mm->rss = 0; @@ -1032,6 +1008,25 @@ elf_fpregset_t fpu; /* NT_PRFPREG */ struct elf_prpsinfo psinfo; /* NT_PRPSINFO */ + /* first copy the parameters from user space */ + memset(&psinfo, 0, sizeof(psinfo)); + { + int i, len; + + len = current->mm->arg_end - current->mm->arg_start; + if (len >= ELF_PRARGSZ) + len = ELF_PRARGSZ-1; + copy_from_user(&psinfo.pr_psargs, + (const char *)current->mm->arg_start, len); + for(i = 0; i < len; i++) + if (psinfo.pr_psargs[i] == 0) + psinfo.pr_psargs[i] = ' '; + psinfo.pr_psargs[len] = 0; + + } + + /* now stop all vm operations */ + down_write(¤t->mm->mmap_sem); segs = current->mm->map_count; #ifdef DEBUG @@ -1073,7 +1068,6 @@ * Set up the notes in similar form to SVR4 core dumps made * with info from their /proc. */ - memset(&psinfo, 0, sizeof(psinfo)); memset(&prstatus, 0, sizeof(prstatus)); notes[0].name = "CORE"; @@ -1129,23 +1123,6 @@ psinfo.pr_flag = current->flags; psinfo.pr_uid = NEW_TO_OLD_UID(current->uid); psinfo.pr_gid = NEW_TO_OLD_GID(current->gid); - { - int i, len; - - set_fs(fs); - - len = current->mm->arg_end - current->mm->arg_start; - if (len >= ELF_PRARGSZ) - len = ELF_PRARGSZ-1; - copy_from_user(&psinfo.pr_psargs, - (const char *)current->mm->arg_start, len); - for(i = 0; i < len; i++) - if (psinfo.pr_psargs[i] == 0) - psinfo.pr_psargs[i] = ' '; - psinfo.pr_psargs[len] = 0; - - set_fs(KERNEL_DS); - } strncpy(psinfo.pr_fname, current->comm, sizeof(psinfo.pr_fname)); notes[2].name = "CORE"; @@ -1217,8 +1194,6 @@ if (!writenote(¬es[i], file)) goto end_coredump; - set_fs(fs); - DUMP_SEEK(dataoff); for(vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) { @@ -1232,22 +1207,24 @@ for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - - pgd = pgd_offset(vma->vm_mm, addr); - if (pgd_none(*pgd)) - goto nextpage_coredump; - pmd = pmd_offset(pgd, addr); - if (pmd_none(*pmd)) - goto nextpage_coredump; - pte = pte_offset(pmd, addr); - if (pte_none(*pte)) { -nextpage_coredump: + struct page* page; + struct vm_area_struct *vma; + + if (get_user_pages(current, current->mm, addr, 1, 0, 1, + &page, &vma) <= 0) { DUMP_SEEK (file->f_pos + PAGE_SIZE); } else { - DUMP_WRITE((void*)addr, PAGE_SIZE); + if (page == ZERO_PAGE(addr)) { + DUMP_SEEK (file->f_pos + PAGE_SIZE); + } else { + void *kaddr; + flush_cache_page(vma, addr); + kaddr = kmap(page); + DUMP_WRITE(kaddr, PAGE_SIZE); + flush_page_to_ram(page); + kunmap(page); + } + put_page(page); } } } @@ -1260,6 +1237,7 @@ end_coredump: set_fs(fs); + up_write(¤t->mm->mmap_sem); return has_dumped; } #endif /* USE_ELF_CORE_DUMP */ diff -u --recursive --new-file v2.5.1/linux/fs/bio.c linux/fs/bio.c --- v2.5.1/linux/fs/bio.c Tue Dec 18 14:56:39 2001 +++ linux/fs/bio.c Thu Dec 27 08:15:15 2001 @@ -142,6 +142,7 @@ bio->bi_io_vec = bvl; return bio; } + mempool_free(bio, bio_pool); return NULL; } @@ -311,28 +312,6 @@ return NULL; } -#ifdef BIO_PAGEIO -static int bio_end_io_page(struct bio *bio) -{ - struct page *page = bio_page(bio); - - if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) - SetPageError(page); - if (!PageError(page)) - SetPageUptodate(page); - - /* - * Run the hooks that have to be done when a page I/O has completed. - */ - if (PageTestandClearDecrAfter(page)) - atomic_dec(&nr_async_pages); - - UnlockPage(page); - bio_put(bio); - return 1; -} -#endif - static int bio_end_io_kio(struct bio *bio, int nr_sectors) { struct kiobuf *kio = (struct kiobuf *) bio->bi_private; @@ -465,7 +444,10 @@ else clear_bit(BIO_UPTODATE, &bio->bi_flags); - return bio->bi_end_io(bio, nr_sectors); + if (bio->bi_end_io) + return bio->bi_end_io(bio, nr_sectors); + + return 0; } static void __init biovec_init_pool(void) diff -u --recursive --new-file v2.5.1/linux/fs/block_dev.c linux/fs/block_dev.c --- v2.5.1/linux/fs/block_dev.c Tue Dec 18 14:56:39 2001 +++ linux/fs/block_dev.c Thu Dec 27 08:29:15 2001 @@ -102,6 +102,26 @@ return 0; } +int sb_set_blocksize(struct super_block *sb, int size) +{ + int bits; + if (set_blocksize(sb->s_dev, size) < 0) + return 0; + sb->s_blocksize = size; + for (bits = 9, size >>= 9; size >>= 1; bits++) + ; + sb->s_blocksize_bits = bits; + return sb->s_blocksize; +} + +int sb_min_blocksize(struct super_block *sb, int size) +{ + int minsize = get_hardsect_size(sb->s_dev); + if (size < minsize) + size = minsize; + return sb_set_blocksize(sb, size); +} + static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer_head * bh, int create) { if (iblock >= max_block(inode->i_rdev)) @@ -499,7 +519,10 @@ de = devfs_find_handle (NULL, NULL, i, MINOR (dev), DEVFS_SPECIAL_BLK, 0); - if (de) bdops = devfs_get_ops (de); + if (de) { + bdops = devfs_get_ops (de); + devfs_put_ops (de); /* We're running in owner module */ + } } if (bdops == NULL) return 0; diff -u --recursive --new-file v2.5.1/linux/fs/buffer.c linux/fs/buffer.c --- v2.5.1/linux/fs/buffer.c Tue Dec 18 14:56:39 2001 +++ linux/fs/buffer.c Thu Dec 27 08:17:43 2001 @@ -324,7 +324,7 @@ lock_kernel(); sync_inodes_sb(sb); - DQUOT_SYNC(dev); + DQUOT_SYNC(sb); lock_super(sb); if (sb->s_dirt && sb->s_op && sb->s_op->write_super) sb->s_op->write_super(sb); @@ -346,7 +346,14 @@ lock_kernel(); sync_inodes(dev); - DQUOT_SYNC(dev); + if (dev) { + struct super_block *sb = get_super(dev); + if (sb) { + DQUOT_SYNC(sb); + drop_super(sb); + } + } else + DQUOT_SYNC(NULL); sync_supers(dev); unlock_kernel(); @@ -1444,7 +1451,7 @@ return 1; } -void create_empty_buffers(struct page *page, kdev_t dev, unsigned long blocksize) +void create_empty_buffers(struct page *page, unsigned long blocksize) { struct buffer_head *bh, *head, *tail; @@ -1455,8 +1462,6 @@ bh = head; do { - bh->b_dev = dev; - bh->b_blocknr = 0; bh->b_end_io = NULL; tail = bh; bh = bh->b_this_page; @@ -1518,7 +1523,7 @@ BUG(); if (!page->buffers) - create_empty_buffers(page, inode->i_dev, 1 << inode->i_blkbits); + create_empty_buffers(page, 1 << inode->i_blkbits); head = page->buffers; block = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); @@ -1585,7 +1590,7 @@ blocksize = 1 << inode->i_blkbits; if (!page->buffers) - create_empty_buffers(page, inode->i_dev, blocksize); + create_empty_buffers(page, blocksize); head = page->buffers; bbits = inode->i_blkbits; @@ -1702,7 +1707,7 @@ PAGE_BUG(page); blocksize = 1 << inode->i_blkbits; if (!page->buffers) - create_empty_buffers(page, inode->i_dev, blocksize); + create_empty_buffers(page, blocksize); head = page->buffers; blocks = PAGE_CACHE_SIZE >> inode->i_blkbits; @@ -1907,7 +1912,7 @@ goto out; if (!page->buffers) - create_empty_buffers(page, inode->i_dev, blocksize); + create_empty_buffers(page, blocksize); /* Find the buffer that contains "offset" */ bh = page->buffers; @@ -2123,13 +2128,14 @@ panic("brw_page: page not locked for I/O"); if (!page->buffers) - create_empty_buffers(page, dev, size); + create_empty_buffers(page, size); head = bh = page->buffers; /* Stage 1: lock all the buffers */ do { lock_buffer(bh); bh->b_blocknr = *(b++); + bh->b_dev = dev; set_bit(BH_Mapped, &bh->b_state); set_buffer_async_io(bh); bh = bh->b_this_page; diff -u --recursive --new-file v2.5.1/linux/fs/char_dev.c linux/fs/char_dev.c --- v2.5.1/linux/fs/char_dev.c Fri Nov 2 11:48:21 2001 +++ linux/fs/char_dev.c Sat Dec 29 17:30:07 2001 @@ -6,6 +6,7 @@ #include <linux/config.h> #include <linux/init.h> +#include <linux/fs.h> #include <linux/slab.h> #define HASH_BITS 6 diff -u --recursive --new-file v2.5.1/linux/fs/coda/cache.c linux/fs/coda/cache.c --- v2.5.1/linux/fs/coda/cache.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/cache.c Sun Dec 30 10:31:51 2001 @@ -14,7 +14,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #include <linux/list.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/coda_linux.c linux/fs/coda/coda_linux.c --- v2.5.1/linux/fs/coda/coda_linux.c Wed Apr 25 16:18:54 2001 +++ linux/fs/coda/coda_linux.c Sun Dec 30 10:31:51 2001 @@ -15,7 +15,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/file.c linux/fs/coda/file.c --- v2.5.1/linux/fs/coda/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/file.c Sun Dec 30 10:31:51 2001 @@ -16,7 +16,6 @@ #include <linux/errno.h> #include <linux/locks.h> #include <linux/smp_lock.h> -#include <asm/segment.h> #include <linux/string.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/inode.c linux/fs/coda/inode.c --- v2.5.1/linux/fs/coda/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/inode.c Sun Dec 30 10:31:51 2001 @@ -25,7 +25,6 @@ #include <linux/fs.h> #include <linux/vmalloc.h> -#include <asm/segment.h> #include <linux/coda.h> #include <linux/coda_linux.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/pioctl.c linux/fs/coda/pioctl.c --- v2.5.1/linux/fs/coda/pioctl.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/pioctl.c Sun Dec 30 10:31:51 2001 @@ -14,7 +14,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <linux/string.h> #define __NO_VERSION__ #include <linux/module.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/psdev.c linux/fs/coda/psdev.c --- v2.5.1/linux/fs/coda/psdev.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/psdev.c Sun Dec 30 10:31:51 2001 @@ -38,7 +38,6 @@ #include <linux/list.h> #include <linux/smp_lock.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/poll.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/fs/coda/sysctl.c linux/fs/coda/sysctl.c --- v2.5.1/linux/fs/coda/sysctl.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/sysctl.c Sun Dec 30 10:31:51 2001 @@ -21,7 +21,6 @@ #include <linux/stat.h> #include <linux/ctype.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/utsname.h> #define __NO_VERSION__ diff -u --recursive --new-file v2.5.1/linux/fs/coda/upcall.c linux/fs/coda/upcall.c --- v2.5.1/linux/fs/coda/upcall.c Tue Dec 18 14:56:39 2001 +++ linux/fs/coda/upcall.c Sun Dec 30 10:31:51 2001 @@ -15,7 +15,6 @@ */ #include <asm/system.h> -#include <asm/segment.h> #include <asm/signal.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/fs/cramfs/inode.c linux/fs/cramfs/inode.c --- v2.5.1/linux/fs/cramfs/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/cramfs/inode.c Tue Dec 25 15:39:20 2001 @@ -195,9 +195,7 @@ unsigned long root_offset; struct super_block * retval = NULL; - set_blocksize(sb->s_dev, PAGE_CACHE_SIZE); - sb->s_blocksize = PAGE_CACHE_SIZE; - sb->s_blocksize_bits = PAGE_CACHE_SHIFT; + sb_set_blocksize(sb, PAGE_CACHE_SIZE); /* Invalidate the read buffers on mount: think disk change.. */ for (i = 0; i < READ_BUFFERS; i++) diff -u --recursive --new-file v2.5.1/linux/fs/devfs/base.c linux/fs/devfs/base.c --- v2.5.1/linux/fs/devfs/base.c Tue Dec 18 14:56:39 2001 +++ linux/fs/devfs/base.c Sun Dec 30 10:31:51 2001 @@ -427,7 +427,7 @@ Work sponsored by SGI. v0.92 20000306 Richard Gooch <rgooch@atnf.csiro.au> - Added DEVFS_FL_NO_PERSISTENCE flag. + Added DEVFS_ FL_NO_PERSISTENCE flag. Removed unnecessary call to <update_devfs_inode_from_entry> in <devfs_readdir>. Work sponsored by SGI. @@ -517,7 +517,6 @@ 20010730 Richard Gooch <rgooch@atnf.csiro.au> Added DEVFSD_NOTIFY_DELETE event. 20010801 Richard Gooch <rgooch@atnf.csiro.au> - Removed #include <asm/segment.h>. v0.109 20010807 Richard Gooch <rgooch@atnf.csiro.au> Fixed inode table races by removing it and using @@ -562,6 +561,45 @@ 20011122 Richard Gooch <rgooch@atnf.csiro.au> Use slab cache rather than fixed buffer for devfsd events. v1.1 + 20011125 Richard Gooch <rgooch@atnf.csiro.au> + Send DEVFSD_NOTIFY_REGISTERED events in <devfs_mk_dir>. + 20011127 Richard Gooch <rgooch@atnf.csiro.au> + Fixed locking bug in <devfs_d_revalidate_wait> due to typo. + Do not send CREATE, CHANGE, ASYNC_OPEN or DELETE events from + devfsd or children. + v1.2 + 20011202 Richard Gooch <rgooch@atnf.csiro.au> + Fixed bug in <devfsd_read>: was dereferencing freed pointer. + v1.3 + 20011203 Richard Gooch <rgooch@atnf.csiro.au> + Fixed bug in <devfsd_close>: was dereferencing freed pointer. + Added process group check for devfsd privileges. + v1.4 + 20011204 Richard Gooch <rgooch@atnf.csiro.au> + Use SLAB_ATOMIC in <devfsd_notify_de> from <devfs_d_delete>. + v1.5 + 20011211 Richard Gooch <rgooch@atnf.csiro.au> + Return old entry in <devfs_mk_dir> for 2.4.x kernels. + 20011212 Richard Gooch <rgooch@atnf.csiro.au> + Increment refcount on module in <check_disc_changed>. + 20011215 Richard Gooch <rgooch@atnf.csiro.au> + Created <devfs_get_handle> and exported <devfs_put>. + Increment refcount on module in <devfs_get_ops>. + Created <devfs_put_ops>. + v1.6 + 20011216 Richard Gooch <rgooch@atnf.csiro.au> + Added poisoning to <devfs_put>. + Improved debugging messages. + v1.7 + 20011221 Richard Gooch <rgooch@atnf.csiro.au> + Corrected (made useful) debugging message in <unregister>. + Moved <kmem_cache_create> in <mount_devfs_fs> to <init_devfs_fs> + 20011224 Richard Gooch <rgooch@atnf.csiro.au> + Added magic number to guard against scribbling drivers. + 20011226 Richard Gooch <rgooch@atnf.csiro.au> + Only return old entry in <devfs_mk_dir> if a directory. + Defined macros for error and debug messages. + v1.8 */ #include <linux/types.h> #include <linux/errno.h> @@ -594,13 +632,16 @@ #include <asm/bitops.h> #include <asm/atomic.h> -#define DEVFS_VERSION "1.1 (20011122)" +#define DEVFS_VERSION "1.8 (20011226)" #define DEVFS_NAME "devfs" #define FIRST_INODE 1 #define STRING_LENGTH 256 +#define FAKE_BLOCK_SIZE 1024 +#define POISON_PTR ( *(void **) poison_array ) +#define MAGIC_VALUE 0x327db823 #ifndef TRUE # define TRUE 1 @@ -637,9 +678,28 @@ #define OPTION_MOUNT 0x01 #define OPTION_ONLY 0x02 -#define OOPS(format, args...) {printk (format, ## args); \ - printk ("Forcing Oops\n"); \ - BUG();} +#define PRINTK(format, args...) \ + {printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);} + +#define OOPS(format, args...) \ + {printk (KERN_CRIT "%s" format, __FUNCTION__ , ## args); \ + printk ("Forcing Oops\n"); \ + BUG();} + +#ifdef CONFIG_DEVFS_DEBUG +# define VERIFY_ENTRY(de) \ + {if ((de) && (de)->magic_number != MAGIC_VALUE) \ + OOPS ("(%p): bad magic value: %x\n", (de), (de)->magic_number);} +# define WRITE_ENTRY_MAGIC(de,magic) (de)->magic_number = (magic) +# define DPRINTK(flag, format, args...) \ + {if (devfs_debug & flag) \ + printk (KERN_INFO "%s" format, __FUNCTION__ , ## args);} +#else +# define VERIFY_ENTRY(de) +# define WRITE_ENTRY_MAGIC(de,magic) +# define DPRINTK(flag, format, args...) +#endif + struct directory_type { @@ -696,6 +756,9 @@ struct devfs_entry { +#ifdef CONFIG_DEVFS_DEBUG + unsigned int magic_number; +#endif void *info; atomic_t refcount; /* When this drops to zero, it's unused */ union @@ -740,6 +803,7 @@ struct devfsd_buf_entry *devfsd_last_event; volatile int devfsd_sleeping; volatile struct task_struct *devfsd_task; + volatile pid_t devfsd_pgrp; volatile struct file *devfsd_file; struct devfsd_notify_struct *devfsd_info; volatile unsigned long devfsd_event_mask; @@ -757,6 +821,8 @@ static unsigned int stat_num_entries; static unsigned int stat_num_bytes; #endif +static unsigned char poison_array[8] = + {0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a}; #ifdef CONFIG_DEVFS_MOUNT static unsigned int boot_options = OPTION_MOUNT; @@ -802,27 +868,26 @@ static struct devfs_entry *devfs_get (struct devfs_entry *de) { + VERIFY_ENTRY (de); if (de) atomic_inc (&de->refcount); return de; } /* End Function devfs_get */ /** * devfs_put - Put (release) a reference to a devfs entry. - * @de: The devfs entry. + * @de: The handle to the devfs entry. */ -static void devfs_put (struct devfs_entry *de) +void devfs_put (devfs_handle_t de) { if (!de) return; + VERIFY_ENTRY (de); + if (de->info == POISON_PTR) OOPS ("(%p): poisoned pointer\n", de); if ( !atomic_dec_and_test (&de->refcount) ) return; - if (de == root_entry) - OOPS ("%s: devfs_put(): root entry being freed\n", DEVFS_NAME); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_FREE) - printk ("%s: devfs_put(%s): de: %p, parent: %p \"%s\"\n", - DEVFS_NAME, de->name, de, de->parent, - de->parent ? de->parent->name : "no parent"); -#endif + if (de == root_entry) OOPS ("(%p): root entry being freed\n", de); + DPRINTK (DEBUG_FREE, "(%s): de: %p, parent: %p \"%s\"\n", + de->name, de, de->parent, + de->parent ? de->parent->name : "no parent"); if ( S_ISLNK (de->mode) ) kfree (de->u.symlink.linkname); if ( ( S_ISCHR (de->mode) || S_ISBLK (de->mode) ) && de->u.fcb.autogen ) { @@ -831,6 +896,7 @@ MKDEV (de->u.fcb.u.device.major, de->u.fcb.u.device.minor) ); } + WRITE_ENTRY_MAGIC (de, 0); #ifdef CONFIG_DEVFS_DEBUG spin_lock (&stat_lock); --stat_num_entries; @@ -838,6 +904,7 @@ if ( S_ISLNK (de->mode) ) stat_num_bytes -= de->u.symlink.length + 1; spin_unlock (&stat_lock); #endif + de->info = POISON_PTR; kfree (de); } /* End Function devfs_put */ @@ -860,7 +927,7 @@ if ( !S_ISDIR (dir->mode) ) { - printk ("%s: search_dir(%s): not a directory\n", DEVFS_NAME,dir->name); + PRINTK ("(%s): not a directory\n", dir->name); return NULL; } for (curr = dir->u.dir.first; curr != NULL; curr = curr->next) @@ -893,7 +960,7 @@ if ( name && (namelen < 1) ) namelen = strlen (name); if ( ( new = kmalloc (sizeof *new + namelen, GFP_KERNEL) ) == NULL ) return NULL; - memset (new, 0, sizeof *new + namelen); + memset (new, 0, sizeof *new + namelen); /* Will set '\0' on name */ new->mode = mode; if ( S_ISDIR (mode) ) rwlock_init (&new->u.dir.lock); atomic_set (&new->refcount, 1); @@ -902,6 +969,7 @@ spin_unlock (&counter_lock); if (name) memcpy (new->name, name, namelen); new->namelen = namelen; + WRITE_ENTRY_MAGIC (new, MAGIC_VALUE); #ifdef CONFIG_DEVFS_DEBUG spin_lock (&stat_lock); ++stat_num_entries; @@ -918,7 +986,7 @@ * @de: The devfs entry to append. * @removable: If TRUE, increment the count of removable devices for %dir. * @old_de: If an existing entry exists, it will be written here. This may - * be %NULL. + * be %NULL. An implicit devfs_get() is performed on this entry. * * Append a devfs entry to a directory's list of children, checking first to * see if an entry of the same name exists. The directory will be locked. @@ -934,8 +1002,7 @@ if (old_de) *old_de = NULL; if ( !S_ISDIR (dir->mode) ) { - printk ("%s: append_entry(%s): dir: \"%s\" is not a directory\n", - DEVFS_NAME, de->name, dir->name); + PRINTK ("(%s): dir: \"%s\" is not a directory\n", de->name, dir->name); devfs_put (de); return -ENOTDIR; } @@ -1105,15 +1172,13 @@ if ( ( *dir = _devfs_make_parent_for_leaf (*dir, name, namelen, &leaf_pos) ) == NULL ) { - printk ("%s: prepare_leaf(%s): could not create parent path\n", - DEVFS_NAME, name); + PRINTK ("(%s): could not create parent path\n", name); return NULL; } if ( ( de = _devfs_alloc_entry (name + leaf_pos, namelen - leaf_pos,mode) ) == NULL ) { - printk ("%s: prepare_leaf(%s): could not allocate entry\n", - DEVFS_NAME, name); + PRINTK ("(%s): could not allocate entry\n", name); devfs_put (*dir); return NULL; } @@ -1160,19 +1225,20 @@ /** - * find_by_dev - Find a devfs entry in a directory. + * _devfs_find_by_dev - Find a devfs entry in a directory. * @dir: The directory where to search * @major: The major number to search for. * @minor: The minor number to search for. * @type: The type of special file to search for. This may be either * %DEVFS_SPECIAL_CHR or %DEVFS_SPECIAL_BLK. * - * Returns the devfs_entry pointer on success, else %NULL. + * Returns the devfs_entry pointer on success, else %NULL. An implicit + * devfs_get() is performed. */ -static struct devfs_entry *find_by_dev (struct devfs_entry *dir, - unsigned int major, unsigned int minor, - char type) +static struct devfs_entry *_devfs_find_by_dev (struct devfs_entry *dir, + unsigned int major, + unsigned int minor, char type) { struct devfs_entry *entry, *de; @@ -1180,7 +1246,7 @@ if (dir == NULL) return NULL; if ( !S_ISDIR (dir->mode) ) { - printk ("%s: find_by_dev(): not a directory\n", DEVFS_NAME); + PRINTK ("(%p): not a directory\n", dir); devfs_put (dir); return NULL; } @@ -1205,7 +1271,7 @@ for (entry = dir->u.dir.first; entry != NULL; entry = entry->next) { if ( !S_ISDIR (entry->mode) ) continue; - de = find_by_dev (entry, major, minor, type); + de = _devfs_find_by_dev (entry, major, minor, type); if (de) { read_unlock (&dir->u.dir.lock); @@ -1216,51 +1282,51 @@ read_unlock (&dir->u.dir.lock); devfs_put (dir); return NULL; -} /* End Function find_by_dev */ +} /* End Function _devfs_find_by_dev */ /** - * find_entry - Find a devfs entry. + * _devfs_find_entry - Find a devfs entry. * @dir: The handle to the parent devfs directory entry. If this is %NULL the * name is relative to the root of the devfs. - * @name: The name of the entry. This is ignored if @handle is not %NULL. - * @namelen: The number of characters in @name, not including a %NULL - * terminator. If this is 0, then @name must be %NULL-terminated and the - * length is computed internally. - * @major: The major number. This is used if @handle and @name are %NULL. - * @minor: The minor number. This is used if @handle and @name are %NULL. + * @name: The name of the entry. This may be %NULL. + * @major: The major number. This is used if lookup by @name fails. + * @minor: The minor number. This is used if lookup by @name fails. * NOTE: If @major and @minor are both 0, searching by major and minor * numbers is disabled. * @type: The type of special file to search for. This may be either * %DEVFS_SPECIAL_CHR or %DEVFS_SPECIAL_BLK. * @traverse_symlink: If %TRUE then symbolic links are traversed. * - * Returns the devfs_entry pointer on success, else %NULL. + * Returns the devfs_entry pointer on success, else %NULL. An implicit + * devfs_get() is performed. */ -static struct devfs_entry *find_entry (devfs_handle_t dir, - const char *name, unsigned int namelen, - unsigned int major, unsigned int minor, - char type, int traverse_symlink) +static struct devfs_entry *_devfs_find_entry (devfs_handle_t dir, + const char *name, + unsigned int major, + unsigned int minor, + char type, int traverse_symlink) { struct devfs_entry *entry; if (name != NULL) { - if (namelen < 1) namelen = strlen (name); + unsigned int namelen = strlen (name); + if (name[0] == '/') { /* Skip leading pathname component */ if (namelen < 2) { - printk ("%s: find_entry(%s): too short\n", DEVFS_NAME, name); + PRINTK ("(%s): too short\n", name); return NULL; } for (++name, --namelen; (*name != '/') && (namelen > 0); ++name, --namelen); if (namelen < 2) { - printk ("%s: find_entry(%s): too short\n", DEVFS_NAME, name); + PRINTK ("(%s): too short\n", name); return NULL; } ++name; @@ -1271,12 +1337,13 @@ } /* Have to search by major and minor: slow */ if ( (major == 0) && (minor == 0) ) return NULL; - return find_by_dev (root_entry, major, minor, type); -} /* End Function find_entry */ + return _devfs_find_by_dev (root_entry, major, minor, type); +} /* End Function _devfs_find_entry */ static struct devfs_entry *get_devfs_entry_from_vfs_inode (struct inode *inode) { if (inode == NULL) return NULL; + VERIFY_ENTRY ( (struct devfs_entry *) inode->u.generic_ip ); return inode->u.generic_ip; } /* End Function get_devfs_entry_from_vfs_inode */ @@ -1315,10 +1382,14 @@ { struct task_struct *p; - for (p = current; p != &init_task; p = p->p_opptr) + if (current == fs_info->devfsd_task) return (TRUE); + if (current->pgrp == fs_info->devfsd_pgrp) return (TRUE); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,1) + for (p = current->p_opptr; p != &init_task; p = p->p_opptr) { if (p == fs_info->devfsd_task) return (TRUE); } +#endif return (FALSE); } /* End Function is_devfsd_or_child */ @@ -1375,13 +1446,16 @@ static int devfsd_notify_de (struct devfs_entry *de, unsigned short type, umode_t mode, - uid_t uid, gid_t gid, struct fs_info *fs_info) + uid_t uid, gid_t gid, struct fs_info *fs_info, + int atomic) { struct devfsd_buf_entry *entry; struct devfs_entry *curr; if ( !( fs_info->devfsd_event_mask & (1 << type) ) ) return (FALSE); - if ( ( entry = kmem_cache_alloc (devfsd_buf_cache, 0) ) == NULL ) + if ( ( entry = kmem_cache_alloc (devfsd_buf_cache, + atomic ? SLAB_ATOMIC : SLAB_KERNEL) ) + == NULL ) { atomic_inc (&fs_info->devfsd_overrun_count); return (FALSE); @@ -1414,7 +1488,7 @@ static void devfsd_notify (struct devfs_entry *de,unsigned short type,int wait) { if (devfsd_notify_de (de, type, de->mode, current->euid, - current->egid, &fs_info) && wait) + current->egid, &fs_info, 0) && wait) wait_for_devfsd_finished (&fs_info); } /* End Function devfsd_notify */ @@ -1451,7 +1525,7 @@ if (name == NULL) { - printk ("%s: devfs_register(): NULL name pointer\n", DEVFS_NAME); + PRINTK ("(): NULL name pointer\n"); return NULL; } if (ops == NULL) @@ -1459,23 +1533,19 @@ if ( S_ISBLK (mode) ) ops = (void *) get_blkfops (major); if (ops == NULL) { - printk ("%s: devfs_register(%s): NULL ops pointer\n", - DEVFS_NAME, name); + PRINTK ("(%s): NULL ops pointer\n", name); return NULL; } - printk ("%s: devfs_register(%s): NULL ops, got %p from major table\n", - DEVFS_NAME, name, ops); + PRINTK ("(%s): NULL ops, got %p from major table\n", name, ops); } if ( S_ISDIR (mode) ) { - printk("%s: devfs_register(%s): creating directories is not allowed\n", - DEVFS_NAME, name); + PRINTK ("(%s): creating directories is not allowed\n", name); return NULL; } if ( S_ISLNK (mode) ) { - printk ("%s: devfs_register(%s): creating symlinks is not allowed\n", - DEVFS_NAME, name); + PRINTK ("(%s): creating symlinks is not allowed\n", name); return NULL; } if ( ( S_ISCHR (mode) || S_ISBLK (mode) ) && @@ -1483,8 +1553,8 @@ { if ( ( devnum = devfs_alloc_devnum (devtype) ) == NODEV ) { - printk ("%s: devfs_register(%s): exhausted %s device numbers\n", - DEVFS_NAME, name, S_ISCHR (mode) ? "char" : "block"); + PRINTK ("(%s): exhausted %s device numbers\n", + name, S_ISCHR (mode) ? "char" : "block"); return NULL; } major = MAJOR (devnum); @@ -1492,8 +1562,7 @@ } if ( ( de = _devfs_prepare_leaf (&dir, name, mode) ) == NULL ) { - printk ("%s: devfs_register(%s): could not prepare leaf\n", - DEVFS_NAME, name); + PRINTK ("(%s): could not prepare leaf\n", name); if (devnum != NODEV) devfs_dealloc_devnum (devtype, devnum); return NULL; } @@ -1505,8 +1574,7 @@ } else if ( !S_ISREG (mode) ) { - printk ("%s: devfs_register(%s): illegal mode: %x\n", - DEVFS_NAME, name, mode); + PRINTK ("(%s): illegal mode: %x\n", name, mode); devfs_put (de); devfs_put (dir); return (NULL); @@ -1530,17 +1598,13 @@ if ( ( err = _devfs_append_entry (dir, de, de->u.fcb.removable, NULL) ) != 0 ) { - printk("%s: devfs_register(%s): could not append to parent, err: %d\n", - DEVFS_NAME, name, err); + PRINTK ("(%s): could not append to parent, err: %d\n", name, err); devfs_put (dir); if (devnum != NODEV) devfs_dealloc_devnum (devtype, devnum); return NULL; } -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_REGISTER) - printk ("%s: devfs_register(%s): de: %p dir: %p \"%s\" pp: %p\n", - DEVFS_NAME, name, de, dir, dir->name, dir->parent); -#endif + DPRINTK (DEBUG_REGISTER, "(%s): de: %p dir: %p \"%s\" pp: %p\n", + name, de, dir, dir->name, dir->parent); devfsd_notify (de, DEVFSD_NOTIFY_REGISTERED, flags & DEVFS_FL_WAIT); devfs_put (dir); return de; @@ -1576,7 +1640,7 @@ /** - * unregister - Unregister a device entry from it's parent. + * _devfs_unregister - Unregister a device entry from it's parent. * @dir: The parent directory. * @de: The entry to unregister. * @@ -1584,7 +1648,7 @@ * unlocked by this function. */ -static void unregister (struct devfs_entry *dir, struct devfs_entry *de) +static void _devfs_unregister (struct devfs_entry *dir, struct devfs_entry *de) { int unhooked = _devfs_unhook (de); @@ -1603,34 +1667,30 @@ write_lock (&de->u.dir.lock); de->u.dir.no_more_additions = TRUE; child = de->u.dir.first; - unregister (de, child); + VERIFY_ENTRY (child); + _devfs_unregister (de, child); if (!child) break; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_UNREGISTER) - printk ("%s: unregister(): child->name: \"%s\" child: %p\n", - DEVFS_NAME, child->name, child); -#endif + DPRINTK (DEBUG_UNREGISTER, "(%s): child: %p refcount: %d\n", + child->name, child, atomic_read (&child->refcount) ); devfs_put (child); } -} /* End Function unregister */ +} /* End Function _devfs_unregister */ /** * devfs_unregister - Unregister a device entry. * @de: A handle previously created by devfs_register() or returned from - * devfs_find_handle(). If this is %NULL the routine does nothing. + * devfs_get_handle(). If this is %NULL the routine does nothing. */ void devfs_unregister (devfs_handle_t de) { + VERIFY_ENTRY (de); if ( (de == NULL) || (de->parent == NULL) ) return; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_UNREGISTER) - printk ("%s: devfs_unregister(): de->name: \"%s\" de: %p\n", - DEVFS_NAME, de->name, de); -#endif + DPRINTK (DEBUG_UNREGISTER, "(%s): de: %p refcount: %d\n", + de->name, de, atomic_read (&de->refcount) ); write_lock (&de->parent->u.dir.lock); - unregister (de->parent, de); + _devfs_unregister (de->parent, de); devfs_put (de); } /* End Function devfs_unregister */ @@ -1646,16 +1706,12 @@ if (handle != NULL) *handle = NULL; if (name == NULL) { - printk ("%s: devfs_do_symlink(): NULL name pointer\n", DEVFS_NAME); + PRINTK ("(): NULL name pointer\n"); return -EINVAL; } -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_REGISTER) - printk ("%s: devfs_do_symlink(%s)\n", DEVFS_NAME, name); -#endif if (link == NULL) { - printk ("%s: devfs_do_symlink(): NULL link pointer\n", DEVFS_NAME); + PRINTK ("(%s): NULL link pointer\n", name); return -EINVAL; } linklength = strlen (link); @@ -1666,8 +1722,7 @@ if ( ( de = _devfs_prepare_leaf (&dir, name, S_IFLNK | S_IRUGO | S_IXUGO) ) == NULL ) { - printk ("%s: devfs_do_symlink(%s): could not prepare leaf\n", - DEVFS_NAME, name); + PRINTK ("(%s): could not prepare leaf\n", name); kfree (newlink); return -ENOTDIR; } @@ -1677,8 +1732,7 @@ de->u.symlink.length = linklength; if ( ( err = _devfs_append_entry (dir, de, FALSE, NULL) ) != 0 ) { - printk ("%s: devfs_do_symlink(%s): could not append to parent, err: %d\n", - DEVFS_NAME, name, err); + PRINTK ("(%s): could not append to parent, err: %d\n", name, err); devfs_put (dir); return err; } @@ -1713,6 +1767,7 @@ devfs_handle_t de; if (handle != NULL) *handle = NULL; + DPRINTK (DEBUG_REGISTER, "(%s)\n", name); err = devfs_do_symlink (dir, name, flags, link, &de, info); if (err) return err; if (handle != NULL) *handle = de; @@ -1738,39 +1793,47 @@ devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name, void *info) { int err; - struct devfs_entry *de; + struct devfs_entry *de, *old; if (name == NULL) { - printk ("%s: devfs_mk_dir(): NULL name pointer\n", DEVFS_NAME); + PRINTK ("(): NULL name pointer\n"); return NULL; } if ( ( de = _devfs_prepare_leaf (&dir, name, MODE_DIR) ) == NULL ) { - printk ("%s: devfs_mk_dir(%s): could not prepare leaf\n", - DEVFS_NAME, name); + PRINTK ("(%s): could not prepare leaf\n", name); return NULL; } de->info = info; - if ( ( err = _devfs_append_entry (dir, de, FALSE, NULL) ) != 0 ) + if ( ( err = _devfs_append_entry (dir, de, FALSE, &old) ) != 0 ) { - printk ("%s: devfs_mk_dir(%s): could not append to dir: %p \"%s\", err: %d\n", - DEVFS_NAME, name, dir, dir->name, err); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,1) + if ( old && S_ISDIR (old->mode) ) + { + PRINTK ("(%s): using old entry in dir: %p \"%s\"\n", + name, dir, dir->name); + old->vfs_created = FALSE; + devfs_put (dir); + return old; + } +#endif + PRINTK ("(%s): could not append to dir: %p \"%s\", err: %d\n", + name, dir, dir->name, err); + devfs_put (old); devfs_put (dir); return NULL; } -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_REGISTER) - printk ("%s: devfs_mk_dir(%s): de: %p dir: %p \"%s\"\n", - DEVFS_NAME, name, de, dir, dir->name); -#endif + DPRINTK (DEBUG_REGISTER, "(%s): de: %p dir: %p \"%s\"\n", + name, de, dir, dir->name); + devfsd_notify (de, DEVFSD_NOTIFY_REGISTERED, 0); devfs_put (dir); return de; } /* End Function devfs_mk_dir */ /** - * devfs_find_handle - Find the handle of a devfs entry. + * devfs_get_handle - Find the handle of a devfs entry. * @dir: The handle to the parent devfs directory entry. If this is %NULL the * name is relative to the root of the devfs. * @name: The name of the entry. @@ -1782,20 +1845,31 @@ * traversed. Symlinks pointing out of the devfs namespace will cause a * failure. Symlink traversal consumes stack space. * - * Returns a handle which may later be used in a call to devfs_unregister(), - * devfs_get_flags(), or devfs_set_flags(). On failure %NULL is returned. + * Returns a handle which may later be used in a call to + * devfs_unregister(), devfs_get_flags(), or devfs_set_flags(). A + * subsequent devfs_put() is required to decrement the refcount. + * On failure %NULL is returned. */ +devfs_handle_t devfs_get_handle (devfs_handle_t dir, const char *name, + unsigned int major, unsigned int minor, + char type, int traverse_symlinks) +{ + if ( (name != NULL) && (name[0] == '\0') ) name = NULL; + return _devfs_find_entry (dir, name, major, minor, type,traverse_symlinks); +} /* End Function devfs_get_handle */ + + +/* Compatibility function. Will be removed in sometime in 2.5 */ + devfs_handle_t devfs_find_handle (devfs_handle_t dir, const char *name, unsigned int major, unsigned int minor, char type, int traverse_symlinks) { devfs_handle_t de; - if ( (name != NULL) && (name[0] == '\0') ) name = NULL; - de = find_entry (dir, name, 0, major, minor, type, traverse_symlinks); - devfs_put (de); /* FIXME: in 2.5 consider dropping this and require a - call to devfs_put() */ + de = devfs_get_handle (dir, name, major, minor, type, traverse_symlinks); + devfs_put (de); return de; } /* End Function devfs_find_handle */ @@ -1813,6 +1887,7 @@ unsigned int fl = 0; if (de == NULL) return -EINVAL; + VERIFY_ENTRY (de); if (de->hide) fl |= DEVFS_FL_HIDE; if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) ) { @@ -1836,11 +1911,8 @@ int devfs_set_flags (devfs_handle_t de, unsigned int flags) { if (de == NULL) return -EINVAL; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_SET_FLAGS) - printk ("%s: devfs_set_flags(): de->name: \"%s\"\n", - DEVFS_NAME, de->name); -#endif + VERIFY_ENTRY (de); + DPRINTK (DEBUG_SET_FLAGS, "(%s): flags: %x\n", de->name, flags); de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE; if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) ) { @@ -1864,6 +1936,7 @@ unsigned int *minor) { if (de == NULL) return -EINVAL; + VERIFY_ENTRY (de); if ( S_ISDIR (de->mode) ) return -EISDIR; if ( !S_ISCHR (de->mode) && !S_ISBLK (de->mode) ) return -EINVAL; if (major != NULL) *major = de->u.fcb.u.device.major; @@ -1904,6 +1977,7 @@ #define NAMEOF(de) ( (de)->mode ? (de)->name : (de)->u.name ) if (de == NULL) return -EINVAL; + VERIFY_ENTRY (de); if (de->namelen >= buflen) return -ENAMETOOLONG; /* Must be first */ path[buflen - 1] = '\0'; if (de->parent == NULL) return buflen - 1; /* Don't prepend root */ @@ -1925,18 +1999,57 @@ * @de: The handle to the device entry. * * Returns a pointer to the device operations on success, else NULL. + * The use count for the module owning the operations will be incremented. */ void *devfs_get_ops (devfs_handle_t de) { + struct module *owner; + if (de == NULL) return NULL; - if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) ) - return de->u.fcb.ops; - return NULL; + VERIFY_ENTRY (de); + if ( !S_ISCHR (de->mode) && !S_ISBLK (de->mode) && !S_ISREG (de->mode) ) + return NULL; + if (de->u.fcb.ops == NULL) return NULL; + read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */ + if (de->next == de) owner = NULL; /* Ops pointer is already stale */ + else if ( S_ISCHR (de->mode) || S_ISREG (de->mode) ) + owner = ( (struct file_operations *) de->u.fcb.ops )->owner; + else owner = ( (struct block_device_operations *) de->u.fcb.ops )->owner; + if ( (de->next == de) || !try_inc_mod_count (owner) ) + { /* Entry is already unhooked or module is unloading */ + read_unlock (&de->parent->u.dir.lock); + return NULL; + } + read_unlock (&de->parent->u.dir.lock); /* Module can continue unloading*/ + return de->u.fcb.ops; } /* End Function devfs_get_ops */ /** + * devfs_put_ops - Put the device operations for a devfs entry. + * @de: The handle to the device entry. + * + * The use count for the module owning the operations will be decremented. + */ + +void devfs_put_ops (devfs_handle_t de) +{ + struct module *owner; + + if (de == NULL) return; + VERIFY_ENTRY (de); + if ( !S_ISCHR (de->mode) && !S_ISBLK (de->mode) && !S_ISREG (de->mode) ) + return; + if (de->u.fcb.ops == NULL) return; + if ( S_ISCHR (de->mode) || S_ISREG (de->mode) ) + owner = ( (struct file_operations *) de->u.fcb.ops )->owner; + else owner = ( (struct block_device_operations *) de->u.fcb.ops )->owner; + if (owner) __MOD_DEC_USE_COUNT (owner); +} /* End Function devfs_put_ops */ + + +/** * devfs_set_file_size - Set the file size for a devfs regular file. * @de: The handle to the device entry. * @size: The new file size. @@ -1947,6 +2060,7 @@ int devfs_set_file_size (devfs_handle_t de, unsigned long size) { if (de == NULL) return -EINVAL; + VERIFY_ENTRY (de); if ( !S_ISREG (de->mode) ) return -EINVAL; if (de->u.fcb.u.file.size == size) return 0; de->u.fcb.u.file.size = size; @@ -1966,6 +2080,7 @@ void *devfs_get_info (devfs_handle_t de) { if (de == NULL) return NULL; + VERIFY_ENTRY (de); return de->info; } /* End Function devfs_get_info */ @@ -1980,6 +2095,7 @@ int devfs_set_info (devfs_handle_t de, void *info) { if (de == NULL) return -EINVAL; + VERIFY_ENTRY (de); de->info = info; return 0; } /* End Function devfs_set_info */ @@ -1994,6 +2110,7 @@ devfs_handle_t devfs_get_parent (devfs_handle_t de) { if (de == NULL) return NULL; + VERIFY_ENTRY (de); return de->parent; } /* End Function devfs_get_parent */ @@ -2008,6 +2125,7 @@ devfs_handle_t devfs_get_first_child (devfs_handle_t de) { if (de == NULL) return NULL; + VERIFY_ENTRY (de); if ( !S_ISDIR (de->mode) ) return NULL; return de->u.dir.first; } /* End Function devfs_get_first_child */ @@ -2023,6 +2141,7 @@ devfs_handle_t devfs_get_next_sibling (devfs_handle_t de) { if (de == NULL) return NULL; + VERIFY_ENTRY (de); return de->next; } /* End Function devfs_get_next_sibling */ @@ -2038,14 +2157,15 @@ void devfs_auto_unregister (devfs_handle_t master, devfs_handle_t slave) { if (master == NULL) return; + VERIFY_ENTRY (master); + VERIFY_ENTRY (slave); if (master->slave != NULL) { /* Because of the dumbness of the layers above, ignore duplicates */ if (master->slave == slave) return; - printk ("%s: devfs_auto_unregister(): only one slave allowed\n", - DEVFS_NAME); - OOPS (" master: \"%s\" old slave: \"%s\" new slave: \"%s\"\n", - master->name, master->slave->name, slave->name); + PRINTK ("(%s): only one slave allowed\n", master->name); + OOPS ("(): old slave: \"%s\" new slave: \"%s\"\n", + master->slave->name, slave->name); } master->slave = slave; } /* End Function devfs_auto_unregister */ @@ -2061,6 +2181,7 @@ devfs_handle_t devfs_get_unregister_slave (devfs_handle_t master) { if (master == NULL) return NULL; + VERIFY_ENTRY (master); return master->slave; } /* End Function devfs_get_unregister_slave */ @@ -2076,6 +2197,7 @@ const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen) { if (de == NULL) return NULL; + VERIFY_ENTRY (de); if (namelen != NULL) *namelen = de->namelen; return de->name; } /* End Function devfs_get_name */ @@ -2218,10 +2340,12 @@ __setup("devfs=", devfs_setup); +EXPORT_SYMBOL(devfs_put); EXPORT_SYMBOL(devfs_register); EXPORT_SYMBOL(devfs_unregister); EXPORT_SYMBOL(devfs_mk_symlink); EXPORT_SYMBOL(devfs_mk_dir); +EXPORT_SYMBOL(devfs_get_handle); EXPORT_SYMBOL(devfs_find_handle); EXPORT_SYMBOL(devfs_get_flags); EXPORT_SYMBOL(devfs_set_flags); @@ -2268,8 +2392,9 @@ buf->parent = parent; buf->namelen = namelen; buf->u.name = name; + WRITE_ENTRY_MAGIC (buf, MAGIC_VALUE); if ( !devfsd_notify_de (buf, DEVFSD_NOTIFY_LOOKUP, 0, - current->euid, current->egid, fs_info) ) + current->euid, current->egid, fs_info, 0) ) return -ENOENT; /* Possible success */ return 0; @@ -2286,14 +2411,17 @@ static int check_disc_changed (struct devfs_entry *de) { int tmp; + int retval = 0; kdev_t dev = MKDEV (de->u.fcb.u.device.major, de->u.fcb.u.device.minor); - struct block_device_operations *bdops = de->u.fcb.ops; + struct block_device_operations *bdops; extern int warn_no_part; if ( !S_ISBLK (de->mode) ) return 0; - if (bdops == NULL) return 0; - if (bdops->check_media_change == NULL) return 0; - if ( !bdops->check_media_change (dev) ) return 0; + bdops = devfs_get_ops (de); + if (!bdops) return 0; + if (bdops->check_media_change == NULL) goto out; + if ( !bdops->check_media_change (dev) ) goto out; + retval = 1; printk ( KERN_DEBUG "VFS: Disk change detected on device %s\n", kdevname (dev) ); if (invalidate_device(dev, 0)) @@ -2303,7 +2431,9 @@ warn_no_part = 0; if (bdops->revalidate) bdops->revalidate (dev); warn_no_part = tmp; - return 1; +out: + devfs_put_ops (de); + return retval; } /* End Function check_disc_changed */ @@ -2375,16 +2505,10 @@ if (retval != 0) return retval; retval = inode_setattr (inode, iattr); if (retval != 0) return retval; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_CHANGE) - { - printk ("%s: notify_change(%d): VFS inode: %p devfs_entry: %p\n", - DEVFS_NAME, (int) inode->i_ino, inode, de); - printk ("%s: mode: 0%o uid: %d gid: %d\n", - DEVFS_NAME, (int) inode->i_mode, - (int) inode->i_uid, (int) inode->i_gid); - } -#endif + DPRINTK (DEBUG_I_CHANGE, "(%d): VFS inode: %p devfs_entry: %p\n", + (int) inode->i_ino, inode, de); + DPRINTK (DEBUG_I_CHANGE, "(): mode: 0%o uid: %d gid: %d\n", + (int) inode->i_mode, (int) inode->i_uid, (int) inode->i_gid); /* Inode is not on hash chains, thus must save permissions here rather than in a write_inode() method */ if ( ( !S_ISREG (inode->i_mode) && !S_ISCHR (inode->i_mode) && @@ -2397,16 +2521,17 @@ de->inode.atime = inode->i_atime; de->inode.mtime = inode->i_mtime; de->inode.ctime = inode->i_ctime; - if ( iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID) ) + if ( ( iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID) ) && + !is_devfsd_or_child (fs_info) ) devfsd_notify_de (de, DEVFSD_NOTIFY_CHANGE, inode->i_mode, - inode->i_uid, inode->i_gid, fs_info); + inode->i_uid, inode->i_gid, fs_info, 0); return 0; } /* End Function devfs_notify_change */ static int devfs_statfs (struct super_block *sb, struct statfs *buf) { buf->f_type = DEVFS_SUPER_MAGIC; - buf->f_bsize = PAGE_SIZE / sizeof (long); + buf->f_bsize = FAKE_BLOCK_SIZE; buf->f_bfree = 0; buf->f_bavail = 0; buf->f_ffree = 0; @@ -2428,7 +2553,7 @@ /** - * get_vfs_inode - Get a VFS inode. + * _devfs_get_vfs_inode - Get a VFS inode. * @sb: The super block. * @de: The devfs inode. * @dentry: The dentry to register with the devfs inode. @@ -2437,9 +2562,9 @@ * performed if the inode is created. */ -static struct inode *get_vfs_inode (struct super_block *sb, - struct devfs_entry *de, - struct dentry *dentry) +static struct inode *_devfs_get_vfs_inode (struct super_block *sb, + struct devfs_entry *de, + struct dentry *dentry) { int is_fcb = FALSE; struct inode *inode; @@ -2447,8 +2572,7 @@ if (de->prev == de) return NULL; /* Quick check to see if unhooked */ if ( ( inode = new_inode (sb) ) == NULL ) { - printk ("%s: get_vfs_inode(%s): new_inode() failed, de: %p\n", - DEVFS_NAME, de->name, de); + PRINTK ("(%s): new_inode() failed, de: %p\n", de->name, de); return NULL; } if (de->parent) @@ -2465,13 +2589,10 @@ } inode->u.generic_ip = devfs_get (de); inode->i_ino = de->inode.ino; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_GET) - printk ("%s: get_vfs_inode(%d): VFS inode: %p devfs_entry: %p\n", - DEVFS_NAME, (int) inode->i_ino, inode, de); -#endif + DPRINTK (DEBUG_I_GET, "(%d): VFS inode: %p devfs_entry: %p\n", + (int) inode->i_ino, inode, de); inode->i_blocks = 0; - inode->i_blksize = 1024; + inode->i_blksize = FAKE_BLOCK_SIZE; inode->i_op = &devfs_iops; inode->i_fop = &devfs_fops; inode->i_rdev = NODEV; @@ -2491,8 +2612,7 @@ if (!inode->i_bdev->bd_op && de->u.fcb.ops) inode->i_bdev->bd_op = de->u.fcb.ops; } - else printk ("%s: get_vfs_inode(%d): no block device from bdget()\n", - DEVFS_NAME, (int) inode->i_ino); + else PRINTK ("(%d): no block device from bdget()\n",(int)inode->i_ino); is_fcb = TRUE; } else if ( S_ISFIFO (de->mode) ) inode->i_fop = &def_fifo_fops; @@ -2519,14 +2639,10 @@ inode->i_atime = de->inode.atime; inode->i_mtime = de->inode.mtime; inode->i_ctime = de->inode.ctime; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_GET) - printk ("%s: mode: 0%o uid: %d gid: %d\n", - DEVFS_NAME, (int) inode->i_mode, - (int) inode->i_uid, (int) inode->i_gid); -#endif + DPRINTK (DEBUG_I_GET, "(): mode: 0%o uid: %d gid: %d\n", + (int) inode->i_mode, (int) inode->i_uid, (int) inode->i_gid); return inode; -} /* End Function get_vfs_inode */ +} /* End Function _devfs_get_vfs_inode */ /* File operations for device entries follow */ @@ -2542,11 +2658,8 @@ fs_info = inode->i_sb->u.generic_sbp; parent = get_devfs_entry_from_vfs_inode (file->f_dentry->d_inode); if ( (long) file->f_pos < 0 ) return -EINVAL; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_F_READDIR) - printk ("%s: readdir(): fs_info: %p pos: %ld\n", DEVFS_NAME, - fs_info, (long) file->f_pos); -#endif + DPRINTK (DEBUG_F_READDIR, "(%s): fs_info: %p pos: %ld\n", + parent->name, fs_info, (long) file->f_pos); switch ( (long) file->f_pos ) { case 0: @@ -2637,9 +2750,9 @@ inode->i_uid = current->euid; inode->i_gid = current->egid; } - if (df->aopen_notify) + if ( df->aopen_notify && !is_devfsd_or_child (fs_info) ) devfsd_notify_de (de, DEVFSD_NOTIFY_ASYNC_OPEN, inode->i_mode, - current->euid, current->egid, fs_info); + current->euid, current->egid, fs_info, 0); return 0; } /* End Function devfs_open */ @@ -2666,13 +2779,7 @@ static void devfs_d_release (struct dentry *dentry) { -#ifdef CONFIG_DEVFS_DEBUG - struct inode *inode = dentry->d_inode; - - if (devfs_debug & DEBUG_D_RELEASE) - printk ("%s: d_release(): dentry: %p inode: %p\n", - DEVFS_NAME, dentry, inode); -#endif + DPRINTK (DEBUG_D_RELEASE, "(%p): inode: %p\n", dentry, dentry->d_inode); } /* End Function devfs_d_release */ /** @@ -2686,14 +2793,11 @@ struct devfs_entry *de; de = get_devfs_entry_from_vfs_inode (inode); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_D_IPUT) - printk ("%s: d_iput(): dentry: %p inode: %p de: %p de->dentry: %p\n", - DEVFS_NAME, dentry, inode, de, de->inode.dentry); -#endif + DPRINTK (DEBUG_D_IPUT,"(%s): dentry: %p inode: %p de: %p de->dentry: %p\n", + de->name, dentry, inode, de, de->inode.dentry); if ( de->inode.dentry && (de->inode.dentry != dentry) ) - OOPS ("%s: d_iput(%s): de: %p dentry: %p de->dentry: %p\n", - DEVFS_NAME, de->name, de, dentry, de->inode.dentry); + OOPS ("(%s): de: %p dentry: %p de->dentry: %p\n", + de->name, de, dentry, de->inode.dentry); de->inode.dentry = NULL; iput (inode); devfs_put (de); @@ -2733,20 +2837,13 @@ /* Unhash dentry if negative (has no inode) */ if (inode == NULL) { -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_D_DELETE) - printk ("%s: d_delete(): dropping negative dentry: %p\n", - DEVFS_NAME, dentry); -#endif + DPRINTK (DEBUG_D_DELETE, "(%p): dropping negative dentry\n", dentry); return 1; } fs_info = inode->i_sb->u.generic_sbp; de = get_devfs_entry_from_vfs_inode (inode); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_D_DELETE) - printk ("%s: d_delete(): dentry: %p inode: %p devfs_entry: %p\n", - DEVFS_NAME, dentry, inode, de); -#endif + DPRINTK (DEBUG_D_DELETE, "(%p): inode: %p devfs_entry: %p\n", + dentry, inode, de); if (de == NULL) return 0; if ( !S_ISCHR (de->mode) && !S_ISBLK (de->mode) && !S_ISREG (de->mode) ) return 0; @@ -2754,7 +2851,7 @@ de->u.fcb.open = FALSE; if (de->u.fcb.aopen_notify) devfsd_notify_de (de, DEVFSD_NOTIFY_CLOSE, inode->i_mode, - current->euid, current->egid, fs_info); + current->euid, current->egid, fs_info, 1); if (!de->u.fcb.auto_owner) return 0; /* Change the ownership/protection back */ inode->i_mode = (de->mode & S_IFMT) | S_IRUGO | S_IWUGO; @@ -2774,25 +2871,19 @@ devfs_handle_t parent = get_devfs_entry_from_vfs_inode (dir); struct inode *inode; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_LOOKUP) - printk ("%s: d_revalidate(%s): dentry: %p by: \"%s\"\n", - DEVFS_NAME, dentry->d_name.name, dentry, current->comm); -#endif + DPRINTK (DEBUG_I_LOOKUP, "(%s): dentry: %p by: \"%s\"\n", + dentry->d_name.name, dentry, current->comm); read_lock (&parent->u.dir.lock); de = _devfs_search_dir (parent, dentry->d_name.name, dentry->d_name.len); - read_lock (&parent->u.dir.lock); + read_unlock (&parent->u.dir.lock); if (de == NULL) return 1; /* Create an inode, now that the driver information is available */ - inode = get_vfs_inode (dir->i_sb, de, dentry); + inode = _devfs_get_vfs_inode (dir->i_sb, de, dentry); devfs_put (de); if (!inode) return 1; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_LOOKUP) - printk ("%s: d_revalidate(): new VFS inode(%u): %p devfs_entry: %p\n", - DEVFS_NAME, de->inode.ino, inode, de); -#endif + DPRINTK (DEBUG_I_LOOKUP, "(%s): new VFS inode(%u): %p de: %p\n", + de->name, de->inode.ino, inode, de); d_instantiate (dentry, inode); return 1; } @@ -2805,21 +2896,17 @@ static struct dentry *devfs_lookup (struct inode *dir, struct dentry *dentry) { - struct fs_info *fs_info; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; struct devfs_entry *parent, *de; struct inode *inode; /* Set up the dentry operations before anything else, to ensure cleaning up on any error */ dentry->d_op = &devfs_dops; - fs_info = dir->i_sb->u.generic_sbp; /* First try to get the devfs entry for this directory */ parent = get_devfs_entry_from_vfs_inode (dir); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_LOOKUP) - printk ("%s: lookup(%s): dentry: %p parent: %p by: \"%s\"\n", - DEVFS_NAME, dentry->d_name.name, dentry, parent,current->comm); -#endif + DPRINTK (DEBUG_I_LOOKUP, "(%s): dentry: %p parent: %p by: \"%s\"\n", + dentry->d_name.name, dentry, parent, current->comm); if (parent == NULL) return ERR_PTR (-ENOENT); read_lock (&parent->u.dir.lock); de = _devfs_search_dir (parent, dentry->d_name.name, dentry->d_name.len); @@ -2872,14 +2959,11 @@ d_add (dentry, NULL); /* Open the floodgates */ } /* Create an inode, now that the driver information is available */ - inode = get_vfs_inode (dir->i_sb, de, dentry); + inode = _devfs_get_vfs_inode (dir->i_sb, de, dentry); devfs_put (de); if (!inode) return ERR_PTR (-ENOMEM); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_LOOKUP) - printk ("%s: lookup(): new VFS inode(%u): %p devfs_entry: %p\n", - DEVFS_NAME, de->inode.ino, inode, de); -#endif + DPRINTK (DEBUG_I_LOOKUP, "(%s): new VFS inode(%u): %p de: %p\n", + de->name, de->inode.ino, inode, de); d_instantiate (dentry, inode); if (dentry->d_op == &devfs_wait_dops) { /* Unlock directory semaphore, which will release any waiters. They @@ -2897,20 +2981,19 @@ int unhooked; struct devfs_entry *de; struct inode *inode = dentry->d_inode; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_UNLINK) - printk ("%s: unlink(%s)\n", DEVFS_NAME, dentry->d_name.name); -#endif de = get_devfs_entry_from_vfs_inode (inode); + DPRINTK (DEBUG_I_UNLINK, "(%s): de: %p\n", dentry->d_name.name, de); if (de == NULL) return -ENOENT; if (!de->vfs_created) return -EPERM; write_lock (&de->parent->u.dir.lock); unhooked = _devfs_unhook (de); write_unlock (&de->parent->u.dir.lock); if (!unhooked) return -ENOENT; - devfsd_notify_de (de, DEVFSD_NOTIFY_DELETE, inode->i_mode, - inode->i_uid, inode->i_gid, dir->i_sb->u.generic_sbp); + if ( !is_devfsd_or_child (fs_info) ) + devfsd_notify_de (de, DEVFSD_NOTIFY_DELETE, inode->i_mode, + inode->i_uid, inode->i_gid, fs_info, 0); free_dentry (de); devfs_put (de); return 0; @@ -2920,21 +3003,17 @@ const char *symname) { int err; - struct fs_info *fs_info; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; struct devfs_entry *parent, *de; struct inode *inode; - fs_info = dir->i_sb->u.generic_sbp; /* First try to get the devfs entry for this directory */ parent = get_devfs_entry_from_vfs_inode (dir); if (parent == NULL) return -ENOENT; err = devfs_do_symlink (parent, dentry->d_name.name, DEVFS_FL_NONE, symname, &de, NULL); -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_DISABLED) - printk ("%s: symlink(): errcode from <devfs_do_symlink>: %d\n", - DEVFS_NAME, err); -#endif + DPRINTK (DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n", + dentry->d_name.name, err); if (err < 0) return err; de->vfs_created = TRUE; de->inode.uid = current->euid; @@ -2942,28 +3021,25 @@ de->inode.atime = CURRENT_TIME; de->inode.mtime = CURRENT_TIME; de->inode.ctime = CURRENT_TIME; - if ( ( inode = get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) + if ( ( inode = _devfs_get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) return -ENOMEM; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_DISABLED) - printk ("%s: symlink(): new VFS inode(%u): %p dentry: %p\n", - DEVFS_NAME, de->inode.ino, inode, dentry); -#endif + DPRINTK (DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n", + dentry->d_name.name, de->inode.ino, inode, dentry); d_instantiate (dentry, inode); - devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, - inode->i_uid, inode->i_gid, fs_info); + if ( !is_devfsd_or_child (fs_info) ) + devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, + inode->i_uid, inode->i_gid, fs_info, 0); return 0; } /* End Function devfs_symlink */ static int devfs_mkdir (struct inode *dir, struct dentry *dentry, int mode) { int err; - struct fs_info *fs_info; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; struct devfs_entry *parent, *de; struct inode *inode; mode = (mode & ~S_IFMT) | S_IFDIR; /* VFS doesn't pass S_IFMT part */ - fs_info = dir->i_sb->u.generic_sbp; parent = get_devfs_entry_from_vfs_inode (dir); if (parent == NULL) return -ENOENT; de = _devfs_alloc_entry (dentry->d_name.name, dentry->d_name.len, mode); @@ -2976,16 +3052,14 @@ de->inode.atime = CURRENT_TIME; de->inode.mtime = CURRENT_TIME; de->inode.ctime = CURRENT_TIME; - if ( ( inode = get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) + if ( ( inode = _devfs_get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) return -ENOMEM; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_DISABLED) - printk ("%s: mkdir(): new VFS inode(%u): %p dentry: %p\n", - DEVFS_NAME, de->inode.ino, inode, dentry); -#endif + DPRINTK (DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n", + dentry->d_name.name, de->inode.ino, inode, dentry); d_instantiate (dentry, inode); - devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, - inode->i_uid, inode->i_gid, fs_info); + if ( !is_devfsd_or_child (fs_info) ) + devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, + inode->i_uid, inode->i_gid, fs_info, 0); return 0; } /* End Function devfs_mkdir */ @@ -2993,11 +3067,10 @@ { int err = 0; struct devfs_entry *de; - struct fs_info *fs_info; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; struct inode *inode = dentry->d_inode; if (dir->i_sb->u.generic_sbp != inode->i_sb->u.generic_sbp) return -EINVAL; - fs_info = dir->i_sb->u.generic_sbp; de = get_devfs_entry_from_vfs_inode (inode); if (de == NULL) return -ENOENT; if ( !S_ISDIR (de->mode) ) return -ENOTDIR; @@ -3013,8 +3086,9 @@ if ( !_devfs_unhook (de) ) err = -ENOENT; write_unlock (&de->parent->u.dir.lock); if (err) return err; - devfsd_notify_de (de, DEVFSD_NOTIFY_DELETE, inode->i_mode, - inode->i_uid, inode->i_gid, fs_info); + if ( !is_devfsd_or_child (fs_info) ) + devfsd_notify_de (de, DEVFSD_NOTIFY_DELETE, inode->i_mode, + inode->i_uid, inode->i_gid, fs_info, 0); free_dentry (de); devfs_put (de); return 0; @@ -3024,16 +3098,12 @@ int rdev) { int err; - struct fs_info *fs_info; + struct fs_info *fs_info = dir->i_sb->u.generic_sbp; struct devfs_entry *parent, *de; struct inode *inode; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_MKNOD) - printk ("%s: mknod(%s): mode: 0%o dev: %d\n", - DEVFS_NAME, dentry->d_name.name, mode, rdev); -#endif - fs_info = dir->i_sb->u.generic_sbp; + DPRINTK (DEBUG_I_MKNOD, "(%s): mode: 0%o dev: %d\n", + dentry->d_name.name, mode, rdev); parent = get_devfs_entry_from_vfs_inode (dir); if (parent == NULL) return -ENOENT; de = _devfs_alloc_entry (dentry->d_name.name, dentry->d_name.len, mode); @@ -3051,16 +3121,14 @@ de->inode.atime = CURRENT_TIME; de->inode.mtime = CURRENT_TIME; de->inode.ctime = CURRENT_TIME; - if ( ( inode = get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) + if ( ( inode = _devfs_get_vfs_inode (dir->i_sb, de, dentry) ) == NULL ) return -ENOMEM; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_I_MKNOD) - printk ("%s: new VFS inode(%u): %p dentry: %p\n", - DEVFS_NAME, de->inode.ino, inode, dentry); -#endif + DPRINTK (DEBUG_I_MKNOD, ": new VFS inode(%u): %p dentry: %p\n", + de->inode.ino, inode, dentry); d_instantiate (dentry, inode); - devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, - inode->i_uid, inode->i_gid, fs_info); + if ( !is_devfsd_or_child (fs_info) ) + devfsd_notify_de (de, DEVFSD_NOTIFY_CREATE, inode->i_mode, + inode->i_uid, inode->i_gid, fs_info, 0); return 0; } /* End Function devfs_mknod */ @@ -3124,15 +3192,11 @@ sb->s_blocksize_bits = 10; sb->s_magic = DEVFS_SUPER_MAGIC; sb->s_op = &devfs_sops; - if ( ( root_inode = get_vfs_inode (sb, root_entry, NULL) ) == NULL ) + if ( ( root_inode = _devfs_get_vfs_inode (sb, root_entry, NULL) ) == NULL ) goto out_no_root; sb->s_root = d_alloc_root (root_inode); if (!sb->s_root) goto out_no_root; -#ifdef CONFIG_DEVFS_DEBUG - if (devfs_debug & DEBUG_S_READ) - printk ("%s: read super, made devfs ptr: %p\n", - DEVFS_NAME, sb->u.generic_sbp); -#endif + DPRINTK (DEBUG_S_READ, "(): made devfs ptr: %p\n", sb->u.generic_sbp); return sb; out_no_root: @@ -3233,11 +3297,17 @@ tlen = rpos - *ppos; if (done) { + devfs_handle_t parent; + spin_lock (&fs_info->devfsd_buffer_lock); fs_info->devfsd_first_event = entry->next; if (entry->next == NULL) fs_info->devfsd_last_event = NULL; spin_unlock (&fs_info->devfsd_buffer_lock); - for (; de != NULL; de = de->parent) devfs_put (de); + for (; de != NULL; de = parent) + { + parent = de->parent; + devfs_put (de); + } kmem_cache_free (devfsd_buf_cache, entry); if (ival > 0) atomic_sub (ival, &fs_info->devfsd_overrun_count); *ppos = 0; @@ -3274,6 +3344,8 @@ } fs_info->devfsd_task = current; spin_unlock (&lock); + fs_info->devfsd_pgrp = (current->pgrp == current->pid) ? + current->pgrp : 0; fs_info->devfsd_file = file; fs_info->devfsd_info = kmalloc (sizeof *fs_info->devfsd_info, GFP_KERNEL); @@ -3304,7 +3376,7 @@ static int devfsd_close (struct inode *inode, struct file *file) { - struct devfsd_buf_entry *entry; + struct devfsd_buf_entry *entry, *next; struct fs_info *fs_info = inode->i_sb->u.generic_sbp; if (fs_info->devfsd_file != file) return 0; @@ -3320,10 +3392,14 @@ fs_info->devfsd_info = NULL; } spin_unlock (&fs_info->devfsd_buffer_lock); + fs_info->devfsd_pgrp = 0; fs_info->devfsd_task = NULL; wake_up (&fs_info->revalidate_wait_queue); - for (; entry; entry = entry->next) + for (; entry; entry = next) + { + next = entry->next; kmem_cache_free (devfsd_buf_cache, entry); + } return 0; } /* End Function devfsd_close */ @@ -3353,14 +3429,15 @@ printk ("%s: v%s Richard Gooch (rgooch@atnf.csiro.au)\n", DEVFS_NAME, DEVFS_VERSION); + devfsd_buf_cache = kmem_cache_create ("devfsd_event", + sizeof (struct devfsd_buf_entry), + 0, 0, NULL, NULL); + if (!devfsd_buf_cache) OOPS ("(): unable to allocate event slab\n"); #ifdef CONFIG_DEVFS_DEBUG devfs_debug = devfs_debug_init; printk ("%s: devfs_debug: 0x%0x\n", DEVFS_NAME, devfs_debug); #endif printk ("%s: boot_options: 0x%0x\n", DEVFS_NAME, boot_options); - devfsd_buf_cache = kmem_cache_create ("devfsd_event", - sizeof (struct devfsd_buf_entry), - 0, 0, NULL, NULL); err = register_filesystem (&devfs_fs_type); if (!err) { diff -u --recursive --new-file v2.5.1/linux/fs/devfs/util.c linux/fs/devfs/util.c --- v2.5.1/linux/fs/devfs/util.c Thu Oct 11 09:43:30 2001 +++ linux/fs/devfs/util.c Tue Dec 25 15:39:20 2001 @@ -61,67 +61,6 @@ /* Private functions follow */ /** - * _devfs_convert_name - Convert from an old style location-based name to new style. - * @new: The new name will be written here. - * @old: The old name. - * @disc: If true, disc partitioning information should be processed. - */ - -static void __init _devfs_convert_name (char *new, const char *old, int disc) -{ - int host, bus, target, lun; - char *ptr; - char part[8]; - - /* Decode "c#b#t#u#" */ - if (old[0] != 'c') return; - host = simple_strtol (old + 1, &ptr, 10); - if (ptr[0] != 'b') return; - bus = simple_strtol (ptr + 1, &ptr, 10); - if (ptr[0] != 't') return; - target = simple_strtol (ptr + 1, &ptr, 10); - if (ptr[0] != 'u') return; - lun = simple_strtol (ptr + 1, &ptr, 10); - if (disc) - { - /* Decode "p#" */ - if (ptr[0] == 'p') sprintf (part, "part%s", ptr + 1); - else strcpy (part, "disc"); - } - else part[0] = '\0'; - sprintf (new, "/host%d/bus%d/target%d/lun%d/%s", - host, bus, target, lun, part); -} /* End Function _devfs_convert_name */ - - -/* Public functions follow */ - -/** - * devfs_make_root - Create the root FS device entry if required. - * @name: The name of the root FS device, as passed by "root=". - */ - -void __init devfs_make_root (const char *name) -{ - char dest[64]; - - if ( (strncmp (name, "sd/", 3) == 0) || (strncmp (name, "sr/", 3) == 0) ) - { - strcpy (dest, "../scsi"); - _devfs_convert_name (dest + 7, name + 3, (name[1] == 'd') ? 1 : 0); - } - else if ( (strncmp (name, "ide/hd/", 7) == 0) || - (strncmp (name, "ide/cd/", 7) == 0) ) - { - strcpy (dest, ".."); - _devfs_convert_name (dest + 2, name + 7, (name[4] == 'h') ? 1 : 0); - } - else return; - devfs_mk_symlink (NULL, name, DEVFS_FL_DEFAULT, dest, NULL, NULL); -} /* End Function devfs_make_root */ - - -/** * devfs_register_tape - Register a tape device in the "/dev/tapes" hierarchy. * @de: Any tape device entry in the device directory. */ diff -u --recursive --new-file v2.5.1/linux/fs/dquot.c linux/fs/dquot.c --- v2.5.1/linux/fs/dquot.c Tue Dec 18 14:56:39 2001 +++ linux/fs/dquot.c Thu Dec 27 08:17:43 2001 @@ -136,14 +136,14 @@ return is_enabled(sb_dqopt(sb), type); } -static inline int const hashfn(kdev_t dev, unsigned int id, short type) +static inline int const hashfn(struct super_block *sb, unsigned int id, short type) { - return((HASHDEV(dev) ^ id) * (MAXQUOTAS - type)) % NR_DQHASH; + return((HASHDEV(sb->s_dev) ^ id) * (MAXQUOTAS - type)) % NR_DQHASH; } static inline void insert_dquot_hash(struct dquot *dquot) { - struct list_head *head = dquot_hash + hashfn(dquot->dq_dev, dquot->dq_id, dquot->dq_type); + struct list_head *head = dquot_hash + hashfn(dquot->dq_sb, dquot->dq_id, dquot->dq_type); list_add(&dquot->dq_hash, head); } @@ -153,14 +153,14 @@ INIT_LIST_HEAD(&dquot->dq_hash); } -static inline struct dquot *find_dquot(unsigned int hashent, kdev_t dev, unsigned int id, short type) +static inline struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, unsigned int id, short type) { struct list_head *head; struct dquot *dquot; for (head = dquot_hash[hashent].next; head != dquot_hash+hashent; head = head->next) { dquot = list_entry(head, struct dquot, dq_hash); - if (dquot->dq_dev == dev && dquot->dq_id == id && dquot->dq_type == type) + if (dquot->dq_sb == sb && dquot->dq_id == id && dquot->dq_type == type) return dquot; } return NODQUOT; @@ -289,7 +289,7 @@ sizeof(struct dqblk), &offset); if (ret != sizeof(struct dqblk)) printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", - kdevname(dquot->dq_dev)); + kdevname(dquot->dq_sb->s_dev)); set_fs(fs); up(sem); @@ -359,7 +359,7 @@ } } -int sync_dquots(kdev_t dev, short type) +int sync_dquots(struct super_block *sb, short type) { struct list_head *head; struct dquot *dquot; @@ -368,7 +368,7 @@ restart: for (head = inuse_list.next; head != &inuse_list; head = head->next) { dquot = list_entry(head, struct dquot, dq_inuse); - if (dev && dquot->dq_dev != dev) + if (sb && dquot->dq_sb != sb) continue; if (type != -1 && dquot->dq_type != type) continue; @@ -440,7 +440,8 @@ if (!dquot->dq_count) { printk("VFS: dqput: trying to free free dquot\n"); printk("VFS: device %s, dquot of %s %d\n", - kdevname(dquot->dq_dev), quotatypes[dquot->dq_type], + kdevname(dquot->dq_sb->s_dev), + quotatypes[dquot->dq_type], dquot->dq_id); return; } @@ -493,7 +494,7 @@ static struct dquot *dqget(struct super_block *sb, unsigned int id, short type) { - unsigned int hashent = hashfn(sb->s_dev, id, type); + unsigned int hashent = hashfn(sb, id, type); struct dquot *dquot, *empty = NODQUOT; struct quota_mount_options *dqopt = sb_dqopt(sb); @@ -504,7 +505,7 @@ return NODQUOT; } - if ((dquot = find_dquot(hashent, sb->s_dev, id, type)) == NODQUOT) { + if ((dquot = find_dquot(hashent, sb, id, type)) == NODQUOT) { if (empty == NODQUOT) { if ((empty = get_empty_dquot()) == NODQUOT) schedule(); /* Try to wait for a moment... */ @@ -513,7 +514,6 @@ dquot = empty; dquot->dq_id = id; dquot->dq_type = type; - dquot->dq_dev = sb->s_dev; dquot->dq_sb = sb; /* hash it first so it can be found */ insert_dquot_hash(dquot); @@ -1471,7 +1471,7 @@ flags |= SET_QLIMIT; break; case Q_SYNC: - ret = sync_dquots(dev, type); + ret = sync_dquots(sb, type); goto out; case Q_GETSTATS: ret = get_stats(addr); diff -u --recursive --new-file v2.5.1/linux/fs/efs/file.c linux/fs/efs/file.c --- v2.5.1/linux/fs/efs/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/efs/file.c Thu Dec 27 08:17:43 2001 @@ -29,11 +29,8 @@ return 0; } phys = efs_map_block(inode, iblock); - if (phys) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); - } + if (phys) + map_bh(bh_result, inode->i_sb, phys); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/efs/super.c linux/fs/efs/super.c --- v2.5.1/linux/fs/efs/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/efs/super.c Tue Dec 25 15:39:20 2001 @@ -132,16 +132,13 @@ } struct super_block *efs_read_super(struct super_block *s, void *d, int silent) { - kdev_t dev = s->s_dev; struct efs_sb_info *sb; struct buffer_head *bh; sb = SUPER_INFO(s); s->s_magic = EFS_SUPER_MAGIC; - s->s_blocksize = EFS_BLOCKSIZE; - s->s_blocksize_bits = EFS_BLOCKSIZE_BITS; - set_blocksize(dev, EFS_BLOCKSIZE); + sb_set_blocksize(s, EFS_BLOCKSIZE); /* read the vh (volume header) block */ bh = sb_bread(s, 0); diff -u --recursive --new-file v2.5.1/linux/fs/exec.c linux/fs/exec.c --- v2.5.1/linux/fs/exec.c Tue Dec 18 14:56:39 2001 +++ linux/fs/exec.c Sun Dec 30 10:51:45 2001 @@ -973,9 +973,7 @@ if (do_truncate(file->f_dentry, 0) != 0) goto close_fail; - down_read(¤t->mm->mmap_sem); retval = binfmt->core_dump(signr, regs, file); - up_read(¤t->mm->mmap_sem); close_fail: filp_close(file, NULL); diff -u --recursive --new-file v2.5.1/linux/fs/ext2/ialloc.c linux/fs/ext2/ialloc.c --- v2.5.1/linux/fs/ext2/ialloc.c Tue Dec 18 14:56:39 2001 +++ linux/fs/ext2/ialloc.c Sun Dec 30 10:53:53 2001 @@ -393,7 +393,7 @@ if (inode->u.ext2_i.i_flags & EXT2_SYNC_FL) inode->i_flags |= S_SYNC; insert_inode_hash(inode); - inode->i_generation = event++; + inode->i_generation = sb->u.ext2_sb.s_next_generation++; mark_inode_dirty(inode); unlock_super (sb); diff -u --recursive --new-file v2.5.1/linux/fs/ext2/inode.c linux/fs/ext2/inode.c --- v2.5.1/linux/fs/ext2/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/ext2/inode.c Thu Dec 27 08:17:43 2001 @@ -524,9 +524,7 @@ /* Simplest case - block found, no allocation needed */ if (!partial) { got_it: - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = le32_to_cpu(chain[depth-1].key); - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); /* Clean up and exit */ partial = chain+depth-1; /* the whole chain */ goto cleanup; diff -u --recursive --new-file v2.5.1/linux/fs/ext2/super.c linux/fs/ext2/super.c --- v2.5.1/linux/fs/ext2/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/ext2/super.c Sun Dec 30 10:53:53 2001 @@ -25,6 +25,7 @@ #include <linux/init.h> #include <linux/locks.h> #include <linux/blkdev.h> +#include <linux/random.h> #include <asm/uaccess.h> @@ -418,9 +419,6 @@ * This is important for devices that have a hardware * sectorsize that is larger than the default. */ - blocksize = get_hardsect_size(dev); - if(blocksize < BLOCK_SIZE ) - blocksize = BLOCK_SIZE; sb->u.ext2_sb.s_mount_opt = 0; if (!parse_options ((char *) data, &sb_block, &resuid, &resgid, @@ -428,11 +426,11 @@ return NULL; } - if (set_blocksize(dev, blocksize) < 0) { - printk ("EXT2-fs: unable to set blocksize %d\n", blocksize); + blocksize = sb_min_blocksize(sb, BLOCK_SIZE); + if (!blocksize) { + printk ("EXT2-fs: unable to set blocksize\n"); return NULL; } - sb->s_blocksize = blocksize; /* * If the superblock doesn't start on a sector boundary, @@ -485,18 +483,12 @@ bdevname(dev), i); goto failed_mount; } - sb->s_blocksize_bits = - le32_to_cpu(EXT2_SB(sb)->s_es->s_log_block_size) + 10; - sb->s_blocksize = 1 << sb->s_blocksize_bits; - - sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); - + blocksize = BLOCK_SIZE << le32_to_cpu(EXT2_SB(sb)->s_es->s_log_block_size); /* If the blocksize doesn't match, re-read the thing.. */ if (sb->s_blocksize != blocksize) { - blocksize = sb->s_blocksize; brelse(bh); - if (set_blocksize(dev, blocksize) < 0) { + if (!sb_set_blocksize(sb, blocksize)) { printk(KERN_ERR "EXT2-fs: blocksize too small for device.\n"); return NULL; } @@ -517,6 +509,8 @@ } } + sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); + if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) { sb->u.ext2_sb.s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; sb->u.ext2_sb.s_first_ino = EXT2_GOOD_OLD_FIRST_INO; @@ -630,6 +624,7 @@ sb->u.ext2_sb.s_loaded_inode_bitmaps = 0; sb->u.ext2_sb.s_loaded_block_bitmaps = 0; sb->u.ext2_sb.s_gdb_count = db_count; + get_random_bytes(&sb->u.ext2_sb.s_next_generation, sizeof(u32)); /* * set up enough so that it can read an inode */ diff -u --recursive --new-file v2.5.1/linux/fs/ext3/inode.c linux/fs/ext3/inode.c --- v2.5.1/linux/fs/ext3/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/ext3/inode.c Thu Dec 27 08:17:43 2001 @@ -743,9 +743,7 @@ if (!partial) { bh_result->b_state &= ~(1UL << BH_New); got_it: - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = le32_to_cpu(chain[depth-1].key); - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); /* Clean up and exit */ partial = chain+depth-1; /* the whole chain */ goto cleanup; @@ -1265,8 +1263,7 @@ /* bget() all the buffers */ if (order_data) { if (!page->buffers) - create_empty_buffers(page, - inode->i_dev, inode->i_sb->s_blocksize); + create_empty_buffers(page, inode->i_sb->s_blocksize); page_buffers = page->buffers; walk_page_buffers(handle, page_buffers, 0, PAGE_CACHE_SIZE, NULL, bget_one); @@ -1369,7 +1366,7 @@ goto out; if (!page->buffers) - create_empty_buffers(page, inode->i_dev, blocksize); + create_empty_buffers(page, blocksize); /* Find the buffer that contains "offset" */ bh = page->buffers; diff -u --recursive --new-file v2.5.1/linux/fs/ext3/super.c linux/fs/ext3/super.c --- v2.5.1/linux/fs/ext3/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/ext3/super.c Tue Dec 25 15:39:20 2001 @@ -912,10 +912,6 @@ * This is important for devices that have a hardware * sectorsize that is larger than the default. */ - blocksize = EXT3_MIN_BLOCK_SIZE; - hblock = get_hardsect_size(dev); - if (blocksize < hblock) - blocksize = hblock; sbi->s_mount_opt = 0; sbi->s_resuid = EXT3_DEF_RESUID; @@ -925,8 +921,7 @@ goto out_fail; } - sb->s_blocksize = blocksize; - set_blocksize (dev, blocksize); + blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); /* * The ext3 superblock will not be buffer aligned for other than 1kB @@ -980,11 +975,10 @@ bdevname(dev), i); goto failed_mount; } - sb->s_blocksize_bits = le32_to_cpu(es->s_log_block_size) + 10; - sb->s_blocksize = 1 << sb->s_blocksize_bits; + blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); - if (sb->s_blocksize < EXT3_MIN_BLOCK_SIZE || - sb->s_blocksize > EXT3_MAX_BLOCK_SIZE) { + if (blocksize < EXT3_MIN_BLOCK_SIZE || + blocksize > EXT3_MAX_BLOCK_SIZE) { printk(KERN_ERR "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n", blocksize, bdevname(dev)); @@ -993,21 +987,20 @@ sb->s_maxbytes = ext3_max_size(sb->s_blocksize_bits); + hblock = get_hardsect_size(dev); if (sb->s_blocksize != blocksize) { - blocksize = sb->s_blocksize; - /* * Make sure the blocksize for the filesystem is larger * than the hardware sectorsize for the machine. */ - if (sb->s_blocksize < hblock) { + if (blocksize < hblock) { printk(KERN_ERR "EXT3-fs: blocksize %d too small for " "device blocksize %d.\n", blocksize, hblock); goto failed_mount; } brelse (bh); - set_blocksize (dev, sb->s_blocksize); + sb_set_blocksize(sb, blocksize); logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; bh = sb_bread(sb, logic_sb_block); diff -u --recursive --new-file v2.5.1/linux/fs/fat/cache.c linux/fs/fat/cache.c --- v2.5.1/linux/fs/fat/cache.c Fri Oct 12 13:48:42 2001 +++ linux/fs/fat/cache.c Thu Dec 27 08:17:43 2001 @@ -144,7 +144,7 @@ } fat_cache = &cache[0]; for (count = 0; count < FAT_CACHE; count++) { - cache[count].device = 0; + cache[count].sb = NULL; cache[count].next = count == FAT_CACHE-1 ? NULL : &cache[count+1]; } @@ -162,7 +162,7 @@ return; spin_lock(&fat_cache_lock); for (walk = fat_cache; walk; walk = walk->next) - if (inode->i_dev == walk->device + if (inode->i_sb == walk->sb && walk->start_cluster == first && walk->file_cluster <= cluster && walk->file_cluster > *f_clu) { @@ -188,8 +188,8 @@ struct fat_cache *walk; for (walk = fat_cache; walk; walk = walk->next) { - if (walk->device) - printk("<%s,%d>(%d,%d) ", kdevname(walk->device), + if (walk->sb) + printk("<%s,%d>(%d,%d) ", bdevname(walk->sb->s_dev), walk->start_cluster, walk->file_cluster, walk->disk_cluster); else printk("-- "); @@ -207,7 +207,7 @@ last = NULL; spin_lock(&fat_cache_lock); for (walk = fat_cache; walk->next; walk = (last = walk)->next) - if (inode->i_dev == walk->device + if (inode->i_sb == walk->sb && walk->start_cluster == first && walk->file_cluster == f_clu) { if (walk->disk_cluster != d_clu) { @@ -231,7 +231,7 @@ spin_unlock(&fat_cache_lock); return; } - walk->device = inode->i_dev; + walk->sb = inode->i_sb; walk->start_cluster = first; walk->file_cluster = f_clu; walk->disk_cluster = d_clu; @@ -255,21 +255,21 @@ spin_lock(&fat_cache_lock); for (walk = fat_cache; walk; walk = walk->next) - if (walk->device == inode->i_dev + if (walk->sb == inode->i_sb && walk->start_cluster == first) - walk->device = 0; + walk->sb = NULL; spin_unlock(&fat_cache_lock); } -void fat_cache_inval_dev(kdev_t device) +void fat_cache_inval_dev(struct super_block *sb) { struct fat_cache *walk; spin_lock(&fat_cache_lock); for (walk = fat_cache; walk; walk = walk->next) - if (walk->device == device) - walk->device = 0; + if (walk->sb == sb) + walk->sb = 0; spin_unlock(&fat_cache_lock); } diff -u --recursive --new-file v2.5.1/linux/fs/fat/file.c linux/fs/fat/file.c --- v2.5.1/linux/fs/fat/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/fat/file.c Thu Dec 27 08:17:43 2001 @@ -55,9 +55,7 @@ phys = fat_bmap(inode, iblock); if (phys) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, inode->i_sb, phys); return 0; } if (!create) @@ -74,10 +72,8 @@ phys = fat_bmap(inode, iblock); if (!phys) BUG(); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); bh_result->b_state |= (1UL << BH_New); + map_bh(bh_result, inode->i_sb, phys); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/fat/inode.c linux/fs/fat/inode.c --- v2.5.1/linux/fs/fat/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/fat/inode.c Sun Dec 30 10:53:53 2001 @@ -146,6 +146,7 @@ goto out; *res = 0; inode->i_ino = iunique(sb, MSDOS_ROOT_INO); + inode->i_version = 0; fat_fill_inode(inode, de); fat_attach(inode, ino); insert_inode_hash(inode); @@ -185,7 +186,7 @@ if (MSDOS_SB(sb)->fat_bits == 32) { fat_clusters_flush(sb); } - fat_cache_inval_dev(sb->s_dev); + fat_cache_inval_dev(sb); set_blocksize (sb->s_dev,BLOCK_SIZE); if (MSDOS_SB(sb)->nls_disk) { unload_nls(MSDOS_SB(sb)->nls_disk); @@ -383,7 +384,7 @@ MSDOS_I(inode)->i_fat_inode = inode; inode->i_uid = sbi->options.fs_uid; inode->i_gid = sbi->options.fs_gid; - inode->i_version = ++event; + inode->i_version++; inode->i_generation = 0; inode->i_mode = (S_IRWXUGO & ~sbi->options.fs_umask) | S_IFDIR; inode->i_op = sbi->dir_ops; @@ -569,10 +570,6 @@ sb->s_maxbytes = MAX_NON_LFS; sb->s_op = &fat_sops; - hard_blksize = get_hardsect_size(sb->s_dev); - if (!hard_blksize) - hard_blksize = 512; - opts.isvfat = sbi->options.isvfat; if (!parse_options((char *) data, &fat, &debug, &opts, cvf_format, cvf_options)) @@ -582,8 +579,7 @@ fat_cache_init(); - sb->s_blocksize = hard_blksize; - set_blocksize(sb->s_dev, hard_blksize); + sb_min_blocksize(sb, 512); bh = sb_bread(sb, 0); if (bh == NULL) { printk("FAT: unable to read boot sector\n"); @@ -625,13 +621,15 @@ goto out_invalid; } - if (logical_sector_size < hard_blksize) { + if (logical_sector_size < sb->s_blocksize) { printk("FAT: logical sector size too small for device" " (logical sector size = %d)\n", logical_sector_size); brelse(bh); goto out_invalid; } + hard_blksize = sb->s_blocksize; + sbi->cluster_bits = ffs(logical_sector_size * sbi->cluster_size) - 1; sbi->fats = b->fats; sbi->fat_start = CF_LE_W(b->reserved); @@ -716,9 +714,7 @@ if (error) goto out_invalid; - sb->s_blocksize = logical_sector_size; - sb->s_blocksize_bits = ffs(logical_sector_size) - 1; - set_blocksize(sb->s_dev, sb->s_blocksize); + sb_set_blocksize(sb, logical_sector_size); sbi->cvf_format = &default_cvf; if (!strcmp(cvf_format, "none")) i = -1; @@ -781,6 +777,7 @@ if (!root_inode) goto out_unload_nls; root_inode->i_ino = MSDOS_ROOT_INO; + root_inode->i_version = 0; fat_read_root(root_inode); insert_inode_hash(root_inode); sb->s_root = d_alloc_root(root_inode); @@ -802,7 +799,7 @@ out_invalid: if (!silent) { printk("VFS: Can't find a valid FAT filesystem on dev %s.\n", - kdevname(sb->s_dev)); + bdevname(sb->s_dev)); } out_fail: if (opts.iocharset) { @@ -892,7 +889,7 @@ MSDOS_I(inode)->i_fat_inode = inode; inode->i_uid = sbi->options.fs_uid; inode->i_gid = sbi->options.fs_gid; - inode->i_version = ++event; + inode->i_version++; inode->i_generation = CURRENT_TIME; if ((de->attr & ATTR_DIR) && !IS_FREE(de->name)) { diff -u --recursive --new-file v2.5.1/linux/fs/freevxfs/vxfs_inode.c linux/fs/freevxfs/vxfs_inode.c --- v2.5.1/linux/fs/freevxfs/vxfs_inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/freevxfs/vxfs_inode.c Sat Dec 29 17:30:07 2001 @@ -35,6 +35,7 @@ #include <linux/fs.h> #include <linux/kernel.h> #include <linux/slab.h> +#include <linux/pagemap.h> #include "vxfs.h" #include "vxfs_inode.h" diff -u --recursive --new-file v2.5.1/linux/fs/freevxfs/vxfs_subr.c linux/fs/freevxfs/vxfs_subr.c --- v2.5.1/linux/fs/freevxfs/vxfs_subr.c Tue Dec 18 14:56:39 2001 +++ linux/fs/freevxfs/vxfs_subr.c Thu Dec 27 08:17:43 2001 @@ -142,10 +142,7 @@ pblock = vxfs_bmap1(ip, iblock); if (pblock != 0) { - bp->b_dev = ip->i_dev; - bp->b_blocknr = pblock; - bp->b_state |= (1UL << BH_Mapped); - + map_bh(bp, ip->i_sb, pblock); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/hfs/dir.c linux/fs/hfs/dir.c --- v2.5.1/linux/fs/hfs/dir.c Tue Feb 13 14:13:45 2001 +++ linux/fs/hfs/dir.c Sun Dec 30 10:53:53 2001 @@ -69,8 +69,8 @@ /* * update_dirs_plus() * - * Update the fields 'i_size', 'i_nlink', 'i_ctime', 'i_mtime' and - * 'i_version' of the inodes associated with a directory that has + * Update the fields 'i_size', 'i_nlink', 'i_ctime' and 'i_mtime' + * of the inodes associated with a directory that has * had a file ('is_dir'==0) or directory ('is_dir'!=0) added to it. */ static inline void update_dirs_plus(struct hfs_cat_entry *dir, int is_dir) @@ -88,7 +88,6 @@ ++(tmp->i_nlink); } tmp->i_size += HFS_I(tmp)->dir_size; - tmp->i_version = ++event; } tmp->i_ctime = tmp->i_mtime = CURRENT_TIME; mark_inode_dirty(tmp); @@ -100,7 +99,7 @@ * update_dirs_minus() * * Update the fields 'i_size', 'i_nlink', 'i_ctime', 'i_mtime' and - * 'i_version' of the inodes associated with a directory that has + * of the inodes associated with a directory that has * had a file ('is_dir'==0) or directory ('is_dir'!=0) removed. */ static inline void update_dirs_minus(struct hfs_cat_entry *dir, int is_dir) @@ -118,7 +117,6 @@ --(tmp->i_nlink); } tmp->i_size -= HFS_I(tmp)->dir_size; - tmp->i_version = ++event; } tmp->i_ctime = tmp->i_mtime = CURRENT_TIME; mark_inode_dirty(tmp); diff -u --recursive --new-file v2.5.1/linux/fs/hfs/file.c linux/fs/hfs/file.c --- v2.5.1/linux/fs/hfs/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/hfs/file.c Thu Dec 27 08:17:43 2001 @@ -112,11 +112,9 @@ phys = hfs_extent_map(HFS_I(inode)->fork, iblock, create); if (phys) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); if (create) bh_result->b_state |= (1UL << BH_New); + map_bh(bh_result, inode->i_sb, phys); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/hfs/file_cap.c linux/fs/hfs/file_cap.c --- v2.5.1/linux/fs/hfs/file_cap.c Mon Sep 10 07:31:25 2001 +++ linux/fs/hfs/file_cap.c Sun Dec 30 10:53:53 2001 @@ -103,7 +103,6 @@ if (offset != file->f_pos) { file->f_pos = offset; file->f_reada = 0; - file->f_version = ++event; } retval = offset; } diff -u --recursive --new-file v2.5.1/linux/fs/hfs/file_hdr.c linux/fs/hfs/file_hdr.c --- v2.5.1/linux/fs/hfs/file_hdr.c Sun Aug 12 10:56:56 2001 +++ linux/fs/hfs/file_hdr.c Sun Dec 30 10:53:53 2001 @@ -359,7 +359,6 @@ if (offset != file->f_pos) { file->f_pos = offset; file->f_reada = 0; - file->f_version = ++event; } retval = offset; } diff -u --recursive --new-file v2.5.1/linux/fs/hfs/super.c linux/fs/hfs/super.c --- v2.5.1/linux/fs/hfs/super.c Tue Dec 18 14:56:39 2001 +++ linux/fs/hfs/super.c Tue Dec 25 15:39:20 2001 @@ -401,9 +401,7 @@ } /* set the device driver to 512-byte blocks */ - set_blocksize(dev, HFS_SECTOR_SIZE); - s->s_blocksize_bits = HFS_SECTOR_SIZE_BITS; - s->s_blocksize = HFS_SECTOR_SIZE; + sb_set_blocksize(s, HFS_SECTOR_SIZE); #ifdef CONFIG_MAC_PARTITION /* check to see if we're in a partition */ diff -u --recursive --new-file v2.5.1/linux/fs/hpfs/file.c linux/fs/hpfs/file.c --- v2.5.1/linux/fs/hpfs/file.c Tue Dec 18 14:56:39 2001 +++ linux/fs/hpfs/file.c Thu Dec 27 08:17:43 2001 @@ -73,9 +73,7 @@ secno s; s = hpfs_bmap(inode, iblock); if (s) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = s; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, inode->i_sb, s); return 0; } if (!create) return 0; @@ -89,9 +87,8 @@ } inode->i_blocks++; inode->u.hpfs_i.mmu_private += 512; - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = s; - bh_result->b_state |= (1UL << BH_Mapped) | (1UL << BH_New); + bh_result->b_state |= 1UL << BH_New; + map_bh(bh_result, inode->i_sb, s); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/hpfs/hpfs_fn.h linux/fs/hpfs/hpfs_fn.h --- v2.5.1/linux/fs/hpfs/hpfs_fn.h Tue Dec 18 14:56:39 2001 +++ linux/fs/hpfs/hpfs_fn.h Sun Dec 30 10:31:51 2001 @@ -19,7 +19,6 @@ #include <linux/stat.h> #include <linux/string.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/smp_lock.h> diff -u --recursive --new-file v2.5.1/linux/fs/hpfs/super.c linux/fs/hpfs/super.c --- v2.5.1/linux/fs/hpfs/super.c Thu Oct 25 00:02:26 2001 +++ linux/fs/hpfs/super.c Tue Dec 25 15:39:20 2001 @@ -409,7 +409,7 @@ /*s->s_hpfs_mounting = 1;*/ dev = s->s_dev; - set_blocksize(dev, 512); + sb_set_blocksize(s, 512); s->s_hpfs_fs_size = -1; if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; @@ -436,8 +436,6 @@ /* Fill superblock stuff */ s->s_magic = HPFS_SUPER_MAGIC; - s->s_blocksize = 512; - s->s_blocksize_bits = 9; s->s_op = &hpfs_sops; s->s_hpfs_root = superblock->root; diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/dcache.c linux/fs/intermezzo/dcache.c --- v2.5.1/linux/fs/intermezzo/dcache.c Tue Nov 13 09:20:56 2001 +++ linux/fs/intermezzo/dcache.c Sun Dec 30 10:31:51 2001 @@ -16,7 +16,6 @@ #include <linux/errno.h> #include <linux/locks.h> #include <linux/slab.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/ext_attr.c linux/fs/intermezzo/ext_attr.c --- v2.5.1/linux/fs/intermezzo/ext_attr.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/ext_attr.c Sun Dec 30 10:31:51 2001 @@ -28,7 +28,6 @@ #include <asm/uaccess.h> #include <linux/slab.h> #include <linux/vmalloc.h> -#include <asm/segment.h> #include <linux/smp_lock.h> #include <linux/intermezzo_fs.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/inode.c linux/fs/intermezzo/inode.c --- v2.5.1/linux/fs/intermezzo/inode.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/inode.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <asm/uaccess.h> #include <linux/slab.h> #include <linux/vmalloc.h> -#include <asm/segment.h> #include <linux/intermezzo_fs.h> #include <linux/intermezzo_upcall.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal.c linux/fs/intermezzo/journal.c --- v2.5.1/linux/fs/intermezzo/journal.c Tue Nov 13 09:20:56 2001 +++ linux/fs/intermezzo/journal.c Sun Dec 30 10:31:51 2001 @@ -14,7 +14,6 @@ #include <linux/time.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #include <linux/smp_lock.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal_ext2.c linux/fs/intermezzo/journal_ext2.c --- v2.5.1/linux/fs/intermezzo/journal_ext2.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/journal_ext2.c Sun Dec 30 10:31:51 2001 @@ -12,7 +12,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #include <linux/ext2_fs.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal_ext3.c linux/fs/intermezzo/journal_ext3.c --- v2.5.1/linux/fs/intermezzo/journal_ext3.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/journal_ext3.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #include <linux/smp_lock.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal_obdfs.c linux/fs/intermezzo/journal_obdfs.c --- v2.5.1/linux/fs/intermezzo/journal_obdfs.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/journal_obdfs.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #ifdef CONFIG_OBDFS_FS diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal_reiserfs.c linux/fs/intermezzo/journal_reiserfs.c --- v2.5.1/linux/fs/intermezzo/journal_reiserfs.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/journal_reiserfs.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/errno.h> #include <linux/smp_lock.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #if 0 diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/journal_xfs.c linux/fs/intermezzo/journal_xfs.c --- v2.5.1/linux/fs/intermezzo/journal_xfs.c Tue Nov 13 09:20:56 2001 +++ linux/fs/intermezzo/journal_xfs.c Sun Dec 30 10:31:51 2001 @@ -12,7 +12,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #ifdef CONFIG_FS_XFS diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/presto.c linux/fs/intermezzo/presto.c --- v2.5.1/linux/fs/intermezzo/presto.c Tue Nov 13 09:20:56 2001 +++ linux/fs/intermezzo/presto.c Sun Dec 30 10:31:51 2001 @@ -17,7 +17,6 @@ #include <linux/vmalloc.h> #include <linux/slab.h> #include <linux/locks.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/string.h> #include <linux/smp_lock.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/psdev.c linux/fs/intermezzo/psdev.c --- v2.5.1/linux/fs/intermezzo/psdev.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/psdev.c Sun Dec 30 10:31:51 2001 @@ -35,6 +35,7 @@ #include <linux/sched.h> #include <linux/lp.h> #include <linux/slab.h> +#include <asm/ioctls.h> #include <linux/ioport.h> #include <linux/fcntl.h> #include <linux/delay.h> @@ -46,7 +47,6 @@ #include <linux/init.h> #include <linux/list.h> #include <asm/io.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/poll.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/sysctl.c linux/fs/intermezzo/sysctl.c --- v2.5.1/linux/fs/intermezzo/sysctl.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/sysctl.c Sun Dec 30 10:31:51 2001 @@ -16,7 +16,6 @@ #include <linux/ctype.h> #include <linux/init.h> #include <asm/bitops.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <linux/utsname.h> #include <linux/blk.h> diff -u --recursive --new-file v2.5.1/linux/fs/intermezzo/upcall.c linux/fs/intermezzo/upcall.c --- v2.5.1/linux/fs/intermezzo/upcall.c Sun Nov 11 10:20:21 2001 +++ linux/fs/intermezzo/upcall.c Sun Dec 30 10:31:51 2001 @@ -20,7 +20,6 @@ */ #include <asm/system.h> -#include <asm/segment.h> #include <asm/signal.h> #include <linux/signal.h> @@ -37,7 +36,6 @@ #include <linux/string.h> #include <asm/uaccess.h> #include <linux/vmalloc.h> -#include <asm/segment.h> #include <linux/intermezzo_fs.h> #include <linux/intermezzo_upcall.h> diff -u --recursive --new-file v2.5.1/linux/fs/isofs/inode.c linux/fs/isofs/inode.c --- v2.5.1/linux/fs/isofs/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/isofs/inode.c Thu Dec 27 08:17:43 2001 @@ -480,7 +480,6 @@ int iso_blknum, block; int orig_zonesize; int table; - unsigned int blocksize, blocksize_bits; unsigned int vol_desc_start; unsigned long first_data_zone; struct inode * inode; @@ -508,26 +507,10 @@ * larger than the blocksize the user specified, then use * that value. */ - blocksize = get_hardsect_size(dev); - if(blocksize > opt.blocksize) { - /* - * Force the blocksize we are going to use to be the - * hardware blocksize. - */ - opt.blocksize = blocksize; - } - - blocksize_bits = 0; - { - int i = opt.blocksize; - while (i != 1){ - blocksize_bits++; - i >>=1; - } - } - - set_blocksize(dev, opt.blocksize); - s->s_blocksize = opt.blocksize; + /* + * What if bugger tells us to go beyond page size? + */ + opt.blocksize = sb_min_blocksize(s, opt.blocksize); s->u.isofs_sb.s_high_sierra = high_sierra = 0; /* default is iso9660 */ @@ -540,7 +523,7 @@ struct hs_volume_descriptor * hdp; struct iso_volume_descriptor * vdp; - block = iso_blknum << (ISOFS_BLOCK_BITS-blocksize_bits); + block = iso_blknum << (ISOFS_BLOCK_BITS - s->s_blocksize_bits); if (!(bh = sb_bread(s, block))) goto out_no_read; @@ -651,7 +634,7 @@ * blocks that were 512 bytes (which should only very rarely * happen.) */ - if(blocksize != 0 && orig_zonesize < blocksize) + if(orig_zonesize < opt.blocksize) goto out_bad_size; /* RDE: convert log zone size to bit shift */ @@ -734,15 +717,7 @@ * entries. By forcing the blocksize in this way, we ensure * that we will never be required to do this. */ - if ( orig_zonesize != opt.blocksize ) { - set_blocksize(dev, orig_zonesize); -#ifndef BEQUIET - printk(KERN_DEBUG - "ISOFS: Forcing new log zone size:%d\n", orig_zonesize); -#endif - } - s->s_blocksize = orig_zonesize; - s->s_blocksize_bits = s -> u.isofs_sb.s_log_zone_size; + sb_set_blocksize(s, orig_zonesize); s->u.isofs_sb.s_nls_iocharset = NULL; @@ -853,7 +828,7 @@ goto out_freebh; out_bad_size: printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n", - orig_zonesize, blocksize); + orig_zonesize, opt.blocksize); goto out_freebh; #ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS out_no_support: @@ -890,7 +865,7 @@ * (0 == error.) */ int isofs_get_blocks(struct inode *inode, sector_t iblock, - struct buffer_head **bh_result, unsigned long nblocks) + struct buffer_head **bh, unsigned long nblocks) { unsigned long b_off; unsigned offset, sect_size; @@ -952,16 +927,14 @@ } } - if ( *bh_result ) { - (*bh_result)->b_dev = inode->i_dev; - (*bh_result)->b_blocknr = firstext + b_off - offset; - (*bh_result)->b_state |= (1UL << BH_Mapped); + if ( *bh ) { + map_bh(*bh, inode->i_sb, firstext + b_off - offset); } else { - *bh_result = sb_getblk(inode->i_sb, firstext+b_off-offset); - if ( !*bh_result ) + *bh = sb_getblk(inode->i_sb, firstext+b_off-offset); + if ( !*bh ) goto abort; } - bh_result++; /* Next buffer head */ + bh++; /* Next buffer head */ b_off++; /* Next buffer offset */ nblocks--; rv++; diff -u --recursive --new-file v2.5.1/linux/fs/isofs/joliet.c linux/fs/isofs/joliet.c --- v2.5.1/linux/fs/isofs/joliet.c Sun Aug 12 10:56:56 2001 +++ linux/fs/isofs/joliet.c Sat Dec 29 17:30:07 2001 @@ -8,7 +8,7 @@ #include <linux/string.h> #include <linux/nls.h> -#include <linux/slab.h> +#include <linux/mm.h> #include <linux/iso_fs.h> #include <asm/unaligned.h> diff -u --recursive --new-file v2.5.1/linux/fs/isofs/namei.c linux/fs/isofs/namei.c --- v2.5.1/linux/fs/isofs/namei.c Tue Dec 18 14:56:39 2001 +++ linux/fs/isofs/namei.c Sat Dec 29 17:30:07 2001 @@ -12,7 +12,7 @@ #include <linux/string.h> #include <linux/stat.h> #include <linux/fcntl.h> -#include <linux/slab.h> +#include <linux/mm.h> #include <linux/errno.h> #include <linux/config.h> /* Joliet? */ diff -u --recursive --new-file v2.5.1/linux/fs/jffs/inode-v23.c linux/fs/jffs/inode-v23.c --- v2.5.1/linux/fs/jffs/inode-v23.c Thu Oct 4 15:14:35 2001 +++ linux/fs/jffs/inode-v23.c Sun Dec 30 10:53:53 2001 @@ -365,7 +365,6 @@ inode->i_ctime = raw_inode->ctime; inode->i_blksize = PAGE_SIZE; inode->i_blocks = (inode->i_size + 511) >> 9; - inode->i_version = 0; f = jffs_find_file(c, raw_inode->ino); @@ -1023,7 +1022,6 @@ from the in-memory file system structures. */ jffs_insert_node(c, del_f, &raw_inode, 0, del_node); - dir->i_version = ++event; dir->i_ctime = dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); inode->i_nlink--; diff -u --recursive --new-file v2.5.1/linux/fs/jffs2/write.c linux/fs/jffs2/write.c --- v2.5.1/linux/fs/jffs2/write.c Thu Oct 4 15:13:18 2001 +++ linux/fs/jffs2/write.c Sun Dec 30 09:09:24 2001 @@ -31,7 +31,7 @@ * provisions above, a recipient may use your version of this file * under either the RHEPL or the GPL. * - * $Id: write.c,v 1.28 2001/05/01 16:25:25 dwmw2 Exp $ + * $Id: write.c,v 1.30 2001/12/30 16:01:11 dwmw2 Exp $ * */ @@ -207,8 +207,6 @@ } raw->flash_offset = flash_ofs; raw->totlen = PAD(ri->totlen); - raw->next_in_ino = f->inocache->nodes; - f->inocache->nodes = raw; raw->next_phys = NULL; fn->ofs = ri->offset; @@ -222,6 +220,14 @@ sizeof(*ri)+datalen, flash_ofs, ret, retlen); /* Mark the space as dirtied */ if (retlen) { + /* Doesn't belong to any inode */ + raw->next_in_ino = NULL; + + /* Don't change raw->size to match retlen. We may have + written the node header already, and only the data will + seem corrupted, in which case the scan would skip over + any node we write before the original intended end of + this node */ jffs2_add_physical_node_ref(c, raw, sizeof(*ri)+datalen, 1); jffs2_mark_node_obsolete(c, raw); } else { @@ -237,6 +243,11 @@ } /* Mark the space used */ jffs2_add_physical_node_ref(c, raw, retlen, 0); + + /* Link into per-inode list */ + raw->next_in_ino = f->inocache->nodes; + f->inocache->nodes = raw; + D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n", flash_ofs, ri->dsize, ri->csize, ri->node_crc, ri->data_crc, ri->totlen)); if (writelen) *writelen = retlen; diff -u --recursive --new-file v2.5.1/linux/fs/minix/inode.c linux/fs/minix/inode.c --- v2.5.1/linux/fs/minix/inode.c Tue Dec 18 14:56:39 2001 +++ linux/fs/minix/inode.c Tue Dec 25 15:39:20 2001 @@ -126,9 +126,7 @@ struct buffer_head **map; struct minix_super_block *ms; int i, block; - kdev_t dev = s->s_dev; struct inode *root_inode; - unsigned int hblock; struct minix_sb_info *sbi = &s->u.minix_sb; /* N.B. These should be compile-time tests. @@ -138,13 +136,9 @@ if (64 != sizeof(struct minix2_inode)) panic("bad V2 i-node size"); - hblock = get_hardsect_size(dev); - if (hblock > BLOCK_SIZE) + if (!sb_set_blocksize(s, BLOCK_SIZE)) goto out_bad_hblock; - set_blocksize(dev, BLOCK_SIZE); - s->s_blocksize = BLOCK_SIZE; - s->s_blocksize_bits = BLOCK_SIZE_BITS; if (!(bh = sb_bread(s, 1))) goto out_bad_sb; @@ -264,7 +258,7 @@ out_no_fs: if (!silent) printk("VFS: Can't find a Minix or Minix V2 filesystem on device " - "%s.\n", kdevname(dev)); + "%s.\n", bdevname(s->s_dev)); out_release: brelse(bh); goto out; diff -u --recursive --new-file v2.5.1/linux/fs/minix/itree_common.c linux/fs/minix/itree_common.c --- v2.5.1/linux/fs/minix/itree_common.c Tue Dec 18 14:56:39 2001 +++ linux/fs/minix/itree_common.c Thu Dec 27 08:17:43 2001 @@ -141,7 +141,7 @@ } static inline int get_block(struct inode * inode, sector_t block, - struct buffer_head *bh_result, int create) + struct buffer_head *bh, int create) { int err = -EIO; int offsets[DEPTH]; @@ -160,9 +160,7 @@ /* Simplest case - block found, no allocation needed */ if (!partial) { got_it: - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = block_to_cpu(chain[depth-1].key); - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh, inode->i_sb, block_to_cpu(chain[depth-1].key)); /* Clean up and exit */ partial = chain+depth-1; /* the whole chain */ goto cleanup; @@ -196,7 +194,7 @@ if (splice_branch(inode, chain, partial, left) < 0) goto changed; - bh_result->b_state |= (1UL << BH_New); + bh->b_state |= (1UL << BH_New); goto got_it; changed: diff -u --recursive --new-file v2.5.1/linux/fs/msdos/namei.c linux/fs/msdos/namei.c --- v2.5.1/linux/fs/msdos/namei.c Fri Oct 12 13:48:42 2001 +++ linux/fs/msdos/namei.c Sun Dec 30 10:53:53 2001 @@ -476,7 +476,7 @@ if (error) goto out; } - new_dir->i_version = ++event; + new_dir->i_version++; /* There we go */ @@ -491,7 +491,7 @@ else MSDOS_I(old_inode)->i_attrs &= ~ATTR_HIDDEN; mark_inode_dirty(old_inode); - old_dir->i_version = ++event; + old_dir->i_version++; old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; mark_inode_dirty(old_dir); if (new_inode) { @@ -528,7 +528,7 @@ else MSDOS_I(old_inode)->i_attrs &= ~ATTR_HIDDEN; mark_inode_dirty(old_inode); - old_dir->i_version = ++event; + old_dir->i_version++; old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; mark_inode_dirty(old_dir); return 0; diff -u --recursive --new-file v2.5.1/linux/fs/namespace.c linux/fs/namespace.c --- v2.5.1/linux/fs/namespace.c Tue Dec 18 14:56:39 2001 +++ linux/fs/namespace.c Sat Dec 29 17:30:07 2001 @@ -10,16 +10,18 @@ #include <linux/config.h> #include <linux/slab.h> +#include <linux/sched.h> #include <linux/smp_lock.h> #include <linux/init.h> #include <linux/quotaops.h> #include <linux/acct.h> #include <linux/module.h> #include <linux/seq_file.h> +#include <linux/namespace.h> #include <asm/uaccess.h> -struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data); +struct vfsmount *do_kern_mount(const char *type, int flags, char *name, void *data); int do_remount_sb(struct super_block *sb, int flags, void * data); void kill_super(struct super_block *sb); @@ -27,10 +29,6 @@ static int hash_mask, hash_bits; static kmem_cache_t *mnt_cache; -static LIST_HEAD(vfsmntlist); -static DECLARE_MUTEX(mount_sem); -static struct vfsmount *root_vfsmnt; - static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry) { unsigned long tmp = ((unsigned long) mnt / L1_CACHE_BYTES); @@ -96,7 +94,7 @@ while (mnt->mnt_parent != mnt) mnt = mnt->mnt_parent; spin_unlock(&dcache_lock); - return mnt == root_vfsmnt; + return mnt == current->namespace->root; } static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd) @@ -164,26 +162,29 @@ /* iterator */ static void *m_start(struct seq_file *m, loff_t *pos) { + struct namespace *n = m->private; struct list_head *p; - loff_t n = *pos; + loff_t l = *pos; - down(&mount_sem); - list_for_each(p, &vfsmntlist) - if (!n--) + down_read(&n->sem); + list_for_each(p, &n->list) + if (!l--) return list_entry(p, struct vfsmount, mnt_list); return NULL; } static void *m_next(struct seq_file *m, void *v, loff_t *pos) { + struct namespace *n = m->private; struct list_head *p = ((struct vfsmount *)v)->mnt_list.next; (*pos)++; - return p==&vfsmntlist ? NULL : list_entry(p, struct vfsmount, mnt_list); + return p==&n->list ? NULL : list_entry(p, struct vfsmount, mnt_list); } static void m_stop(struct seq_file *m, void *v) { - up(&mount_sem); + struct namespace *n = m->private; + up_read(&n->sem); } static inline void mangle(struct seq_file *m, const char *s) @@ -329,7 +330,7 @@ return retval; } - down(&mount_sem); + down_write(¤t->namespace->sem); spin_lock(&dcache_lock); if (atomic_read(&sb->s_active) == 1) { @@ -337,7 +338,7 @@ spin_unlock(&dcache_lock); lock_kernel(); DQUOT_OFF(sb); - acct_auto_close(sb->s_dev); + acct_auto_close(sb); unlock_kernel(); spin_lock(&dcache_lock); } @@ -348,7 +349,7 @@ retval = 0; } spin_unlock(&dcache_lock); - up(&mount_sem); + up_write(¤t->namespace->sem); return retval; } @@ -478,7 +479,7 @@ struct list_head head; attach_mnt(mnt, nd); list_add_tail(&head, &mnt->mnt_list); - list_splice(&head, vfsmntlist.prev); + list_splice(&head, current->namespace->list.prev); mntget(mnt); err = 0; } @@ -505,7 +506,7 @@ if (err) return err; - down(&mount_sem); + down_write(¤t->namespace->sem); err = -EINVAL; if (check_mnt(nd->mnt) && (!recurse || check_mnt(old_nd.mnt))) { err = -ENOMEM; @@ -525,7 +526,7 @@ mntput(mnt); } - up(&mount_sem); + up_write(¤t->namespace->sem); path_release(&old_nd); return err; } @@ -572,7 +573,7 @@ if (err) return err; - down(&mount_sem); + down_write(¤t->namespace->sem); while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) ; err = -EINVAL; @@ -612,7 +613,7 @@ out1: up(&nd->dentry->d_inode->i_zombie); out: - up(&mount_sem); + up_write(¤t->namespace->sem); if (!err) path_release(&parent_nd); path_release(&old_nd); @@ -622,13 +623,22 @@ static int do_add_mount(struct nameidata *nd, char *type, int flags, int mnt_flags, char *name, void *data) { - struct vfsmount *mnt = do_kern_mount(type, flags, name, data); - int err = PTR_ERR(mnt); + struct vfsmount *mnt; + int err; + + if (!type || !memchr(type, 0, PAGE_SIZE)) + return -EINVAL; + /* we need capabilities... */ + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + mnt = do_kern_mount(type, flags, name, data); + err = PTR_ERR(mnt); if (IS_ERR(mnt)) goto out; - down(&mount_sem); + down_write(¤t->namespace->sem); /* Something was mounted here while we slept */ while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) ; @@ -644,7 +654,7 @@ mnt->mnt_flags = mnt_flags; err = graft_tree(mnt, nd); unlock: - up(&mount_sem); + up_write(¤t->namespace->sem); mntput(mnt); out: return err; @@ -744,6 +754,86 @@ return retval; } +int copy_namespace(int flags, struct task_struct *tsk) +{ + struct namespace *namespace = tsk->namespace; + struct namespace *new_ns; + struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; + struct fs_struct *fs = tsk->fs; + + if (!namespace) + return 0; + + get_namespace(namespace); + + if (! (flags & CLONE_NEWNS)) + return 0; + + if (!capable(CAP_SYS_ADMIN)) { + put_namespace(namespace); + return -EPERM; + } + + new_ns = kmalloc(sizeof(struct namespace *), GFP_KERNEL); + if (!new_ns) + goto out; + + atomic_set(&new_ns->count, 1); + init_rwsem(&new_ns->sem); + new_ns->root = NULL; + INIT_LIST_HEAD(&new_ns->list); + + down_write(&tsk->namespace->sem); + /* First pass: copy the tree topology */ + new_ns->root = copy_tree(namespace->root, namespace->root->mnt_root); + spin_lock(&dcache_lock); + list_add_tail(&new_ns->list, &new_ns->root->mnt_list); + spin_unlock(&dcache_lock); + + /* Second pass: switch the tsk->fs->* elements */ + if (fs) { + struct vfsmount *p, *q; + write_lock(&fs->lock); + + p = namespace->root; + q = new_ns->root; + while (p) { + if (p == fs->rootmnt) { + rootmnt = p; + fs->rootmnt = mntget(q); + } + if (p == fs->pwdmnt) { + pwdmnt = p; + fs->pwdmnt = mntget(q); + } + if (p == fs->altrootmnt) { + altrootmnt = p; + fs->altrootmnt = mntget(q); + } + p = next_mnt(p, namespace->root); + q = next_mnt(q, new_ns->root); + } + write_unlock(&fs->lock); + } + up_write(&tsk->namespace->sem); + + tsk->namespace = new_ns; + + if (rootmnt) + mntput(rootmnt); + if (pwdmnt) + mntput(pwdmnt); + if (altrootmnt) + mntput(altrootmnt); + + put_namespace(namespace); + return 0; + +out: + put_namespace(namespace); + return -ENOMEM; +} + asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, unsigned long flags, void * data) { @@ -862,7 +952,7 @@ user_nd.mnt = mntget(current->fs->rootmnt); user_nd.dentry = dget(current->fs->root); read_unlock(¤t->fs->lock); - down(&mount_sem); + down_write(¤t->namespace->sem); down(&old_nd.dentry->d_inode->i_zombie); error = -EINVAL; if (!check_mnt(user_nd.mnt)) @@ -907,7 +997,7 @@ path_release(&parent_nd); out2: up(&old_nd.dentry->d_inode->i_zombie); - up(&mount_sem); + up_write(¤t->namespace->sem); path_release(&user_nd); path_release(&old_nd); out1: @@ -920,95 +1010,34 @@ goto out2; } -/* - * Absolutely minimal fake fs - only empty root directory and nothing else. - * In 2.5 we'll use ramfs or tmpfs, but for now it's all we need - just - * something to go with root vfsmount. - */ -static struct inode_operations rootfs_dir_inode_operations; -static struct file_operations rootfs_dir_operations; -static int rootfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) -{ - struct inode * inode = new_inode(dir->i_sb); - int error = -ENOSPC; - if (inode) { - inode->i_mode = S_IFDIR|mode; - inode->i_uid = current->fsuid; - inode->i_gid = current->fsgid; - inode->i_op = &rootfs_dir_inode_operations; - inode->i_fop = &rootfs_dir_operations; - d_instantiate(dentry, inode); - dget(dentry); - error = 0; - } - return error; -} -static int rootfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev) -{ - struct inode * inode = new_inode(dir->i_sb); - int error = -ENOSPC; - if (inode) { - inode->i_uid = current->fsuid; - inode->i_gid = current->fsgid; - init_special_inode(inode, mode, dev); - d_instantiate(dentry, inode); - dget(dentry); - error = 0; - } - return error; -} -static int rootfs_unlink(struct inode * dir, struct dentry *dentry) -{ - dentry->d_inode->i_nlink--; - dput(dentry); - return 0; -} -static struct dentry *rootfs_lookup(struct inode *dir, struct dentry *dentry) -{ - d_add(dentry, NULL); - return NULL; -} -static struct file_operations rootfs_dir_operations = { - read: generic_read_dir, - readdir: dcache_readdir, -}; -static struct inode_operations rootfs_dir_inode_operations = { - lookup: rootfs_lookup, - mkdir: rootfs_mkdir, - mknod: rootfs_mknod, - unlink: rootfs_unlink, -}; -static struct super_block *rootfs_read_super(struct super_block * sb, void * data, int silent) +static void __init init_mount_tree(void) { - struct inode * inode; - struct dentry * root; - static struct super_operations s_ops = {}; - sb->s_op = &s_ops; - inode = new_inode(sb); - if (!inode) - return NULL; - inode->i_mode = S_IFDIR|0555; - inode->i_uid = inode->i_gid = 0; - inode->i_op = &rootfs_dir_inode_operations; - inode->i_fop = &rootfs_dir_operations; - root = d_alloc_root(inode); - if (!root) { - iput(inode); - return NULL; + struct vfsmount *mnt; + struct namespace *namespace; + struct task_struct *p; + + mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); + if (IS_ERR(mnt)) + panic("Can't create rootfs"); + namespace = kmalloc(sizeof(*namespace), GFP_KERNEL); + if (!namespace) + panic("Can't allocate initial namespace"); + atomic_set(&namespace->count, 1); + INIT_LIST_HEAD(&namespace->list); + init_rwsem(&namespace->sem); + list_add(&mnt->mnt_list, &namespace->list); + namespace->root = mnt; + + init_task.namespace = namespace; + read_lock(&tasklist_lock); + for_each_task(p) { + get_namespace(namespace); + p->namespace = namespace; } - sb->s_root = root; - return sb; -} -static DECLARE_FSTYPE(root_fs_type, "rootfs", rootfs_read_super, FS_NOMOUNT); + read_unlock(&tasklist_lock); -static void __init init_mount_tree(void) -{ - register_filesystem(&root_fs_type); - root_vfsmnt = do_kern_mount("rootfs", 0, "rootfs", NULL); - if (IS_ERR(root_vfsmnt)) - panic("can't allocate root vfsmount"); - set_fs_pwd(current->fs, root_vfsmnt, root_vfsmnt->mnt_root); - set_fs_root(current->fs, root_vfsmnt, root_vfsmnt->mnt_root); + set_fs_pwd(current->fs, namespace->root, namespace->root->mnt_root); + set_fs_root(current->fs, namespace->root, namespace->root->mnt_root); } void __init mnt_init(unsigned long mempages) @@ -1066,5 +1095,6 @@ d++; i--; } while (i); + init_rootfs(); init_mount_tree(); } diff -u --recursive --new-file v2.5.1/linux/fs/ncpfs/symlink.c linux/fs/ncpfs/symlink.c --- v2.5.1/linux/fs/ncpfs/symlink.c Fri Dec 29 14:07:57 2000 +++ linux/fs/ncpfs/symlink.c Sun Dec 30 10:31:51 2001 @@ -21,7 +21,6 @@ #ifdef CONFIG_NCPFS_EXTRAS #include <asm/uaccess.h> -#include <asm/segment.h> #include <linux/errno.h> #include <linux/fs.h> diff -u --recursive --new-file v2.5.1/linux/fs/nfs/file.c linux/fs/nfs/file.c --- v2.5.1/linux/fs/nfs/file.c Sun Sep 23 09:48:01 2001 +++ linux/fs/nfs/file.c Thu Dec 20 08:57:31 2001 @@ -161,15 +161,10 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to) { long status; - loff_t pos = ((loff_t)page->index<<PAGE_CACHE_SHIFT) + to; - struct inode *inode = page->mapping->host; lock_kernel(); status = nfs_updatepage(file, page, offset, to-offset); unlock_kernel(); - /* most likely it's already done. CHECKME */ - if (pos > inode->i_size) - inode->i_size = pos; return status; } diff -u --recursive --new-file v2.5.1/linux/fs/nfs/inode.c linux/fs/nfs/inode.c --- v2.5.1/linux/fs/nfs/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/nfs/inode.c Thu Dec 20 08:57:31 2001 @@ -107,17 +107,10 @@ inode->i_rdev = 0; /* We can't support UPDATE_ATIME(), since the server will reset it */ inode->i_flags |= S_NOATIME; - NFS_FILEID(inode) = 0; - NFS_FSID(inode) = 0; - NFS_FLAGS(inode) = 0; INIT_LIST_HEAD(&inode->u.nfs_i.read); INIT_LIST_HEAD(&inode->u.nfs_i.dirty); INIT_LIST_HEAD(&inode->u.nfs_i.commit); INIT_LIST_HEAD(&inode->u.nfs_i.writeback); - inode->u.nfs_i.nread = 0; - inode->u.nfs_i.ndirty = 0; - inode->u.nfs_i.ncommit = 0; - inode->u.nfs_i.npages = 0; NFS_CACHEINV(inode); NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode); NFS_ATTRTIMEO_UPDATE(inode) = jiffies; @@ -655,19 +648,6 @@ inode->i_op = &nfs_symlink_inode_operations; else init_special_inode(inode, inode->i_mode, fattr->rdev); - /* - * Preset the size and mtime, as there's no need - * to invalidate the caches. - */ - inode->i_size = nfs_size_to_loff_t(fattr->size); - inode->i_mtime = nfs_time_to_secs(fattr->mtime); - inode->i_atime = nfs_time_to_secs(fattr->atime); - inode->i_ctime = nfs_time_to_secs(fattr->ctime); - NFS_CACHE_CTIME(inode) = fattr->ctime; - NFS_CACHE_MTIME(inode) = fattr->mtime; - NFS_CACHE_ISIZE(inode) = fattr->size; - NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode); - NFS_ATTRTIMEO_UPDATE(inode) = jiffies; memcpy(&inode->u.nfs_i.fh, fh, sizeof(inode->u.nfs_i.fh)); } nfs_refresh_inode(inode, fattr); @@ -697,6 +677,9 @@ return 0; if (memcmp(&inode->u.nfs_i.fh, fh, sizeof(inode->u.nfs_i.fh)) != 0) return 0; + /* Force an attribute cache update if inode->i_count == 0 */ + if (!atomic_read(&inode->i_count)) + NFS_CACHEINV(inode); return 1; } @@ -797,7 +780,9 @@ if (!S_ISREG(inode->i_mode)) attr->ia_valid &= ~ATTR_SIZE; + filemap_fdatasync(inode->i_mapping); error = nfs_wb_all(inode); + filemap_fdatawait(inode->i_mapping); if (error) goto out; @@ -825,6 +810,8 @@ fattr.pre_ctime = NFS_CACHE_CTIME(inode); fattr.valid |= NFS_ATTR_WCC; } + /* Force an attribute cache update */ + NFS_CACHEINV(inode); error = nfs_refresh_inode(inode, &fattr); out: return error; @@ -966,6 +953,34 @@ } /* + * nfs_fattr_obsolete - Test if attribute data is newer than cached data + * @inode: inode + * @fattr: attributes to test + * + * Avoid stuffing the attribute cache with obsolete information. + * We always accept updates if the attribute cache timed out, or if + * fattr->ctime is newer than our cached value. + * If fattr->ctime matches the cached value, we still accept the update + * if it increases the file size. + */ +static inline +int nfs_fattr_obsolete(struct inode *inode, struct nfs_fattr *fattr) +{ + s64 cdif; + + if (time_after(jiffies, NFS_READTIME(inode)+NFS_ATTRTIMEO(inode))) + goto out_valid; + if ((cdif = (s64)fattr->ctime - (s64)NFS_CACHE_CTIME(inode)) > 0) + goto out_valid; + /* Ugh... */ + if (cdif == 0 && fattr->size > NFS_CACHE_ISIZE(inode)) + goto out_valid; + return -1; + out_valid: + return 0; +} + +/* * Many nfs protocol calls return the new file attributes after * an operation. Here we update the inode to reflect the state * of the server's inode. @@ -982,6 +997,7 @@ { __u64 new_size, new_mtime; loff_t new_isize; + time_t new_atime; int invalid = 0; dfprintk(VFS, "NFS: refresh_inode(%x/%ld ct=%d info=0x%x)\n", @@ -1007,6 +1023,11 @@ new_size = fattr->size; new_isize = nfs_size_to_loff_t(fattr->size); + new_atime = nfs_time_to_secs(fattr->atime); + /* Avoid races */ + if (nfs_fattr_obsolete(inode, fattr)) + goto out_nochange; + /* * Update the read time so we don't revalidate too often. */ @@ -1056,7 +1077,7 @@ NFS_CACHE_CTIME(inode) = fattr->ctime; inode->i_ctime = nfs_time_to_secs(fattr->ctime); - inode->i_atime = nfs_time_to_secs(fattr->atime); + inode->i_atime = new_atime; NFS_CACHE_MTIME(inode) = new_mtime; inode->i_mtime = nfs_time_to_secs(new_mtime); @@ -1093,7 +1114,10 @@ if (invalid) nfs_zap_caches(inode); return 0; - + out_nochange: + if (new_atime - inode->i_atime > 0) + inode->i_atime = new_atime; + return 0; out_changed: /* * Big trouble! The inode has become a different object. diff -u --recursive --new-file v2.5.1/linux/fs/nfs/nfs2xdr.c linux/fs/nfs/nfs2xdr.c --- v2.5.1/linux/fs/nfs/nfs2xdr.c Fri Nov 2 17:40:09 2001 +++ linux/fs/nfs/nfs2xdr.c Thu Dec 20 08:57:31 2001 @@ -270,14 +270,12 @@ count = ntohl(*p++); hdrlen = (u8 *) p - (u8 *) iov->iov_base; - recvd = req->rq_rlen - hdrlen; - if (p != iov[req->rq_rnr-1].iov_base) { - /* Unexpected reply header size. Punt. - * XXX: Move iovec contents to align data on page - * boundary and adjust RPC header size guess */ - printk(KERN_WARNING "NFS: Odd RPC header size in read reply: %d\n", hdrlen); - return -errno_NFSERR_IO; + if (iov->iov_len > hdrlen) { + dprintk("NFS: READ header is short. iovec will be shifted.\n"); + xdr_shift_iovec(iov, req->rq_rnr, iov->iov_len - hdrlen); } + + recvd = req->rq_rlen - hdrlen; if (count > recvd) { printk(KERN_WARNING "NFS: server cheating in read reply: " "count %d > recvd %d\n", count, recvd); @@ -448,27 +446,23 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs_readdirres *res) { struct iovec *iov = req->rq_rvec; + int hdrlen; int status, nr; u32 *end, *entry, len; if ((status = ntohl(*p++))) return -nfs_stat_to_errno(status); - if ((void *) p != ((u8 *) iov->iov_base+iov->iov_len)) { - /* Unexpected reply header size. Punt. */ - printk(KERN_WARNING "NFS: Odd RPC header size in readdirres reply\n"); - return -errno_NFSERR_IO; + + hdrlen = (u8 *) p - (u8 *) iov->iov_base; + if (iov->iov_len > hdrlen) { + dprintk("NFS: READDIR header is short. iovec will be shifted.\n"); + xdr_shift_iovec(iov, req->rq_rnr, iov->iov_len - hdrlen); } + /* Get start and end address of XDR data */ p = (u32 *) iov[1].iov_base; end = (u32 *) ((u8 *) p + iov[1].iov_len); - - /* Get start and end of dirent buffer */ - if (res->buffer != p) { - printk(KERN_ERR "NFS: Bad result buffer in readdir\n"); - return -errno_NFSERR_IO; - } - for (nr = 0; *p++; nr++) { entry = p - 1; if (p + 2 > end) @@ -598,13 +592,21 @@ static int nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_readlinkres *res) { + struct iovec *iov = req->rq_rvec; u32 *strlen; char *string; + int hdrlen; int status; unsigned int len; if ((status = ntohl(*p++))) return -nfs_stat_to_errno(status); + hdrlen = (u8 *) p - (u8 *) iov->iov_base; + if (iov->iov_len > hdrlen) { + dprintk("NFS: READLINK header is short. iovec will be shifted.\n"); + xdr_shift_iovec(iov, req->rq_rnr, iov->iov_len - hdrlen); + } + strlen = (u32*)res->buffer; /* Convert length of symlink */ len = ntohl(*strlen); diff -u --recursive --new-file v2.5.1/linux/fs/nfs/read.c linux/fs/nfs/read.c --- v2.5.1/linux/fs/nfs/read.c Fri Nov 9 14:28:15 2001 +++ linux/fs/nfs/read.c Thu Dec 20 08:57:31 2001 @@ -397,7 +397,7 @@ { struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata; struct inode *inode = data->inode; - int count = data->res.count; + unsigned int count = data->res.count; dprintk("NFS: %4d nfs_readpage_result, (status %d)\n", task->tk_pid, task->tk_status); @@ -408,9 +408,15 @@ struct page *page = req->wb_page; nfs_list_remove_request(req); - if (task->tk_status >= 0 && count >= 0) { + if (task->tk_status >= 0) { + if (count < PAGE_CACHE_SIZE) { + char *p = kmap(page); + memset(p + count, 0, PAGE_CACHE_SIZE - count); + kunmap(page); + count = 0; + } else + count -= PAGE_CACHE_SIZE; SetPageUptodate(page); - count -= PAGE_CACHE_SIZE; } else SetPageError(page); flush_dcache_page(page); diff -u --recursive --new-file v2.5.1/linux/fs/nfs/write.c linux/fs/nfs/write.c --- v2.5.1/linux/fs/nfs/write.c Tue Nov 20 14:18:50 2001 +++ linux/fs/nfs/write.c Sat Dec 29 17:30:07 2001 @@ -49,7 +49,7 @@ #include <linux/config.h> #include <linux/types.h> #include <linux/slab.h> -#include <linux/swap.h> +#include <linux/mm.h> #include <linux/pagemap.h> #include <linux/file.h> @@ -213,6 +213,7 @@ unsigned int offset, unsigned int count) { struct nfs_page *req; + loff_t end; int status; req = nfs_update_request(file, inode, page, offset, count); @@ -223,6 +224,10 @@ req->wb_cred = get_rpccred(NFS_I(inode)->mm_cred); nfs_unlock_request(req); nfs_strategy(inode); + end = ((loff_t)page->index<<PAGE_CACHE_SHIFT) + (loff_t)(offset + count); + if (inode->i_size < end) + inode->i_size = end; + out: return status; } @@ -781,6 +786,7 @@ struct dentry *dentry = file->f_dentry; struct inode *inode = dentry->d_inode; struct nfs_page *req; + loff_t end; int status = 0; dprintk("NFS: nfs_updatepage(%s/%s %d@%Ld)\n", @@ -812,6 +818,10 @@ goto done; status = 0; + end = ((loff_t)page->index<<PAGE_CACHE_SHIFT) + (loff_t)(offset + count); + if (inode->i_size < end) + inode->i_size = end; + /* If we wrote past the end of the page. * Call the strategy routine so it can send out a bunch * of requests. diff -u --recursive --new-file v2.5.1/linux/fs/nfsd/export.c linux/fs/nfsd/export.c --- v2.5.1/linux/fs/nfsd/export.c Wed Oct 3 22:57:36 2001 +++ linux/fs/nfsd/export.c Sat Dec 29 17:30:07 2001 @@ -16,6 +16,7 @@ #include <linux/unistd.h> #include <linux/slab.h> +#include <linux/sched.h> #include <linux/stat.h> #include <linux/in.h> diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_base.c linux/fs/nls/nls_base.c --- v2.5.1/linux/fs/nls/nls_base.c Fri Feb 9 11:29:44 2001 +++ linux/fs/nls/nls_base.c Sat Dec 29 17:30:07 2001 @@ -13,7 +13,7 @@ #include <linux/string.h> #include <linux/config.h> #include <linux/nls.h> -#include <linux/slab.h> +#include <linux/kernel.h> #include <linux/errno.h> #ifdef CONFIG_KMOD #include <linux/kmod.h> diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_big5.c linux/fs/nls/nls_big5.c --- v2.5.1/linux/fs/nls/nls_big5.c Mon Oct 16 12:58:51 2000 +++ linux/fs/nls/nls_big5.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_big5) module_exit(exit_nls_big5) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp1251.c linux/fs/nls/nls_cp1251.c --- v2.5.1/linux/fs/nls/nls_cp1251.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp1251.c Sun Dec 30 11:16:26 2001 @@ -315,4 +315,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp1255.c linux/fs/nls/nls_cp1255.c --- v2.5.1/linux/fs/nls/nls_cp1255.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp1255.c Sun Dec 30 11:16:26 2001 @@ -396,4 +396,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp437.c linux/fs/nls/nls_cp437.c --- v2.5.1/linux/fs/nls/nls_cp437.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp437.c Sun Dec 30 11:16:26 2001 @@ -401,4 +401,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp737.c linux/fs/nls/nls_cp737.c --- v2.5.1/linux/fs/nls/nls_cp737.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp737.c Sun Dec 30 11:16:26 2001 @@ -364,4 +364,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp775.c linux/fs/nls/nls_cp775.c --- v2.5.1/linux/fs/nls/nls_cp775.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp775.c Sun Dec 30 11:16:26 2001 @@ -333,4 +333,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp850.c linux/fs/nls/nls_cp850.c --- v2.5.1/linux/fs/nls/nls_cp850.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp850.c Sun Dec 30 11:16:26 2001 @@ -329,4 +329,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp852.c linux/fs/nls/nls_cp852.c --- v2.5.1/linux/fs/nls/nls_cp852.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp852.c Sun Dec 30 11:16:26 2001 @@ -351,4 +351,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp855.c linux/fs/nls/nls_cp855.c --- v2.5.1/linux/fs/nls/nls_cp855.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp855.c Sun Dec 30 11:16:26 2001 @@ -313,4 +313,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp857.c linux/fs/nls/nls_cp857.c --- v2.5.1/linux/fs/nls/nls_cp857.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp857.c Sun Dec 30 11:16:26 2001 @@ -315,4 +315,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp860.c linux/fs/nls/nls_cp860.c --- v2.5.1/linux/fs/nls/nls_cp860.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp860.c Sun Dec 30 11:16:26 2001 @@ -378,4 +378,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp861.c linux/fs/nls/nls_cp861.c --- v2.5.1/linux/fs/nls/nls_cp861.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp861.c Sun Dec 30 11:16:26 2001 @@ -401,4 +401,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp862.c linux/fs/nls/nls_cp862.c --- v2.5.1/linux/fs/nls/nls_cp862.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp862.c Sun Dec 30 11:16:26 2001 @@ -435,4 +435,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp863.c linux/fs/nls/nls_cp863.c --- v2.5.1/linux/fs/nls/nls_cp863.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp863.c Sun Dec 30 11:16:26 2001 @@ -395,4 +395,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp864.c linux/fs/nls/nls_cp864.c --- v2.5.1/linux/fs/nls/nls_cp864.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp864.c Sun Dec 30 11:16:26 2001 @@ -421,4 +421,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp865.c linux/fs/nls/nls_cp865.c --- v2.5.1/linux/fs/nls/nls_cp865.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp865.c Sun Dec 30 11:16:26 2001 @@ -401,4 +401,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp866.c linux/fs/nls/nls_cp866.c --- v2.5.1/linux/fs/nls/nls_cp866.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp866.c Sun Dec 30 11:16:26 2001 @@ -319,4 +319,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp869.c linux/fs/nls/nls_cp869.c --- v2.5.1/linux/fs/nls/nls_cp869.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp869.c Sun Dec 30 11:16:26 2001 @@ -329,4 +329,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp874.c linux/fs/nls/nls_cp874.c --- v2.5.1/linux/fs/nls/nls_cp874.c Sun Sep 30 12:26:08 2001 +++ linux/fs/nls/nls_cp874.c Sun Dec 30 11:16:26 2001 @@ -287,4 +287,4 @@ * c-continued-brace-offset: 0 * End: */ -MODULE_LICENSE("BSD without advertising clause"); +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp932.c linux/fs/nls/nls_cp932.c --- v2.5.1/linux/fs/nls/nls_cp932.c Fri Apr 6 10:51:19 2001 +++ linux/fs/nls/nls_cp932.c Sun Dec 30 11:16:26 2001 @@ -7904,6 +7904,7 @@ module_init(init_nls_cp932) module_exit(exit_nls_cp932) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp936.c linux/fs/nls/nls_cp936.c --- v2.5.1/linux/fs/nls/nls_cp936.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_cp936.c Sun Dec 30 11:16:26 2001 @@ -11024,6 +11024,7 @@ module_init(init_nls_cp936) module_exit(exit_nls_cp936) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp949.c linux/fs/nls/nls_cp949.c --- v2.5.1/linux/fs/nls/nls_cp949.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_cp949.c Sun Dec 30 11:16:26 2001 @@ -13941,6 +13941,7 @@ module_init(init_nls_cp949) module_exit(exit_nls_cp949) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_cp950.c linux/fs/nls/nls_cp950.c --- v2.5.1/linux/fs/nls/nls_cp950.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_cp950.c Sun Dec 30 11:16:26 2001 @@ -9480,6 +9480,7 @@ module_init(init_nls_cp950) module_exit(exit_nls_cp950) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_euc-jp.c linux/fs/nls/nls_euc-jp.c --- v2.5.1/linux/fs/nls/nls_euc-jp.c Fri Apr 6 10:51:19 2001 +++ linux/fs/nls/nls_euc-jp.c Sun Dec 30 11:16:26 2001 @@ -581,6 +581,7 @@ module_init(init_nls_euc_jp) module_exit(exit_nls_euc_jp) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_euc-kr.c linux/fs/nls/nls_euc-kr.c --- v2.5.1/linux/fs/nls/nls_euc-kr.c Mon Oct 16 12:58:51 2000 +++ linux/fs/nls/nls_euc-kr.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_euc_kr) module_exit(exit_nls_euc_kr) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_gb2312.c linux/fs/nls/nls_gb2312.c --- v2.5.1/linux/fs/nls/nls_gb2312.c Mon Oct 16 12:58:51 2000 +++ linux/fs/nls/nls_gb2312.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_gb2312) module_exit(exit_nls_gb2312) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-1.c linux/fs/nls/nls_iso8859-1.c --- v2.5.1/linux/fs/nls/nls_iso8859-1.c Tue Jul 18 22:48:33 2000 +++ linux/fs/nls/nls_iso8859-1.c Sun Dec 30 11:16:26 2001 @@ -254,6 +254,7 @@ module_init(init_nls_iso8859_1) module_exit(exit_nls_iso8859_1) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-13.c linux/fs/nls/nls_iso8859-13.c --- v2.5.1/linux/fs/nls/nls_iso8859-13.c Sat May 19 17:47:55 2001 +++ linux/fs/nls/nls_iso8859-13.c Sun Dec 30 11:16:26 2001 @@ -282,6 +282,7 @@ module_init(init_nls_iso8859_13) module_exit(exit_nls_iso8859_13) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-14.c linux/fs/nls/nls_iso8859-14.c --- v2.5.1/linux/fs/nls/nls_iso8859-14.c Tue Jul 18 22:48:33 2000 +++ linux/fs/nls/nls_iso8859-14.c Sun Dec 30 11:16:26 2001 @@ -338,6 +338,7 @@ module_init(init_nls_iso8859_14) module_exit(exit_nls_iso8859_14) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-15.c linux/fs/nls/nls_iso8859-15.c --- v2.5.1/linux/fs/nls/nls_iso8859-15.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-15.c Sun Dec 30 11:16:26 2001 @@ -304,6 +304,7 @@ module_init(init_nls_iso8859_15) module_exit(exit_nls_iso8859_15) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-2.c linux/fs/nls/nls_iso8859-2.c --- v2.5.1/linux/fs/nls/nls_iso8859-2.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-2.c Sun Dec 30 11:16:26 2001 @@ -305,6 +305,7 @@ module_init(init_nls_iso8859_2) module_exit(exit_nls_iso8859_2) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-3.c linux/fs/nls/nls_iso8859-3.c --- v2.5.1/linux/fs/nls/nls_iso8859-3.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-3.c Sun Dec 30 11:16:26 2001 @@ -305,6 +305,7 @@ module_init(init_nls_iso8859_3) module_exit(exit_nls_iso8859_3) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-4.c linux/fs/nls/nls_iso8859-4.c --- v2.5.1/linux/fs/nls/nls_iso8859-4.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-4.c Sun Dec 30 11:16:26 2001 @@ -305,6 +305,7 @@ module_init(init_nls_iso8859_4) module_exit(exit_nls_iso8859_4) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-5.c linux/fs/nls/nls_iso8859-5.c --- v2.5.1/linux/fs/nls/nls_iso8859-5.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-5.c Sun Dec 30 11:16:26 2001 @@ -269,6 +269,7 @@ module_init(init_nls_iso8859_5) module_exit(exit_nls_iso8859_5) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-6.c linux/fs/nls/nls_iso8859-6.c --- v2.5.1/linux/fs/nls/nls_iso8859-6.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-6.c Sun Dec 30 11:16:26 2001 @@ -260,6 +260,7 @@ module_init(init_nls_iso8859_6) module_exit(exit_nls_iso8859_6) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-7.c linux/fs/nls/nls_iso8859-7.c --- v2.5.1/linux/fs/nls/nls_iso8859-7.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-7.c Sun Dec 30 11:16:26 2001 @@ -314,6 +314,7 @@ module_init(init_nls_iso8859_7) module_exit(exit_nls_iso8859_7) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-8.c linux/fs/nls/nls_iso8859-8.c --- v2.5.1/linux/fs/nls/nls_iso8859-8.c Fri Apr 6 10:51:19 2001 +++ linux/fs/nls/nls_iso8859-8.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_iso8859_8) module_exit(exit_nls_iso8859_8) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_iso8859-9.c linux/fs/nls/nls_iso8859-9.c --- v2.5.1/linux/fs/nls/nls_iso8859-9.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_iso8859-9.c Sun Dec 30 11:16:26 2001 @@ -269,6 +269,7 @@ module_init(init_nls_iso8859_9) module_exit(exit_nls_iso8859_9) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_koi8-r.c linux/fs/nls/nls_koi8-r.c --- v2.5.1/linux/fs/nls/nls_koi8-r.c Fri Jul 21 15:19:51 2000 +++ linux/fs/nls/nls_koi8-r.c Sun Dec 30 11:16:26 2001 @@ -320,6 +320,7 @@ module_init(init_nls_koi8_r) module_exit(exit_nls_koi8_r) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_koi8-ru.c linux/fs/nls/nls_koi8-ru.c --- v2.5.1/linux/fs/nls/nls_koi8-ru.c Sat May 19 17:47:55 2001 +++ linux/fs/nls/nls_koi8-ru.c Sun Dec 30 11:16:26 2001 @@ -80,6 +80,7 @@ module_init(init_nls_koi8_ru) module_exit(exit_nls_koi8_ru) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_koi8-u.c linux/fs/nls/nls_koi8-u.c --- v2.5.1/linux/fs/nls/nls_koi8-u.c Sat May 19 17:47:55 2001 +++ linux/fs/nls/nls_koi8-u.c Sun Dec 30 11:16:26 2001 @@ -327,6 +327,7 @@ module_init(init_nls_koi8_u) module_exit(exit_nls_koi8_u) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_sjis.c linux/fs/nls/nls_sjis.c --- v2.5.1/linux/fs/nls/nls_sjis.c Mon Oct 16 12:58:51 2000 +++ linux/fs/nls/nls_sjis.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_sjis) module_exit(exit_nls_sjis) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_tis-620.c linux/fs/nls/nls_tis-620.c --- v2.5.1/linux/fs/nls/nls_tis-620.c Fri Apr 6 10:51:19 2001 +++ linux/fs/nls/nls_tis-620.c Sun Dec 30 11:16:26 2001 @@ -42,6 +42,7 @@ module_init(init_nls_tis_620) module_exit(exit_nls_tis_620) +MODULE_LICENSE("Dual BSD/GPL"); /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -u --recursive --new-file v2.5.1/linux/fs/nls/nls_utf8.c linux/fs/nls/nls_utf8.c --- v2.5.1/linux/fs/nls/nls_utf8.c Tue Jul 18 22:48:33 2000 +++ linux/fs/nls/nls_utf8.c Sun Dec 30 11:16:26 2001 @@ -58,3 +58,4 @@ module_init(init_nls_utf8) module_exit(exit_nls_utf8) +MODULE_LICENSE("Dual BSD/GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/ntfs/fs.c linux/fs/ntfs/fs.c --- v2.5.1/linux/fs/ntfs/fs.c Tue Dec 18 14:56:40 2001 +++ linux/fs/ntfs/fs.c Tue Dec 25 15:39:20 2001 @@ -1016,14 +1016,11 @@ init_ntfs_super_block(vol); if (!parse_options(vol, (char*)options)) goto ntfs_read_super_vol; - blocksize = get_hardsect_size(sb->s_dev); - if (blocksize < 512) - blocksize = 512; - if (set_blocksize(sb->s_dev, blocksize) < 0) { - ntfs_error("Unable to set blocksize %d.\n", blocksize); + blocksize = sb_min_blocksize(sb, 512); + if (!blocksize) { + ntfs_error("Unable to set blocksize.\n"); goto ntfs_read_super_vol; } - sb->s_blocksize = blocksize; /* Read the super block (boot block). */ if (!(bh = sb_bread(sb, 0))) { ntfs_error("Reading super block failed\n"); @@ -1052,10 +1049,7 @@ } ntfs_debug(DEBUG_OTHER, "Done to init volume\n"); /* Inform the kernel that a device block is a NTFS cluster. */ - sb->s_blocksize = vol->cluster_size; - sb->s_blocksize_bits = vol->cluster_size_bits; - if (blocksize != vol->cluster_size && - set_blocksize(sb->s_dev, sb->s_blocksize) < 0) { + if (!sb_set_blocksize(sb, vol->cluster_size)) { ntfs_error("Cluster size too small for device.\n"); goto ntfs_read_super_unl; } diff -u --recursive --new-file v2.5.1/linux/fs/partitions/check.h linux/fs/partitions/check.h --- v2.5.1/linux/fs/partitions/check.h Tue Dec 18 14:56:40 2001 +++ linux/fs/partitions/check.h Sun Dec 30 11:01:45 2001 @@ -1,18 +1,10 @@ #include <linux/pagemap.h> +#include <linux/blkdev.h> /* * add_gd_partition adds a partitions details to the devices partition * description. */ void add_gd_partition(struct gendisk *hd, int minor, int start, int size); - -typedef struct {struct page *v;} Sector; - -unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *); - -static inline void put_dev_sector(Sector p) -{ - page_cache_release(p.v); -} extern int warn_no_part; diff -u --recursive --new-file v2.5.1/linux/fs/proc/array.c linux/fs/proc/array.c --- v2.5.1/linux/fs/proc/array.c Thu Oct 11 09:00:01 2001 +++ linux/fs/proc/array.c Thu Dec 27 08:21:28 2001 @@ -335,8 +335,7 @@ /* scale priority and nice values from timeslices to -20..20 */ /* to make it look like a "normal" Unix priority/nice value */ - priority = task->counter; - priority = 20 - (priority * 10 + DEF_COUNTER / 2) / DEF_COUNTER; + priority = task->dyn_prio; nice = task->nice; read_lock(&tasklist_lock); diff -u --recursive --new-file v2.5.1/linux/fs/proc/base.c linux/fs/proc/base.c --- v2.5.1/linux/fs/proc/base.c Wed Oct 10 23:42:47 2001 +++ linux/fs/proc/base.c Sat Dec 29 17:30:07 2001 @@ -23,6 +23,9 @@ #include <linux/init.h> #include <linux/file.h> #include <linux/string.h> +#include <linux/seq_file.h> +#include <linux/namespace.h> +#include <linux/mm.h> /* * For hysterical raisins we keep the same inumbers as in the old procfs. @@ -246,6 +249,46 @@ read: pid_maps_read, }; +extern struct seq_operations mounts_op; +static int mounts_open(struct inode *inode, struct file *file) +{ + struct task_struct *task = inode->u.proc_i.task; + int ret = seq_open(file, &mounts_op); + + if (!ret) { + struct seq_file *m = file->private_data; + struct namespace *namespace; + task_lock(task); + namespace = task->namespace; + if (namespace) + get_namespace(namespace); + task_unlock(task); + + if (namespace) + m->private = namespace; + else { + seq_release(inode, file); + ret = -EINVAL; + } + } + return ret; +} + +static int mounts_release(struct inode *inode, struct file *file) +{ + struct seq_file *m = file->private_data; + struct namespace *namespace = m->private; + put_namespace(namespace); + return seq_release(inode, file); +} + +static struct file_operations proc_mounts_operations = { + open: mounts_open, + read: seq_read, + llseek: seq_lseek, + release: mounts_release, +}; + #define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */ static ssize_t proc_info_read(struct file * file, char * buf, @@ -497,6 +540,7 @@ PROC_PID_STATM, PROC_PID_MAPS, PROC_PID_CPU, + PROC_PID_MOUNTS, PROC_PID_FD_DIR = 0x8000, /* 0x8000-0xffff */ }; @@ -516,6 +560,7 @@ E(PROC_PID_CWD, "cwd", S_IFLNK|S_IRWXUGO), E(PROC_PID_ROOT, "root", S_IFLNK|S_IRWXUGO), E(PROC_PID_EXE, "exe", S_IFLNK|S_IRWXUGO), + E(PROC_PID_MOUNTS, "mounts", S_IFREG|S_IRUGO), {0,0,NULL,0} }; #undef E @@ -874,6 +919,9 @@ case PROC_PID_MEM: inode->i_op = &proc_mem_inode_operations; inode->i_fop = &proc_mem_operations; + break; + case PROC_PID_MOUNTS: + inode->i_fop = &proc_mounts_operations; break; default: printk("procfs: impossible type (%d)",p->type); diff -u --recursive --new-file v2.5.1/linux/fs/proc/proc_misc.c linux/fs/proc/proc_misc.c --- v2.5.1/linux/fs/proc/proc_misc.c Tue Dec 18 14:56:40 2001 +++ linux/fs/proc/proc_misc.c Tue Dec 25 15:39:20 2001 @@ -500,18 +500,6 @@ write: write_profile, }; -extern struct seq_operations mounts_op; -static int mounts_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &mounts_op); -} -static struct file_operations proc_mounts_operations = { - open: mounts_open, - read: seq_read, - llseek: seq_lseek, - release: seq_release, -}; - struct proc_dir_entry *proc_root_kcore; static void create_seq_entry(char *name, mode_t mode, struct file_operations *f) @@ -555,11 +543,12 @@ for (p = simple_ones; p->name; p++) create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL); + proc_symlink("mounts", NULL, "self/mounts"); + /* And now for trickier ones */ entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); if (entry) entry->proc_fops = &proc_kmsg_operations; - create_seq_entry("mounts", 0, &proc_mounts_operations); create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); create_seq_entry("interrupts", 0, &proc_interrupts_operations); #ifdef CONFIG_MODULES diff -u --recursive --new-file v2.5.1/linux/fs/qnx4/dir.c linux/fs/qnx4/dir.c --- v2.5.1/linux/fs/qnx4/dir.c Tue Dec 18 14:56:40 2001 +++ linux/fs/qnx4/dir.c Sun Dec 30 10:31:51 2001 @@ -18,7 +18,6 @@ #include <linux/qnx4_fs.h> #include <linux/stat.h> -#include <asm/segment.h> static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir) { diff -u --recursive --new-file v2.5.1/linux/fs/qnx4/fsync.c linux/fs/qnx4/fsync.c --- v2.5.1/linux/fs/qnx4/fsync.c Tue Dec 18 14:56:40 2001 +++ linux/fs/qnx4/fsync.c Sun Dec 30 10:31:51 2001 @@ -21,7 +21,6 @@ #include <linux/fs.h> #include <linux/qnx4_fs.h> -#include <asm/segment.h> #include <asm/system.h> /* diff -u --recursive --new-file v2.5.1/linux/fs/qnx4/inode.c linux/fs/qnx4/inode.c --- v2.5.1/linux/fs/qnx4/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/qnx4/inode.c Sat Dec 29 17:30:07 2001 @@ -18,8 +18,8 @@ #include <linux/string.h> #include <linux/errno.h> #include <linux/slab.h> -#include <linux/qnx4_fs.h> #include <linux/fs.h> +#include <linux/qnx4_fs.h> #include <linux/locks.h> #include <linux/init.h> #include <linux/highuid.h> @@ -213,9 +213,7 @@ phys = qnx4_block_map( inode, iblock ); if ( phys ) { // logical block is before EOF - bh->b_dev = inode->i_dev; - bh->b_blocknr = phys; - bh->b_state |= (1UL << BH_Mapped); + map_bh(bh, inode->i_sb, phys); } else if ( create ) { // to be done. } @@ -339,13 +337,10 @@ void *data, int silent) { struct buffer_head *bh; - kdev_t dev = s->s_dev; struct inode *root; const char *errmsg; - set_blocksize(dev, QNX4_BLOCK_SIZE); - s->s_blocksize = QNX4_BLOCK_SIZE; - s->s_blocksize_bits = QNX4_BLOCK_SIZE_BITS; + sb_set_blocksize(s, QNX4_BLOCK_SIZE); /* Check the boot signature. Since the qnx4 code is dangerous, we should leave as quickly as possible diff -u --recursive --new-file v2.5.1/linux/fs/qnx4/namei.c linux/fs/qnx4/namei.c --- v2.5.1/linux/fs/qnx4/namei.c Tue Sep 5 14:07:30 2000 +++ linux/fs/qnx4/namei.c Sun Dec 30 10:31:51 2001 @@ -21,7 +21,6 @@ #include <linux/fcntl.h> #include <linux/errno.h> -#include <asm/segment.h> /* * check if the filename is correct. For some obscure reason, qnx writes a diff -u --recursive --new-file v2.5.1/linux/fs/qnx4/truncate.c linux/fs/qnx4/truncate.c --- v2.5.1/linux/fs/qnx4/truncate.c Fri Feb 9 11:29:44 2001 +++ linux/fs/qnx4/truncate.c Sat Dec 29 17:30:07 2001 @@ -13,9 +13,8 @@ #include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> -#include <linux/slab.h> -#include <linux/qnx4_fs.h> #include <linux/fs.h> +#include <linux/qnx4_fs.h> #include <linux/locks.h> #include <asm/uaccess.h> diff -u --recursive --new-file v2.5.1/linux/fs/ramfs/inode.c linux/fs/ramfs/inode.c --- v2.5.1/linux/fs/ramfs/inode.c Wed Oct 24 15:19:18 2001 +++ linux/fs/ramfs/inode.c Tue Dec 25 15:39:20 2001 @@ -325,6 +325,7 @@ } static DECLARE_FSTYPE(ramfs_fs_type, "ramfs", ramfs_read_super, FS_LITTER); +static DECLARE_FSTYPE(rootfs_fs_type, "rootfs", ramfs_read_super, FS_NOMOUNT|FS_LITTER); static int __init init_ramfs_fs(void) { @@ -338,5 +339,11 @@ module_init(init_ramfs_fs) module_exit(exit_ramfs_fs) + +int __init init_rootfs(void) +{ + return register_filesystem(&rootfs_fs_type); +} + MODULE_LICENSE("GPL"); diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/buffer2.c linux/fs/reiserfs/buffer2.c --- v2.5.1/linux/fs/reiserfs/buffer2.c Fri Nov 9 14:18:25 2001 +++ linux/fs/reiserfs/buffer2.c Thu Dec 27 08:21:28 2001 @@ -47,7 +47,7 @@ } run_task_queue(&tq_disk); current->policy |= SCHED_YIELD; - /*current->counter = 0;*/ + /* current->dyn_prio = 0; */ schedule(); } if (repeat_counter > 30000000) { @@ -64,12 +64,12 @@ block. */ /* The function is NOT SCHEDULE-SAFE! */ -struct buffer_head * reiserfs_bread (struct super_block *super, int n_block, int n_size) +struct buffer_head * reiserfs_bread (struct super_block *super, int n_block) { struct buffer_head *result; PROC_EXP( unsigned int ctx_switches = kstat.context_swtch ); - result = bread (super -> s_dev, n_block, n_size); + result = sb_bread(super, n_block); PROC_INFO_INC( super, breads ); PROC_EXP( if( kstat.context_swtch != ctx_switches ) PROC_INFO_INC( super, bread_miss ) ); @@ -84,9 +84,9 @@ actually get the block off of the disk. */ /* The function is NOT SCHEDULE-SAFE! */ -struct buffer_head * reiserfs_getblk (kdev_t n_dev, int n_block, int n_size) +struct buffer_head * reiserfs_getblk(struct super_block *sb, int n_block) { - return getblk (n_dev, n_block, n_size); + return sb_getblk(sb, n_block); } #ifdef NEW_GET_NEW_BUFFER @@ -114,7 +114,7 @@ blocknr, 1)) == NO_DISK_SPACE ) return NO_DISK_SPACE; - *pp_s_new_bh = reiserfs_getblk(p_s_sb->s_dev, n_new_blocknumber, p_s_sb->s_blocksize); + *pp_s_new_bh = reiserfs_getblk(p_s_sb, n_new_blocknumber); if ( buffer_uptodate(*pp_s_new_bh) ) { RFALSE( buffer_dirty(*pp_s_new_bh) || (*pp_s_new_bh)->b_dev == NODEV, @@ -149,7 +149,7 @@ printk("get_new_buffer(%u): counter(%d) too big", current->pid, repeat_counter); #endif - current->counter = 0; + current->time_slice = 0; schedule(); } @@ -291,7 +291,7 @@ if ( (n_repeat = reiserfs_new_unf_blocknrs (th, &n_new_blocknumber, p_s_bh->b_blocknr)) == NO_DISK_SPACE ) return NO_DISK_SPACE; - *pp_s_new_bh = reiserfs_getblk(p_s_sb->s_dev, n_new_blocknumber, p_s_sb->s_blocksize); + *pp_s_new_bh = reiserfs_getblk(p_s_sb, n_new_blocknumber); if (atomic_read (&(*pp_s_new_bh)->b_count) > 1) { /* Free path buffers to prevent deadlock which can occur in the situation like : this process holds p_s_path; Block diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/fix_node.c linux/fs/reiserfs/fix_node.c --- v2.5.1/linux/fs/reiserfs/fix_node.c Tue Dec 18 14:56:40 2001 +++ linux/fs/reiserfs/fix_node.c Thu Dec 27 08:17:43 2001 @@ -806,7 +806,7 @@ RFALSE( ! *p_n_blocknr, "PAP-8135: reiserfs_new_blocknrs failed when got new blocks"); - p_s_new_bh = reiserfs_getblk(p_s_sb->s_dev, *p_n_blocknr, p_s_sb->s_blocksize); + p_s_new_bh = reiserfs_getblk(p_s_sb, *p_n_blocknr); if (atomic_read (&(p_s_new_bh->b_count)) > 1) { /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ /* @@ -1926,7 +1926,7 @@ n_child_position = ( p_s_bh == p_s_tb->FL[n_h] ) ? p_s_tb->lkey[n_h] : B_NR_ITEMS (p_s_tb->FL[n_h]); n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position); - p_s_bh = reiserfs_bread(p_s_sb, n_son_number, p_s_sb->s_blocksize); + p_s_bh = reiserfs_bread(p_s_sb, n_son_number); if (!p_s_bh) return IO_ERROR; if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { @@ -1959,7 +1959,7 @@ n_child_position = ( p_s_bh == p_s_tb->FR[n_h] ) ? p_s_tb->rkey[n_h] + 1 : 0; n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position); - p_s_bh = reiserfs_bread(p_s_sb, n_son_number, p_s_sb->s_blocksize); + p_s_bh = reiserfs_bread(p_s_sb, n_son_number); if (!p_s_bh) return IO_ERROR; if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/inode.c linux/fs/reiserfs/inode.c --- v2.5.1/linux/fs/reiserfs/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/reiserfs/inode.c Thu Dec 27 08:17:43 2001 @@ -205,9 +205,7 @@ static inline void set_block_dev_mapped (struct buffer_head * bh, b_blocknr_t block, struct inode * inode) { - bh->b_dev = inode->i_dev; - bh->b_blocknr = block; - bh->b_state |= (1UL << BH_Mapped); + map_bh(bh, inode->i_sb, block); } @@ -287,9 +285,7 @@ blocknr = get_block_num(ind_item, path.pos_in_item) ; ret = 0 ; if (blocknr) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = blocknr; - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, inode->i_sb, blocknr); } else if ((args & GET_BLOCK_NO_HOLE)) { ret = -ENOENT ; } @@ -380,10 +376,9 @@ finished: pathrelse (&path); - bh_result->b_blocknr = 0 ; - bh_result->b_dev = inode->i_dev; + /* I _really_ doubt that you want it. Chris? */ + map_bh(bh_result, inode->i_sb, 0); mark_buffer_uptodate (bh_result, 1); - bh_result->b_state |= (1UL << BH_Mapped); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/namei.c linux/fs/reiserfs/namei.c --- v2.5.1/linux/fs/reiserfs/namei.c Fri Nov 9 14:18:25 2001 +++ linux/fs/reiserfs/namei.c Thu Dec 27 08:21:28 2001 @@ -1168,7 +1168,7 @@ // FIXME: do we need this? shouldn't we simply continue? run_task_queue(&tq_disk); current->policy |= SCHED_YIELD; - /*current->counter = 0;*/ + /*current->time_slice = 0;*/ schedule(); #endif continue; diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/resize.c linux/fs/reiserfs/resize.c --- v2.5.1/linux/fs/reiserfs/resize.c Tue Dec 18 14:56:40 2001 +++ linux/fs/reiserfs/resize.c Thu Dec 27 08:17:43 2001 @@ -111,7 +111,7 @@ for (i = 0; i < bmap_nr; i++) bitmap[i] = SB_AP_BITMAP(s)[i]; for (i = bmap_nr; i < bmap_nr_new; i++) { - bitmap[i] = reiserfs_getblk(s->s_dev, i * s->s_blocksize * 8, s->s_blocksize); + bitmap[i] = reiserfs_getblk(s, i * s->s_blocksize * 8); memset(bitmap[i]->b_data, 0, sb->s_blocksize); reiserfs_test_and_set_le_bit(0, bitmap[i]->b_data); diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/stree.c linux/fs/reiserfs/stree.c --- v2.5.1/linux/fs/reiserfs/stree.c Tue Dec 18 14:56:40 2001 +++ linux/fs/reiserfs/stree.c Thu Dec 27 08:17:43 2001 @@ -604,7 +604,7 @@ if (blocknr == 0) return; - bh = reiserfs_getblk (s->s_dev, blocknr, s->s_blocksize); + bh = reiserfs_getblk (s, blocknr); if (!buffer_uptodate (bh)) { ll_rw_block (READA, 1, &bh); @@ -649,8 +649,7 @@ DISK_LEAF_NODE_LEVEL */ ) { int n_block_number = SB_ROOT_BLOCK (p_s_sb), - expected_level = SB_TREE_HEIGHT (p_s_sb), - n_block_size = p_s_sb->s_blocksize; + expected_level = SB_TREE_HEIGHT (p_s_sb); struct buffer_head * p_s_bh; struct path_element * p_s_last_element; int n_node_level, n_retval; @@ -697,7 +696,7 @@ /* Read the next tree node, and set the last element in the path to have a pointer to it. */ if ( ! (p_s_bh = p_s_last_element->pe_buffer = - reiserfs_bread(p_s_sb, n_block_number, n_block_size)) ) { + reiserfs_bread(p_s_sb, n_block_number)) ) { p_s_search_path->path_length --; pathrelse(p_s_search_path); return IO_ERROR; diff -u --recursive --new-file v2.5.1/linux/fs/reiserfs/super.c linux/fs/reiserfs/super.c --- v2.5.1/linux/fs/reiserfs/super.c Fri Nov 9 14:18:25 2001 +++ linux/fs/reiserfs/super.c Sat Dec 29 11:13:15 2001 @@ -19,6 +19,7 @@ #include <linux/smp_lock.h> #include <linux/locks.h> #include <linux/init.h> +#include <linux/blkdev.h> #define REISERFS_OLD_BLOCKSIZE 4096 #define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20 @@ -302,11 +303,11 @@ labeling scheme currently used will have enough space. Then we need one block for the super. -Hans */ bmp = (REISERFS_DISK_OFFSET_IN_BYTES / s->s_blocksize) + 1; /* first of bitmap blocks */ - SB_AP_BITMAP (s)[0] = reiserfs_bread (s, bmp, s->s_blocksize); + SB_AP_BITMAP (s)[0] = reiserfs_bread (s, bmp); if(!SB_AP_BITMAP(s)[0]) return 1; for (i = 1, bmp = dl = s->s_blocksize * 8; i < sb_bmap_nr(rs); i ++) { - SB_AP_BITMAP (s)[i] = reiserfs_bread (s, bmp, s->s_blocksize); + SB_AP_BITMAP (s)[i] = reiserfs_bread (s, bmp); if (!SB_AP_BITMAP (s)[i]) return 1; bmp += dl; @@ -329,7 +330,7 @@ memset (SB_AP_BITMAP (s), 0, sizeof (struct buffer_head *) * sb_bmap_nr(rs)); for (i = 0; i < sb_bmap_nr(rs); i ++) { - SB_AP_BITMAP (s)[i] = reiserfs_bread (s, bmp1 + i, s->s_blocksize); + SB_AP_BITMAP (s)[i] = reiserfs_bread (s, bmp1 + i); if (!SB_AP_BITMAP (s)[i]) return 1; } @@ -355,17 +356,17 @@ free, SB_FREE_BLOCKS (s)); } -static int read_super_block (struct super_block * s, int size, int offset) +static int read_super_block (struct super_block * s, int offset) { struct buffer_head * bh; struct reiserfs_super_block * rs; - bh = bread (s->s_dev, offset / size, size); + bh = sb_bread (s, offset / s->s_blocksize); if (!bh) { printk ("read_super_block: " "bread failed (dev %s, block %d, size %d)\n", - kdevname (s->s_dev), offset / size, size); + kdevname (s->s_dev), offset / s->s_blocksize, s->s_blocksize); return 1; } @@ -373,7 +374,7 @@ if (!is_reiserfs_magic_string (rs)) { printk ("read_super_block: " "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", - kdevname(s->s_dev), bh->b_blocknr, size); + kdevname(s->s_dev), bh->b_blocknr, s->s_blocksize); brelse (bh); return 1; } @@ -381,30 +382,23 @@ // // ok, reiserfs signature (old or new) found in at the given offset // - s->s_blocksize = sb_blocksize(rs); - s->s_blocksize_bits = 0; - while ((1 << s->s_blocksize_bits) != s->s_blocksize) - s->s_blocksize_bits ++; - brelse (bh); - if (s->s_blocksize != size) - set_blocksize (s->s_dev, s->s_blocksize); + sb_set_blocksize (s, sb_blocksize(rs)); - bh = reiserfs_bread (s, offset / s->s_blocksize, s->s_blocksize); + bh = reiserfs_bread (s, offset / s->s_blocksize); if (!bh) { printk("read_super_block: " "bread failed (dev %s, block %d, size %d)\n", - kdevname (s->s_dev), offset / size, size); + kdevname (s->s_dev), offset / s->s_blocksize, s->s_blocksize); return 1; } rs = (struct reiserfs_super_block *)bh->b_data; - if (!is_reiserfs_magic_string (rs) || - sb_blocksize(rs) != s->s_blocksize) { + if (!is_reiserfs_magic_string (rs) || sb_blocksize(rs) != s->s_blocksize) { printk ("read_super_block: " "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", - kdevname(s->s_dev), bh->b_blocknr, size); + kdevname(s->s_dev), bh->b_blocknr, s->s_blocksize); brelse (bh); printk ("read_super_block: can't find a reiserfs filesystem on dev %s.\n", kdevname(s->s_dev)); return 1; @@ -612,9 +606,7 @@ { int size; struct inode *root_inode; - kdev_t dev = s->s_dev; int j; - extern int *blksize_size[]; struct reiserfs_transaction_handle th ; int old_format = 0; unsigned long blocks; @@ -633,18 +625,14 @@ return NULL; } - if (blksize_size[MAJOR(dev)] && blksize_size[MAJOR(dev)][MINOR(dev)] != 0) { - /* as blocksize is set for partition we use it */ - size = blksize_size[MAJOR(dev)][MINOR(dev)]; - } else { - size = BLOCK_SIZE; - set_blocksize (s->s_dev, BLOCK_SIZE); - } + size = block_size(s->s_dev); + sb_set_blocksize(s, size); /* read block (64-th 1k block), which can contain reiserfs super block */ - if (read_super_block (s, size, REISERFS_DISK_OFFSET_IN_BYTES)) { + if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) { // try old format (undistributed bitmap, super block in 8-th 1k block of a device) - if (read_super_block (s, size, REISERFS_OLD_DISK_OFFSET_IN_BYTES)) + sb_set_blocksize(s, size); + if (read_super_block (s, REISERFS_OLD_DISK_OFFSET_IN_BYTES)) goto error; else old_format = 1; diff -u --recursive --new-file v2.5.1/linux/fs/romfs/inode.c linux/fs/romfs/inode.c --- v2.5.1/linux/fs/romfs/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/romfs/inode.c Tue Dec 25 15:39:20 2001 @@ -102,9 +102,7 @@ /* I would parse the options here, but there are none.. :) */ - set_blocksize(dev, ROMBSIZE); - s->s_blocksize = ROMBSIZE; - s->s_blocksize_bits = ROMBSBITS; + sb_set_blocksize(s, ROMBSIZE); s->u.generic_sbp = (void *) 0; s->s_maxbytes = 0xFFFFFFFF; diff -u --recursive --new-file v2.5.1/linux/fs/super.c linux/fs/super.c --- v2.5.1/linux/fs/super.c Tue Dec 18 14:56:40 2001 +++ linux/fs/super.c Thu Dec 27 08:29:15 2001 @@ -34,8 +34,6 @@ #define __NO_VERSION__ #include <linux/module.h> -int do_remount_sb(struct super_block *sb, int flags, void * data); - LIST_HEAD(super_blocks); spinlock_t sb_lock = SPIN_LOCK_UNLOCKED; @@ -377,7 +375,7 @@ get_filesystem(type); } -void put_unnamed_dev(kdev_t dev); /* should become static */ +static void put_anon_dev(kdev_t dev); /** * remove_super - makes superblock unreachable @@ -407,7 +405,7 @@ if (bdev) blkdev_put(bdev, BDEV_FS); else - put_unnamed_dev(dev); + put_anon_dev(dev); } struct vfsmount *alloc_vfsmnt(void); @@ -530,40 +528,127 @@ return err; } +/** + * do_remount_sb - asks filesystem to change mount options. + * @sb: superblock in question + * @flags: numeric part of options + * @data: the rest of options + * + * Alters the mount options of a mounted file system. + */ +int do_remount_sb(struct super_block *sb, int flags, void *data) +{ + int retval; + + if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev)) + return -EACCES; + /*flags |= MS_RDONLY;*/ + if (flags & MS_RDONLY) + acct_auto_close(sb); + shrink_dcache_sb(sb); + fsync_super(sb); + /* If we are remounting RDONLY, make sure there are no rw files open */ + if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) + if (!fs_may_remount_ro(sb)) + return -EBUSY; + if (sb->s_op && sb->s_op->remount_fs) { + lock_super(sb); + retval = sb->s_op->remount_fs(sb, &flags, data); + unlock_super(sb); + if (retval) + return retval; + } + sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); + return 0; +} + /* * Unnamed block devices are dummy devices used by virtual * filesystems which don't use real block-devices. -- jrs */ -static unsigned long unnamed_dev_in_use[256/(8*sizeof(unsigned long))]; +enum {Max_anon = 256}; +static unsigned long unnamed_dev_in_use[Max_anon/(8*sizeof(unsigned long))]; +static spinlock_t unnamed_dev_lock = SPIN_LOCK_UNLOCKED;/* protects the above */ -kdev_t get_unnamed_dev(void) +/** + * put_anon_dev - release anonymous device number. + * @dev: device in question + */ +static void put_anon_dev(kdev_t dev) { - int i; - - for (i = 1; i < 256; i++) { - if (!test_and_set_bit(i,unnamed_dev_in_use)) - return MKDEV(UNNAMED_MAJOR, i); - } - return 0; + spin_lock(&unnamed_dev_lock); + clear_bit(MINOR(dev), unnamed_dev_in_use); + spin_unlock(&unnamed_dev_lock); } -void put_unnamed_dev(kdev_t dev) +/** + * get_anon_super - allocate a superblock for non-device fs + * @type: filesystem type + * @compare: check if existing superblock is what we want + * @data: argument for @compare. + * + * get_anon_super is a helper for non-blockdevice filesystems. + * It either finds and returns one of the superblocks of given type + * (if it can find one that would satisfy caller) or creates a new + * one. In the either case we return an active reference to superblock + * with ->s_umount locked. If superblock is new it gets a new + * anonymous device allocated for it and is inserted into lists - + * other initialization is left to caller. + * + * Rather than duplicating all that logics every time when + * we want something that doesn't fit "nodev" and "single" we pull + * the relevant code into common helper and let get_sb_...() call + * it. + * + * NB: get_sb_...() is going to become an fs type method, with + * current ->read_super() becoming a callback used by common instances. + */ +struct super_block *get_anon_super(struct file_system_type *type, + int (*compare)(struct super_block *,void *), void *data) { - if (!dev || MAJOR(dev) != UNNAMED_MAJOR) - return; - if (test_and_clear_bit(MINOR(dev), unnamed_dev_in_use)) - return; - printk("VFS: put_unnamed_dev: freeing unused device %s\n", - kdevname(dev)); + struct super_block *s = alloc_super(); + kdev_t dev; + struct list_head *p; + + if (!s) + return ERR_PTR(-ENOMEM); + + spin_lock(&unnamed_dev_lock); + dev = find_first_zero_bit(unnamed_dev_in_use, Max_anon); + if (dev == Max_anon) { + spin_unlock(&unnamed_dev_lock); + destroy_super(s); + return ERR_PTR(-EMFILE); + } + set_bit(dev, unnamed_dev_in_use); + spin_unlock(&unnamed_dev_lock); + +retry: + spin_lock(&sb_lock); + if (compare) list_for_each(p, &type->fs_supers) { + struct super_block *old; + old = list_entry(p, struct super_block, s_instances); + if (!compare(old, data)) + continue; + if (!grab_super(old)) + goto retry; + destroy_super(s); + return old; + } + + s->s_dev = dev; + insert_super(s, type); + return s; } static struct super_block *get_sb_bdev(struct file_system_type *fs_type, - char *dev_name, int flags, void * data) + int flags, char *dev_name, void * data) { struct inode *inode; struct block_device *bdev; struct block_device_operations *bdops; + devfs_handle_t de; struct super_block * s; struct nameidata nd; struct list_head *p; @@ -587,28 +672,26 @@ goto out; bd_acquire(inode); bdev = inode->i_bdev; - bdops = devfs_get_ops ( devfs_get_handle_from_inode (inode) ); + de = devfs_get_handle_from_inode (inode); + bdops = devfs_get_ops (de); /* Increments module use count */ if (bdops) bdev->bd_op = bdops; /* Done with lookups, semaphore down */ dev = to_kdev_t(bdev->bd_dev); if (!(flags & MS_RDONLY)) mode |= FMODE_WRITE; error = blkdev_get(bdev, mode, 0, BDEV_FS); + devfs_put_ops (de); /* Decrement module use count now we're safe */ if (error) goto out; check_disk_change(dev); error = -EACCES; - if (!(flags & MS_RDONLY) && is_read_only(dev)) { - blkdev_put(bdev, BDEV_FS); - goto out; - } + if (!(flags & MS_RDONLY) && is_read_only(dev)) + goto out1; error = -ENOMEM; s = alloc_super(); - if (!s) { - blkdev_put(bdev, BDEV_FS); - goto out; - } + if (!s) + goto out1; error = -EBUSY; restart: @@ -622,8 +705,7 @@ ((flags ^ old->s_flags) & MS_RDONLY)) { spin_unlock(&sb_lock); destroy_super(s); - blkdev_put(bdev, BDEV_FS); - goto out; + goto out1; } if (!grab_super(old)) goto restart; @@ -636,97 +718,103 @@ s->s_bdev = bdev; s->s_flags = flags; insert_super(s, fs_type); - - error = -EINVAL; - lock_super(s); if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0)) - goto out_fail; + goto Einval; s->s_flags |= MS_ACTIVE; - unlock_super(s); path_release(&nd); return s; -out_fail: - unlock_super(s); +Einval: deactivate_super(s); remove_super(s); + error = -EINVAL; + goto out; +out1: + blkdev_put(bdev, BDEV_FS); out: path_release(&nd); return ERR_PTR(error); } static struct super_block *get_sb_nodev(struct file_system_type *fs_type, - int flags, void * data) + int flags, char *dev_name, void *data) { - struct super_block *s = alloc_super(); + struct super_block *s = get_anon_super(fs_type, NULL, NULL); + + if (IS_ERR(s)) + return s; - if (!s) - return ERR_PTR(-ENOMEM); - s->s_dev = get_unnamed_dev(); - if (!s->s_dev) { - destroy_super(s); - return ERR_PTR(-EMFILE); - } s->s_flags = flags; - spin_lock(&sb_lock); - insert_super(s, fs_type); - lock_super(s); - if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0)) - goto out_fail; + if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0)) { + deactivate_super(s); + remove_super(s); + return ERR_PTR(-EINVAL); + } s->s_flags |= MS_ACTIVE; - unlock_super(s); return s; +} -out_fail: - unlock_super(s); - deactivate_super(s); - remove_super(s); - return ERR_PTR(-EINVAL); +static int compare_single(struct super_block *s, void *p) +{ + return 1; } static struct super_block *get_sb_single(struct file_system_type *fs_type, - int flags, void *data) + int flags, char *dev_name, void *data) { - struct super_block * s = alloc_super(); - if (!s) - return ERR_PTR(-ENOMEM); - /* - * Get the superblock of kernel-wide instance, but - * keep the reference to fs_type. - */ -retry: - spin_lock(&sb_lock); - if (!list_empty(&fs_type->fs_supers)) { - struct super_block *old; - old = list_entry(fs_type->fs_supers.next, struct super_block, - s_instances); - if (!grab_super(old)) - goto retry; - destroy_super(s); - do_remount_sb(old, flags, data); - return old; - } else { - s->s_dev = get_unnamed_dev(); - if (!s->s_dev) { - spin_unlock(&sb_lock); - destroy_super(s); - return ERR_PTR(-EMFILE); - } + struct super_block *s = get_anon_super(fs_type, compare_single, NULL); + + if (IS_ERR(s)) + return s; + if (!s->s_root) { s->s_flags = flags; - insert_super(s, fs_type); - lock_super(s); - if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0)) - goto out_fail; + if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0)) { + deactivate_super(s); + remove_super(s); + return ERR_PTR(-EINVAL); + } s->s_flags |= MS_ACTIVE; - unlock_super(s); - return s; - - out_fail: - unlock_super(s); - deactivate_super(s); - remove_super(s); - return ERR_PTR(-EINVAL); } + do_remount_sb(s, flags, data); + return s; +} + +struct vfsmount * +do_kern_mount(const char *fstype, int flags, char *name, void *data) +{ + struct file_system_type *type = get_fs_type(fstype); + struct super_block *sb = ERR_PTR(-ENOMEM); + struct vfsmount *mnt; + + if (!type) + return ERR_PTR(-ENODEV); + + mnt = alloc_vfsmnt(); + if (!mnt) + goto out; + set_devname(mnt, name); + if (type->fs_flags & FS_REQUIRES_DEV) + sb = get_sb_bdev(type, flags, name, data); + else if (type->fs_flags & FS_SINGLE) + sb = get_sb_single(type, flags, name, data); + else + sb = get_sb_nodev(type, flags, name, data); + if (IS_ERR(sb)) + goto out_mnt; + if (type->fs_flags & FS_NOMOUNT) + sb->s_flags |= MS_NOUSER; + mnt->mnt_sb = sb; + mnt->mnt_root = dget(sb->s_root); + mnt->mnt_mountpoint = sb->s_root; + mnt->mnt_parent = mnt; + up_write(&sb->s_umount); + put_filesystem(type); + return mnt; +out_mnt: + free_vfsmnt(mnt); +out: + put_filesystem(type); + return (struct vfsmount *)sb; } void kill_super(struct super_block *sb) @@ -739,7 +827,6 @@ return; down_write(&sb->s_umount); - lock_kernel(); sb->s_root = NULL; /* Need to clean after the sucker */ if (fs->fs_flags & FS_LITTER) @@ -748,6 +835,7 @@ dput(root); fsync_super(sb); lock_super(sb); + lock_kernel(); sb->s_flags &= ~MS_ACTIVE; invalidate_inodes(sb); /* bad name - it should be evict_inodes() */ if (sop) { @@ -768,96 +856,7 @@ remove_super(sb); } -/* - * Alters the mount flags of a mounted file system. Only the mount point - * is used as a reference - file system type and the device are ignored. - */ - -int do_remount_sb(struct super_block *sb, int flags, void *data) -{ - int retval; - - if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev)) - return -EACCES; - /*flags |= MS_RDONLY;*/ - if (flags & MS_RDONLY) - acct_auto_close(sb->s_dev); - shrink_dcache_sb(sb); - fsync_super(sb); - /* If we are remounting RDONLY, make sure there are no rw files open */ - if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) - if (!fs_may_remount_ro(sb)) - return -EBUSY; - if (sb->s_op && sb->s_op->remount_fs) { - lock_super(sb); - retval = sb->s_op->remount_fs(sb, &flags, data); - unlock_super(sb); - if (retval) - return retval; - } - sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); - - /* - * We can't invalidate inodes as we can loose data when remounting - * (someone might manage to alter data while we are waiting in lock_super() - * or in foo_remount_fs())) - */ - - return 0; -} - -struct vfsmount *do_kern_mount(char *type, int flags, char *name, void *data) -{ - struct file_system_type * fstype; - struct vfsmount *mnt = NULL; - struct super_block *sb; - - if (!type || !memchr(type, 0, PAGE_SIZE)) - return ERR_PTR(-EINVAL); - - /* we need capabilities... */ - if (!capable(CAP_SYS_ADMIN)) - return ERR_PTR(-EPERM); - - /* ... filesystem driver... */ - fstype = get_fs_type(type); - if (!fstype) - return ERR_PTR(-ENODEV); - - /* ... allocated vfsmount... */ - mnt = alloc_vfsmnt(); - if (!mnt) { - mnt = ERR_PTR(-ENOMEM); - goto fs_out; - } - set_devname(mnt, name); - /* get locked superblock */ - if (fstype->fs_flags & FS_REQUIRES_DEV) - sb = get_sb_bdev(fstype, name, flags, data); - else if (fstype->fs_flags & FS_SINGLE) - sb = get_sb_single(fstype, flags, data); - else - sb = get_sb_nodev(fstype, flags, data); - - if (IS_ERR(sb)) { - free_vfsmnt(mnt); - mnt = (struct vfsmount *)sb; - goto fs_out; - } - if (fstype->fs_flags & FS_NOMOUNT) - sb->s_flags |= MS_NOUSER; - - mnt->mnt_sb = sb; - mnt->mnt_root = dget(sb->s_root); - mnt->mnt_mountpoint = mnt->mnt_root; - mnt->mnt_parent = mnt; - up_write(&sb->s_umount); -fs_out: - put_filesystem(fstype); - return mnt; -} - struct vfsmount *kern_mount(struct file_system_type *type) { - return do_kern_mount((char *)type->name, 0, (char *)type->name, NULL); + return do_kern_mount(type->name, 0, (char *)type->name, NULL); } diff -u --recursive --new-file v2.5.1/linux/fs/sysv/dir.c linux/fs/sysv/dir.c --- v2.5.1/linux/fs/sysv/dir.c Fri Nov 9 13:45:35 2001 +++ linux/fs/sysv/dir.c Sun Dec 30 10:53:53 2001 @@ -41,7 +41,6 @@ struct inode *dir = (struct inode *)page->mapping->host; int err = 0; - dir->i_version = ++event; page->mapping->a_ops->commit_write(NULL, page, from, to); if (IS_SYNC(dir)) err = waitfor_one_page(page); @@ -111,7 +110,6 @@ done: filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; - filp->f_version = inode->i_version; UPDATE_ATIME(inode); return 0; } diff -u --recursive --new-file v2.5.1/linux/fs/sysv/itree.c linux/fs/sysv/itree.c --- v2.5.1/linux/fs/sysv/itree.c Tue Dec 18 14:56:40 2001 +++ linux/fs/sysv/itree.c Thu Dec 27 08:17:43 2001 @@ -211,9 +211,7 @@ /* Simplest case - block found, no allocation needed */ if (!partial) { got_it: - bh_result->b_dev = sb->s_dev; - bh_result->b_blocknr = block_to_cpu(sb, chain[depth-1].key); - bh_result->b_state |= (1UL << BH_Mapped); + map_bh(bh_result, sb, block_to_cpu(sb, chain[depth-1].key)); /* Clean up and exit */ partial = chain+depth-1; /* the whole chain */ goto cleanup; diff -u --recursive --new-file v2.5.1/linux/fs/sysv/super.c linux/fs/sysv/super.c --- v2.5.1/linux/fs/sysv/super.c Tue Dec 18 14:56:40 2001 +++ linux/fs/sysv/super.c Tue Dec 25 15:39:20 2001 @@ -315,8 +315,6 @@ sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone) << sb->sv_inodes_per_block_bits; - sb->s_blocksize = bsize; - sb->s_blocksize_bits = n_bits; if (!silent) printk("VFS: Found a %s FS (block size = %ld) on device %s\n", found, sb->s_blocksize, bdevname(sb->s_dev)); @@ -361,8 +359,7 @@ panic("Coherent FS: bad super-block size"); if (64 != sizeof (struct sysv_inode)) panic("sysv fs: bad i-node size"); - set_blocksize(dev,BLOCK_SIZE); - sb->s_blocksize = BLOCK_SIZE; + sb_set_blocksize(sb, BLOCK_SIZE); sb->sv_block_base = 0; for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) { @@ -380,8 +377,7 @@ case 1: blocknr = bh->b_blocknr << 1; brelse(bh); - set_blocksize(dev, 512); - sb->s_blocksize = 512; + sb_set_blocksize(sb, 512); bh1 = sb_bread(sb, blocknr); bh = sb_bread(sb, blocknr + 1); break; @@ -391,8 +387,7 @@ case 3: blocknr = bh->b_blocknr >> 1; brelse(bh); - set_blocksize(dev, 2048); - sb->s_blocksize = 2048; + sb_set_blocksize(sb, 2048); bh1 = bh = sb_bread(sb, blocknr); break; default: @@ -408,7 +403,7 @@ brelse(bh1); brelse(bh); - set_blocksize(sb->s_dev,BLOCK_SIZE); + sb_set_blocksize(sb, BLOCK_SIZE); printk("oldfs: cannot read superblock\n"); failed: return NULL; @@ -443,8 +438,7 @@ sb->sv_type = FSTYPE_V7; sb->sv_bytesex = BYTESEX_PDP; - set_blocksize(dev, 512); - sb->s_blocksize = 512; + sb_set_blocksize(sb, 512); if ((bh = sb_bread(sb, 1)) == NULL) { if (!silent) diff -u --recursive --new-file v2.5.1/linux/fs/udf/inode.c linux/fs/udf/inode.c --- v2.5.1/linux/fs/udf/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/udf/inode.c Sun Dec 30 10:53:53 2001 @@ -215,7 +215,6 @@ page_cache_release(page); mark_inode_dirty(inode); - inode->i_version ++; } struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int *err) @@ -310,7 +309,6 @@ mark_buffer_dirty(sbh); udf_release_data(sbh); mark_inode_dirty(inode); - inode->i_version ++; return dbh; } @@ -324,11 +322,7 @@ { phys = udf_block_map(inode, block); if (phys) - { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); - } + map_bh(bh_result, inode->i_sb, phys); return 0; } @@ -357,11 +351,9 @@ if (!phys) BUG(); - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); if (new) bh_result->b_state |= (1UL << BH_New); + map_bh(bh_result, inode->i_sb, phys); abort: unlock_kernel(); return err; @@ -1039,7 +1031,6 @@ long convtime_usec; int offset, alen; - inode->i_version = ++event; UDF_I_NEW_INODE(inode) = 0; fe = (struct FileEntry *)bh->b_data; diff -u --recursive --new-file v2.5.1/linux/fs/udf/namei.c linux/fs/udf/namei.c --- v2.5.1/linux/fs/udf/namei.c Tue Dec 18 14:56:40 2001 +++ linux/fs/udf/namei.c Sun Dec 30 10:53:53 2001 @@ -595,7 +595,6 @@ dir->i_size += nfidlen; if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) UDF_I_LENALLOC(dir) += nfidlen; - dir->i_version = ++event; mark_inode_dirty(dir); return fi; } @@ -654,7 +653,6 @@ if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) { mark_inode_dirty(dir); - dir->i_version = ++event; } if (fibh.sbh != fibh.ebh) udf_release_data(fibh.ebh); @@ -692,7 +690,6 @@ if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) { mark_inode_dirty(dir); - dir->i_version = ++event; } mark_inode_dirty(inode); @@ -756,7 +753,6 @@ cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); cfi.fileCharacteristics |= FILE_DIRECTORY; udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); - dir->i_version = ++event; dir->i_nlink++; mark_inode_dirty(dir); d_instantiate(dentry, inode); @@ -851,14 +847,12 @@ if (!empty_dir(inode)) goto end_rmdir; retval = udf_delete_entry(dir, fi, &fibh, &cfi); - dir->i_version = ++event; if (retval) goto end_rmdir; if (inode->i_nlink != 2) udf_warning(inode->i_sb, "udf_rmdir", "empty directory has nlink != 2 (%d)", inode->i_nlink); - inode->i_version = ++event; inode->i_nlink = 0; inode->i_size = 0; mark_inode_dirty(inode); @@ -1070,7 +1064,6 @@ if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) { mark_inode_dirty(dir); - dir->i_version = ++event; } if (fibh.sbh != fibh.ebh) udf_release_data(fibh.ebh); @@ -1123,7 +1116,6 @@ if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB) { mark_inode_dirty(dir); - dir->i_version = ++event; } if (fibh.sbh != fibh.ebh) udf_release_data(fibh.ebh); @@ -1205,7 +1197,6 @@ if (!nfi) goto end_rename; } - new_dir->i_version = ++event; /* * Like most other Unix systems, set the ctime for inodes on a @@ -1227,7 +1218,6 @@ ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi); udf_delete_entry(old_dir, ofi, &ofibh, &ocfi); - old_dir->i_version = ++event; if (new_inode) { new_inode->i_nlink--; @@ -1247,7 +1237,6 @@ if (UDF_I_ALLOCTYPE(old_inode) == ICB_FLAG_AD_IN_ICB) { mark_inode_dirty(old_inode); - old_inode->i_version = ++event; } else mark_buffer_dirty_inode(dir_bh, old_inode); diff -u --recursive --new-file v2.5.1/linux/fs/udf/super.c linux/fs/udf/super.c --- v2.5.1/linux/fs/udf/super.c Tue Dec 18 14:56:40 2001 +++ linux/fs/udf/super.c Tue Dec 25 15:39:20 2001 @@ -357,30 +357,11 @@ static int udf_set_blocksize(struct super_block *sb, int bsize) { - /* Use specified block size if specified */ - if (bsize) - sb->s_blocksize = bsize; - if (get_hardsect_size(sb->s_dev) > sb->s_blocksize) - sb->s_blocksize = get_hardsect_size(sb->s_dev); - - /* Block size must be an even multiple of 512 */ - switch (sb->s_blocksize) - { - case 512: sb->s_blocksize_bits = 9; break; - case 1024: sb->s_blocksize_bits = 10; break; - case 2048: sb->s_blocksize_bits = 11; break; - case 4096: sb->s_blocksize_bits = 12; break; - case 8192: sb->s_blocksize_bits = 13; break; - default: - { - udf_debug("Bad block size (%ld)\n", sb->s_blocksize); - printk(KERN_ERR "udf: bad block size (%ld)\n", sb->s_blocksize); - return 0; - } + if (!sb_min_blocksize(sb, bsize)) { + udf_debug("Bad block size (%d)\n", bsize); + printk(KERN_ERR "udf: bad block size (%d)\n", bsize); + return 0; } - - /* Set the block size */ - set_blocksize(sb->s_dev, sb->s_blocksize); return sb->s_blocksize; } diff -u --recursive --new-file v2.5.1/linux/fs/ufs/inode.c linux/fs/ufs/inode.c --- v2.5.1/linux/fs/ufs/inode.c Tue Dec 18 14:56:40 2001 +++ linux/fs/ufs/inode.c Thu Dec 27 08:17:43 2001 @@ -310,22 +310,16 @@ static int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create) { - struct super_block * sb; - struct ufs_sb_private_info * uspi; + struct super_block * sb = inode->i_sb; + struct ufs_sb_private_info * uspi = sb->u.ufs_sb.s_uspi; struct buffer_head * bh; int ret, err, new; unsigned long ptr, phys; - sb = inode->i_sb; - uspi = sb->u.ufs_sb.s_uspi; - if (!create) { phys = ufs_frag_map(inode, fragment); - if (phys) { - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); - } + if (phys) + map_bh(bh_result, sb, phys); return 0; } @@ -392,11 +386,9 @@ out: if (err) goto abort; - bh_result->b_dev = inode->i_dev; - bh_result->b_blocknr = phys; - bh_result->b_state |= (1UL << BH_Mapped); if (new) bh_result->b_state |= (1UL << BH_New); + map_bh(bh_result, sb, phys); abort: unlock_kernel(); return err; diff -u --recursive --new-file v2.5.1/linux/fs/ufs/super.c linux/fs/ufs/super.c --- v2.5.1/linux/fs/ufs/super.c Tue Dec 18 14:56:40 2001 +++ linux/fs/ufs/super.c Tue Dec 25 15:39:20 2001 @@ -596,8 +596,7 @@ } again: - set_blocksize (sb->s_dev, block_size); - sb->s_blocksize = block_size; + sb_set_blocksize(sb, block_size); /* * read ufs super block from device @@ -716,8 +715,6 @@ /* * Read ufs_super_block into internal data structures */ - sb->s_blocksize = fs32_to_cpu(sb, usb1->fs_fsize); - sb->s_blocksize_bits = fs32_to_cpu(sb, usb1->fs_fshift); sb->s_op = &ufs_super_ops; sb->dq_op = NULL; /***/ sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); diff -u --recursive --new-file v2.5.1/linux/fs/vfat/namei.c linux/fs/vfat/namei.c --- v2.5.1/linux/fs/vfat/namei.c Thu Oct 25 00:02:26 2001 +++ linux/fs/vfat/namei.c Sun Dec 30 10:53:53 2001 @@ -1040,8 +1040,8 @@ return res; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); - inode->i_version = ++event; - dir->i_version = event; + inode->i_version++; + dir->i_version++; dentry->d_time = dentry->d_parent->d_inode->i_version; d_instantiate(dentry,inode); return 0; @@ -1057,7 +1057,7 @@ /* remove the shortname */ dir->i_mtime = CURRENT_TIME; dir->i_atime = CURRENT_TIME; - dir->i_version = ++event; + dir->i_version++; mark_inode_dirty(dir); de->name[0] = DELETED_FLAG; fat_mark_buffer_dirty(sb, bh); @@ -1138,8 +1138,8 @@ goto out; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); - inode->i_version = ++event; - dir->i_version = event; + inode->i_version++; + dir->i_version++; dir->i_nlink++; inode->i_nlink = 2; /* no need to mark them dirty */ res = fat_new_dir(inode, dir, 1); @@ -1209,7 +1209,7 @@ if (res < 0) goto rename_done; } - new_dir->i_version = ++event; + new_dir->i_version++; /* releases old_bh */ vfat_remove_entry(old_dir,&old_sinfo,old_bh,old_de); @@ -1218,7 +1218,7 @@ fat_attach(old_inode, sinfo.ino); mark_inode_dirty(old_inode); - old_dir->i_version = ++event; + old_dir->i_version++; old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; mark_inode_dirty(old_dir); if (new_inode) { diff -u --recursive --new-file v2.5.1/linux/include/asm-arm/bitops.h linux/include/asm-arm/bitops.h --- v2.5.1/linux/include/asm-arm/bitops.h Sun Aug 12 11:14:00 2001 +++ linux/include/asm-arm/bitops.h Tue Dec 25 21:43:32 2001 @@ -2,6 +2,8 @@ * Copyright 1995, Russell King. * Various bits and pieces copyrights include: * Linus Torvalds (test_bit). + * Big endian support: Copyright 2001, Nicolas Pitre + * reworked by rmk. * * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). * @@ -17,81 +19,271 @@ #ifdef __KERNEL__ +#include <asm/system.h> + #define smp_mb__before_clear_bit() do { } while (0) #define smp_mb__after_clear_bit() do { } while (0) /* - * Function prototypes to keep gcc -Wall happy. + * These functions are the basis of our bit ops. + * First, the atomic bitops. + * + * The endian issue for these functions is handled by the macros below. */ -extern void set_bit(int nr, volatile void * addr); +static inline void +____atomic_set_bit_mask(unsigned int mask, volatile unsigned char *p) +{ + unsigned long flags; + + local_irq_save(flags); + *p |= mask; + local_irq_restore(flags); +} -static inline void __set_bit(int nr, volatile void *addr) +static inline void +____atomic_clear_bit_mask(unsigned int mask, volatile unsigned char *p) { - ((unsigned char *) addr)[nr >> 3] |= (1U << (nr & 7)); + unsigned long flags; + + local_irq_save(flags); + *p &= ~mask; + local_irq_restore(flags); } -extern void clear_bit(int nr, volatile void * addr); +static inline void +____atomic_change_bit_mask(unsigned int mask, volatile unsigned char *p) +{ + unsigned long flags; + + local_irq_save(flags); + *p ^= mask; + local_irq_restore(flags); +} -static inline void __clear_bit(int nr, volatile void *addr) +static inline int +____atomic_test_and_set_bit_mask(unsigned int mask, volatile unsigned char *p) { - ((unsigned char *) addr)[nr >> 3] &= ~(1U << (nr & 7)); + unsigned long flags; + unsigned int res; + + local_irq_save(flags); + res = *p; + *p = res | mask; + local_irq_restore(flags); + + return res & mask; } -extern void change_bit(int nr, volatile void * addr); +static inline int +____atomic_test_and_clear_bit_mask(unsigned int mask, volatile unsigned char *p) +{ + unsigned long flags; + unsigned int res; -static inline void __change_bit(int nr, volatile void *addr) + local_irq_save(flags); + res = *p; + *p = res & ~mask; + local_irq_restore(flags); + + return res & mask; +} + +static inline int +____atomic_test_and_change_bit_mask(unsigned int mask, volatile unsigned char *p) { - ((unsigned char *) addr)[nr >> 3] ^= (1U << (nr & 7)); + unsigned long flags; + unsigned int res; + + local_irq_save(flags); + res = *p; + *p = res ^ mask; + local_irq_restore(flags); + + return res & mask; } -extern int test_and_set_bit(int nr, volatile void * addr); +/* + * Now the non-atomic variants. We let the compiler handle all optimisations + * for these. + */ +static inline void ____nonatomic_set_bit(int nr, volatile void *p) +{ + ((unsigned char *) p)[nr >> 3] |= (1U << (nr & 7)); +} + +static inline void ____nonatomic_clear_bit(int nr, volatile void *p) +{ + ((unsigned char *) p)[nr >> 3] &= ~(1U << (nr & 7)); +} + +static inline void ____nonatomic_change_bit(int nr, volatile void *p) +{ + ((unsigned char *) p)[nr >> 3] ^= (1U << (nr & 7)); +} -static inline int __test_and_set_bit(int nr, volatile void *addr) +static inline int ____nonatomic_test_and_set_bit(int nr, volatile void *p) { unsigned int mask = 1 << (nr & 7); unsigned int oldval; - oldval = ((unsigned char *) addr)[nr >> 3]; - ((unsigned char *) addr)[nr >> 3] = oldval | mask; + oldval = ((unsigned char *) p)[nr >> 3]; + ((unsigned char *) p)[nr >> 3] = oldval | mask; return oldval & mask; } -extern int test_and_clear_bit(int nr, volatile void * addr); - -static inline int __test_and_clear_bit(int nr, volatile void *addr) +static inline int ____nonatomic_test_and_clear_bit(int nr, volatile void *p) { unsigned int mask = 1 << (nr & 7); unsigned int oldval; - oldval = ((unsigned char *) addr)[nr >> 3]; - ((unsigned char *) addr)[nr >> 3] = oldval & ~mask; + oldval = ((unsigned char *) p)[nr >> 3]; + ((unsigned char *) p)[nr >> 3] = oldval & ~mask; return oldval & mask; } -extern int test_and_change_bit(int nr, volatile void * addr); - -static inline int __test_and_change_bit(int nr, volatile void *addr) +static inline int ____nonatomic_test_and_change_bit(int nr, volatile void *p) { unsigned int mask = 1 << (nr & 7); unsigned int oldval; - oldval = ((unsigned char *) addr)[nr >> 3]; - ((unsigned char *) addr)[nr >> 3] = oldval ^ mask; + oldval = ((unsigned char *) p)[nr >> 3]; + ((unsigned char *) p)[nr >> 3] = oldval ^ mask; return oldval & mask; } -extern int find_first_zero_bit(void * addr, unsigned size); -extern int find_next_zero_bit(void * addr, int size, int offset); - /* * This routine doesn't need to be atomic. */ -static inline int test_bit(int nr, const void * addr) +static inline int ____test_bit(int nr, const void * p) { - return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); + return ((volatile unsigned char *) p)[nr >> 3] & (1U << (nr & 7)); } /* + * A note about Endian-ness. + * ------------------------- + * + * When the ARM is put into big endian mode via CR15, the processor + * merely swaps the order of bytes within words, thus: + * + * ------------ physical data bus bits ----------- + * D31 ... D24 D23 ... D16 D15 ... D8 D7 ... D0 + * little byte 3 byte 2 byte 1 byte 0 + * big byte 0 byte 1 byte 2 byte 3 + * + * This means that reading a 32-bit word at address 0 returns the same + * value irrespective of the endian mode bit. + * + * Peripheral devices should be connected with the data bus reversed in + * "Big Endian" mode. ARM Application Note 61 is applicable, and is + * available from http://www.arm.com/. + * + * The following assumes that the data bus connectivity for big endian + * mode has been followed. + * + * Note that bit 0 is defined to be 32-bit word bit 0, not byte 0 bit 0. + */ + +/* + * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. + */ +extern void _set_bit_le(int nr, volatile void * p); +extern void _clear_bit_le(int nr, volatile void * p); +extern void _change_bit_le(int nr, volatile void * p); +extern int _test_and_set_bit_le(int nr, volatile void * p); +extern int _test_and_clear_bit_le(int nr, volatile void * p); +extern int _test_and_change_bit_le(int nr, volatile void * p); +extern int _find_first_zero_bit_le(void * p, unsigned size); +extern int _find_next_zero_bit_le(void * p, int size, int offset); + +/* + * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. + */ +extern void _set_bit_be(int nr, volatile void * p); +extern void _clear_bit_be(int nr, volatile void * p); +extern void _change_bit_be(int nr, volatile void * p); +extern int _test_and_set_bit_be(int nr, volatile void * p); +extern int _test_and_clear_bit_be(int nr, volatile void * p); +extern int _test_and_change_bit_be(int nr, volatile void * p); +extern int _find_first_zero_bit_be(void * p, unsigned size); +extern int _find_next_zero_bit_be(void * p, int size, int offset); + + +/* + * The __* form of bitops are non-atomic and may be reordered. + */ +#define ATOMIC_BITOP_LE(name,nr,p) \ + (__builtin_constant_p(nr) ? \ + ____atomic_##name##_mask(1 << ((nr) & 7), \ + ((unsigned char *)(p)) + ((nr) >> 3)) : \ + _##name##_le(nr,p)) + +#define ATOMIC_BITOP_BE(name,nr,p) \ + (__builtin_constant_p(nr) ? \ + ____atomic_##name##_mask(1 << ((nr) & 7), \ + ((unsigned char *)(p)) + (((nr) >> 3) ^ 3)) : \ + _##name##_be(nr,p)) + +#define NONATOMIC_BITOP_LE(name,nr,p) \ + (____nonatomic_##name(nr, p)) + +#define NONATOMIC_BITOP_BE(name,nr,p) \ + (____nonatomic_##name(nr ^ 0x18, p)) + +#ifndef __ARMEB__ +/* + * These are the little endian, atomic definitions. + */ +#define set_bit(nr,p) ATOMIC_BITOP_LE(set_bit,nr,p) +#define clear_bit(nr,p) ATOMIC_BITOP_LE(clear_bit,nr,p) +#define change_bit(nr,p) ATOMIC_BITOP_LE(change_bit,nr,p) +#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p) +#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p) +#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p) +#define test_bit(nr,p) ____test_bit(nr,p) +#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) +#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) + +/* + * These are the little endian, non-atomic definitions. + */ +#define __set_bit(nr,p) NONATOMIC_BITOP_LE(set_bit,nr,p) +#define __clear_bit(nr,p) NONATOMIC_BITOP_LE(clear_bit,nr,p) +#define __change_bit(nr,p) NONATOMIC_BITOP_LE(change_bit,nr,p) +#define __test_and_set_bit(nr,p) NONATOMIC_BITOP_LE(test_and_set_bit,nr,p) +#define __test_and_clear_bit(nr,p) NONATOMIC_BITOP_LE(test_and_clear_bit,nr,p) +#define __test_and_change_bit(nr,p) NONATOMIC_BITOP_LE(test_and_change_bit,nr,p) +#define __test_bit(nr,p) ____test_bit(nr,p) + +#else + +/* + * These are the little endian, atomic definitions. + */ +#define set_bit(nr,p) ATOMIC_BITOP_BE(set_bit,nr,p) +#define clear_bit(nr,p) ATOMIC_BITOP_BE(clear_bit,nr,p) +#define change_bit(nr,p) ATOMIC_BITOP_BE(change_bit,nr,p) +#define test_and_set_bit(nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p) +#define test_and_clear_bit(nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p) +#define test_and_change_bit(nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p) +#define test_bit(nr,p) ____test_bit((nr) ^ 0x18, p) +#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz) +#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off) + +/* + * These are the little endian, non-atomic definitions. + */ +#define __set_bit(nr,p) NONATOMIC_BITOP_BE(set_bit,nr,p) +#define __clear_bit(nr,p) NONATOMIC_BITOP_BE(clear_bit,nr,p) +#define __change_bit(nr,p) NONATOMIC_BITOP_BE(change_bit,nr,p) +#define __test_and_set_bit(nr,p) NONATOMIC_BITOP_BE(test_and_set_bit,nr,p) +#define __test_and_clear_bit(nr,p) NONATOMIC_BITOP_BE(test_and_clear_bit,nr,p) +#define __test_and_change_bit(nr,p) NONATOMIC_BITOP_BE(test_and_change_bit,nr,p) +#define __test_bit(nr,p) ____test_bit((nr) ^ 0x18, p) + +#endif + +/* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first.. */ @@ -126,18 +318,25 @@ #define hweight16(x) generic_hweight16(x) #define hweight8(x) generic_hweight8(x) -#define ext2_set_bit test_and_set_bit -#define ext2_clear_bit test_and_clear_bit -#define ext2_test_bit test_bit -#define ext2_find_first_zero_bit find_first_zero_bit -#define ext2_find_next_zero_bit find_next_zero_bit - -/* Bitmap functions for the minix filesystem. */ -#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) -#define minix_set_bit(nr,addr) set_bit(nr,addr) -#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) -#define minix_test_bit(nr,addr) test_bit(nr,addr) -#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) +/* + * Ext2 is defined to use little-endian byte ordering. + * These do not need to be atomic. + */ +#define ext2_set_bit(nr,p) NONATOMIC_BITOP_LE(test_and_set_bit,nr,p) +#define ext2_clear_bit(nr,p) NONATOMIC_BITOP_LE(test_and_clear_bit,nr,p) +#define ext2_test_bit(nr,p) __test_bit(nr,p) +#define ext2_find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) +#define ext2_find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) + +/* + * Minix is defined to use little-endian byte ordering. + * These do not need to be atomic. + */ +#define minix_set_bit(nr,p) NONATOMIC_BITOP_LE(set_bit,nr,p) +#define minix_test_bit(nr,p) __test_bit(nr,p) +#define minix_test_and_set_bit(nr,p) NONATOMIC_BITOP_LE(test_and_set_bit,nr,p) +#define minix_test_and_clear_bit(nr,p) NONATOMIC_BITOP_LE(test_and_clear_bit,nr,p) +#define minix_find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) #endif /* __KERNEL__ */ diff -u --recursive --new-file v2.5.1/linux/include/asm-sparc/keyboard.h linux/include/asm-sparc/keyboard.h --- v2.5.1/linux/include/asm-sparc/keyboard.h Tue Aug 28 07:09:44 2001 +++ linux/include/asm-sparc/keyboard.h Tue Dec 25 15:39:20 2001 @@ -40,7 +40,6 @@ #define kbd_init pcikbd_init #define compute_shiftstate pci_compute_shiftstate -#define keyboard_wait_for_keypress pci_wait_for_keypress #define getkeycode pci_getkeycode #define setkeycode pci_setkeycode #define getledstate pci_getledstate diff -u --recursive --new-file v2.5.1/linux/include/asm-sparc64/keyboard.h linux/include/asm-sparc64/keyboard.h --- v2.5.1/linux/include/asm-sparc64/keyboard.h Tue Aug 28 07:09:44 2001 +++ linux/include/asm-sparc64/keyboard.h Tue Dec 25 15:39:20 2001 @@ -38,7 +38,6 @@ #define kbd_init pcikbd_init #define compute_shiftstate pci_compute_shiftstate -#define keyboard_wait_for_keypress pci_wait_for_keypress #define getkeycode pci_getkeycode #define setkeycode pci_setkeycode #define getledstate pci_getledstate diff -u --recursive --new-file v2.5.1/linux/include/linux/acct.h linux/include/linux/acct.h --- v2.5.1/linux/include/linux/acct.h Thu Nov 22 11:46:18 2001 +++ linux/include/linux/acct.h Sun Dec 30 10:59:29 2001 @@ -76,7 +76,7 @@ #include <linux/config.h> #ifdef CONFIG_BSD_PROCESS_ACCT -extern void acct_auto_close(kdev_t dev); +extern void acct_auto_close(struct super_block *sb); extern int acct_process(long exitcode); #else #define acct_auto_close(x) do { } while (0) diff -u --recursive --new-file v2.5.1/linux/include/linux/amigaffs.h linux/include/linux/amigaffs.h --- v2.5.1/linux/include/linux/amigaffs.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/amigaffs.h Tue Dec 25 15:39:20 2001 @@ -23,8 +23,7 @@ static inline void affs_set_blocksize(struct super_block *sb, int size) { - set_blocksize(sb->s_dev, size); - sb->s_blocksize = size; + sb_set_blocksize(sb, size); } static inline struct buffer_head * affs_bread(struct super_block *sb, int block) diff -u --recursive --new-file v2.5.1/linux/include/linux/bio.h linux/include/linux/bio.h --- v2.5.1/linux/include/linux/bio.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/bio.h Sun Dec 30 10:59:53 2001 @@ -35,6 +35,7 @@ #endif #define BIO_MAX_SECTORS 128 +#define BIO_MAX_SIZE (BIO_MAX_SECTORS << 9) /* * was unsigned short, but we might as well be ready for > 64kB I/O pages diff -u --recursive --new-file v2.5.1/linux/include/linux/blk.h linux/include/linux/blk.h --- v2.5.1/linux/include/linux/blk.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/blk.h Sun Dec 30 11:00:16 2001 @@ -20,7 +20,6 @@ #define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */ extern unsigned long initrd_start,initrd_end; -extern int mount_initrd; /* zero if initrd should not be mounted */ extern int initrd_below_start_ok; /* 1 if it is not an error if initrd_start < memory_start */ extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ @@ -54,6 +53,9 @@ while ((rq = __elv_next_request(q))) { rq->flags |= REQ_STARTED; + + if (&rq->queuelist == q->last_merge) + q->last_merge = NULL; if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn) break; diff -u --recursive --new-file v2.5.1/linux/include/linux/blkdev.h linux/include/linux/blkdev.h --- v2.5.1/linux/include/linux/blkdev.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/blkdev.h Sun Dec 30 11:00:11 2001 @@ -6,7 +6,7 @@ #include <linux/genhd.h> #include <linux/tqueue.h> #include <linux/list.h> -#include <linux/mm.h> +#include <linux/pagemap.h> #include <asm/scatterlist.h> @@ -130,16 +130,17 @@ struct request_queue { /* - * the queue request freelist, one for reads and one for writes - */ - struct request_list rq[2]; - - /* * Together with queue_head for cacheline sharing */ struct list_head queue_head; + struct list_head *last_merge; elevator_t elevator; + /* + * the queue request freelist, one for reads and one for writes + */ + struct request_list rq[2]; + request_fn_proc *request_fn; merge_request_fn *back_merge_fn; merge_request_fn *front_merge_fn; @@ -195,8 +196,7 @@ #define RQ_SCSI_DISCONNECTING 0xffe0 #define QUEUE_FLAG_PLUGGED 0 /* queue is plugged */ -#define QUEUE_FLAG_NOSPLIT 1 /* can process bio over several goes */ -#define QUEUE_FLAG_CLUSTER 2 /* cluster several segments into 1 */ +#define QUEUE_FLAG_CLUSTER 1 /* cluster several segments into 1 */ #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) #define blk_mark_plugged(q) set_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) @@ -206,6 +206,14 @@ #define rq_data_dir(rq) ((rq)->flags & 1) /* + * mergeable request must not have _NOMERGE or _BARRIER bit set, nor may + * it already be started by driver. + */ +#define rq_mergeable(rq) \ + (!((rq)->flags & (REQ_NOMERGE | REQ_STARTED | REQ_BARRIER)) \ + && ((rq)->flags & REQ_CMD)) + +/* * noop, requests are automagically marked as active/inactive by I/O * scheduler -- see elv_next_request */ @@ -213,27 +221,25 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn; -#define BLK_BOUNCE_HIGH (blk_max_low_pfn << PAGE_SHIFT) -#define BLK_BOUNCE_ANY (blk_max_pfn << PAGE_SHIFT) -#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) - -#ifdef CONFIG_HIGHMEM +/* + * standard bounce addresses: + * + * BLK_BOUNCE_HIGH : bounce all highmem pages + * BLK_BOUNCE_ANY : don't bounce anything + * BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary + */ +#define BLK_BOUNCE_HIGH (blk_max_low_pfn << PAGE_SHIFT) +#define BLK_BOUNCE_ANY (blk_max_pfn << PAGE_SHIFT) +#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) +extern int init_emergency_isa_pool(void); extern void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig); -extern void init_emergency_isa_pool(void); extern inline void blk_queue_bounce(request_queue_t *q, struct bio **bio) { create_bounce(q->bounce_pfn, q->bounce_gfp, bio); } -#else /* CONFIG_HIGHMEM */ - -#define blk_queue_bounce(q, bio) do { } while (0) -#define init_emergency_isa_pool() do { } while (0) - -#endif /* CONFIG_HIGHMEM */ - #define rq_for_each_bio(bio, rq) \ if ((rq->bio)) \ for (bio = (rq)->bio; bio; bio = bio->bi_next) @@ -275,9 +281,13 @@ extern void blk_recount_segments(request_queue_t *, struct bio *); extern inline int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *); extern inline int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *); -extern void blk_queue_assign_lock(request_queue_t *q, spinlock_t *); - extern int block_ioctl(kdev_t, unsigned int, unsigned long); +extern int ll_10byte_cmd_build(request_queue_t *, struct request *); + +/* + * get ready for proper ref counting + */ +#define blk_put_queue(q) do { } while (0) /* * Access functions for manipulating queue properties @@ -292,6 +302,9 @@ extern void blk_queue_max_segment_size(request_queue_t *q, unsigned int); extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short); extern void blk_queue_segment_boundary(request_queue_t *q, unsigned long); +extern void blk_queue_assign_lock(request_queue_t *q, spinlock_t *); +extern void blk_queue_prep_rq(request_queue_t *q, prep_rq_fn *pfn); + extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); extern void generic_unplug_device(void *); @@ -366,6 +379,15 @@ retval = blksize_size[major][minor]; } return retval; +} + +typedef struct {struct page *v;} Sector; + +unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *); + +static inline void put_dev_sector(Sector p) +{ + page_cache_release(p.v); } #endif diff -u --recursive --new-file v2.5.1/linux/include/linux/blkdev.h.orig linux/include/linux/blkdev.h.orig --- v2.5.1/linux/include/linux/blkdev.h.orig Tue Dec 18 14:56:40 2001 +++ linux/include/linux/blkdev.h.orig Wed Dec 31 16:00:00 1969 @@ -1,371 +0,0 @@ -#ifndef _LINUX_BLKDEV_H -#define _LINUX_BLKDEV_H - -#include <linux/major.h> -#include <linux/sched.h> -#include <linux/genhd.h> -#include <linux/tqueue.h> -#include <linux/list.h> -#include <linux/mm.h> - -#include <asm/scatterlist.h> - -struct request_queue; -typedef struct request_queue request_queue_t; -struct elevator_s; -typedef struct elevator_s elevator_t; - -struct request_list { - unsigned int count; - struct list_head free; - wait_queue_head_t wait; -}; - -struct request { - struct list_head queuelist; /* looking for ->queue? you must _not_ - * access it directly, use - * blkdev_dequeue_request! */ - int elevator_sequence; - - unsigned char cmd[16]; - - unsigned long flags; /* see REQ_ bits below */ - - int rq_status; /* should split this into a few status bits */ - kdev_t rq_dev; - int errors; - sector_t sector; - unsigned long nr_sectors; - unsigned long hard_sector; /* the hard_* are block layer - * internals, no driver should - * touch them - */ - unsigned long hard_nr_sectors; - - /* Number of scatter-gather DMA addr+len pairs after - * physical address coalescing is performed. - */ - unsigned short nr_phys_segments; - - /* Number of scatter-gather addr+len pairs after - * physical and DMA remapping hardware coalescing is performed. - * This is the number of scatter-gather entries the driver - * will actually have to deal with after DMA mapping is done. - */ - unsigned short nr_hw_segments; - - unsigned int current_nr_sectors; - unsigned int hard_cur_sectors; - void *special; - char *buffer; - struct completion *waiting; - struct bio *bio, *biotail; - request_queue_t *q; - struct request_list *rl; -}; - -/* - * first three bits match BIO_RW* bits, important - */ -enum rq_flag_bits { - __REQ_RW, /* not set, read. set, write */ - __REQ_RW_AHEAD, /* READA */ - __REQ_BARRIER, /* may not be passed */ - __REQ_CMD, /* is a regular fs rw request */ - __REQ_NOMERGE, /* don't touch this for merging */ - __REQ_STARTED, /* drive already may have started this one */ - __REQ_DONTPREP, /* don't call prep for this one */ - /* - * for IDE - */ - __REQ_DRIVE_CMD, - __REQ_DRIVE_TASK, - - __REQ_PC, /* packet command (special) */ - __REQ_BLOCK_PC, /* queued down pc from block layer */ - __REQ_SENSE, /* sense retrival */ - - __REQ_SPECIAL, /* driver special command */ - - __REQ_NR_BITS, /* stops here */ -}; - -#define REQ_RW (1 << __REQ_RW) -#define REQ_RW_AHEAD (1 << __REQ_RW_AHEAD) -#define REQ_BARRIER (1 << __REQ_BARRIER) -#define REQ_CMD (1 << __REQ_CMD) -#define REQ_NOMERGE (1 << __REQ_NOMERGE) -#define REQ_STARTED (1 << __REQ_STARTED) -#define REQ_DONTPREP (1 << __REQ_DONTPREP) -#define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD) -#define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK) -#define REQ_PC (1 << __REQ_PC) -#define REQ_SENSE (1 << __REQ_SENSE) -#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC) -#define REQ_SPECIAL (1 << __REQ_SPECIAL) - -#include <linux/elevator.h> - -typedef int (merge_request_fn) (request_queue_t *, struct request *, - struct bio *); -typedef int (merge_requests_fn) (request_queue_t *, struct request *, - struct request *); -typedef void (request_fn_proc) (request_queue_t *q); -typedef request_queue_t * (queue_proc) (kdev_t dev); -typedef int (make_request_fn) (request_queue_t *q, struct bio *bio); -typedef int (prep_rq_fn) (request_queue_t *, struct request *); -typedef void (unplug_device_fn) (void *q); - -enum blk_queue_state { - Queue_down, - Queue_up, -}; - -/* - * Default nr free requests per queue, ll_rw_blk will scale it down - * according to available RAM at init time - */ -#define QUEUE_NR_REQUESTS 8192 - -struct request_queue -{ - /* - * the queue request freelist, one for reads and one for writes - */ - struct request_list rq[2]; - - /* - * Together with queue_head for cacheline sharing - */ - struct list_head queue_head; - elevator_t elevator; - - request_fn_proc *request_fn; - merge_request_fn *back_merge_fn; - merge_request_fn *front_merge_fn; - merge_requests_fn *merge_requests_fn; - make_request_fn *make_request_fn; - prep_rq_fn *prep_rq_fn; - - /* - * The queue owner gets to use this for whatever they like. - * ll_rw_blk doesn't touch it. - */ - void *queuedata; - - /* - * queue needs bounce pages for pages above this limit - */ - unsigned long bounce_pfn; - int bounce_gfp; - - /* - * This is used to remove the plug when tq_disk runs. - */ - struct tq_struct plug_tq; - - /* - * various queue flags, see QUEUE_* below - */ - unsigned long queue_flags; - - /* - * protects queue structures from reentrancy - */ - spinlock_t *queue_lock; - - /* - * queue settings - */ - unsigned short max_sectors; - unsigned short max_phys_segments; - unsigned short max_hw_segments; - unsigned short hardsect_size; - unsigned int max_segment_size; - - unsigned long seg_boundary_mask; - - wait_queue_head_t queue_wait; -}; - -#define RQ_INACTIVE (-1) -#define RQ_ACTIVE 1 -#define RQ_SCSI_BUSY 0xffff -#define RQ_SCSI_DONE 0xfffe -#define RQ_SCSI_DISCONNECTING 0xffe0 - -#define QUEUE_FLAG_PLUGGED 0 /* queue is plugged */ -#define QUEUE_FLAG_NOSPLIT 1 /* can process bio over several goes */ -#define QUEUE_FLAG_CLUSTER 2 /* cluster several segments into 1 */ - -#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) -#define blk_mark_plugged(q) set_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) -#define blk_queue_empty(q) elv_queue_empty(q) -#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) - -#define rq_data_dir(rq) ((rq)->flags & 1) - -/* - * noop, requests are automagically marked as active/inactive by I/O - * scheduler -- see elv_next_request - */ -#define blk_queue_headactive(q, head_active) - -extern unsigned long blk_max_low_pfn, blk_max_pfn; - -#define BLK_BOUNCE_HIGH (blk_max_low_pfn << PAGE_SHIFT) -#define BLK_BOUNCE_ANY (blk_max_pfn << PAGE_SHIFT) -#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) - -#ifdef CONFIG_HIGHMEM - -extern void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig); -extern void init_emergency_isa_pool(void); - -extern inline void blk_queue_bounce(request_queue_t *q, struct bio **bio) -{ - create_bounce(q->bounce_pfn, q->bounce_gfp, bio); -} - -#else /* CONFIG_HIGHMEM */ - -#define blk_queue_bounce(q, bio) do { } while (0) -#define init_emergency_isa_pool() do { } while (0) - -#endif /* CONFIG_HIGHMEM */ - -#define rq_for_each_bio(bio, rq) \ - if ((rq->bio)) \ - for (bio = (rq)->bio; bio; bio = bio->bi_next) - -struct blk_dev_struct { - /* - * queue_proc has to be atomic - */ - request_queue_t request_queue; - queue_proc *queue; - void *data; -}; - -struct sec_size { - unsigned block_size; - unsigned block_size_bits; -}; - -/* - * Used to indicate the default queue for drivers that don't bother - * to implement multiple queues. We have this access macro here - * so as to eliminate the need for each and every block device - * driver to know about the internal structure of blk_dev[]. - */ -#define BLK_DEFAULT_QUEUE(_MAJOR) &blk_dev[_MAJOR].request_queue - -extern struct sec_size * blk_sec[MAX_BLKDEV]; -extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; -extern void grok_partitions(kdev_t dev, long size); -extern int wipe_partitions(kdev_t dev); -extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, long size); -extern void generic_make_request(struct bio *bio); -extern inline request_queue_t *blk_get_queue(kdev_t dev); -extern void blkdev_release_request(struct request *); -extern void blk_attempt_remerge(request_queue_t *, struct request *); -extern struct request *blk_get_request(request_queue_t *, int, int); -extern void blk_put_request(struct request *); -extern void blk_plug_device(request_queue_t *); -extern void blk_recount_segments(request_queue_t *, struct bio *); -extern inline int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *); -extern inline int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *); -extern void blk_queue_assign_lock(request_queue_t *q, spinlock_t *); - -extern int block_ioctl(kdev_t, unsigned int, unsigned long); - -/* - * Access functions for manipulating queue properties - */ -extern int blk_init_queue(request_queue_t *, request_fn_proc *, spinlock_t *); -extern void blk_cleanup_queue(request_queue_t *); -extern void blk_queue_make_request(request_queue_t *, make_request_fn *); -extern void blk_queue_bounce_limit(request_queue_t *, u64); -extern void blk_queue_max_sectors(request_queue_t *q, unsigned short); -extern void blk_queue_max_phys_segments(request_queue_t *q, unsigned short); -extern void blk_queue_max_hw_segments(request_queue_t *q, unsigned short); -extern void blk_queue_max_segment_size(request_queue_t *q, unsigned int); -extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short); -extern void blk_queue_segment_boundary(request_queue_t *q, unsigned long); -extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); -extern void blk_dump_rq_flags(struct request *, char *); -extern void generic_unplug_device(void *); - -extern int * blk_size[MAX_BLKDEV]; - -extern int * blksize_size[MAX_BLKDEV]; - -extern int * max_readahead[MAX_BLKDEV]; - -#define MAX_PHYS_SEGMENTS 128 -#define MAX_HW_SEGMENTS 128 -#define MAX_SECTORS 255 - -#define MAX_SEGMENT_SIZE 65536 - -/* read-ahead in pages.. */ -#define MAX_READAHEAD 31 -#define MIN_READAHEAD 3 - -#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) -#define blkdev_entry_next_request(entry) blkdev_entry_to_request((entry)->next) -#define blkdev_entry_prev_request(entry) blkdev_entry_to_request((entry)->prev) -#define blkdev_next_request(req) blkdev_entry_to_request((req)->queuelist.next) -#define blkdev_prev_request(req) blkdev_entry_to_request((req)->queuelist.prev) - -extern void drive_stat_acct(struct request *, int, int); - -extern inline void blk_clear(int major) -{ - blk_size[major] = NULL; -#if 0 - blk_size_in_bytes[major] = NULL; -#endif - blksize_size[major] = NULL; - max_readahead[major] = NULL; - read_ahead[major] = 0; -} - -extern inline int get_hardsect_size(kdev_t dev) -{ - request_queue_t *q = blk_get_queue(dev); - int retval = 512; - - if (q && q->hardsect_size) - retval = q->hardsect_size; - - return retval; -} - -#define blk_finished_io(nsects) do { } while (0) -#define blk_started_io(nsects) do { } while (0) - -extern inline unsigned int blksize_bits(unsigned int size) -{ - unsigned int bits = 8; - do { - bits++; - size >>= 1; - } while (size > 256); - return bits; -} - -extern inline unsigned int block_size(kdev_t dev) -{ - int retval = BLOCK_SIZE; - int major = MAJOR(dev); - - if (blksize_size[major]) { - int minor = MINOR(dev); - if (blksize_size[major][minor]) - retval = blksize_size[major][minor]; - } - return retval; -} - -#endif diff -u --recursive --new-file v2.5.1/linux/include/linux/console.h linux/include/linux/console.h --- v2.5.1/linux/include/linux/console.h Thu Nov 22 11:46:19 2001 +++ linux/include/linux/console.h Sun Dec 30 10:59:30 2001 @@ -97,7 +97,6 @@ void (*write)(struct console *, const char *, unsigned); int (*read)(struct console *, const char *, unsigned); kdev_t (*device)(struct console *); - int (*wait_key)(struct console *); void (*unblank)(void); int (*setup)(struct console *, char *); short flags; diff -u --recursive --new-file v2.5.1/linux/include/linux/devfs_fs.h linux/include/linux/devfs_fs.h --- v2.5.1/linux/include/linux/devfs_fs.h Fri Sep 21 10:55:23 2001 +++ linux/include/linux/devfs_fs.h Thu Dec 27 08:29:15 2001 @@ -26,7 +26,7 @@ binary interface will change */ struct devfsd_notify_struct -{ +{ /* Use native C types to ensure same types in kernel and user space */ unsigned int type; /* DEVFSD_NOTIFY_* value */ unsigned int mode; /* Mode of the inode or device entry */ unsigned int major; /* Major number of device entry */ diff -u --recursive --new-file v2.5.1/linux/include/linux/devfs_fs_kernel.h linux/include/linux/devfs_fs_kernel.h --- v2.5.1/linux/include/linux/devfs_fs_kernel.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/devfs_fs_kernel.h Sun Dec 30 10:59:30 2001 @@ -37,8 +37,7 @@ */ #define DEVFS_FL_REMOVABLE 0x010 /* This is a removable media device */ #define DEVFS_FL_WAIT 0x020 /* Wait for devfsd to finish */ -#define DEVFS_FL_NO_PERSISTENCE 0x040 /* Forget changes after unregister */ -#define DEVFS_FL_CURRENT_OWNER 0x080 /* Set initial ownership to current */ +#define DEVFS_FL_CURRENT_OWNER 0x040 /* Set initial ownership to current */ #define DEVFS_FL_DEFAULT DEVFS_FL_NONE @@ -61,6 +60,7 @@ #define UNIQUE_NUMBERSPACE_INITIALISER {SPIN_LOCK_UNLOCKED, 0, 0, 0, NULL} +extern void devfs_put (devfs_handle_t de); extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, unsigned int flags, unsigned int major, unsigned int minor, @@ -71,6 +71,9 @@ devfs_handle_t *handle, void *info); extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name, void *info); +extern devfs_handle_t devfs_get_handle (devfs_handle_t dir, const char *name, + unsigned int major,unsigned int minor, + char type, int traverse_symlinks); extern devfs_handle_t devfs_find_handle (devfs_handle_t dir, const char *name, unsigned int major,unsigned int minor, char type, int traverse_symlinks); @@ -81,6 +84,7 @@ extern devfs_handle_t devfs_get_handle_from_inode (struct inode *inode); extern int devfs_generate_path (devfs_handle_t de, char *path, int buflen); extern void *devfs_get_ops (devfs_handle_t de); +extern void devfs_put_ops (devfs_handle_t de); extern int devfs_set_file_size (devfs_handle_t de, unsigned long size); extern void *devfs_get_info (devfs_handle_t de); extern int devfs_set_info (devfs_handle_t de, void *info); @@ -112,7 +116,6 @@ int number); extern void mount_devfs_fs (void); -extern void devfs_make_root (const char *name); #else /* CONFIG_DEVFS_FS */ @@ -123,6 +126,10 @@ #define UNIQUE_NUMBERSPACE_INITIALISER {0} +static inline void devfs_put (devfs_handle_t de) +{ + return; +} static inline devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, unsigned int flags, @@ -148,6 +155,15 @@ { return NULL; } +static inline devfs_handle_t devfs_get_handle (devfs_handle_t dir, + const char *name, + unsigned int major, + unsigned int minor, + char type, + int traverse_symlinks) +{ + return NULL; +} static inline devfs_handle_t devfs_find_handle (devfs_handle_t dir, const char *name, unsigned int major, @@ -183,6 +199,10 @@ { return NULL; } +static inline void devfs_put_ops (devfs_handle_t de) +{ + return; +} static inline int devfs_set_file_size (devfs_handle_t de, unsigned long size) { return -ENOSYS; @@ -288,10 +308,6 @@ } static inline void mount_devfs_fs (void) -{ - return; -} -static inline void devfs_make_root (const char *name) { return; } diff -u --recursive --new-file v2.5.1/linux/include/linux/elevator.h linux/include/linux/elevator.h --- v2.5.1/linux/include/linux/elevator.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/elevator.h Thu Dec 20 08:50:13 2001 @@ -1,12 +1,8 @@ #ifndef _LINUX_ELEVATOR_H #define _LINUX_ELEVATOR_H -typedef void (elevator_fn) (struct request *, elevator_t *, - struct list_head *, - struct list_head *, int); - typedef int (elevator_merge_fn) (request_queue_t *, struct request **, - struct list_head *, struct bio *); + struct bio *); typedef void (elevator_merge_cleanup_fn) (request_queue_t *, struct request *, int); @@ -21,8 +17,7 @@ struct elevator_s { - int read_latency; - int write_latency; + int latency[2]; elevator_merge_fn *elevator_merge_fn; elevator_merge_cleanup_fn *elevator_merge_cleanup_fn; @@ -35,11 +30,11 @@ elevator_exit_fn *elevator_exit_fn; }; -int elevator_noop_merge(request_queue_t *, struct request **, struct list_head *, struct bio *); +int elevator_noop_merge(request_queue_t *, struct request **, struct bio *); void elevator_noop_merge_cleanup(request_queue_t *, struct request *, int); void elevator_noop_merge_req(struct request *, struct request *); -int elevator_linus_merge(request_queue_t *, struct request **, struct list_head *, struct bio *); +int elevator_linus_merge(request_queue_t *, struct request **, struct bio *); void elevator_linus_merge_cleanup(request_queue_t *, struct request *, int); void elevator_linus_merge_req(struct request *, struct request *); int elv_linus_init(request_queue_t *, elevator_t *); @@ -69,32 +64,7 @@ #define ELEVATOR_FRONT_MERGE 1 #define ELEVATOR_BACK_MERGE 2 -/* - * This is used in the elevator algorithm. We don't prioritise reads - * over writes any more --- although reads are more time-critical than - * writes, by treating them equally we increase filesystem throughput. - * This turns out to give better overall performance. -- sct - */ -#define IN_ORDER(s1,s2) \ - ((((s1)->rq_dev == (s2)->rq_dev && \ - (s1)->sector < (s2)->sector)) || \ - (s1)->rq_dev < (s2)->rq_dev) - -#define BHRQ_IN_ORDER(bh, rq) \ - ((((bh)->b_rdev == (rq)->rq_dev && \ - (bh)->b_rsector < (rq)->sector)) || \ - (bh)->b_rdev < (rq)->rq_dev) - -static inline int elevator_request_latency(elevator_t * elevator, int rw) -{ - int latency; - - latency = elevator->read_latency; - if (rw != READ) - latency = elevator->write_latency; - - return latency; -} +#define elevator_request_latency(e, rw) ((e)->latency[(rw) & 1]) /* * will change once we move to a more complex data structure than a simple @@ -116,9 +86,7 @@ #define ELEVATOR_NOOP \ ((elevator_t) { \ - 0, /* read_latency */ \ - 0, /* write_latency */ \ - \ + { 0, 0}, \ elevator_noop_merge, /* elevator_merge_fn */ \ elevator_noop_merge_cleanup, /* elevator_merge_cleanup_fn */ \ elevator_noop_merge_req, /* elevator_merge_req_fn */ \ @@ -130,9 +98,7 @@ #define ELEVATOR_LINUS \ ((elevator_t) { \ - 8192, /* read passovers */ \ - 16384, /* write passovers */ \ - \ + { 8192, 16384 }, \ elevator_linus_merge, /* elevator_merge_fn */ \ elevator_linus_merge_cleanup, /* elevator_merge_cleanup_fn */ \ elevator_linus_merge_req, /* elevator_merge_req_fn */ \ diff -u --recursive --new-file v2.5.1/linux/include/linux/ext2_fs_sb.h linux/include/linux/ext2_fs_sb.h --- v2.5.1/linux/include/linux/ext2_fs_sb.h Fri Dec 29 14:36:44 2000 +++ linux/include/linux/ext2_fs_sb.h Sun Dec 30 10:53:53 2001 @@ -56,6 +56,7 @@ int s_desc_per_block_bits; int s_inode_size; int s_first_ino; + u32 s_next_generation; }; #endif /* _LINUX_EXT2_FS_SB */ diff -u --recursive --new-file v2.5.1/linux/include/linux/file.h linux/include/linux/file.h --- v2.5.1/linux/include/linux/file.h Wed Aug 23 11:22:26 2000 +++ linux/include/linux/file.h Sun Dec 30 10:59:33 2001 @@ -5,6 +5,8 @@ #ifndef __LINUX_FILE_H #define __LINUX_FILE_H +#include <linux/sched.h> + extern void FASTCALL(fput(struct file *)); extern struct file * FASTCALL(fget(unsigned int fd)); diff -u --recursive --new-file v2.5.1/linux/include/linux/fs.h linux/include/linux/fs.h --- v2.5.1/linux/include/linux/fs.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/fs.h Sun Dec 30 10:59:30 2001 @@ -982,6 +982,7 @@ extern struct vfsmount *kern_mount(struct file_system_type *); extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); +extern void umount_tree(struct vfsmount *); #define kern_umount mntput @@ -1102,7 +1103,7 @@ extern int try_to_free_buffers(struct page *, unsigned int); extern void refile_buffer(struct buffer_head * buf); -extern void create_empty_buffers(struct page *, kdev_t, unsigned long); +extern void create_empty_buffers(struct page *, unsigned long); extern void end_buffer_io_sync(struct buffer_head *bh, int uptodate); /* reiserfs_writepage needs this */ @@ -1378,6 +1379,8 @@ __bforget(buf); } extern int set_blocksize(kdev_t, int); +extern int sb_set_blocksize(struct super_block *, int); +extern int sb_min_blocksize(struct super_block *, int); extern struct buffer_head * bread(kdev_t, int, int); static inline struct buffer_head * sb_bread(struct super_block *sb, int block) { @@ -1390,6 +1393,12 @@ static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, int block) { return get_hash_table(sb->s_dev, block, sb->s_blocksize); +} +static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) +{ + bh->b_state |= 1 << BH_Mapped; + bh->b_dev = sb->s_dev; + bh->b_blocknr = block; } extern void wakeup_bdflush(void); extern void put_unused_buffer_head(struct buffer_head * bh); diff -u --recursive --new-file v2.5.1/linux/include/linux/gfp.h linux/include/linux/gfp.h --- v2.5.1/linux/include/linux/gfp.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/gfp.h Sun Dec 30 10:59:30 2001 @@ -0,0 +1,81 @@ +#ifndef __LINUX_GFP_H +#define __LINUX_GFP_H + +#include <linux/mmzone.h> +#include <linux/stddef.h> +#include <linux/linkage.h> +/* + * GFP bitmasks.. + */ +/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low four bits) */ +#define __GFP_DMA 0x01 +#define __GFP_HIGHMEM 0x02 + +/* Action modifiers - doesn't change the zoning */ +#define __GFP_WAIT 0x10 /* Can wait and reschedule? */ +#define __GFP_HIGH 0x20 /* Should access emergency pools? */ +#define __GFP_IO 0x40 /* Can start low memory physical IO? */ +#define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */ +#define __GFP_FS 0x100 /* Can call down to low-level FS? */ + +#define GFP_NOHIGHIO (__GFP_HIGH | __GFP_WAIT | __GFP_IO) +#define GFP_NOIO (__GFP_HIGH | __GFP_WAIT) +#define GFP_NOFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO) +#define GFP_ATOMIC (__GFP_HIGH) +#define GFP_USER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) +#define GFP_HIGHUSER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS | __GFP_HIGHMEM) +#define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) +#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) +#define GFP_KSWAPD ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) + +/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some + platforms, used as appropriate on others */ + +#define GFP_DMA __GFP_DMA + +/* + * There is only one page-allocator function, and two main namespaces to + * it. The alloc_page*() variants return 'struct page *' and as such + * can allocate highmem pages, the *get*page*() variants return + * virtual kernel addresses to the allocated page(s). + */ +extern struct page * FASTCALL(_alloc_pages(unsigned int gfp_mask, unsigned int order)); +extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_t *zonelist)); +extern struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order); + +static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order) +{ + /* + * Gets optimized away by the compiler. + */ + if (order >= MAX_ORDER) + return NULL; + return _alloc_pages(gfp_mask, order); +} + +#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) + +extern unsigned long FASTCALL(__get_free_pages(unsigned int gfp_mask, unsigned int order)); +extern unsigned long FASTCALL(get_zeroed_page(unsigned int gfp_mask)); + +#define __get_free_page(gfp_mask) \ + __get_free_pages((gfp_mask),0) + +#define __get_dma_pages(gfp_mask, order) \ + __get_free_pages((gfp_mask) | GFP_DMA,(order)) + +/* + * The old interface name will be removed in 2.5: + */ +#define get_free_page get_zeroed_page + +/* + * There is only one 'core' page-freeing function. + */ +extern void FASTCALL(__free_pages(struct page *page, unsigned int order)); +extern void FASTCALL(free_pages(unsigned long addr, unsigned int order)); + +#define __free_page(page) __free_pages((page), 0) +#define free_page(addr) free_pages((addr),0) + +#endif /* __LINUX_GFP_H */ diff -u --recursive --new-file v2.5.1/linux/include/linux/i8k.h linux/include/linux/i8k.h --- v2.5.1/linux/include/linux/i8k.h Fri Nov 2 17:46:47 2001 +++ linux/include/linux/i8k.h Sun Dec 30 10:38:45 2001 @@ -1,5 +1,5 @@ /* - * i8k.h -- Linux driver for accessing the SMM BIOS on Dell I8000 laptops + * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops * * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> * @@ -36,9 +36,9 @@ #define I8K_FAN_HIGH 2 #define I8K_FAN_MAX I8K_FAN_HIGH -#define I8K_VOL_UP 0x01 -#define I8K_VOL_DOWN 0x02 -#define I8K_VOL_MUTE 0x03 +#define I8K_VOL_UP 1 +#define I8K_VOL_DOWN 2 +#define I8K_VOL_MUTE 4 #define I8K_AC 1 #define I8K_BATTERY 0 diff -u --recursive --new-file v2.5.1/linux/include/linux/interrupt.h linux/include/linux/interrupt.h --- v2.5.1/linux/include/linux/interrupt.h Thu Nov 22 11:46:19 2001 +++ linux/include/linux/interrupt.h Sun Dec 30 10:59:30 2001 @@ -3,12 +3,14 @@ #define _LINUX_INTERRUPT_H #include <linux/config.h> +#include <linux/sched.h> #include <linux/kernel.h> #include <linux/smp.h> #include <linux/cache.h> #include <asm/bitops.h> #include <asm/atomic.h> +#include <asm/system.h> #include <asm/ptrace.h> struct irqaction { diff -u --recursive --new-file v2.5.1/linux/include/linux/isdn.h linux/include/linux/isdn.h --- v2.5.1/linux/include/linux/isdn.h Sun Sep 30 12:26:42 2001 +++ linux/include/linux/isdn.h Sun Dec 30 10:31:51 2001 @@ -150,7 +150,6 @@ #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/kernel.h> #include <linux/signal.h> diff -u --recursive --new-file v2.5.1/linux/include/linux/kbd_kern.h linux/include/linux/kbd_kern.h --- v2.5.1/linux/include/linux/kbd_kern.h Thu Nov 22 11:47:23 2001 +++ linux/include/linux/kbd_kern.h Sun Dec 30 11:00:39 2001 @@ -140,7 +140,6 @@ int getkeycode(unsigned int scancode); int setkeycode(unsigned int scancode, unsigned int keycode); void compute_shiftstate(void); -int keyboard_wait_for_keypress(struct console *); /* defkeymap.c */ diff -u --recursive --new-file v2.5.1/linux/include/linux/kernel.h linux/include/linux/kernel.h --- v2.5.1/linux/include/linux/kernel.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/kernel.h Sun Dec 30 10:59:29 2001 @@ -37,16 +37,6 @@ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ -# define NORET_TYPE /**/ -# define ATTRIB_NORET __attribute__((noreturn)) -# define NORET_AND noreturn, - -#ifdef __i386__ -#define FASTCALL(x) x __attribute__((regparm(3))) -#else -#define FASTCALL(x) x -#endif - struct completion; extern struct notifier_block *panic_notifier_list; diff -u --recursive --new-file v2.5.1/linux/include/linux/keyboard.h linux/include/linux/keyboard.h --- v2.5.1/linux/include/linux/keyboard.h Thu Nov 22 11:47:07 2001 +++ linux/include/linux/keyboard.h Sun Dec 30 11:00:25 2001 @@ -26,7 +26,6 @@ extern const int max_vals[]; extern unsigned short *key_maps[MAX_NR_KEYMAPS]; extern unsigned short plain_map[NR_KEYS]; -extern wait_queue_head_t keypress_wait; extern unsigned char keyboard_type; #endif diff -u --recursive --new-file v2.5.1/linux/include/linux/linkage.h linux/include/linux/linkage.h --- v2.5.1/linux/include/linux/linkage.h Mon Dec 11 12:49:54 2000 +++ linux/include/linux/linkage.h Sat Dec 29 17:30:07 2001 @@ -60,4 +60,14 @@ #endif +# define NORET_TYPE /**/ +# define ATTRIB_NORET __attribute__((noreturn)) +# define NORET_AND noreturn, + +#ifdef __i386__ +#define FASTCALL(x) x __attribute__((regparm(3))) +#else +#define FASTCALL(x) x +#endif + #endif diff -u --recursive --new-file v2.5.1/linux/include/linux/mm.h linux/include/linux/mm.h --- v2.5.1/linux/include/linux/mm.h Thu Nov 22 11:46:20 2001 +++ linux/include/linux/mm.h Sun Dec 30 10:59:30 2001 @@ -7,6 +7,7 @@ #ifdef __KERNEL__ #include <linux/config.h> +#include <linux/gfp.h> #include <linux/string.h> #include <linux/list.h> #include <linux/mmzone.h> @@ -344,51 +345,6 @@ /* The array of struct pages */ extern mem_map_t * mem_map; -/* - * There is only one page-allocator function, and two main namespaces to - * it. The alloc_page*() variants return 'struct page *' and as such - * can allocate highmem pages, the *get*page*() variants return - * virtual kernel addresses to the allocated page(s). - */ -extern struct page * FASTCALL(_alloc_pages(unsigned int gfp_mask, unsigned int order)); -extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_t *zonelist)); -extern struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order); - -static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order) -{ - /* - * Gets optimized away by the compiler. - */ - if (order >= MAX_ORDER) - return NULL; - return _alloc_pages(gfp_mask, order); -} - -#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) - -extern unsigned long FASTCALL(__get_free_pages(unsigned int gfp_mask, unsigned int order)); -extern unsigned long FASTCALL(get_zeroed_page(unsigned int gfp_mask)); - -#define __get_free_page(gfp_mask) \ - __get_free_pages((gfp_mask),0) - -#define __get_dma_pages(gfp_mask, order) \ - __get_free_pages((gfp_mask) | GFP_DMA,(order)) - -/* - * The old interface name will be removed in 2.5: - */ -#define get_free_page get_zeroed_page - -/* - * There is only one 'core' page-freeing function. - */ -extern void FASTCALL(__free_pages(struct page *page, unsigned int order)); -extern void FASTCALL(free_pages(unsigned long addr, unsigned int order)); - -#define __free_page(page) __free_pages((page), 0) -#define free_page(addr) free_pages((addr),0) - extern void show_free_areas(void); extern void show_free_areas_node(pg_data_t *pgdat); @@ -418,6 +374,9 @@ extern void ptrace_disable(struct task_struct *); extern int ptrace_check_attach(struct task_struct *task, int kill); +int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, + int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); + /* * On a two-level page table, this ends up being trivial. Thus the * inlining and the symmetry break with pte_alloc() that does all @@ -511,35 +470,6 @@ /* generic vm_area_ops exported for stackable file systems */ extern int filemap_sync(struct vm_area_struct *, unsigned long, size_t, unsigned int); extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int); - -/* - * GFP bitmasks.. - */ -/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low four bits) */ -#define __GFP_DMA 0x01 -#define __GFP_HIGHMEM 0x02 - -/* Action modifiers - doesn't change the zoning */ -#define __GFP_WAIT 0x10 /* Can wait and reschedule? */ -#define __GFP_HIGH 0x20 /* Should access emergency pools? */ -#define __GFP_IO 0x40 /* Can start low memory physical IO? */ -#define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */ -#define __GFP_FS 0x100 /* Can call down to low-level FS? */ - -#define GFP_NOHIGHIO (__GFP_HIGH | __GFP_WAIT | __GFP_IO) -#define GFP_NOIO (__GFP_HIGH | __GFP_WAIT) -#define GFP_NOFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO) -#define GFP_ATOMIC (__GFP_HIGH) -#define GFP_USER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) -#define GFP_HIGHUSER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS | __GFP_HIGHMEM) -#define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) -#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) -#define GFP_KSWAPD ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS) - -/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some - platforms, used as appropriate on others */ - -#define GFP_DMA __GFP_DMA /* vma is the first one with address < vma->vm_end, * and even address < vma->vm_start. Have to extend vma. */ diff -u --recursive --new-file v2.5.1/linux/include/linux/msdos_fs.h linux/include/linux/msdos_fs.h --- v2.5.1/linux/include/linux/msdos_fs.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/msdos_fs.h Thu Dec 27 08:17:43 2001 @@ -200,7 +200,7 @@ #include <linux/nls.h> struct fat_cache { - kdev_t device; /* device number. 0 means unused. */ + struct super_block *sb; /* fs in question. NULL means unused */ int start_cluster; /* first cluster of the chain. */ int file_cluster; /* cluster number in the file. */ int disk_cluster; /* cluster number on disk. */ @@ -252,7 +252,7 @@ int *d_clu); extern void fat_cache_add(struct inode *inode, int f_clu, int d_clu); extern void fat_cache_inval_inode(struct inode *inode); -extern void fat_cache_inval_dev(kdev_t device); +extern void fat_cache_inval_dev(struct super_block *sb); extern int fat_get_cluster(struct inode *inode, int cluster); extern int fat_free(struct inode *inode, int skip); diff -u --recursive --new-file v2.5.1/linux/include/linux/namespace.h linux/include/linux/namespace.h --- v2.5.1/linux/include/linux/namespace.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/namespace.h Tue Dec 25 15:39:20 2001 @@ -0,0 +1,42 @@ +#ifndef _NAMESPACE_H_ +#define _NAMESPACE_H_ +#ifdef __KERNEL__ + +struct namespace { + atomic_t count; + struct vfsmount * root; + struct list_head list; + struct rw_semaphore sem; +}; + +static inline void put_namespace(struct namespace *namespace) +{ + if (atomic_dec_and_test(&namespace->count)) { + down_write(&namespace->sem); + spin_lock(&dcache_lock); + umount_tree(namespace->root); + spin_unlock(&dcache_lock); + up_write(&namespace->sem); + kfree(namespace); + } +} + +static inline void exit_namespace(struct task_struct *p) +{ + struct namespace *namespace = p->namespace; + if (namespace) { + task_lock(p); + p->namespace = NULL; + task_unlock(p); + put_namespace(namespace); + } +} +extern int copy_namespace(int, struct task_struct *); + +static inline void get_namespace(struct namespace *namespace) +{ + atomic_inc(&namespace->count); +} + +#endif +#endif diff -u --recursive --new-file v2.5.1/linux/include/linux/parport.h linux/include/linux/parport.h --- v2.5.1/linux/include/linux/parport.h Wed Nov 14 14:52:47 2001 +++ linux/include/linux/parport.h Sat Dec 29 17:30:07 2001 @@ -8,6 +8,7 @@ #ifndef _PARPORT_H_ #define _PARPORT_H_ +#include <linux/sched.h> /* Start off with user-visible constants */ diff -u --recursive --new-file v2.5.1/linux/include/linux/pci_ids.h linux/include/linux/pci_ids.h --- v2.5.1/linux/include/linux/pci_ids.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/pci_ids.h Thu Dec 27 08:38:57 2001 @@ -946,11 +946,12 @@ #define PCI_DEVICE_ID_VIA_8233_7 0x3065 #define PCI_DEVICE_ID_VIA_82C686_6 0x3068 #define PCI_DEVICE_ID_VIA_8233_0 0x3074 -#define PCI_DEVICE_ID_VIA_8622 0x3102 -#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 -#define PCI_DEVICE_ID_VIA_8361 0x3112 #define PCI_DEVICE_ID_VIA_8633_0 0x3091 #define PCI_DEVICE_ID_VIA_8367_0 0x3099 +#define PCI_DEVICE_ID_VIA_8622 0x3102 +#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 +#define PCI_DEVICE_ID_VIA_8361 0x3112 +#define PCI_DEVICE_ID_VIA_8233A 0x3147 #define PCI_DEVICE_ID_VIA_86C100A 0x6100 #define PCI_DEVICE_ID_VIA_8231 0x8231 #define PCI_DEVICE_ID_VIA_8231_4 0x8235 @@ -960,7 +961,7 @@ #define PCI_DEVICE_ID_VIA_82C597_1 0x8597 #define PCI_DEVICE_ID_VIA_82C598_1 0x8598 #define PCI_DEVICE_ID_VIA_8601_1 0x8601 -#define PCI_DEVICE_ID_VIA_8505_1 0X8605 +#define PCI_DEVICE_ID_VIA_8505_1 0x8605 #define PCI_DEVICE_ID_VIA_8633_1 0xB091 #define PCI_DEVICE_ID_VIA_8367_1 0xB099 diff -u --recursive --new-file v2.5.1/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h --- v2.5.1/linux/include/linux/proc_fs.h Thu Nov 22 11:46:23 2001 +++ linux/include/linux/proc_fs.h Sun Dec 30 10:59:30 2001 @@ -3,6 +3,8 @@ #include <linux/config.h> #include <linux/slab.h> +#include <linux/fs.h> +#include <asm/atomic.h> /* * The proc filesystem constants/structures diff -u --recursive --new-file v2.5.1/linux/include/linux/quota.h linux/include/linux/quota.h --- v2.5.1/linux/include/linux/quota.h Thu Nov 22 10:38:31 2001 +++ linux/include/linux/quota.h Thu Dec 27 08:17:43 2001 @@ -167,7 +167,6 @@ /* fields after this point are cleared when invalidating */ struct super_block *dq_sb; /* superblock this applies to */ unsigned int dq_id; /* ID this applies to (uid, gid) */ - kdev_t dq_dev; /* Device this applies to */ short dq_type; /* Type of quota */ short dq_flags; /* See DQ_* */ unsigned long dq_referenced; /* Number of times this dquot was diff -u --recursive --new-file v2.5.1/linux/include/linux/quotaops.h linux/include/linux/quotaops.h --- v2.5.1/linux/include/linux/quotaops.h Thu Nov 22 11:46:52 2001 +++ linux/include/linux/quotaops.h Sun Dec 30 11:00:14 2001 @@ -23,7 +23,7 @@ extern void dquot_initialize(struct inode *inode, short type); extern void dquot_drop(struct inode *inode); extern int quota_off(struct super_block *sb, short type); -extern int sync_dquots(kdev_t dev, short type); +extern int sync_dquots(struct super_block *sb, short type); extern int dquot_alloc_block(struct inode *inode, unsigned long number, char prealloc); extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); @@ -159,7 +159,7 @@ return 0; } -#define DQUOT_SYNC(dev) sync_dquots(dev, -1) +#define DQUOT_SYNC(sb) sync_dquots(sb, -1) #define DQUOT_OFF(sb) quota_off(sb, -1) #else @@ -171,7 +171,7 @@ #define DQUOT_DROP(inode) do { } while(0) #define DQUOT_ALLOC_INODE(inode) (0) #define DQUOT_FREE_INODE(inode) do { } while(0) -#define DQUOT_SYNC(dev) do { } while(0) +#define DQUOT_SYNC(sb) do { } while(0) #define DQUOT_OFF(sb) do { } while(0) #define DQUOT_TRANSFER(inode, iattr) (0) extern __inline__ int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, int nr) diff -u --recursive --new-file v2.5.1/linux/include/linux/raid/md_k.h linux/include/linux/raid/md_k.h --- v2.5.1/linux/include/linux/raid/md_k.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/raid/md_k.h Wed Dec 19 15:18:10 2001 @@ -240,7 +240,7 @@ int (*stop_resync)(mddev_t *mddev); int (*restart_resync)(mddev_t *mddev); - int (*sync_request)(mddev_t *mddev, sector_t sector_nr); + int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster); }; diff -u --recursive --new-file v2.5.1/linux/include/linux/raid/raid1.h linux/include/linux/raid/raid1.h --- v2.5.1/linux/include/linux/raid/raid1.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/raid/raid1.h Wed Dec 19 15:18:10 2001 @@ -9,8 +9,8 @@ int number; int raid_disk; kdev_t dev; - int sect_limit; - int head_position; + sector_t head_position; + atomic_t nr_pending; /* * State bits: @@ -31,23 +31,21 @@ int raid_disks; int working_disks; int last_used; - sector_t next_sect; - int sect_count; + sector_t next_seq_sect; mdk_thread_t *thread, *resync_thread; int resync_mirrors; mirror_info_t *spare; spinlock_t device_lock; /* for use when syncing mirrors: */ - unsigned long start_active, start_ready, - start_pending, start_future; - int cnt_done, cnt_active, cnt_ready, - cnt_pending, cnt_future; - int phase; - int window; - wait_queue_head_t wait_done; - wait_queue_head_t wait_ready; - spinlock_t segment_lock; + + spinlock_t resync_lock; + int nr_pending; + int barrier; + sector_t next_resync; + + wait_queue_head_t wait_idle; + wait_queue_head_t wait_resume; mempool_t *r1bio_pool; mempool_t *r1buf_pool; @@ -62,7 +60,8 @@ #define mddev_to_conf(mddev) ((conf_t *) mddev->private) /* - * this is our 'private' 'collective' RAID1 buffer head. + * this is our 'private' RAID1 bio. + * * it contains information about what kind of IO operations were started * for this RAID1 operation, and about their status: */ @@ -83,6 +82,7 @@ * if the IO is in READ direction, then this bio is used: */ struct bio *read_bio; + int read_disk; /* * if the IO is in WRITE direction, then multiple bios are used: */ @@ -94,5 +94,5 @@ /* bits for r1bio.state */ #define R1BIO_Uptodate 1 -#define R1BIO_SyncPhase 2 + #endif diff -u --recursive --new-file v2.5.1/linux/include/linux/reiserfs_fs.h linux/include/linux/reiserfs_fs.h --- v2.5.1/linux/include/linux/reiserfs_fs.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/reiserfs_fs.h Sat Dec 29 17:30:07 2001 @@ -15,10 +15,10 @@ #include <linux/types.h> #ifdef __KERNEL__ #include <linux/slab.h> +#include <linux/interrupt.h> #include <linux/tqueue.h> #include <asm/unaligned.h> #include <linux/bitops.h> -#include <asm/hardirq.h> #include <linux/proc_fs.h> #endif @@ -1827,12 +1827,12 @@ //void decrement_i_read_sync_counter (struct inode * p_s_inode); -#define block_size(inode) ((inode)->i_sb->s_blocksize) +#define i_block_size(inode) ((inode)->i_sb->s_blocksize) #define file_size(inode) ((inode)->i_size) -#define tail_size(inode) (file_size (inode) & (block_size (inode) - 1)) +#define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1)) #define tail_has_to_be_packed(inode) (!dont_have_tails ((inode)->i_sb) &&\ -!STORE_TAIL_IN_UNFM(file_size (inode), tail_size(inode), block_size (inode))) +!STORE_TAIL_IN_UNFM(file_size (inode), tail_size(inode), i_block_size (inode))) /* int get_buffer_by_range (struct super_block * p_s_sb, struct key * p_s_range_begin, struct key * p_s_range_end, @@ -1989,10 +1989,9 @@ /* buffer2.c */ -struct buffer_head * reiserfs_getblk (kdev_t n_dev, int n_block, int n_size); +struct buffer_head * reiserfs_getblk (struct super_block *super, int n_block); void wait_buffer_until_released (const struct buffer_head * bh); -struct buffer_head * reiserfs_bread (struct super_block *super, int n_block, - int n_size); +struct buffer_head * reiserfs_bread (struct super_block *super, int n_block); /* fix_nodes.c */ void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); diff -u --recursive --new-file v2.5.1/linux/include/linux/sched.h linux/include/linux/sched.h --- v2.5.1/linux/include/linux/sched.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/sched.h Sun Dec 30 10:59:30 2001 @@ -41,6 +41,7 @@ #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ #define CLONE_THREAD 0x00010000 /* Same thread group? */ +#define CLONE_NEWNS 0x00020000 /* New namespace group? */ #define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD) @@ -149,6 +150,7 @@ extern void update_process_times(int user); extern void update_one_process(struct task_struct *p, unsigned long user, unsigned long system, int cpu); +extern void expire_task(struct task_struct *p); #define MAX_SCHEDULE_TIMEOUT LONG_MAX extern signed long FASTCALL(schedule_timeout(signed long timeout)); @@ -165,6 +167,7 @@ */ #define NR_OPEN_DEFAULT BITS_PER_LONG +struct namespace; /* * Open file table structure */ @@ -299,7 +302,7 @@ * all fields in a single cacheline that are needed for * the goodness() loop in schedule(). */ - long counter; + long dyn_prio; long nice; unsigned long policy; struct mm_struct *mm; @@ -318,7 +321,10 @@ * that's just fine.) */ struct list_head run_list; + long time_slice; unsigned long sleep_time; + /* recalculation loop checkpoint */ + unsigned long rcl_last; struct task_struct *next_task, *prev_task; struct mm_struct *active_mm; @@ -388,6 +394,8 @@ struct fs_struct *fs; /* open file information */ struct files_struct *files; +/* namespace */ + struct namespace *namespace; /* signal handlers */ spinlock_t sigmask_lock; /* Protects signal and blocked */ struct signal_struct *sig; @@ -444,8 +452,9 @@ */ #define _STK_LIM (8*1024*1024) -#define DEF_COUNTER (10*HZ/100) /* 100 ms time slice */ -#define MAX_COUNTER (20*HZ/100) +#define MAX_DYNPRIO 100 +#define DEF_TSLICE (6 * HZ / 100) +#define MAX_TSLICE (20 * HZ / 100) #define DEF_NICE (0) @@ -466,14 +475,16 @@ addr_limit: KERNEL_DS, \ exec_domain: &default_exec_domain, \ lock_depth: -1, \ - counter: DEF_COUNTER, \ + dyn_prio: 0, \ nice: DEF_NICE, \ policy: SCHED_OTHER, \ mm: NULL, \ active_mm: &init_mm, \ cpus_runnable: -1, \ cpus_allowed: -1, \ - run_list: LIST_HEAD_INIT(tsk.run_list), \ + run_list: { NULL, NULL }, \ + rcl_last: 0, \ + time_slice: DEF_TSLICE, \ next_task: &tsk, \ prev_task: &tsk, \ p_opptr: &tsk, \ diff -u --recursive --new-file v2.5.1/linux/include/linux/shm.h linux/include/linux/shm.h --- v2.5.1/linux/include/linux/shm.h Thu Nov 22 11:46:18 2001 +++ linux/include/linux/shm.h Sun Dec 30 10:59:31 2001 @@ -80,7 +80,6 @@ asmlinkage long sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr); asmlinkage long sys_shmdt (char *shmaddr); asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf); -extern void shm_unuse(swp_entry_t entry, struct page *page); #endif /* __KERNEL__ */ diff -u --recursive --new-file v2.5.1/linux/include/linux/slab.h linux/include/linux/slab.h --- v2.5.1/linux/include/linux/slab.h Tue Dec 18 14:56:40 2001 +++ linux/include/linux/slab.h Sun Dec 30 10:59:30 2001 @@ -11,8 +11,8 @@ typedef struct kmem_cache_s kmem_cache_t; -#include <linux/mm.h> -#include <linux/cache.h> +#include <linux/gfp.h> +#include <linux/types.h> /* flags for kmem_cache_alloc() */ #define SLAB_NOFS GFP_NOFS @@ -64,6 +64,7 @@ extern int FASTCALL(kmem_cache_reap(int)); extern int slabinfo_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); +struct file; extern int slabinfo_write_proc(struct file *file, const char *buffer, unsigned long count, void *data); diff -u --recursive --new-file v2.5.1/linux/include/linux/sunrpc/clnt.h linux/include/linux/sunrpc/clnt.h --- v2.5.1/linux/include/linux/sunrpc/clnt.h Thu Nov 22 11:47:20 2001 +++ linux/include/linux/sunrpc/clnt.h Sun Dec 30 11:00:40 2001 @@ -15,6 +15,7 @@ #include <linux/sunrpc/auth.h> #include <linux/sunrpc/stats.h> #include <linux/sunrpc/xdr.h> +#include <asm/signal.h> /* * This defines an RPC port mapping diff -u --recursive --new-file v2.5.1/linux/include/linux/threads.h linux/include/linux/threads.h --- v2.5.1/linux/include/linux/threads.h Thu Nov 22 11:46:18 2001 +++ linux/include/linux/threads.h Sun Dec 30 10:59:29 2001 @@ -5,7 +5,7 @@ /* * The default limit for the nr of threads is now in - * /proc/sys/kernel/max-threads. + * /proc/sys/kernel/threads-max. */ #ifdef CONFIG_SMP diff -u --recursive --new-file v2.5.1/linux/include/linux/vt_kern.h linux/include/linux/vt_kern.h --- v2.5.1/linux/include/linux/vt_kern.h Thu Nov 22 11:47:07 2001 +++ linux/include/linux/vt_kern.h Sun Dec 30 11:00:25 2001 @@ -9,6 +9,7 @@ #include <linux/config.h> #include <linux/vt.h> #include <linux/kd.h> +#include <linux/tty.h> /* * Presently, a lot of graphics programs do not restore the contents of diff -u --recursive --new-file v2.5.1/linux/include/linux/wait.h linux/include/linux/wait.h --- v2.5.1/linux/include/linux/wait.h Thu Nov 22 11:46:19 2001 +++ linux/include/linux/wait.h Sun Dec 30 10:59:30 2001 @@ -19,24 +19,11 @@ #include <asm/page.h> #include <asm/processor.h> -/* - * Debug control. Slow but useful. - */ -#if defined(CONFIG_DEBUG_WAITQ) -#define WAITQUEUE_DEBUG 1 -#else -#define WAITQUEUE_DEBUG 0 -#endif - struct __wait_queue { unsigned int flags; #define WQ_FLAG_EXCLUSIVE 0x01 struct task_struct * task; struct list_head task_list; -#if WAITQUEUE_DEBUG - long __magic; - long __waker; -#endif }; typedef struct __wait_queue wait_queue_t; @@ -77,129 +64,47 @@ struct __wait_queue_head { wq_lock_t lock; struct list_head task_list; -#if WAITQUEUE_DEBUG - long __magic; - long __creator; -#endif }; typedef struct __wait_queue_head wait_queue_head_t; /* - * Debugging macros. We eschew `do { } while (0)' because gcc can generate - * spurious .aligns. - */ -#if WAITQUEUE_DEBUG -#define WQ_BUG() BUG() -#define CHECK_MAGIC(x) \ - do { \ - if ((x) != (long)&(x)) { \ - printk("bad magic %lx (should be %lx), ", \ - (long)x, (long)&(x)); \ - WQ_BUG(); \ - } \ - } while (0) -#define CHECK_MAGIC_WQHEAD(x) \ - do { \ - if ((x)->__magic != (long)&((x)->__magic)) { \ - printk("bad magic %lx (should be %lx, creator %lx), ", \ - (x)->__magic, (long)&((x)->__magic), (x)->__creator); \ - WQ_BUG(); \ - } \ - } while (0) -#define WQ_CHECK_LIST_HEAD(list) \ - do { \ - if (!(list)->next || !(list)->prev) \ - WQ_BUG(); \ - } while(0) -#define WQ_NOTE_WAKER(tsk) \ - do { \ - (tsk)->__waker = (long)__builtin_return_address(0); \ - } while (0) -#else -#define WQ_BUG() -#define CHECK_MAGIC(x) -#define CHECK_MAGIC_WQHEAD(x) -#define WQ_CHECK_LIST_HEAD(list) -#define WQ_NOTE_WAKER(tsk) -#endif - -/* * Macros for declaration and initialisaton of the datatypes */ -#if WAITQUEUE_DEBUG -# define __WAITQUEUE_DEBUG_INIT(name) (long)&(name).__magic, 0 -# define __WAITQUEUE_HEAD_DEBUG_INIT(name) (long)&(name).__magic, (long)&(name).__magic -#else -# define __WAITQUEUE_DEBUG_INIT(name) -# define __WAITQUEUE_HEAD_DEBUG_INIT(name) -#endif - #define __WAITQUEUE_INITIALIZER(name, tsk) { \ task: tsk, \ - task_list: { NULL, NULL }, \ - __WAITQUEUE_DEBUG_INIT(name)} + task_list: { NULL, NULL } } #define DECLARE_WAITQUEUE(name, tsk) \ wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) #define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ lock: WAITQUEUE_RW_LOCK_UNLOCKED, \ - task_list: { &(name).task_list, &(name).task_list }, \ - __WAITQUEUE_HEAD_DEBUG_INIT(name)} + task_list: { &(name).task_list, &(name).task_list } } #define DECLARE_WAIT_QUEUE_HEAD(name) \ wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name) static inline void init_waitqueue_head(wait_queue_head_t *q) { -#if WAITQUEUE_DEBUG - if (!q) - WQ_BUG(); -#endif q->lock = WAITQUEUE_RW_LOCK_UNLOCKED; INIT_LIST_HEAD(&q->task_list); -#if WAITQUEUE_DEBUG - q->__magic = (long)&q->__magic; - q->__creator = (long)current_text_addr(); -#endif } static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) { -#if WAITQUEUE_DEBUG - if (!q || !p) - WQ_BUG(); -#endif q->flags = 0; q->task = p; -#if WAITQUEUE_DEBUG - q->__magic = (long)&q->__magic; -#endif } static inline int waitqueue_active(wait_queue_head_t *q) { -#if WAITQUEUE_DEBUG - if (!q) - WQ_BUG(); - CHECK_MAGIC_WQHEAD(q); -#endif - return !list_empty(&q->task_list); } static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) { -#if WAITQUEUE_DEBUG - if (!head || !new) - WQ_BUG(); - CHECK_MAGIC_WQHEAD(head); - CHECK_MAGIC(new->__magic); - if (!head->task_list.next || !head->task_list.prev) - WQ_BUG(); -#endif list_add(&new->task_list, &head->task_list); } @@ -209,25 +114,12 @@ static inline void __add_wait_queue_tail(wait_queue_head_t *head, wait_queue_t *new) { -#if WAITQUEUE_DEBUG - if (!head || !new) - WQ_BUG(); - CHECK_MAGIC_WQHEAD(head); - CHECK_MAGIC(new->__magic); - if (!head->task_list.next || !head->task_list.prev) - WQ_BUG(); -#endif list_add_tail(&new->task_list, &head->task_list); } static inline void __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) { -#if WAITQUEUE_DEBUG - if (!old) - WQ_BUG(); - CHECK_MAGIC(old->__magic); -#endif list_del(&old->task_list); } diff -u --recursive --new-file v2.5.1/linux/include/scsi/scsicam.h linux/include/scsi/scsicam.h --- v2.5.1/linux/include/scsi/scsicam.h Mon Feb 19 17:14:38 2001 +++ linux/include/scsi/scsicam.h Thu Dec 27 08:17:43 2001 @@ -14,6 +14,7 @@ #define SCSICAM_H #include <linux/kdev_t.h> extern int scsicam_bios_param (Disk *disk, kdev_t dev, int *ip); -extern int scsi_partsize(struct buffer_head *bh, unsigned long capacity, +extern int scsi_partsize(unsigned char *buf, unsigned long capacity, unsigned int *cyls, unsigned int *hds, unsigned int *secs); +extern unsigned char *scsi_bios_ptable(kdev_t dev); #endif /* def SCSICAM_H */ diff -u --recursive --new-file v2.5.1/linux/init/do_mounts.c linux/init/do_mounts.c --- v2.5.1/linux/init/do_mounts.c Tue Dec 18 14:56:40 2001 +++ linux/init/do_mounts.c Tue Dec 25 15:39:20 2001 @@ -3,13 +3,10 @@ #include <linux/slab.h> #include <linux/devfs_fs_kernel.h> #include <linux/unistd.h> -#include <linux/string.h> #include <linux/ctype.h> -#include <linux/init.h> -#include <linux/smp_lock.h> #include <linux/blk.h> -#include <linux/tty.h> #include <linux/fd.h> +#include <linux/tty.h> #include <linux/nfs_fs.h> #include <linux/nfs_fs_sb.h> @@ -18,12 +15,9 @@ #include <linux/ext2_fs.h> #include <linux/romfs_fs.h> -#include <asm/uaccess.h> - #define BUILD_CRAMDISK extern int get_filesystem_list(char * buf); -extern void wait_for_keypress(void); asmlinkage long sys_mount(char *dev_name, char *dir_name, char *type, unsigned long flags, void *data); @@ -38,12 +32,21 @@ #ifdef CONFIG_BLK_DEV_INITRD unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ -#endif -#ifdef CONFIG_BLK_DEV_RAM -extern int rd_doload; +static int __initdata mount_initrd = 1; + +static int __init no_initrd(char *str) +{ + mount_initrd = 0; + return 1; +} + +__setup("noinitrd", no_initrd); #else -static int rd_doload = 0; +static int __initdata mount_initrd = 0; #endif + +int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */ + int root_mountflags = MS_RDONLY | MS_VERBOSE; static char root_device_name[64]; @@ -52,6 +55,13 @@ static int do_devfs = 0; +static int __init load_ramdisk(char *str) +{ + rd_doload = simple_strtol(str,NULL,0) & 3; + return 1; +} +__setup("load_ramdisk=", load_ramdisk); + static int __init readonly(char *str) { if (*str) @@ -353,8 +363,9 @@ static void __init change_floppy(char *fmt, ...) { - extern void wait_for_keypress(void); + struct termios termios; char buf[80]; + char c; int fd; va_list args; va_start(args, fmt); @@ -366,11 +377,38 @@ close(fd); } printk(KERN_NOTICE "VFS: Insert %s and press ENTER\n", buf); - wait_for_keypress(); + fd = open("/dev/console", O_RDWR, 0); + if (fd >= 0) { + sys_ioctl(fd, TCGETS, (long)&termios); + termios.c_lflag &= ~ICANON; + sys_ioctl(fd, TCSETSF, (long)&termios); + read(fd, &c, 1); + termios.c_lflag |= ICANON; + sys_ioctl(fd, TCSETSF, (long)&termios); + close(fd); + } } #ifdef CONFIG_BLK_DEV_RAM +int __initdata rd_prompt = 1; /* 1 = prompt for RAM disk, 0 = don't prompt */ + +static int __init prompt_ramdisk(char *str) +{ + rd_prompt = simple_strtol(str,NULL,0) & 1; + return 1; +} +__setup("prompt_ramdisk=", prompt_ramdisk); + +int __initdata rd_image_start; /* starting block # of image */ + +static int __init ramdisk_start_setup(char *str) +{ + rd_image_start = simple_strtol(str,NULL,0); + return 1; +} +__setup("ramdisk_start=", ramdisk_start_setup); + static int __init crd_load(int in_fd, int out_fd); /* @@ -588,7 +626,6 @@ static int __init rd_load_disk(int n) { #ifdef CONFIG_BLK_DEV_RAM - extern int rd_prompt; if (rd_prompt) change_floppy("root floppy disk to be loaded into RAM disk"); create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, n), NULL); @@ -596,6 +633,63 @@ return rd_load_image("/dev/root"); } +#ifdef CONFIG_DEVFS_FS + +static void __init convert_name(char *prefix, char *name, char *p, int part) +{ + int host, bus, target, lun; + char dest[64]; + char src[64]; + char *base = p - 1; + + /* Decode "c#b#t#u#" */ + if (*p++ != 'c') + return; + host = simple_strtol(p, &p, 10); + if (*p++ != 'b') + return; + bus = simple_strtol(p, &p, 10); + if (*p++ != 't') + return; + target = simple_strtol(p, &p, 10); + if (*p++ != 'u') + return; + lun = simple_strtol(p, &p, 10); + if (!part) + sprintf(dest, "%s/host%d/bus%d/target%d/lun%d", + prefix, host, bus, target, lun); + else if (*p++ == 'p') + sprintf(dest, "%s/host%d/bus%d/target%d/lun%d/part%s", + prefix, host, bus, target, lun, p); + else + sprintf(dest, "%s/host%d/bus%d/target%d/lun%d/disc", + prefix, host, bus, target, lun); + *base = '\0'; + sprintf(src, "/dev/%s", name); + sys_mkdir(src, 0755); + *base = '/'; + sprintf(src, "/dev/%s", name); + sys_symlink(dest, src); +} + +static void __init devfs_make_root(char *name) +{ + + if (!strncmp(name, "sd/", 3)) + convert_name("../scsi", name, name+3, 1); + else if (!strncmp(name, "sr/", 3)) + convert_name("../scsi", name, name+3, 0); + else if (!strncmp(name, "ide/hd/", 7)) + convert_name("..", name, name + 7, 1); + else if (!strncmp(name, "ide/cd/", 7)) + convert_name("..", name, name + 7, 0); +} +#else +static void __init devfs_make_root(char *name) +{ +} +#endif + static void __init mount_root(void) { #ifdef CONFIG_ROOT_NFS @@ -715,24 +809,22 @@ */ void prepare_namespace(void) { - int do_initrd = 0; int is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; #ifdef CONFIG_BLK_DEV_INITRD if (!initrd_start) mount_initrd = 0; - if (mount_initrd) - do_initrd = 1; real_root_dev = ROOT_DEV; #endif sys_mkdir("/dev", 0700); sys_mkdir("/root", 0700); + sys_mknod("/dev/console", S_IFCHR|0600, MKDEV(TTYAUX_MAJOR, 1)); #ifdef CONFIG_DEVFS_FS sys_mount("devfs", "/dev", "devfs", 0, NULL); do_devfs = 1; #endif create_dev("/dev/root", ROOT_DEV, NULL); - if (do_initrd) { + if (mount_initrd) { if (initrd_load() && ROOT_DEV != MKDEV(RAMDISK_MAJOR, 0)) { handle_initrd(); goto out; diff -u --recursive --new-file v2.5.1/linux/ipc/shm.c linux/ipc/shm.c --- v2.5.1/linux/ipc/shm.c Tue Dec 18 14:56:40 2001 +++ linux/ipc/shm.c Sat Dec 29 17:30:07 2001 @@ -17,6 +17,7 @@ #include <linux/config.h> #include <linux/slab.h> +#include <linux/mm.h> #include <linux/shm.h> #include <linux/init.h> #include <linux/file.h> diff -u --recursive --new-file v2.5.1/linux/kernel/acct.c linux/kernel/acct.c --- v2.5.1/linux/kernel/acct.c Mon Mar 19 12:35:08 2001 +++ linux/kernel/acct.c Thu Dec 27 08:17:43 2001 @@ -213,10 +213,10 @@ goto out; } -void acct_auto_close(kdev_t dev) +void acct_auto_close(struct super_block *sb) { lock_kernel(); - if (acct_file && acct_file->f_dentry->d_inode->i_dev == dev) + if (acct_file && acct_file->f_dentry->d_inode->i_sb == sb) sys_acct(NULL); unlock_kernel(); } diff -u --recursive --new-file v2.5.1/linux/kernel/exit.c linux/kernel/exit.c --- v2.5.1/linux/kernel/exit.c Tue Dec 18 14:56:41 2001 +++ linux/kernel/exit.c Sat Dec 29 17:30:07 2001 @@ -5,6 +5,7 @@ */ #include <linux/config.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/smp_lock.h> @@ -12,6 +13,7 @@ #include <linux/completion.h> #include <linux/personality.h> #include <linux/tty.h> +#include <linux/namespace.h> #ifdef CONFIG_BSD_PROCESS_ACCT #include <linux/acct.h> #endif @@ -62,9 +64,9 @@ * timeslices, because any timeslice recovered here * was given away by the parent in the first place.) */ - current->counter += p->counter; - if (current->counter >= MAX_COUNTER) - current->counter = MAX_COUNTER; + current->time_slice += p->time_slice; + if (current->time_slice > MAX_TSLICE) + current->time_slice = MAX_TSLICE; p->pid = 0; free_task_struct(p); } else { @@ -452,6 +454,7 @@ sem_exit(); __exit_files(tsk); __exit_fs(tsk); + exit_namespace(tsk); exit_sighand(tsk); exit_thread(); diff -u --recursive --new-file v2.5.1/linux/kernel/fork.c linux/kernel/fork.c --- v2.5.1/linux/kernel/fork.c Tue Dec 18 14:56:41 2001 +++ linux/kernel/fork.c Thu Dec 27 14:44:58 2001 @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/vmalloc.h> #include <linux/completion.h> +#include <linux/namespace.h> #include <linux/personality.h> #include <asm/pgtable.h> @@ -566,6 +567,9 @@ struct task_struct *p; struct completion vfork; + if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) + return -EINVAL; + retval = -EPERM; /* @@ -585,8 +589,10 @@ *p = *current; retval = -EAGAIN; - if (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur) - goto bad_fork_free; + if (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur) { + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE)) + goto bad_fork_free; + } atomic_inc(&p->user->__count); atomic_inc(&p->user->processes); @@ -661,9 +667,11 @@ goto bad_fork_cleanup_fs; if (copy_mm(clone_flags, p)) goto bad_fork_cleanup_sighand; + if (copy_namespace(clone_flags, p)) + goto bad_fork_cleanup_mm; retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs); if (retval) - goto bad_fork_cleanup_mm; + goto bad_fork_cleanup_namespace; p->semundo = NULL; /* Our parent execution domain becomes current domain @@ -682,9 +690,9 @@ * more scheduling fairness. This is only important in the first * timeslice, on the long run the scheduling behaviour is unchanged. */ - p->counter = (current->counter + 1) >> 1; - current->counter >>= 1; - if (!current->counter) + p->time_slice = (current->time_slice + 1) >> 1; + current->time_slice >>= 1; + if (!current->time_slice) current->need_resched = 1; /* @@ -730,6 +738,8 @@ fork_out: return retval; +bad_fork_cleanup_namespace: + exit_namespace(p); bad_fork_cleanup_mm: exit_mm(p); bad_fork_cleanup_sighand: diff -u --recursive --new-file v2.5.1/linux/kernel/kmod.c linux/kernel/kmod.c --- v2.5.1/linux/kernel/kmod.c Tue Jul 17 18:23:50 2001 +++ linux/kernel/kmod.c Tue Dec 25 15:39:20 2001 @@ -24,6 +24,8 @@ #include <linux/unistd.h> #include <linux/kmod.h> #include <linux/smp_lock.h> +#include <linux/slab.h> +#include <linux/namespace.h> #include <linux/completion.h> #include <asm/uaccess.h> @@ -36,6 +38,7 @@ struct fs_struct *our_fs, *init_fs; struct dentry *root, *pwd; struct vfsmount *rootmnt, *pwdmnt; + struct namespace *our_ns, *init_ns; /* * Make modprobe's fs context be a copy of init's. @@ -55,6 +58,11 @@ */ init_fs = init_task.fs; + init_ns = init_task.namespace; + get_namespace(init_ns); + our_ns = current->namespace; + current->namespace = init_ns; + put_namespace(our_ns); read_lock(&init_fs->lock); rootmnt = mntget(init_fs->rootmnt); root = dget(init_fs->root); diff -u --recursive --new-file v2.5.1/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v2.5.1/linux/kernel/ksyms.c Tue Dec 18 14:56:41 2001 +++ linux/kernel/ksyms.c Sat Dec 29 11:23:46 2001 @@ -46,6 +46,7 @@ #include <linux/tty.h> #include <linux/in6.h> #include <linux/completion.h> +#include <linux/seq_file.h> #include <asm/checksum.h> #if defined(CONFIG_PROC_FS) @@ -116,11 +117,11 @@ EXPORT_SYMBOL(find_vma); EXPORT_SYMBOL(get_unmapped_area); EXPORT_SYMBOL(init_mm); +EXPORT_SYMBOL(create_bounce); #ifdef CONFIG_HIGHMEM EXPORT_SYMBOL(kmap_high); EXPORT_SYMBOL(kunmap_high); EXPORT_SYMBOL(highmem_start_page); -EXPORT_SYMBOL(create_bounce); EXPORT_SYMBOL(kmap_prot); EXPORT_SYMBOL(kmap_pte); #endif @@ -188,6 +189,8 @@ EXPORT_SYMBOL(write_inode_now); EXPORT_SYMBOL(notify_change); EXPORT_SYMBOL(set_blocksize); +EXPORT_SYMBOL(sb_set_blocksize); +EXPORT_SYMBOL(sb_min_blocksize); EXPORT_SYMBOL(getblk); EXPORT_SYMBOL(cdget); EXPORT_SYMBOL(cdput); @@ -305,6 +308,7 @@ EXPORT_SYMBOL(ioctl_by_bdev); EXPORT_SYMBOL(grok_partitions); EXPORT_SYMBOL(register_disk); +EXPORT_SYMBOL(read_dev_sector); EXPORT_SYMBOL(tq_disk); EXPORT_SYMBOL(init_buffer); EXPORT_SYMBOL(refile_buffer); @@ -477,6 +481,12 @@ EXPORT_SYMBOL(reparent_to_init); EXPORT_SYMBOL(daemonize); EXPORT_SYMBOL(csum_partial); /* for networking and md */ +EXPORT_SYMBOL(seq_escape); +EXPORT_SYMBOL(seq_printf); +EXPORT_SYMBOL(seq_open); +EXPORT_SYMBOL(seq_release); +EXPORT_SYMBOL(seq_read); +EXPORT_SYMBOL(seq_lseek); /* Program loader interfaces */ EXPORT_SYMBOL(setup_arg_pages); diff -u --recursive --new-file v2.5.1/linux/kernel/pm.c linux/kernel/pm.c --- v2.5.1/linux/kernel/pm.c Fri Apr 6 10:51:19 2001 +++ linux/kernel/pm.c Sat Dec 29 17:30:07 2001 @@ -20,6 +20,7 @@ #include <linux/module.h> #include <linux/spinlock.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/pm.h> #include <linux/interrupt.h> diff -u --recursive --new-file v2.5.1/linux/kernel/ptrace.c linux/kernel/ptrace.c --- v2.5.1/linux/kernel/ptrace.c Wed Nov 21 14:43:01 2001 +++ linux/kernel/ptrace.c Sun Dec 30 10:51:45 2001 @@ -121,119 +121,17 @@ } /* - * Access another process' address space, one page at a time. + * Access another process' address space. + * Source/target buffer must be kernel space, + * Do not walk the page table directly, use get_user_pages */ -static int access_one_page(struct mm_struct * mm, struct vm_area_struct * vma, unsigned long addr, void *buf, int len, int write) -{ - pgd_t * pgdir; - pmd_t * pgmiddle; - pte_t * pgtable; - char *maddr; - struct page *page; - -repeat: - spin_lock(&mm->page_table_lock); - pgdir = pgd_offset(vma->vm_mm, addr); - if (pgd_none(*pgdir)) - goto fault_in_page; - if (pgd_bad(*pgdir)) - goto bad_pgd; - pgmiddle = pmd_offset(pgdir, addr); - if (pmd_none(*pgmiddle)) - goto fault_in_page; - if (pmd_bad(*pgmiddle)) - goto bad_pmd; - pgtable = pte_offset(pgmiddle, addr); - if (!pte_present(*pgtable)) - goto fault_in_page; - if (write && (!pte_write(*pgtable) || !pte_dirty(*pgtable))) - goto fault_in_page; - page = pte_page(*pgtable); - - /* ZERO_PAGE is special: reads from it are ok even though it's marked reserved */ - if (page != ZERO_PAGE(addr) || write) { - if ((!VALID_PAGE(page)) || PageReserved(page)) { - spin_unlock(&mm->page_table_lock); - return 0; - } - } - get_page(page); - spin_unlock(&mm->page_table_lock); - flush_cache_page(vma, addr); - - if (write) { - maddr = kmap(page); - memcpy(maddr + (addr & ~PAGE_MASK), buf, len); - flush_page_to_ram(page); - flush_icache_page(vma, page); - kunmap(page); - } else { - maddr = kmap(page); - memcpy(buf, maddr + (addr & ~PAGE_MASK), len); - flush_page_to_ram(page); - kunmap(page); - } - put_page(page); - return len; - -fault_in_page: - spin_unlock(&mm->page_table_lock); - /* -1: out of memory. 0 - unmapped page */ - if (handle_mm_fault(mm, vma, addr, write) > 0) - goto repeat; - return 0; - -bad_pgd: - spin_unlock(&mm->page_table_lock); - pgd_ERROR(*pgdir); - return 0; - -bad_pmd: - spin_unlock(&mm->page_table_lock); - pmd_ERROR(*pgmiddle); - return 0; -} - -static int access_mm(struct mm_struct *mm, struct vm_area_struct * vma, unsigned long addr, void *buf, int len, int write) -{ - int copied = 0; - - for (;;) { - unsigned long offset = addr & ~PAGE_MASK; - int this_len = PAGE_SIZE - offset; - int retval; - - if (this_len > len) - this_len = len; - retval = access_one_page(mm, vma, addr, buf, this_len, write); - copied += retval; - if (retval != this_len) - break; - - len -= retval; - if (!len) - break; - - addr += retval; - buf += retval; - - if (addr < vma->vm_end) - continue; - if (!vma->vm_next) - break; - if (vma->vm_next->vm_start != vma->vm_end) - break; - - vma = vma->vm_next; - } - return copied; -} int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) { - int copied; struct mm_struct *mm; - struct vm_area_struct * vma; + struct vm_area_struct *vma; + struct page *page; + void *old_buf = buf; /* Worry about races with exit() */ task_lock(tsk); @@ -245,14 +143,41 @@ return 0; down_read(&mm->mmap_sem); - vma = find_extend_vma(mm, addr); - copied = 0; - if (vma) - copied = access_mm(mm, vma, addr, buf, len, write); + /* ignore errors, just check how much was sucessfully transfered */ + while (len) { + int bytes, ret, offset; + void *maddr; + + ret = get_user_pages(current, mm, addr, 1, + write, 1, &page, &vma); + if (ret <= 0) + break; + + bytes = len; + offset = addr & (PAGE_SIZE-1); + if (bytes > PAGE_SIZE-offset) + bytes = PAGE_SIZE-offset; + flush_cache_page(vma, addr); + + maddr = kmap(page); + if (write) { + memcpy(maddr + offset, buf, bytes); + flush_page_to_ram(page); + flush_icache_page(vma, page); + } else { + memcpy(buf, maddr + offset, bytes); + flush_page_to_ram(page); + } + kunmap(page); + put_page(page); + len -= bytes; + buf += bytes; + } up_read(&mm->mmap_sem); mmput(mm); - return copied; + + return buf - old_buf; } int ptrace_readdata(struct task_struct *tsk, unsigned long src, char *dst, int len) diff -u --recursive --new-file v2.5.1/linux/kernel/sched.c linux/kernel/sched.c --- v2.5.1/linux/kernel/sched.c Wed Nov 21 16:25:48 2001 +++ linux/kernel/sched.c Thu Dec 27 14:25:03 2001 @@ -68,7 +68,7 @@ #define TICK_SCALE(x) ((x) << 2) #endif -#define NICE_TO_TICKS(nice) (TICK_SCALE(20-(nice))+1) +#define TASK_TIMESLICE(p) (TICK_SCALE(20-(p)->nice)+1) /* @@ -94,6 +94,8 @@ static LIST_HEAD(runqueue_head); +static unsigned long rcl_curr; + /* * We align per-CPU scheduling data on cacheline boundaries, * to prevent cacheline ping-pong. @@ -165,10 +167,11 @@ * Don't do any other calculations if the time slice is * over.. */ - weight = p->counter; - if (!weight) - goto out; - + if (!p->time_slice) + return 0; + + weight = p->dyn_prio + 1; + #ifdef CONFIG_SMP /* Give a largish advantage to the same processor... */ /* (this is equivalent to penalizing other processors) */ @@ -309,6 +312,10 @@ */ static inline void add_to_runqueue(struct task_struct * p) { + p->dyn_prio += rcl_curr - p->rcl_last; + p->rcl_last = rcl_curr; + if (p->dyn_prio > MAX_DYNPRIO) + p->dyn_prio = MAX_DYNPRIO; list_add(&p->run_list, &runqueue_head); nr_running++; } @@ -361,9 +368,7 @@ static void process_timeout(unsigned long __data) { - struct task_struct * p = (struct task_struct *) __data; - - wake_up_process(p); + wake_up_process((struct task_struct *)__data); } /** @@ -521,6 +526,25 @@ __schedule_tail(prev); } +void expire_task(struct task_struct *p) +{ + if (unlikely(!p->time_slice)) + goto need_resched; + + if (!--p->time_slice) { + if (p->dyn_prio > 0) { + p->time_slice--; + p->dyn_prio--; + } + p->need_resched = 1; + } else + if (p->time_slice < -TASK_TIMESLICE(p)) { + p->time_slice = 0; +need_resched: + p->need_resched = 1; + } +} + /* * 'schedule()' is the scheduler function. It's a very simple and nice * scheduler: it's not perfect, but certainly works for most things. @@ -563,20 +587,20 @@ /* move an exhausted RR process to be last.. */ if (unlikely(prev->policy == SCHED_RR)) - if (!prev->counter) { - prev->counter = NICE_TO_TICKS(prev->nice); + if (!prev->time_slice) { + prev->time_slice = TASK_TIMESLICE(prev); move_last_runqueue(prev); } switch (prev->state) { - case TASK_INTERRUPTIBLE: - if (signal_pending(prev)) { - prev->state = TASK_RUNNING; - break; - } - default: - del_from_runqueue(prev); - case TASK_RUNNING:; + case TASK_INTERRUPTIBLE: + if (signal_pending(prev)) { + prev->state = TASK_RUNNING; + break; + } + default: + del_from_runqueue(prev); + case TASK_RUNNING:; } prev->need_resched = 0; @@ -601,14 +625,12 @@ /* Do we need to re-calculate counters? */ if (unlikely(!c)) { - struct task_struct *p; - - spin_unlock_irq(&runqueue_lock); - read_lock(&tasklist_lock); - for_each_task(p) - p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice); - read_unlock(&tasklist_lock); - spin_lock_irq(&runqueue_lock); + rcl_curr++; + list_for_each(tmp, &runqueue_head) { + p = list_entry(tmp, struct task_struct, run_list); + p->time_slice = TASK_TIMESLICE(p); + p->rcl_last = rcl_curr; + } goto repeat_schedule; } @@ -704,21 +726,17 @@ struct list_head *tmp; struct task_struct *p; - CHECK_MAGIC_WQHEAD(q); - WQ_CHECK_LIST_HEAD(&q->task_list); - list_for_each(tmp,&q->task_list) { unsigned int state; - wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); + wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); - CHECK_MAGIC(curr->__magic); p = curr->task; state = p->state; - if (state & mode) { - WQ_NOTE_WAKER(curr); - if (try_to_wake_up(p, sync) && (curr->flags&WQ_FLAG_EXCLUSIVE) && !--nr_exclusive) - break; - } + if ((state & mode) && + try_to_wake_up(p, sync) && + ((curr->flags & WQ_FLAG_EXCLUSIVE) && + !--nr_exclusive)) + break; } } @@ -876,11 +894,7 @@ static inline struct task_struct *find_process_by_pid(pid_t pid) { - struct task_struct *tsk = current; - - if (pid) - tsk = find_task_by_pid(pid); - return tsk; + return pid ? find_task_by_pid(pid) : current; } static int setscheduler(pid_t pid, int policy, @@ -1049,9 +1063,8 @@ current->policy |= SCHED_YIELD; current->need_resched = 1; - spin_lock_irq(&runqueue_lock); - move_last_runqueue(current); - spin_unlock_irq(&runqueue_lock); + current->time_slice = 0; + current->dyn_prio++; } return 0; } @@ -1100,7 +1113,7 @@ read_lock(&tasklist_lock); p = find_process_by_pid(pid); if (p) - jiffies_to_timespec(p->policy & SCHED_FIFO ? 0 : NICE_TO_TICKS(p->nice), + jiffies_to_timespec(p->policy & SCHED_FIFO ? 0 : TASK_TIMESLICE(p), &t); read_unlock(&tasklist_lock); if (p) @@ -1216,35 +1229,33 @@ */ void reparent_to_init(void) { - struct task_struct *this_task = current; - write_lock_irq(&tasklist_lock); /* Reparent to init */ - REMOVE_LINKS(this_task); - this_task->p_pptr = child_reaper; - this_task->p_opptr = child_reaper; - SET_LINKS(this_task); + REMOVE_LINKS(current); + current->p_pptr = child_reaper; + current->p_opptr = child_reaper; + SET_LINKS(current); /* Set the exit signal to SIGCHLD so we signal init on exit */ - this_task->exit_signal = SIGCHLD; + current->exit_signal = SIGCHLD; /* We also take the runqueue_lock while altering task fields * which affect scheduling decisions */ spin_lock(&runqueue_lock); - this_task->ptrace = 0; - this_task->nice = DEF_NICE; - this_task->policy = SCHED_OTHER; + current->ptrace = 0; + current->nice = DEF_NICE; + current->policy = SCHED_OTHER; /* cpus_allowed? */ /* rt_priority? */ /* signals? */ - this_task->cap_effective = CAP_INIT_EFF_SET; - this_task->cap_inheritable = CAP_INIT_INH_SET; - this_task->cap_permitted = CAP_FULL_SET; - this_task->keep_capabilities = 0; - memcpy(this_task->rlim, init_task.rlim, sizeof(*(this_task->rlim))); - this_task->user = INIT_USER; + current->cap_effective = CAP_INIT_EFF_SET; + current->cap_inheritable = CAP_INIT_INH_SET; + current->cap_permitted = CAP_FULL_SET; + current->keep_capabilities = 0; + memcpy(current->rlim, init_task.rlim, sizeof(*(current->rlim))); + current->user = INIT_USER; spin_unlock(&runqueue_lock); write_unlock_irq(&tasklist_lock); @@ -1291,9 +1302,10 @@ if (current != &init_task && task_on_runqueue(current)) { printk("UGH! (%d:%d) was on the runqueue, removing.\n", - smp_processor_id(), current->pid); + smp_processor_id(), current->pid); del_from_runqueue(current); } + current->dyn_prio = 0; sched_data->curr = current; sched_data->last_schedule = get_cycles(); clear_bit(current->processor, &wait_init_idle); diff -u --recursive --new-file v2.5.1/linux/kernel/signal.c linux/kernel/signal.c --- v2.5.1/linux/kernel/signal.c Tue Dec 18 14:56:41 2001 +++ linux/kernel/signal.c Thu Dec 20 08:50:19 2001 @@ -649,10 +649,8 @@ /* * kill_something_info() interprets pid in interesting ways just like kill(2). * - * POSIX (2001) specifies "If pid is -1, sig shall be sent to all processes - * (excluding an unspecified set of system processes) for which the process - * has permission to send that signal." - * So, probably the process should also signal itself. + * POSIX specifies that kill(-1,sig) is unspecified, but what we have + * is probably wrong. Should make it like BSD or SYSV. */ static int kill_something_info(int sig, struct siginfo *info, int pid) @@ -665,7 +663,7 @@ read_lock(&tasklist_lock); for_each_task(p) { - if (p->pid > 1) { + if (p->pid > 1 && p != current) { int err = send_sig_info(sig, info, p); ++count; if (err != -EPERM) diff -u --recursive --new-file v2.5.1/linux/kernel/sysctl.c linux/kernel/sysctl.c --- v2.5.1/linux/kernel/sysctl.c Tue Dec 18 14:56:41 2001 +++ linux/kernel/sysctl.c Sat Dec 29 17:30:07 2001 @@ -19,6 +19,7 @@ */ #include <linux/config.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/sysctl.h> #include <linux/swapctl.h> diff -u --recursive --new-file v2.5.1/linux/kernel/timer.c linux/kernel/timer.c --- v2.5.1/linux/kernel/timer.c Mon Oct 8 10:41:41 2001 +++ linux/kernel/timer.c Thu Dec 27 08:21:28 2001 @@ -583,10 +583,7 @@ update_one_process(p, user_tick, system, cpu); if (p->pid) { - if (--p->counter <= 0) { - p->counter = 0; - p->need_resched = 1; - } + expire_task(p); if (p->nice > 0) kstat.per_cpu_nice[cpu] += user_tick; else diff -u --recursive --new-file v2.5.1/linux/mm/Makefile linux/mm/Makefile --- v2.5.1/linux/mm/Makefile Tue Dec 18 14:56:41 2001 +++ linux/mm/Makefile Mon Dec 17 10:49:31 2001 @@ -14,8 +14,6 @@ obj-y := memory.o mmap.o filemap.o mprotect.o mlock.o mremap.o \ vmalloc.o slab.o bootmem.o swap.o vmscan.o page_io.o \ page_alloc.o swap_state.o swapfile.o numa.o oom_kill.o \ - shmem.o mempool.o - -obj-$(CONFIG_HIGHMEM) += highmem.o + shmem.o highmem.o mempool.o include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.5.1/linux/mm/highmem.c linux/mm/highmem.c --- v2.5.1/linux/mm/highmem.c Tue Dec 18 14:56:41 2001 +++ linux/mm/highmem.c Sun Dec 30 10:02:19 2001 @@ -19,6 +19,21 @@ #include <linux/mm.h> #include <linux/pagemap.h> #include <linux/mempool.h> +#include <linux/blkdev.h> + +static mempool_t *page_pool, *isa_page_pool; + +static void *page_pool_alloc(int gfp_mask, void *data) +{ + int gfp = gfp_mask | (int) data; + + return alloc_page(gfp); +} + +static void page_pool_free(void *page, void *data) +{ + __free_page(page); +} /* * Virtual_count is not a pure "count". @@ -28,9 +43,10 @@ * since the last TLB flush - so we can't use it. * n means that there are (n-1) current users of it. */ +#ifdef CONFIG_HIGHMEM static int pkmap_count[LAST_PKMAP]; static unsigned int last_pkmap_nr; -static spinlock_t kmap_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t kmap_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; pte_t * pkmap_page_table; @@ -185,19 +201,6 @@ } #define POOL_SIZE 64 -#define ISA_POOL_SIZE 16 - -static mempool_t *page_pool, *isa_page_pool; - -static void *page_pool_alloc(int gfp_mask, void *data) -{ - return alloc_page(gfp_mask); -} - -static void page_pool_free(void *page, void *data) -{ - __free_page(page); -} static __init int init_emergency_pool(void) { @@ -211,11 +214,37 @@ page_pool = mempool_create(POOL_SIZE, page_pool_alloc, page_pool_free, NULL); if (!page_pool) BUG(); - printk("highmem bounce pool size: %d pages and bhs.\n", POOL_SIZE); + printk("highmem bounce pool size: %d pages\n", POOL_SIZE); return 0; } +__initcall(init_emergency_pool); + +/* + * highmem version, map in to vec + */ +static inline void bounce_copy_vec(struct bio_vec *to, unsigned char *vfrom) +{ + unsigned long flags; + unsigned char *vto; + + local_irq_save(flags); + vto = kmap_atomic(to->bv_page, KM_BOUNCE_READ); + memcpy(vto + to->bv_offset, vfrom, to->bv_len); + kunmap_atomic(vto, KM_BOUNCE_READ); + local_irq_restore(flags); +} + +#else /* CONFIG_HIGHMEM */ + +#define bounce_copy_vec(to, vfrom) \ + memcpy(page_address((to)->bv_page) + (to)->bv_offset, vfrom, (to)->bv_len) + +#endif + +#define ISA_POOL_SIZE 16 + /* * gets called "every" time someone init's a queue with BLK_BOUNCE_ISA * as the max address, so check if the pool has already been created. @@ -225,7 +254,7 @@ if (isa_page_pool) return 0; - isa_page_pool = mempool_create(ISA_POOL_SIZE, page_pool_alloc, page_pool_free, NULL); + isa_page_pool = mempool_create(ISA_POOL_SIZE, page_pool_alloc, page_pool_free, (void *) __GFP_DMA); if (!isa_page_pool) BUG(); @@ -233,8 +262,6 @@ return 0; } -__initcall(init_emergency_pool); - /* * Simple bounce buffer support for highmem pages. Depending on the * queue gfp mask set, *to may or may not be a highmem page. kmap it @@ -242,13 +269,12 @@ */ static inline void copy_to_high_bio_irq(struct bio *to, struct bio *from) { - unsigned char *vto, *vfrom; - unsigned long flags; + unsigned char *vfrom; struct bio_vec *tovec, *fromvec; int i; __bio_for_each_segment(tovec, to, i, 0) { - fromvec = &from->bi_io_vec[i]; + fromvec = from->bi_io_vec + i; /* * not bounced @@ -258,11 +284,7 @@ vfrom = page_address(fromvec->bv_page) + fromvec->bv_offset; - local_irq_save(flags); - vto = kmap_atomic(tovec->bv_page, KM_BOUNCE_READ); - memcpy(vto + tovec->bv_offset, vfrom, tovec->bv_len); - kunmap_atomic(vto, KM_BOUNCE_READ); - local_irq_restore(flags); + bounce_copy_vec(tovec, vfrom); } } @@ -281,7 +303,7 @@ * free up bounce indirect pages used */ __bio_for_each_segment(bvec, bio, i, 0) { - org_vec = &bio_orig->bi_io_vec[i]; + org_vec = bio_orig->bi_io_vec + i; if (bvec->bv_page == org_vec->bv_page) continue; @@ -336,10 +358,25 @@ BUG_ON((*bio_orig)->bi_idx); + /* + * for non-isa bounce case, just check if the bounce pfn is equal + * to or bigger than the highest pfn in the system -- in that case, + * don't waste time iterating over bio segments + */ if (!(gfp & GFP_DMA)) { + if (pfn >= blk_max_pfn) + return; + +#ifndef CONFIG_HIGHMEM + /* + * should not hit for non-highmem case + */ + BUG(); +#endif bio_gfp = GFP_NOHIGHIO; pool = page_pool; } else { + BUG_ON(!isa_page_pool); bio_gfp = GFP_NOIO; pool = isa_page_pool; } @@ -359,7 +396,7 @@ if (!bio) bio = bio_alloc(bio_gfp, (*bio_orig)->bi_vcnt); - to = &bio->bi_io_vec[i]; + to = bio->bi_io_vec + i; to->bv_page = mempool_alloc(pool, gfp); to->bv_len = from->bv_len; diff -u --recursive --new-file v2.5.1/linux/mm/memory.c linux/mm/memory.c --- v2.5.1/linux/mm/memory.c Tue Dec 18 14:56:41 2001 +++ linux/mm/memory.c Sun Dec 30 10:51:45 2001 @@ -397,17 +397,16 @@ spin_unlock(&mm->page_table_lock); } - /* * Do a quick page-table lookup for a single page. */ -static struct page * follow_page(unsigned long address, int write) +static struct page * follow_page(struct mm_struct *mm, unsigned long address, int write) { pgd_t *pgd; pmd_t *pmd; pte_t *ptep, pte; - pgd = pgd_offset(current->mm, address); + pgd = pgd_offset(mm, address); if (pgd_none(*pgd) || pgd_bad(*pgd)) goto out; @@ -443,21 +442,74 @@ return page; } +int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, + int len, int write, int force, struct page **pages, struct vm_area_struct **vmas) +{ + int i = 0; + + do { + struct vm_area_struct * vma; + + vma = find_extend_vma(mm, start); + + if ( !vma || + (!force && + ((write && (!(vma->vm_flags & VM_WRITE))) || + (!write && (!(vma->vm_flags & VM_READ))) ) )) { + if (i) return i; + return -EFAULT; + } + + spin_lock(&mm->page_table_lock); + do { + struct page *map; + while (!(map = follow_page(mm, start, write))) { + spin_unlock(&mm->page_table_lock); + switch (handle_mm_fault(mm, vma, start, write)) { + case 1: + tsk->min_flt++; + break; + case 2: + tsk->maj_flt++; + break; + case 0: + if (i) return i; + return -EFAULT; + default: + if (i) return i; + return -ENOMEM; + } + spin_lock(&mm->page_table_lock); + } + if (pages) { + pages[i] = get_page_map(map); + /* FIXME: call the correct function, + * depending on the type of the found page + */ + if (pages[i]) + page_cache_get(pages[i]); + } + if (vmas) + vmas[i] = vma; + i++; + start += PAGE_SIZE; + len--; + } while(len && start < vma->vm_end); + spin_unlock(&mm->page_table_lock); + } while(len); + return i; +} + /* * Force in an entire range of pages from the current process's user VA, * and pin them in physical memory. */ - #define dprintk(x...) + int map_user_kiobuf(int rw, struct kiobuf *iobuf, unsigned long va, size_t len) { - unsigned long ptr, end; - int err; + int pgcount, err; struct mm_struct * mm; - struct vm_area_struct * vma = 0; - struct page * map; - int i; - int datain = (rw == READ); /* Make sure the iobuf is not already mapped somewhere. */ if (iobuf->nr_pages) @@ -466,79 +518,37 @@ mm = current->mm; dprintk ("map_user_kiobuf: begin\n"); - ptr = va & PAGE_MASK; - end = (va + len + PAGE_SIZE - 1) & PAGE_MASK; - err = expand_kiobuf(iobuf, (end - ptr) >> PAGE_SHIFT); + pgcount = (va + len + PAGE_SIZE - 1)/PAGE_SIZE - va/PAGE_SIZE; + /* mapping 0 bytes is not permitted */ + if (!pgcount) BUG(); + err = expand_kiobuf(iobuf, pgcount); if (err) return err; - down_read(&mm->mmap_sem); - - err = -EFAULT; iobuf->locked = 0; - iobuf->offset = va & ~PAGE_MASK; + iobuf->offset = va & (PAGE_SIZE-1); iobuf->length = len; - i = 0; - - /* - * First of all, try to fault in all of the necessary pages - */ - while (ptr < end) { - if (!vma || ptr >= vma->vm_end) { - vma = find_vma(current->mm, ptr); - if (!vma) - goto out_unlock; - if (vma->vm_start > ptr) { - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto out_unlock; - if (expand_stack(vma, ptr)) - goto out_unlock; - } - if (((datain) && (!(vma->vm_flags & VM_WRITE))) || - (!(vma->vm_flags & VM_READ))) { - err = -EACCES; - goto out_unlock; - } - } - spin_lock(&mm->page_table_lock); - while (!(map = follow_page(ptr, datain))) { - int ret; - - spin_unlock(&mm->page_table_lock); - ret = handle_mm_fault(current->mm, vma, ptr, datain); - if (ret <= 0) { - if (!ret) - goto out_unlock; - else { - err = -ENOMEM; - goto out_unlock; - } - } - spin_lock(&mm->page_table_lock); - } - map = get_page_map(map); - if (map) { - flush_dcache_page(map); - page_cache_get(map); - } else - printk (KERN_INFO "Mapped page missing [%d]\n", i); - spin_unlock(&mm->page_table_lock); - iobuf->maplist[i] = map; - iobuf->nr_pages = ++i; - - ptr += PAGE_SIZE; - } - + /* Try to fault in all of the necessary pages */ + down_read(&mm->mmap_sem); + /* rw==READ means read from disk, write into memory area */ + err = get_user_pages(current, mm, va, pgcount, + (rw==READ), 0, iobuf->maplist, NULL); up_read(&mm->mmap_sem); + if (err < 0) { + unmap_kiobuf(iobuf); + dprintk ("map_user_kiobuf: end %d\n", err); + return err; + } + iobuf->nr_pages = err; + while (pgcount--) { + /* FIXME: flush superflous for rw==READ, + * probably wrong function for rw==WRITE + */ + flush_dcache_page(iobuf->maplist[pgcount]); + } dprintk ("map_user_kiobuf: end OK\n"); return 0; - - out_unlock: - up_read(&mm->mmap_sem); - unmap_kiobuf(iobuf); - dprintk ("map_user_kiobuf: end %d\n", err); - return err; } /* @@ -588,6 +598,9 @@ if (map) { if (iobuf->locked) UnlockPage(map); + /* FIXME: cache flush missing for rw==READ + * FIXME: call the correct reference counting function + */ page_cache_release(map); } } @@ -1414,23 +1427,19 @@ return pte_offset(pmd, address); } -/* - * Simplistic page force-in.. - */ int make_pages_present(unsigned long addr, unsigned long end) { - int write; - struct mm_struct *mm = current->mm; + int ret, len, write; struct vm_area_struct * vma; - vma = find_vma(mm, addr); + vma = find_vma(current->mm, addr); write = (vma->vm_flags & VM_WRITE) != 0; if (addr >= end) BUG(); - do { - if (handle_mm_fault(mm, vma, addr, write) < 0) - return -1; - addr += PAGE_SIZE; - } while (addr < end); - return 0; + if (end > vma->vm_end) + BUG(); + len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE; + ret = get_user_pages(current, current->mm, addr, + len, write, 0, NULL, NULL); + return ret == len ? 0 : -1; } diff -u --recursive --new-file v2.5.1/linux/mm/mempool.c linux/mm/mempool.c --- v2.5.1/linux/mm/mempool.c Tue Dec 18 14:56:41 2001 +++ linux/mm/mempool.c Sat Dec 29 17:30:07 2001 @@ -8,6 +8,7 @@ * started by Ingo Molnar, Copyright (C) 2001 */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/mempool.h> diff -u --recursive --new-file v2.5.1/linux/mm/mprotect.c linux/mm/mprotect.c --- v2.5.1/linux/mm/mprotect.c Mon Sep 17 15:30:23 2001 +++ linux/mm/mprotect.c Sat Dec 29 17:30:07 2001 @@ -3,6 +3,7 @@ * * (C) Copyright 1994 Linus Torvalds */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/shm.h> diff -u --recursive --new-file v2.5.1/linux/mm/mremap.c linux/mm/mremap.c --- v2.5.1/linux/mm/mremap.c Thu Sep 20 20:31:26 2001 +++ linux/mm/mremap.c Sat Dec 29 17:30:07 2001 @@ -4,6 +4,7 @@ * (C) Copyright 1996 Linus Torvalds */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/shm.h> diff -u --recursive --new-file v2.5.1/linux/mm/oom_kill.c linux/mm/oom_kill.c --- v2.5.1/linux/mm/oom_kill.c Sat Nov 3 17:05:25 2001 +++ linux/mm/oom_kill.c Thu Dec 27 08:21:28 2001 @@ -149,7 +149,8 @@ * all the memory it needs. That way it should be able to * exit() and clear out its resources quickly... */ - p->counter = 5 * HZ; + p->time_slice = 2 * MAX_TSLICE; + p->dyn_prio = MAX_DYNPRIO + 1; p->flags |= PF_MEMALLOC | PF_MEMDIE; /* This process has hardware access, be more careful. */ diff -u --recursive --new-file v2.5.1/linux/mm/slab.c linux/mm/slab.c --- v2.5.1/linux/mm/slab.c Tue Dec 18 14:56:41 2001 +++ linux/mm/slab.c Sat Dec 29 17:30:07 2001 @@ -70,6 +70,8 @@ #include <linux/config.h> #include <linux/slab.h> +#include <linux/mm.h> +#include <linux/cache.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/compiler.h> diff -u --recursive --new-file v2.5.1/linux/mm/swapfile.c linux/mm/swapfile.c --- v2.5.1/linux/mm/swapfile.c Tue Dec 18 14:56:41 2001 +++ linux/mm/swapfile.c Sat Dec 29 17:30:07 2001 @@ -5,6 +5,7 @@ * Swap reorganised 29.12.95, Stephen Tweedie */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/kernel_stat.h> @@ -913,16 +914,19 @@ if (S_ISBLK(swap_inode->i_mode)) { kdev_t dev = swap_inode->i_rdev; struct block_device_operations *bdops; + devfs_handle_t de; p->swap_device = dev; set_blocksize(dev, PAGE_SIZE); bd_acquire(swap_inode); bdev = swap_inode->i_bdev; - bdops = devfs_get_ops(devfs_get_handle_from_inode(swap_inode)); + de = devfs_get_handle_from_inode(swap_inode); + bdops = devfs_get_ops(de); /* Increments module use count */ if (bdops) bdev->bd_op = bdops; error = blkdev_get(bdev, FMODE_READ|FMODE_WRITE, 0, BDEV_SWAP); + devfs_put_ops(de);/*Decrement module use count now we're safe*/ if (error) goto bad_swap_2; set_blocksize(dev, PAGE_SIZE); diff -u --recursive --new-file v2.5.1/linux/mm/vmscan.c linux/mm/vmscan.c --- v2.5.1/linux/mm/vmscan.c Sat Nov 17 19:18:17 2001 +++ linux/mm/vmscan.c Sat Dec 29 17:30:07 2001 @@ -11,6 +11,7 @@ * Multiqueue VM started 5.8.00, Rik van Riel. */ +#include <linux/mm.h> #include <linux/slab.h> #include <linux/kernel_stat.h> #include <linux/swap.h> diff -u --recursive --new-file v2.5.1/linux/net/802/fddi.c linux/net/802/fddi.c --- v2.5.1/linux/net/802/fddi.c Tue Nov 28 21:53:45 2000 +++ linux/net/802/fddi.c Sun Dec 30 10:31:51 2001 @@ -27,7 +27,6 @@ */ #include <linux/config.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/types.h> #include <linux/kernel.h> diff -u --recursive --new-file v2.5.1/linux/net/802/hippi.c linux/net/802/hippi.c --- v2.5.1/linux/net/802/hippi.c Wed Jun 20 21:00:55 2001 +++ linux/net/802/hippi.c Sun Dec 30 10:31:51 2001 @@ -36,7 +36,6 @@ #include <net/sock.h> #include <asm/uaccess.h> #include <asm/checksum.h> -#include <asm/segment.h> #include <asm/system.h> /* diff -u --recursive --new-file v2.5.1/linux/net/8021q/vlanproc.c linux/net/8021q/vlanproc.c --- v2.5.1/linux/net/8021q/vlanproc.c Tue Nov 13 09:19:41 2001 +++ linux/net/8021q/vlanproc.c Sun Dec 30 10:31:51 2001 @@ -25,7 +25,6 @@ #include <linux/mm.h> /* verify_area(), etc. */ #include <linux/string.h> /* inline mem*, str* functions */ #include <linux/init.h> /* __initfunc et al. */ -#include <asm/segment.h> /* kernel <-> user copy */ #include <asm/byteorder.h> /* htons(), etc. */ #include <asm/uaccess.h> /* copy_to_user */ #include <asm/io.h> diff -u --recursive --new-file v2.5.1/linux/net/atm/resources.c linux/net/atm/resources.c --- v2.5.1/linux/net/atm/resources.c Fri Nov 9 14:11:15 2001 +++ linux/net/atm/resources.c Sun Dec 30 10:31:51 2001 @@ -11,7 +11,6 @@ #include <linux/module.h> #include <linux/bitops.h> #include <net/sock.h> /* for struct sock */ -#include <asm/segment.h> /* for get_fs_long and put_fs_long */ #include "common.h" #include "resources.h" diff -u --recursive --new-file v2.5.1/linux/net/decnet/af_decnet.c linux/net/decnet/af_decnet.c --- v2.5.1/linux/net/decnet/af_decnet.c Fri Nov 9 14:12:54 2001 +++ linux/net/decnet/af_decnet.c Sun Dec 30 10:31:51 2001 @@ -112,7 +112,6 @@ #include <linux/route.h> #include <linux/netfilter.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/ioctls.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/decnet/dn_nsp_in.c linux/net/decnet/dn_nsp_in.c --- v2.5.1/linux/net/decnet/dn_nsp_in.c Fri Nov 9 14:12:54 2001 +++ linux/net/decnet/dn_nsp_in.c Sun Dec 30 10:31:51 2001 @@ -59,7 +59,6 @@ #include <linux/inet.h> #include <linux/route.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/decnet/dn_nsp_out.c linux/net/decnet/dn_nsp_out.c --- v2.5.1/linux/net/decnet/dn_nsp_out.c Mon Jan 22 13:32:10 2001 +++ linux/net/decnet/dn_nsp_out.c Sun Dec 30 10:31:51 2001 @@ -51,7 +51,6 @@ #include <linux/inet.h> #include <linux/route.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/irda/ircomm/ircomm_tty.c linux/net/irda/ircomm/ircomm_tty.c --- v2.5.1/linux/net/irda/ircomm/ircomm_tty.c Sun Sep 30 12:26:09 2001 +++ linux/net/irda/ircomm/ircomm_tty.c Sun Dec 30 10:31:51 2001 @@ -38,7 +38,6 @@ #include <linux/tty.h> #include <linux/interrupt.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <net/irda/irda.h> diff -u --recursive --new-file v2.5.1/linux/net/irda/ircomm/ircomm_tty_ioctl.c linux/net/irda/ircomm/ircomm_tty_ioctl.c --- v2.5.1/linux/net/irda/ircomm/ircomm_tty_ioctl.c Wed Jul 4 11:50:38 2001 +++ linux/net/irda/ircomm/ircomm_tty_ioctl.c Sun Dec 30 10:31:51 2001 @@ -35,7 +35,6 @@ #include <linux/tty.h> #include <linux/serial.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <net/irda/irda.h> diff -u --recursive --new-file v2.5.1/linux/net/irda/irda_device.c linux/net/irda/irda_device.c --- v2.5.1/linux/net/irda/irda_device.c Mon Nov 12 11:29:57 2001 +++ linux/net/irda/irda_device.c Sun Dec 30 10:31:51 2001 @@ -44,7 +44,6 @@ #include <linux/spinlock.h> #include <asm/ioctls.h> -#include <asm/segment.h> #include <asm/uaccess.h> #include <asm/dma.h> #include <asm/io.h> diff -u --recursive --new-file v2.5.1/linux/net/irda/irsyms.c linux/net/irda/irsyms.c --- v2.5.1/linux/net/irda/irsyms.c Fri Nov 9 14:22:17 2001 +++ linux/net/irda/irsyms.c Sun Dec 30 10:31:51 2001 @@ -31,7 +31,6 @@ #include <linux/proc_fs.h> #include <linux/smp_lock.h> -#include <asm/segment.h> #include <net/irda/irda.h> #include <net/irda/irmod.h> diff -u --recursive --new-file v2.5.1/linux/net/irda/irsysctl.c linux/net/irda/irsysctl.c --- v2.5.1/linux/net/irda/irsysctl.c Tue Dec 18 14:56:41 2001 +++ linux/net/irda/irsysctl.c Sun Dec 30 10:31:51 2001 @@ -27,7 +27,6 @@ #include <linux/mm.h> #include <linux/ctype.h> #include <linux/sysctl.h> -#include <asm/segment.h> #include <net/irda/irda.h> #include <net/irda/irias_object.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/af_rose.c linux/net/rose/af_rose.c --- v2.5.1/linux/net/rose/af_rose.c Mon Sep 10 07:58:35 2001 +++ linux/net/rose/af_rose.c Sun Dec 30 10:31:51 2001 @@ -44,7 +44,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_dev.c linux/net/rose/rose_dev.c --- v2.5.1/linux/net/rose/rose_dev.c Wed Jun 27 17:10:55 2001 +++ linux/net/rose/rose_dev.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #include <linux/if_ether.h> /* For the statistics structure. */ #include <asm/system.h> -#include <asm/segment.h> #include <asm/io.h> #include <linux/inet.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_in.c linux/net/rose/rose_in.c --- v2.5.1/linux/net/rose/rose_in.c Fri Dec 29 14:44:46 2000 +++ linux/net/rose/rose_in.c Sun Dec 30 10:31:51 2001 @@ -38,7 +38,6 @@ #include <linux/skbuff.h> #include <net/sock.h> #include <net/ip.h> /* For ip_rcv */ -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_link.c linux/net/rose/rose_link.c --- v2.5.1/linux/net/rose/rose_link.c Fri Dec 29 14:44:46 2000 +++ linux/net/rose/rose_link.c Sun Dec 30 10:31:51 2001 @@ -29,7 +29,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_out.c linux/net/rose/rose_out.c --- v2.5.1/linux/net/rose/rose_out.c Fri Dec 29 14:44:46 2000 +++ linux/net/rose/rose_out.c Sun Dec 30 10:31:51 2001 @@ -30,7 +30,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_route.c linux/net/rose/rose_route.c --- v2.5.1/linux/net/rose/rose_route.c Fri Jun 29 19:38:26 2001 +++ linux/net/rose/rose_route.c Sun Dec 30 10:31:51 2001 @@ -36,7 +36,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_subr.c linux/net/rose/rose_subr.c --- v2.5.1/linux/net/rose/rose_subr.c Fri Jun 29 19:38:26 2001 +++ linux/net/rose/rose_subr.c Sun Dec 30 10:31:51 2001 @@ -30,7 +30,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/rose/rose_timer.c linux/net/rose/rose_timer.c --- v2.5.1/linux/net/rose/rose_timer.c Fri Dec 29 14:44:46 2000 +++ linux/net/rose/rose_timer.c Sun Dec 30 10:31:51 2001 @@ -30,7 +30,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/sunrpc/auth_null.c linux/net/sunrpc/auth_null.c --- v2.5.1/linux/net/sunrpc/auth_null.c Thu Aug 16 09:39:37 2001 +++ linux/net/sunrpc/auth_null.c Sat Dec 29 17:30:07 2001 @@ -7,11 +7,11 @@ */ #include <linux/types.h> -#include <linux/slab.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/utsname.h> #include <linux/sunrpc/clnt.h> +#include <linux/sched.h> #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_AUTH diff -u --recursive --new-file v2.5.1/linux/net/sunrpc/auth_unix.c linux/net/sunrpc/auth_unix.c --- v2.5.1/linux/net/sunrpc/auth_unix.c Thu Aug 16 09:39:37 2001 +++ linux/net/sunrpc/auth_unix.c Sat Dec 29 17:30:07 2001 @@ -7,7 +7,7 @@ */ #include <linux/types.h> -#include <linux/slab.h> +#include <linux/sched.h> #include <linux/socket.h> #include <linux/in.h> #include <linux/sunrpc/clnt.h> diff -u --recursive --new-file v2.5.1/linux/net/wanrouter/wanmain.c linux/net/wanrouter/wanmain.c --- v2.5.1/linux/net/wanrouter/wanmain.c Wed Aug 15 01:22:18 2001 +++ linux/net/wanrouter/wanmain.c Sun Dec 30 10:31:51 2001 @@ -75,7 +75,6 @@ #include <../drivers/net/syncppp.h> #else - #include <asm/segment.h> /* kernel <-> user copy */ #endif #define KMEM_SAFETYZONE 8 diff -u --recursive --new-file v2.5.1/linux/net/wanrouter/wanproc.c linux/net/wanrouter/wanproc.c --- v2.5.1/linux/net/wanrouter/wanproc.c Mon Sep 10 07:58:35 2001 +++ linux/net/wanrouter/wanproc.c Sun Dec 30 10:31:51 2001 @@ -40,7 +40,6 @@ #define PROC_STATS_FORMAT "%30s: %12lu\n" #else #define PROC_STATS_FORMAT "%30s: %12u\n" - #include <asm/segment.h> /* kernel <-> user copy */ #endif diff -u --recursive --new-file v2.5.1/linux/net/x25/af_x25.c linux/net/x25/af_x25.c --- v2.5.1/linux/net/x25/af_x25.c Mon Sep 10 07:58:35 2001 +++ linux/net/x25/af_x25.c Sun Dec 30 10:31:51 2001 @@ -46,7 +46,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_dev.c linux/net/x25/x25_dev.c --- v2.5.1/linux/net/x25/x25_dev.c Mon Jan 22 13:32:10 2001 +++ linux/net/x25/x25_dev.c Sun Dec 30 10:31:51 2001 @@ -33,7 +33,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_facilities.c linux/net/x25/x25_facilities.c --- v2.5.1/linux/net/x25/x25_facilities.c Wed Jan 24 15:28:36 2001 +++ linux/net/x25/x25_facilities.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_in.c linux/net/x25/x25_in.c --- v2.5.1/linux/net/x25/x25_in.c Wed Jan 24 15:28:36 2001 +++ linux/net/x25/x25_in.c Sun Dec 30 10:31:51 2001 @@ -37,7 +37,6 @@ #include <linux/skbuff.h> #include <net/sock.h> #include <net/ip.h> /* For ip_rcv */ -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_link.c linux/net/x25/x25_link.c --- v2.5.1/linux/net/x25/x25_link.c Fri Jun 29 19:38:26 2001 +++ linux/net/x25/x25_link.c Sun Dec 30 10:31:51 2001 @@ -34,7 +34,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_out.c linux/net/x25/x25_out.c --- v2.5.1/linux/net/x25/x25_out.c Thu Apr 12 12:11:39 2001 +++ linux/net/x25/x25_out.c Sun Dec 30 10:31:51 2001 @@ -35,7 +35,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_route.c linux/net/x25/x25_route.c --- v2.5.1/linux/net/x25/x25_route.c Mon Jan 22 13:32:10 2001 +++ linux/net/x25/x25_route.c Sun Dec 30 10:31:51 2001 @@ -33,7 +33,6 @@ #include <linux/if_arp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fcntl.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_subr.c linux/net/x25/x25_subr.c --- v2.5.1/linux/net/x25/x25_subr.c Fri Jun 29 19:38:26 2001 +++ linux/net/x25/x25_subr.c Sun Dec 30 10:31:51 2001 @@ -34,7 +34,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h> diff -u --recursive --new-file v2.5.1/linux/net/x25/x25_timer.c linux/net/x25/x25_timer.c --- v2.5.1/linux/net/x25/x25_timer.c Wed Jan 24 15:28:36 2001 +++ linux/net/x25/x25_timer.c Sun Dec 30 10:31:51 2001 @@ -32,7 +32,6 @@ #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <asm/segment.h> #include <asm/system.h> #include <linux/fcntl.h> #include <linux/mm.h>