]> git.neil.brown.name Git - history.git/commitdiff
Import 2.3.9pre7 2.3.9pre7
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:25:52 +0000 (15:25 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:25:52 +0000 (15:25 -0500)
149 files changed:
Documentation/powerpc/sound.txt
MAINTAINERS
arch/i386/kernel/i386_ksyms.c
arch/i386/kernel/mca.c
arch/i386/kernel/mtrr.c
arch/mips/kernel/irixelf.c
arch/ppc/Makefile
arch/ppc/chrpboot/Makefile
arch/ppc/chrpboot/main.c
arch/ppc/coffboot/Makefile
arch/ppc/common_defconfig
arch/ppc/config.in
arch/ppc/defconfig
arch/ppc/kernel/Makefile
arch/ppc/kernel/chrp_pci.c
arch/ppc/kernel/chrp_setup.c
arch/ppc/kernel/idle.c
arch/ppc/kernel/irq.c
arch/ppc/kernel/mbx_setup.c
arch/ppc/kernel/misc.S
arch/ppc/kernel/mk_defs.c
arch/ppc/kernel/pmac_setup.c
arch/ppc/kernel/ppc_htab.c
arch/ppc/kernel/ppc_ksyms.c
arch/ppc/kernel/prep_setup.c
arch/ppc/kernel/process.c
arch/ppc/kernel/prom.c
arch/ppc/kernel/setup.c
arch/ppc/kernel/signal.c
arch/ppc/kernel/smp.c
arch/ppc/kernel/syscalls.c
arch/ppc/kernel/time.c
arch/ppc/mm/init.c
arch/ppc/xmon/start.c
arch/ppc/xmon/xmon.c
drivers/ap1000/ringbuf.c
drivers/block/genhd.c
drivers/char/ftape/lowlevel/ftape-proc.c
drivers/char/tty_io.c
drivers/net/depca.c
drivers/pci/proc.c
drivers/usb/uhci.c
drivers/usb/usb.c
drivers/usb/usb.h
drivers/zorro/proc.c
fs/adfs/dir.c
fs/adfs/file.c
fs/affs/dir.c
fs/affs/file.c
fs/affs/symlink.c
fs/autofs/dir.c
fs/autofs/root.c
fs/autofs/symlink.c
fs/coda/dir.c
fs/coda/file.c
fs/coda/pioctl.c
fs/coda/symlink.c
fs/devpts/root.c
fs/efs/dir.c
fs/efs/file.c
fs/efs/symlink.c
fs/fat/file.c
fs/file_table.c
fs/hfs/dir_cap.c
fs/hfs/dir_dbl.c
fs/hfs/dir_nat.c
fs/hfs/file.c
fs/hfs/file_cap.c
fs/hfs/file_hdr.c
fs/hpfs/anode.c
fs/hpfs/ea.c
fs/hpfs/file.c
fs/hpfs/inode.c
fs/hpfs/super.c
fs/isofs/dir.c
fs/isofs/file.c
fs/isofs/inode.c
fs/isofs/symlink.c
fs/locks.c
fs/minix/dir.c
fs/minix/file.c
fs/minix/inode.c
fs/minix/symlink.c
fs/msdos/namei.c
fs/ncpfs/dir.c
fs/ncpfs/file.c
fs/ncpfs/symlink.c
fs/nfs/write.c
fs/ntfs/fs.c
fs/open.c
fs/pipe.c
fs/qnx4/dir.c
fs/qnx4/file.c
fs/qnx4/symlinks.c
fs/read_write.c
fs/romfs/inode.c
fs/select.c
fs/smbfs/dir.c
fs/smbfs/file.c
fs/sysv/dir.c
fs/sysv/file.c
fs/sysv/inode.c
fs/sysv/symlink.c
fs/ufs/dir.c
fs/ufs/file.c
fs/ufs/inode.c
fs/ufs/symlink.c
fs/umsdos/dir.c
fs/umsdos/file.c
fs/umsdos/rdir.c
fs/umsdos/symlink.c
fs/vfat/namei.c
include/asm-ppc/hardirq.h
include/asm-ppc/hydra.h
include/asm-ppc/ide.h
include/asm-ppc/irq.h
include/asm-ppc/keyboard.h
include/asm-ppc/machdep.h
include/asm-ppc/mmu.h
include/asm-ppc/page.h
include/asm-ppc/processor.h
include/asm-ppc/ptrace.h
include/asm-ppc/softirq.h
include/asm-ppc/spinlock.h
include/asm-ppc/unistd.h
include/linux/file.h
include/linux/fs.h
include/linux/iso_fs.h
include/linux/minix_fs.h
include/linux/sched.h
include/linux/sysv_fs.h
include/linux/timer.h
include/linux/ufs_fs.h
kernel/fork.c
kernel/ksyms.c
mm/filemap.c
mm/mlock.c
mm/mmap.c
mm/mprotect.c
mm/mremap.c
net/core/scm.c
net/ipv4/ip_masq.c
net/ipv4/ip_masq_mfw.c
net/ipv4/ip_masq_mod.c
net/ipv4/ip_masq_portfw.c
net/ipv4/tcp.c
net/unix/af_unix.c
net/unix/garbage.c
net/wanrouter/wanproc.c

index c028e35f1f6cb7f1052c4989a8a175dfc4fa070c..86411d3a2c71ef2b17e5d9a5006de6f305365a9b 100644 (file)
@@ -4,7 +4,7 @@
 Please mail me (Cort Dougan, cort@cs.nmt.edu) if you have questions,
 comments or corrections.
 
-Last Change: 3.24.98
+Last Change: 6.16.99
 
 This just covers sound on the PReP and CHRP systems for now and later
 will contain information on the PowerMac's.
@@ -51,7 +51,7 @@ set automatically on boot.
 
   Midi is not supported since the cs4232 driver doesn't support midi yet.
 
-2. IBM PowerPersonal PReP machines and IBM LongTrail CHRP
+2. IBM PowerPersonal PReP machines
 
   I've only tested sound on the Power Personal Series of IBM workstations
   so if you try it on others please let me know the result.  I'm especially
@@ -74,3 +74,8 @@ set automatically on boot.
   This setup does _NOT_ allow for recording yet.
 
   Midi is not supported since the cs4232 driver doesn't support midi yet.
+
+2. IBM CHRP
+
+  I have only tested this on the 43P-150.  Build the kernel with the cs4232
+  set as a module and load the module with irq=9 dma=1 dma2=2 io=0x550
index 2b9cf0a6d52b10783b326c5d9262ae15f51a0a2a..45b782ec90b14087cea722696120b95b6dbfd816 100644 (file)
@@ -170,6 +170,12 @@ L: linux-scsi@vger.rutgers.edu
 W:     http://www.dandelion.com/Linux/
 S:     Maintained
 
+CIRRUS LOGIC GENERIC FBDEV DRIVER
+P:     Jeff Garzik
+M:     jgarzik@pobox.com
+L:     linux-fbdev@vuser.vu.union.edu
+S:     Maintained
+
 CONFIGURE, MENUCONFIG, XCONFIG
 P:     Michael Elizabeth Chastain
 M:     mec@shout.net
index f0d5d337829abb6b36ef83670248a82802add63a..afcfd274e2eaef19821c652aa538ef045e2031e6 100644 (file)
@@ -48,6 +48,7 @@ EXPORT_SYMBOL_NOVERS(__down_failed_trylock);
 EXPORT_SYMBOL_NOVERS(__up_wakeup);
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
+EXPORT_SYMBOL(csum_partial_copy_generic);
 /* Delay loops */
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__delay);
index 571075d26f3411037674430107ed2a30ae05f63b..8bfd7fa4543c72120ea975a12c64ea74229848b7 100644 (file)
@@ -142,7 +142,7 @@ static struct inode_operations proc_mca_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 0399caa79e124ede2429b8dfd56d07d877a3a9ff..084ad431c43708b2b08039a4b8d29d2870993273 100644 (file)
@@ -1459,7 +1459,7 @@ static struct inode_operations proc_mtrr_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 966e3b48c94007c71976d6f88dbd3a4a34f05632..0983a1b6a935c8993718f5a80fccda08f7f92d5c 100644 (file)
@@ -308,7 +308,7 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
                return 0xffffffff;
        }
 
-       file = current->files->fd[elf_exec_fileno];
+       file = fget(elf_exec_fileno);
 
        eppnt = elf_phdata;
        for(i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) {
@@ -366,6 +366,7 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
        }
 
        /* Now use mmap to map the library into memory. */
+       fput(file);
        sys_close(elf_exec_fileno);
        if(error < 0 && error > -1024) {
 #ifdef DEBUG_ELF
@@ -615,6 +616,7 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
        unsigned int start_code, end_code, end_data, elf_stack;
        int elf_exec_fileno, retval, has_interp, has_ephdr, size, i;
        char *elf_interpreter;
+       struct file *file;
        mm_segment_t old_fs;
        
        load_addr = 0;
@@ -637,10 +639,8 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
        
        retval = read_exec(bprm->dentry, elf_ex.e_phoff,
                           (char *) elf_phdata, size, 1);
-       if (retval < 0) {
-               kfree (elf_phdata);
-               return retval;
-       }
+       if (retval < 0)
+               goto out_phdata;
        
 #ifdef DEBUG_ELF
        dump_phdrs(elf_phdata, elf_ex.e_phnum);
@@ -665,12 +665,10 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
 
        elf_bss = 0;
        elf_brk = 0;
-       elf_exec_fileno = open_dentry(bprm->dentry, O_RDONLY);
-
-       if (elf_exec_fileno < 0) {
-               kfree (elf_phdata);
-               return elf_exec_fileno;
-       }
+       retval = open_dentry(bprm->dentry, O_RDONLY);
+       if (retval < 0)
+               goto out_phdata;
+       file = fget(elf_exec_fileno = retval);
        
        elf_stack = 0xffffffff;
        elf_interpreter = NULL;
@@ -682,40 +680,26 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
                                           &interpreter_dentry,
                                           &interp_elf_ex, elf_phdata, bprm,
                                           elf_ex.e_phnum);
-       if(retval) {
-               kfree(elf_phdata);
-               sys_close(elf_exec_fileno);
-               return retval;
-       }
+       if(retval)
+               goto out_file;
        
        if(elf_interpreter) {
                retval = verify_irix_interpreter(&interp_elf_ex);
-               if(retval) {
-                       kfree(elf_interpreter);
-                       kfree(elf_phdata);
-                       sys_close(elf_exec_fileno);
-                       return retval;
-               }
+               if(retval)
+                       goto out_interp;
        }
        
        /* OK, we are done with that, now set up the arg stuff,
         * and then start this sucker up.
         */
-       if (!bprm->sh_bang) {
-               if (!bprm->p) {
-                       if(elf_interpreter) {
-                             kfree(elf_interpreter);
-                       }
-                       kfree (elf_phdata);
-                       sys_close(elf_exec_fileno);
-                       return -E2BIG;
-               }
-       }
+       retval = -E2BIG;
+       if (!bprm->sh_bang && !bprm->p)
+               goto out_interp;
        
        /* Flush all traces of the currently running executable */
        retval = flush_old_exec(bprm);
        if (retval)
-               return retval;
+               goto out_interp;
 
        /* OK, This is the point of no return */
        current->mm->end_data = 0;
@@ -737,8 +721,7 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
        old_fs = get_fs();
        set_fs(get_ds());
        
-       map_executable(current->files->fd[elf_exec_fileno], elf_phdata,
-                      elf_ex.e_phnum, &elf_stack, &load_addr,
+       map_executable(file, elf_phdata, elf_ex.e_phnum, &elf_stack, &load_addr,
                       &start_code, &elf_bss, &end_code, &end_data, &elf_brk);
 
        if(elf_interpreter) {
@@ -758,6 +741,7 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
        set_fs(old_fs);
        
        kfree(elf_phdata);
+       fput(file);
        sys_close(elf_exec_fileno);
        current->personality = PER_IRIX32;
 
@@ -820,6 +804,17 @@ static inline int do_load_irix_binary(struct linux_binprm * bprm,
        if (current->flags & PF_PTRACED)
                send_sig(SIGTRAP, current, 0);
        return 0;
+
+out_interp:
+       if(elf_interpreter) {
+             kfree(elf_interpreter);
+       }
+out_file:
+       fput(file);
+       sys_close(elf_exec_fileno);
+out_phdata:
+       kfree (elf_phdata);
+       return retval;
 }
 
 static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
@@ -835,9 +830,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 /* This is really simpleminded and specialized - we are loading an
  * a.out library that is given an ELF header.
  */
-static inline int do_load_irix_library(int fd)
+static inline int do_load_irix_library(struct file *file)
 {
-       struct file * file;
        struct elfhdr elf_ex;
        struct elf_phdr *elf_phdata  =  NULL;
        struct dentry *dentry;
@@ -850,14 +844,12 @@ static inline int do_load_irix_library(int fd)
        int i,j, k;
 
        len = 0;
-       file = current->files->fd[fd];
+       if (!file->f_op)
+               return -EACCES;
        dentry = file->f_dentry;
        inode = dentry->d_inode;
        elf_bss = 0;
        
-       if (!file || !file->f_op)
-               return -EACCES;
-
        /* Seek to the beginning of the file. */
        if (file->f_op->llseek) {
                if ((error = file->f_op->llseek(file, 0, 0)) != 0)
@@ -934,10 +926,15 @@ static inline int do_load_irix_library(int fd)
 
 static int load_irix_library(int fd)
 {
-       int retval;
+       int retval = -EACCES;
+       struct file *file;
 
        MOD_INC_USE_COUNT;
-       retval = do_load_irix_library(fd);
+       file = fget(fd);
+       if (file) {
+               retval = do_load_irix_library(file);
+               fput(file);
+       }
        MOD_DEC_USE_COUNT;
        return retval;
 }
@@ -978,9 +975,12 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
                        return -ENOEXEC;
                }
 
-       filp = current->files->fd[fd];
-       if(!filp || !filp->f_op) {
+       filp = fget(fd);
+       if (!filp)
+               return -EACCES;
+       if(!filp->f_op) {
                printk("irix_mapelf: Bogon filp!\n");
+               fput(file);
                return -EACCES;
        }
 
@@ -998,6 +998,7 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
 
                if(retval != (hp->p_vaddr & 0xfffff000)) {
                        printk("irix_mapelf: do_mmap fails with %d!\n", retval);
+                       fput(file);
                        return retval;
                }
        }
@@ -1005,6 +1006,7 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
 #ifdef DEBUG_ELF
        printk("irix_mapelf: Success, returning %08lx\n", user_phdrp->p_vaddr);
 #endif
+       fput(file);
        return user_phdrp->p_vaddr;
 }
 
index e150d9325ff1b93f35889d62fc8b507df1393d5e..25a2a0fb76772f62d060c31e32151ba33f2b4c4f 100644 (file)
@@ -22,7 +22,8 @@ ASFLAGS               =
 LINKFLAGS      = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
 CFLAGSINC      = -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__
 CFLAGS         := $(CFLAGS) -D__powerpc__ -fsigned-char -msoft-float -pipe \
-               -fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple -mstring
+               -fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple \
+               -mstring
 CPP            = $(CC) -E $(CFLAGS)
 
 ifdef CONFIG_8xx
@@ -30,8 +31,7 @@ CFLAGS := $(CFLAGS) -mcpu=860
 endif
 
 ifdef CONFIG_PPC64
-CFLAGS := $(CFLAGS) -Wa,-mppc64bridge #-Wa,-mppc64
-#CFLAGS := $(CFLAGS) -Wa,-mppc64 -mpowerpc64
+CFLAGS := $(CFLAGS) -Wa,-mppc64bridge #-mpowerpc64
 endif
 
 HEAD := arch/ppc/kernel/head.o
index 53e30d65da2034153c6498b507df0fb1fabb2adf..eb47209270f02d6cefd69864949c3e88d47494eb 100644 (file)
@@ -70,6 +70,9 @@ zImage: $(OBJS) no_initrd.o mknote
        ./mknote > note
        $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
 
+mknote: mknote.c
+       $(HOSTCC) $(HOSTCFLAGS) -o $@ mknote.c
+
 zImage.initrd: $(OBJS) initrd.o
        $(LD) $(LD_ARGS) -o $@ $(OBJS) initrd.o $(LIBS)
 
index 7d141d5c3b0d597003b3d95af7ba8f79f8a0a459..210dd43ad45358c18941a1cbde981fa9d25158fa 100644 (file)
@@ -19,12 +19,13 @@ void gunzip(void *, int, unsigned char *, int *);
 #define RAM_START      0x00000000
 #define RAM_END                (8<<20)
 
-#define RAM_FREE       (6<<20)         /* after image of chrpboot */
+#define RAM_FREE       ((unsigned long)(_end+0x1000)&~0xFFF)
 #define PROG_START     0x00010000
 
 char *avail_ram;
 char *end_avail;
 
+extern char _end[];
 extern char image_data[];
 extern int image_len;
 extern char initrd_data[];
@@ -47,8 +48,8 @@ chrpboot(int a1, int a2, void *prom)
        initrd_start = (RAM_END - initrd_size) & ~0xFFF;
        a1 = initrd_start;
        a2 = initrd_size;
-       printf("initial ramdisk at 0x%x (%u bytes)\n\r", initrd_start,
-              initrd_size);
+       printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n\r", initrd_start,
+              initrd_data,initrd_size);
        memcpy((char *)initrd_start, initrd_data, initrd_size);
        end_avail = (char *)initrd_start;
     } else
@@ -56,7 +57,6 @@ chrpboot(int a1, int a2, void *prom)
     im = image_data;
     len = image_len;
     dst = (void *) PROG_START;
-
     if (im[0] == 0x1f && im[1] == 0x8b) {
        avail_ram = (char *)RAM_FREE;
        printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
index 9151717467801d0f5514f02d0c5e84568009ee62..81e21f3e3814ac2d1cbf95e31da47060e0f56e96 100644 (file)
@@ -3,7 +3,6 @@
 #
 # Paul Mackerras       January 1997
 
-HOSTCC = gcc
 HOSTCFLAGS = -O -I$(TOPDIR)/include
 
 CC     = $(CROSS_COMPILE)gcc
index 699c60ac274696d74643a18ec8343cabb8e28350..9739f20da1131b328bac3bd64065ff0f8d53d20f 100644 (file)
@@ -87,7 +87,7 @@ CONFIG_IDEDMA_PMAC_AUTO=y
 #
 # Additional Block Devices
 #
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_MD is not set
 CONFIG_BLK_DEV_RAM=y
@@ -131,6 +131,7 @@ CONFIG_SKB_LARGE=y
 #
 # CONFIG_IPX is not set
 CONFIG_ATALK=m
+# CONFIG_DECNET is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
 # CONFIG_BRIDGE is not set
@@ -176,7 +177,8 @@ CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_AHA1542 is not set
 # CONFIG_SCSI_AHA1740 is not set
 CONFIG_SCSI_AIC7XXX=y
-# CONFIG_OVERRIDE_CMDS is not set
+# CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT is not set
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
 CONFIG_AIC7XXX_PROC_STATS=y
 CONFIG_AIC7XXX_RESET_DELAY=15
 # CONFIG_SCSI_ADVANSYS is not set
@@ -311,7 +313,7 @@ CONFIG_FB_CT65550=y
 CONFIG_FB_MATROX=y
 # CONFIG_FB_MATROX_MILLENIUM is not set
 CONFIG_FB_MATROX_MYSTIQUE=y
-# CONFIG_FB_MATROX_G100 is not set
+CONFIG_FB_MATROX_G100=y
 # CONFIG_FB_MATROX_MULTIHEAD is not set
 # CONFIG_FB_ATY is not set
 # CONFIG_FB_VIRTUAL is not set
@@ -425,6 +427,7 @@ CONFIG_LOCKD=y
 CONFIG_MAC_PARTITION=y
 # CONFIG_SMD_DISKLABEL is not set
 # CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
 # CONFIG_UNIXWARE_DISKLABEL is not set
 CONFIG_NLS=y
 
@@ -464,6 +467,7 @@ CONFIG_NLS_CODEPAGE_437=y
 #
 CONFIG_SOUND=y
 CONFIG_DMASOUND=y
+# CONFIG_SOUND_CMPCI is not set
 # CONFIG_SOUND_ES1370 is not set
 # CONFIG_SOUND_ES1371 is not set
 # CONFIG_SOUND_SONICVIBES is not set
index a3c166a8a89845122ffd64e25a7b7a334c985daf..2881decd7ecff450bf2035fbec23a8d5199c28e6 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.93 1999/05/14 22:36:58 cort Exp $
+# $Id: config.in,v 1.94 1999/06/25 11:00:07 davem Exp $
 # For a description of the syntax of this configuration file,
 # see the Configure script.
 #
@@ -175,7 +175,6 @@ source drivers/video/Config.in
 endmenu
 
 source drivers/char/Config.in
-source drivers/usb/Config.in
 source fs/Config.in
 
 mainmenu_option next_comment
index d60e6da0a37104190a91cbdb3717fe7a14c194b1..6b12d23092e7b6cf543ba7a343a88c904da5cda9 100644 (file)
@@ -86,7 +86,7 @@ CONFIG_IDEDMA_PMAC_AUTO=y
 #
 # Additional Block Devices
 #
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_MD is not set
 CONFIG_BLK_DEV_RAM=y
@@ -130,6 +130,7 @@ CONFIG_SKB_LARGE=y
 #
 # CONFIG_IPX is not set
 CONFIG_ATALK=m
+# CONFIG_DECNET is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
 # CONFIG_BRIDGE is not set
@@ -175,7 +176,8 @@ CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_AHA1542 is not set
 # CONFIG_SCSI_AHA1740 is not set
 CONFIG_SCSI_AIC7XXX=y
-# CONFIG_OVERRIDE_CMDS is not set
+# CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT is not set
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
 CONFIG_AIC7XXX_PROC_STATS=y
 CONFIG_AIC7XXX_RESET_DELAY=15
 # CONFIG_SCSI_ADVANSYS is not set
@@ -310,7 +312,7 @@ CONFIG_FB_CT65550=y
 CONFIG_FB_MATROX=y
 # CONFIG_FB_MATROX_MILLENIUM is not set
 CONFIG_FB_MATROX_MYSTIQUE=y
-# CONFIG_FB_MATROX_G100 is not set
+CONFIG_FB_MATROX_G100=y
 # CONFIG_FB_MATROX_MULTIHEAD is not set
 # CONFIG_FB_ATY is not set
 # CONFIG_FB_VIRTUAL is not set
@@ -424,6 +426,7 @@ CONFIG_LOCKD=y
 CONFIG_MAC_PARTITION=y
 # CONFIG_SMD_DISKLABEL is not set
 # CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
 # CONFIG_UNIXWARE_DISKLABEL is not set
 CONFIG_NLS=y
 
@@ -463,12 +466,40 @@ CONFIG_NLS_CODEPAGE_437=y
 #
 CONFIG_SOUND=y
 CONFIG_DMASOUND=y
+# CONFIG_SOUND_CMPCI is not set
 # CONFIG_SOUND_ES1370 is not set
 # CONFIG_SOUND_ES1371 is not set
 # CONFIG_SOUND_SONICVIBES is not set
 # CONFIG_SOUND_MSNDCLAS is not set
 # CONFIG_SOUND_MSNDPIN is not set
-# CONFIG_SOUND_OSS is not set
+CONFIG_SOUND_OSS=y
+# CONFIG_SOUND_DMAP is not set
+# CONFIG_SOUND_PAS is not set
+# CONFIG_SOUND_SB is not set
+# CONFIG_SOUND_ADLIB is not set
+# CONFIG_SOUND_GUS is not set
+# CONFIG_SOUND_MPU401 is not set
+# CONFIG_SOUND_PSS is not set
+# CONFIG_SOUND_MSS is not set
+# CONFIG_SOUND_SSCAPE is not set
+# CONFIG_SOUND_TRIX is not set
+# CONFIG_SOUND_MAD16 is not set
+# CONFIG_SOUND_WAVEFRONT is not set
+CONFIG_SOUND_CS4232=m
+# CONFIG_SOUND_OPL3SA2 is not set
+# CONFIG_SOUND_MAUI is not set
+# CONFIG_SOUND_SGALAXY is not set
+# CONFIG_SOUND_AD1816 is not set
+# CONFIG_SOUND_OPL3SA1 is not set
+# CONFIG_SOUND_SOFTOSS is not set
+# CONFIG_SOUND_YM3812 is not set
+# CONFIG_SOUND_VMIDI is not set
+# CONFIG_SOUND_UART6850 is not set
+
+#
+# Additional low level sound drivers
+#
+# CONFIG_LOWLEVEL_SOUND is not set
 
 #
 # Kernel hacking
index 1be8c322ad7a630a94ad088ccd293c80d751f257..635dd91b57e22e9ced5134ebd54e138a7e2d6567 100644 (file)
@@ -56,16 +56,16 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
                $(TOPDIR)/include/asm/processor.h \
                $(TOPDIR)/include/asm/pgtable.h \
                $(TOPDIR)/include/asm/ptrace.h
-       $(CC) ${CFLAGS} -S mk_defs.c
+       $(CC) $(CFLAGS) -S mk_defs.c
        cp ppc_defs.head ppc_defs.h
        grep '^#define' mk_defs.s >>ppc_defs.h
        rm mk_defs.s
 
 find_name : find_name.c
-       $(HOSTCC) -o find_name find_name.c
+       $(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
 
 checks: checks.c
-       $(HOSTCC) ${CFLAGS} -D__KERNEL__ -o checks checks.c
+       $(HOSTCC) $(HOSTCFLAGS) -D__KERNEL__ -o checks checks.c
        ./checks
 
 include $(TOPDIR)/Rules.make
index 575b65918f91e98429c08e695d7ff673fb1c7fb1..c82671947d1143e52fabcafc2feb0776d19de9a6 100644 (file)
@@ -354,7 +354,8 @@ chrp_setup_pci_ptrs(void)
                 }
                 else
                 {
-                       if ( !strncmp("IBM,7043-150", get_property(find_path_device("/"), "name", NULL),12) )
+                       if ( !strncmp("IBM,7043-150", get_property(find_path_device("/"), "name", NULL),12) ||
+                            !strncmp("IBM,7046-155", get_property(find_path_device("/"), "name", NULL),12) )
                        {
                                pci_dram_offset = 0;
                                isa_mem_base = 0x80000000;
index 25c262d0e44563647bbfba3c2bc8146b84bd6261..1653ef0d7d9c7a7d8a4d98038bc2f539ed60d954 100644 (file)
@@ -48,6 +48,7 @@
 #include <asm/irq.h>
 #include <asm/adb.h>
 #include <asm/hydra.h>
+#include <asm/keyboard.h>
 
 #include "time.h"
 #include "local_irq.h"
@@ -66,7 +67,6 @@ extern volatile unsigned char *chrp_int_ack_special;
 
 unsigned long chrp_get_rtc_time(void);
 int chrp_set_rtc_time(unsigned long nowtime);
-unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
 void chrp_calibrate_decr(void);
 void chrp_time_init(void);
 
@@ -281,7 +281,7 @@ __initfunc(void
        /*
         *  Fix the Super I/O configuration
         */
-       /*sio_init();*/
+       sio_init();
 #ifdef CONFIG_DUMMY_CONSOLE
        conswitchp = &dummy_con;
 #endif
@@ -295,15 +295,16 @@ __initfunc(void
                struct property *p;
                device = find_devices("rtas");
                for ( p = device->properties;
-                     strncmp(p->name, "rtas-event-scan-rate", 20) && p ;
+                     p && strncmp(p->name, "rtas-event-scan-rate", 20);
                      p = p->next )
                        /* nothing */ ;
                if ( p && *(unsigned long *)p->value )
                {
-                       rtas_event_scan_rate = (HZ/(*(unsigned long *)p->value)*30)-1;
-                       rtas_event_scan_ct = 1;
+                       ppc_md.heartbeat = chrp_event_scan;
+                       ppc_md.heartbeat_reset = (HZ/(*(unsigned long *)p->value)*30)-1;
+                       ppc_md.heartbeat_count = 1;
                        printk("RTAS Event Scan Rate: %lu (%lu jiffies)\n",
-                              *(unsigned long *)p->value, rtas_event_scan_rate );
+                              *(unsigned long *)p->value, ppc_md.heartbeat_reset );
                }
        }
 }
@@ -312,11 +313,8 @@ void
 chrp_event_scan(void)
 {
        unsigned char log[1024];
-       if ( rtas_event_scan_rate && (rtas_event_scan_ct-- <= 0) )
-       {
-               call_rtas( "event-scan", 4, 1, NULL, 0x0, 1, __pa(log), 1024 );
-               rtas_event_scan_ct = rtas_event_scan_rate;
-       }
+       call_rtas( "event-scan", 4, 1, NULL, 0x0, 1, __pa(log), 1024 );
+       ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
 }
        
 void
@@ -331,7 +329,7 @@ void
 chrp_power_off(void)
 {
        /* allow power on only with power button press */
-#define        PWR_FIELD(x) (0x8000000000000000 >> ((x)-96))
+#define        PWR_FIELD(x) (0x8000000000000000ULL >> ((x)-96))
        printk("RTAS power-off returned %d\n",
               call_rtas("power-off", 2, 1, NULL,
                         ((PWR_FIELD(96)|PWR_FIELD(97))>>32)&0xffffffff,
@@ -632,7 +630,8 @@ __initfunc(void
                ppc_md.kbd_leds          = pckbd_leds;
                ppc_md.kbd_init_hw       = pckbd_init_hw;
 #ifdef CONFIG_MAGIC_SYSRQ
-               ppc_md.kbd_sysrq_xlate   = pckbd_sysrq_xlate;
+               ppc_md.ppc_kbd_sysrq_xlate       = pckbd_sysrq_xlate;
+               SYSRQ_KEY = 0x54;
 #endif         
        }
        else
@@ -644,7 +643,8 @@ __initfunc(void
                ppc_md.kbd_leds          = mackbd_leds;
                ppc_md.kbd_init_hw       = mackbd_init_hw;
 #ifdef CONFIG_MAGIC_SYSRQ
-               ppc_md.kbd_sysrq_xlate   = mackbd_sysrq_xlate;
+               ppc_md.ppc_kbd_sysrq_xlate       = mackbd_sysrq_xlate;
+               SYSRQ_KEY = 0x69;
 #endif         
        }
 #else
@@ -655,7 +655,8 @@ __initfunc(void
        ppc_md.kbd_leds          = pckbd_leds;
        ppc_md.kbd_init_hw       = pckbd_init_hw;
 #ifdef CONFIG_MAGIC_SYSRQ
-       ppc_md.kbd_sysrq_xlate   = pckbd_sysrq_xlate;
+       ppc_md.ppc_kbd_sysrq_xlate       = pckbd_sysrq_xlate;
+       SYSRQ_KEY = 0x54;
 #endif
 #endif
 #endif
@@ -665,9 +666,9 @@ __initfunc(void
         ppc_ide_md.outsw = chrp_ide_outsw;
         ppc_ide_md.default_irq = chrp_ide_default_irq;
         ppc_ide_md.default_io_base = chrp_ide_default_io_base;
-        ppc_ide_md.check_region = chrp_ide_check_region;
-        ppc_ide_md.request_region = chrp_ide_request_region;
-        ppc_ide_md.release_region = chrp_ide_release_region;
+        ppc_ide_md.ide_check_region = chrp_ide_check_region;
+        ppc_ide_md.ide_request_region = chrp_ide_request_region;
+        ppc_ide_md.ide_release_region = chrp_ide_release_region;
         ppc_ide_md.fix_driveid = chrp_ide_fix_driveid;
         ppc_ide_md.ide_init_hwif = chrp_ide_init_hwif_ports;
 
index 38ac7d108a1f3b47f36e389be35662be4e08698b..51246d32e6a96cd14d0664b2cb6a222e4a339251 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: idle.c,v 1.62 1999/05/24 05:43:18 cort Exp $
+ * $Id: idle.c,v 1.63 1999/06/10 22:55:35 geert Exp $
  *
  * Idle daemon for PowerPC.  Idle daemon will handle any action
  * that needs to be taken when the system becomes idle.
@@ -298,7 +298,7 @@ void power_save(void)
        case 7:                 /* 603ev */
        case 8:                 /* 750 */
                save_flags(msr);
-               cli();
+               __cli();
                if (!current->need_resched) {
                        asm("mfspr %0,1008" : "=r" (hid0) :);
                        hid0 &= ~(HID0_NAP | HID0_SLEEP | HID0_DOZE);
index 732a87f69f4a8fe9148908a1dc25edd0602b8706..014957be25635effda5e792ff9a655605e79bcea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: irq.c,v 1.106 1999/05/25 21:16:04 cort Exp $
+ * $Id: irq.c,v 1.107 1999/06/17 05:39:12 paulus Exp $
  *
  *  arch/ppc/kernel/irq.c
  *
@@ -189,6 +189,12 @@ void free_irq(unsigned int irq, void *dev_id)
        request_irq(irq, NULL, 0, NULL, dev_id);
 }
 
+/* XXX should implement irq disable depth like on intel */
+void disable_irq_nosync(unsigned int irq_nr)
+{
+       mask_irq(irq_nr);
+}
+
 void disable_irq(unsigned int irq_nr)
 {
        mask_irq(irq_nr);
index 40f016fb5afb3defefeed5b7dbf63441c58ece86..aa2828cc27bb954928f080faf805a7dc6c9628a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mbx_setup.c,v 1.10 1999/05/14 07:24:19 davem Exp $
+ * $Id: mbx_setup.c,v 1.11 1999/06/28 17:59:43 cort Exp $
  *
  *  linux/arch/ppc/kernel/setup.c
  *
@@ -473,9 +473,9 @@ mbx_init(unsigned long r3, unsigned long r4, unsigned long r5,
         ppc_ide_md.outsw = mbx_ide_outsw;
         ppc_ide_md.default_irq = mbx_ide_default_irq;
         ppc_ide_md.default_io_base = mbx_ide_default_io_base;
-        ppc_ide_md.check_region = mbx_ide_check_region;
-        ppc_ide_md.request_region = mbx_ide_request_region;
-        ppc_ide_md.release_region = mbx_ide_release_region;
+        ppc_ide_md.ide_check_region = mbx_ide_check_region;
+        ppc_ide_md.ide_request_region = mbx_ide_request_region;
+        ppc_ide_md.ide_release_region = mbx_ide_release_region;
         ppc_ide_md.fix_driveid = mbx_ide_fix_driveid;
         ppc_ide_md.ide_init_hwif = mbx_ide_init_hwif_ports;
 
index 7e2db084310f3849dfca0360e24b823c306272da..0caf06a3b4151ee1f9581607d3ada8c791970ddd 100644 (file)
@@ -650,17 +650,19 @@ __clear_msr_me:
 
 /*
  * Create a kernel thread
- *   __kernel_thread(flags, fn, arg)
+ *   kernel_thread(fn, arg, flags)
  */
-_GLOBAL(__kernel_thread)
+_GLOBAL(kernel_thread)
+       mr      r6,r3           /* function */
+       ori     r3,r5,CLONE_VM  /* flags */
        li      r0,__NR_clone
        sc
        cmpi    0,r3,0          /* parent or child? */
        bnelr                   /* return if parent */
        li      r0,0            /* clear out p->tss.regs */
        stw     r0,TSS+PT_REGS(r2)      /* since we don't have user ctx */
-       mtlr    r4              /* fn addr in lr */
-       mr      r3,r5           /* load arg and call fn */
+       mtlr    r6              /* fn addr in lr */
+       mr      r3,r4           /* load arg and call fn */
        blrl
        li      r0,__NR_exit    /* exit after child exits */
         li     r3,0
@@ -866,7 +868,7 @@ sys_call_table:
        .long sys_getresuid     /* 165 */
        .long sys_query_module
        .long sys_poll
-#ifdef CONFIG_NFS      
+#ifdef CONFIG_NFSD     
        .long sys_nfsservctl
 #else
        .long sys_ni_syscall
index b66ccffa8b5d0939ec70a457885e32d531538a76..a3977193a3fe26ba525fb847f41b6abde914eddc 100644 (file)
@@ -97,5 +97,6 @@ main(void)
        DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
        DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
        DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
+       DEFINE(CLONE_VM, CLONE_VM);
        return 0;
 }
index afa1227a7c7913f690e6a49b802d192c9a5ad2a3..ffdc316eda31b16a479e68b39f90e8ebda260940 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/vt_kern.h>
 #include <linux/console.h>
 #include <linux/ide.h>
+#include <linux/pci.h>
 #include <asm/prom.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -56,6 +57,7 @@
 #include <asm/feature.h>
 #include <asm/ide.h>
 #include <asm/machdep.h>
+#include <asm/keyboard.h>
 
 #include "time.h"
 #include "local_irq.h"
@@ -98,6 +100,7 @@ extern char saved_command_line[];
 
 extern void zs_kgdb_hook(int tty_num);
 static void ohare_init(void);
+static void init_p2pbridge(void);
 
 __pmac
 int
@@ -255,6 +258,7 @@ pmac_setup_arch(unsigned long *memory_start_p, unsigned long *memory_end_p))
        ohare_init();
 
        *memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
+       init_p2pbridge();
 
        /* Checks "l2cr-value" property in the registry */
        if ( (_get_PVR() >> 16) == 8) {
@@ -299,6 +303,31 @@ pmac_setup_arch(unsigned long *memory_start_p, unsigned long *memory_end_p))
                ROOT_DEV = to_kdev_t(DEFAULT_ROOT_DEVICE);
 }
 
+/*
+ * Tweak the PCI-PCI bridge chip on the blue & white G3s.
+ */
+__initfunc(static void init_p2pbridge(void))
+{
+       struct device_node *p2pbridge;
+       unsigned char bus, devfn;
+       unsigned short val;
+
+       /* XXX it would be better here to identify the specific
+          PCI-PCI bridge chip we have. */
+       if ((p2pbridge = find_devices("pci-bridge")) == 0
+           || p2pbridge->parent == NULL
+           || strcmp(p2pbridge->parent->name, "pci") != 0)
+               return;
+
+       if (pci_device_loc(p2pbridge, &bus, &devfn) < 0)
+               return;
+
+       pcibios_read_config_word(bus, devfn, PCI_BRIDGE_CONTROL, &val);
+       val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
+       pcibios_write_config_word(bus, devfn, PCI_BRIDGE_CONTROL, val);
+       pcibios_read_config_word(bus, devfn, PCI_BRIDGE_CONTROL, &val);
+}
+
 __initfunc(static void ohare_init(void))
 {
        /*
@@ -488,13 +517,13 @@ pmac_halt(void)
 void
 pmac_ide_insw(ide_ioreg_t port, void *buf, int ns)
 {
-       ide_insw(port, buf, ns);
+       _insw_ns(port+_IO_BASE, buf, ns);
 }
 
 void
 pmac_ide_outsw(ide_ioreg_t port, void *buf, int ns)
 {
-       ide_outsw(port, buf, ns);
+       _outsw_ns(port+_IO_BASE, buf, ns);
 }
 
 int
@@ -596,7 +625,8 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
        ppc_md.kbd_leds          = mackbd_leds;
        ppc_md.kbd_init_hw       = mackbd_init_hw;
 #ifdef CONFIG_MAGIC_SYSRQ
-       ppc_md.kbd_sysrq_xlate   = mackbd_sysrq_xlate;
+       ppc_md.ppc_kbd_sysrq_xlate       = mackbd_sysrq_xlate;
+       SYSRQ_KEY = 0x69;
 #endif
 #endif
 
@@ -605,13 +635,13 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
         ppc_ide_md.outsw = pmac_ide_outsw;
         ppc_ide_md.default_irq = pmac_ide_default_irq;
         ppc_ide_md.default_io_base = pmac_ide_default_io_base;
-        ppc_ide_md.check_region = pmac_ide_check_region;
-        ppc_ide_md.request_region = pmac_ide_request_region;
-        ppc_ide_md.release_region = pmac_ide_release_region;
+        ppc_ide_md.ide_check_region = pmac_ide_check_region;
+        ppc_ide_md.ide_request_region = pmac_ide_request_region;
+        ppc_ide_md.ide_release_region = pmac_ide_release_region;
         ppc_ide_md.fix_driveid = pmac_ide_fix_driveid;
         ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
 
-        ppc_ide_md.io_base = 0;
+        ppc_ide_md.io_base = _IO_BASE; /* actually too early for this :-( */
 #endif         
 }
 
index eba3f185431dc19bab6319a4fafc1158493227b4..9da8db6e89a0357a60d9bb0f09246a5bfebb010a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ppc_htab.c,v 1.26 1998/12/10 00:24:23 cort Exp $
+ * $Id: ppc_htab.c,v 1.28 1999/06/27 10:53:32 davem Exp $
  *
  * PowerPC hash table management proc entry.  Will show information
  * about the current hash table and will allow changes to it.
@@ -74,7 +74,7 @@ struct inode_operations proc_ppc_htab_inode_operations = {
     NULL,          /* rename      */
     NULL,          /* readlink    */
     NULL,          /* follow_link */
-    NULL,          /* bmap        */
+    NULL,          /* get_block   */
     NULL,          /* readpage    */
     NULL,          /* writepage   */
     NULL,          /* flushpage   */
index 36a68ffd67623fc1b0dbb1e2fc9f27999c71a629..1d13403314a67e8c5d536947667ecee31826081f 100644 (file)
@@ -31,8 +31,8 @@
 #include <asm/dma.h>
 #include <asm/machdep.h>
 
-#define __KERNEL_SYSCALLS__
-#include <linux/unistd.h>
+/* Tell string.h we don't want memcpy etc. as cpp defines */
+#define EXPORT_SYMTAB_STROPS
 
 extern void transfer_to_handler(void);
 extern void int_return(void);
@@ -47,7 +47,6 @@ extern atomic_t ppc_n_lost_interrupts;
 extern void do_lost_interrupts(unsigned long);
 extern int do_signal(sigset_t *, struct pt_regs *);
 
-asmlinkage long long __ashrdi3(long long, int);
 asmlinkage int abs(int);
 
 EXPORT_SYMBOL(clear_page);
@@ -66,6 +65,7 @@ EXPORT_SYMBOL(ppc_n_lost_interrupts);
 EXPORT_SYMBOL(do_lost_interrupts);
 EXPORT_SYMBOL(enable_irq);
 EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(disable_irq_nosync);
 EXPORT_SYMBOL(ppc_local_irq_count);
 EXPORT_SYMBOL(ppc_local_bh_count);
 
@@ -112,11 +112,6 @@ EXPORT_SYMBOL(strnlen);
 EXPORT_SYMBOL(strspn);
 EXPORT_SYMBOL(strcmp);
 EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memscan);
-EXPORT_SYMBOL(memcmp);
 
 /* EXPORT_SYMBOL(csum_partial); already in net/netsyms.c */
 EXPORT_SYMBOL(csum_partial_copy_generic);
@@ -153,9 +148,10 @@ EXPORT_SYMBOL(iounmap);
 
 EXPORT_SYMBOL(ide_insw);
 EXPORT_SYMBOL(ide_outsw);
+EXPORT_SYMBOL(ppc_ide_md);
 
 EXPORT_SYMBOL(start_thread);
-EXPORT_SYMBOL(__kernel_thread);
+EXPORT_SYMBOL(kernel_thread);
 
 EXPORT_SYMBOL(__cli);
 EXPORT_SYMBOL(__sti);
@@ -215,11 +211,11 @@ EXPORT_SYMBOL(nvram_read_byte);
 EXPORT_SYMBOL(nvram_write_byte);
 #endif /* CONFIG_PMAC */
 
+EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL_NOVERS(memset);
+EXPORT_SYMBOL_NOVERS(memmove);
+EXPORT_SYMBOL_NOVERS(memscan);
+EXPORT_SYMBOL_NOVERS(memcmp);
+
 EXPORT_SYMBOL(abs);
 EXPORT_SYMBOL(device_is_compatible);
-
-/* The following are special because they're not called
-   explicitly (the C compiler generates them).  Fortunately,
-   their interface isn't gonna change any time soon now, so
-   it's OK to leave it out of version control.  */
-EXPORT_SYMBOL_NOVERS(__ashrdi3);
index 45c64837c7485ba877458d100c803f621a063467..05d46a698b84e0e7729e7b6d878bf48fe96c4d82 100644 (file)
@@ -48,7 +48,7 @@
 #include <asm/mk48t59.h>
 #include <asm/prep_nvram.h>
 #include <asm/raven.h>
-
+#include <asm/keyboard.h>
 
 #include "time.h"
 #include "local_irq.h"
@@ -825,9 +825,9 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
         ppc_ide_md.outsw = prep_ide_outsw;
         ppc_ide_md.default_irq = prep_ide_default_irq;
         ppc_ide_md.default_io_base = prep_ide_default_io_base;
-        ppc_ide_md.check_region = prep_ide_check_region;
-        ppc_ide_md.request_region = prep_ide_request_region;
-        ppc_ide_md.release_region = prep_ide_release_region;
+        ppc_ide_md.ide_check_region = prep_ide_check_region;
+        ppc_ide_md.ide_request_region = prep_ide_request_region;
+        ppc_ide_md.ide_release_region = prep_ide_release_region;
         ppc_ide_md.fix_driveid = prep_ide_fix_driveid;
         ppc_ide_md.ide_init_hwif = prep_ide_init_hwif_ports;
 #endif         
@@ -841,7 +841,8 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5,
        ppc_md.kbd_leds          = pckbd_leds;
        ppc_md.kbd_init_hw       = pckbd_init_hw;
 #ifdef CONFIG_MAGIC_SYSRQ
-       ppc_md.kbd_sysrq_xlate   = pckbd_sysrq_xlate;
+       ppc_md.ppc_kbd_sysrq_xlate       = pckbd_sysrq_xlate;
+       SYSRQ_KEY = 0x54;
 #endif
 #endif
 }
index 0147d427de7f771e384bff91eb719dd616387910..2cb23188ab6be80c6ec12c39c9c8de7a6d121d59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: process.c,v 1.85 1999/05/16 21:27:08 cort Exp $
+ * $Id: process.c,v 1.86 1999/06/17 21:53:46 cort Exp $
  *
  *  linux/arch/ppc/kernel/process.c
  *
@@ -306,6 +306,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        p->tss.fpscr = current->tss.fpscr;
        childregs->msr &= ~MSR_FP;
 
+       p->processor = 0;
 #ifdef __SMP__
        p->last_processor = NO_PROC_ID;
 #endif /* __SMP__ */
index 4c275dc9d198b5a40695f46b20999b04c6deef2a..8fea9f9e8f237309cb11b2688c2f7a6b9d8ff84c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: prom.c,v 1.60 1999/05/25 01:42:41 cort Exp $
+ * $Id: prom.c,v 1.61 1999/06/17 06:05:52 paulus Exp $
  *
  * Procedures for interfacing to the Open Firmware PROM on
  * Power Macintosh computers.
@@ -338,7 +338,9 @@ prom_init(int r3, int r4, prom_entry pp)
                         */
                        model = (char *) early_get_property
                                (r4 + bi->deviceTreeOffset, 4, RELOC("model"));
-                       if (model && strcmp(model, RELOC("iMac,1")) == 0) {
+                       if (model
+                           && (strcmp(model, RELOC("iMac,1")) == 0
+                               || strcmp(model, RELOC("PowerMac1,1")) == 0)) {
                                out_le32((unsigned *)0x80880008, 1);    /* XXX */
                        }
                }
@@ -887,11 +889,11 @@ interpret_pci_props(struct device_node *np, unsigned long mem_start)
            && (imp = (struct pci_intr_map *)
                get_property(np->parent, "interrupt-map", &ml)) != 0
            && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
-               unsigned int busdevfn = pci_addrs[0].addr.a_hi & 0xffff00;
+               unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
                np->n_intrs = 0;
                np->intrs = (struct interrupt_info *) mem_start;
                for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
-                       if (imp[i].addr.a_hi == busdevfn) {
+                       if (imp[i].addr.a_hi == devfn) {
                                np->intrs[np->n_intrs].line = imp[i].intr;
                                np->intrs[np->n_intrs].sense = 0;
                                ++np->n_intrs;
index 3fdb35718bc428a74cbbcc3a3c03f7ae50023b2a..48c06d6e8255a7cea25ef63436fbc54ba4e722cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: setup.c,v 1.133 1999/05/14 07:24:30 davem Exp $
+ * $Id: setup.c,v 1.136 1999/06/18 07:11:35 cort Exp $
  * Common prep/pmac/chrp boot and setup code.
  */
 
@@ -80,6 +80,9 @@ int _machine = 0;
 int have_of = 0;
 int is_prep = 0;
 int is_chrp = 0;
+#ifdef CONFIG_MAGIC_SYSRQ
+unsigned long SYSRQ_KEY;
+#endif /* CONFIG_MAGIC_SYSRQ */
 /* For MTX/MVME boards.. with Raven/Falcon Chipset
       Real close to CHRP, but boot like PReP (via PPCbug)
       There's probably a nicer way to do this.. --Troy */
@@ -160,15 +163,6 @@ void machine_halt(void)
        ppc_md.halt();
 }
   
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-void ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
-{
-       if (ppc_ide_md.ide_init_hwif != NULL) {
-               ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq);
-       }
-}
-#endif
-
 unsigned long cpu_temp(void)
 {
        unsigned char thres = 0;
@@ -376,7 +370,6 @@ identify_machine(unsigned long r3, unsigned long r4, unsigned long r5,
                        else
                        {
                                _machine = _MACH_Pmac;
-                               is_prep = 1;
                        }
                }
 
index 17c0f55d11893bf81b56ee689ff51c0ffe122158..a1b590658790faf98354fc8e18d03442881027bc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  linux/arch/ppc/kernel/signal.c
  *
- *  $Id: signal.c,v 1.24 1999/04/03 11:25:16 paulus Exp $
+ *  $Id: signal.c,v 1.25 1999/06/17 05:40:20 paulus Exp $
  *
  *  PowerPC version 
  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
@@ -455,6 +455,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
                        default:
                                lock_kernel();
                                sigaddset(&current->signal, signr);
+                               recalc_sigpending(current);
                                current->flags |= PF_SIGNALED;
                                do_exit(exit_code);
                                /* NOTREACHED */
index 91b4ba041c46e16769f4b4c2252850388c7c60ef..fc2613ddf423c1ff749904e862e1a14f2fee7da3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: smp.c,v 1.52 1999/05/23 22:43:51 cort Exp $
+ * $Id: smp.c,v 1.54 1999/06/24 17:13:34 cort Exp $
  *
  * Smp support for ppc.
  *
@@ -243,20 +243,21 @@ void __init smp_boot_cpus(void)
 {
        extern struct task_struct *current_set[NR_CPUS];
        extern void __secondary_start_psurge(void);
-       int i;
+       extern void __secondary_start_chrp(void);
+       int i, cpu_nr;
        struct task_struct *p;
        unsigned long a;
 
         printk("Entering SMP Mode...\n");
        /* let other processors know to not do certain initialization */
        first_cpu_booted = 1;
+       smp_num_cpus = 1;
        
        /*
         * assume for now that the first cpu booted is
         * cpu 0, the master -- Cort
         */
        cpu_callin_map[0] = 1;
-       cpu_callin_map[1] = 0;
         smp_store_cpu_info(0);
         active_kernel_processor = 0;
        current->processor = 0;
@@ -282,16 +283,12 @@ void __init smp_boot_cpus(void)
        {
        case _MACH_Pmac:
                /* assume powersurge board - 2 processors -- Cort */
-               smp_num_cpus = 2; 
+               cpu_nr = 2; 
                break;
        case _MACH_chrp:
-               smp_num_cpus = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
+               cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
                                 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
                                OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
-               /* get our processor # - we may not be cpu 0 */
-               printk("SMP %d processors, boot CPU is %d (should be 0)\n",
-                      smp_num_cpus,
-                      10/*openpic_read(&OpenPIC->Processor[0]._Who_Am_I)*/);
                break;
        }
 
@@ -299,7 +296,7 @@ void __init smp_boot_cpus(void)
         * only check for cpus we know exist.  We keep the callin map
         * with cpus at the bottom -- Cort
         */
-       for ( i = 1 ; i < smp_num_cpus; i++ )
+       for ( i = 1 ; i < cpu_nr; i++ )
        {
                int c;
                
@@ -332,6 +329,19 @@ void __init smp_boot_cpus(void)
                case _MACH_chrp:
                        *(unsigned long *)KERNELBASE = i;
                        asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
+#if 0
+                       device = find_type_devices("cpu");
+                       /* assume cpu device list is in order, find the ith cpu */
+                       for ( a = i; device && a; device = device->next, a-- )
+                               ;
+                       if ( !device )
+                               break;
+                       printk( "Starting %s (%lu): ", device->full_name,
+                               *(ulong *)get_property(device, "reg", NULL) );
+                       call_rtas( "start-cpu", 3, 1, NULL,
+                                  *(ulong *)get_property(device, "reg", NULL),
+                                  __pa(__secondary_start_chrp), i);
+#endif                 
                        break;
                }
                
@@ -349,6 +359,7 @@ void __init smp_boot_cpus(void)
                        /* this sync's the decr's -- Cort */
                        if ( _machine == _MACH_Pmac )
                                set_dec(decrementer_count);
+                       smp_num_cpus++;
                } else {
                        printk("Processor %d is stuck.\n", i);
                }
@@ -366,7 +377,6 @@ void __init smp_boot_cpus(void)
 
 void __init smp_commence(void)
 {
-       printk("SMP %d: smp_commence()\n",current->processor);
        /*
         *      Lets the callin's below out of their loop.
         */
@@ -381,16 +391,12 @@ void __init initialize_secondary(void)
 /* Activate a secondary processor. */
 asmlinkage int __init start_secondary(void *unused)
 {
-       printk("SMP %d: start_secondary()\n",current->processor);
        smp_callin();
        return cpu_idle(NULL);
 }
 
 void __init smp_callin(void)
 {
-       int i;
-       
-       printk("SMP %d: smp_callin()\n",current->processor);
         smp_store_cpu_info(current->processor);
        set_dec(decrementer_count);
        
@@ -407,7 +413,6 @@ void __init smp_callin(void)
 
 void __init smp_setup(char *str, int *ints)
 {
-       printk("SMP %d: smp_setup()\n",current->processor);
 }
 
 int __init setup_profiling_timer(unsigned int multiplier)
index 5ae2957574f82edee4ad72b4c9aedf96b9316d2d..571b36391ea2cc76dafa7749a6e405d86ed4296f 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/sys.h>
 #include <linux/ipc.h>
 #include <linux/utsname.h>
+#include <linux/file.h>
 
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
index 6be6b90c2938b5a3d3a756d633d46096cfdebf9f..87c6d67dd0c05e5a3dfd8dfaaa8a27756faf7953 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: time.c,v 1.48 1999/05/22 19:35:57 cort Exp $
+ * $Id: time.c,v 1.50 1999/06/05 00:23:20 cort Exp $
  * Common time routines among all ppc machines.
  *
  * Written by Cort Dougan (cort@cs.nmt.edu) to merge
@@ -126,17 +126,9 @@ void timer_interrupt(struct pt_regs * regs)
        smp_local_timer_interrupt(regs);
 #endif         
 
-#ifdef CONFIG_APUS
-       {
-               extern void apus_heartbeat (void);
-               apus_heartbeat ();
-       }
-#endif
-#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
-       if ( _machine == _MACH_chrp )
-               chrp_event_scan();
-#endif 
-
+       if ( ppc_md.heartbeat && !ppc_md.heartbeat_count--)
+               ppc_md.heartbeat();
+       
        hardirq_exit(cpu);
 }
 
index afd84c499106f9839849140af420e4a66be39f6b..69e1efb06b83c4d69749b49465faa4b2ed24beeb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  $Id: init.c,v 1.166 1999/05/22 18:18:30 cort Exp $
+ *  $Id: init.c,v 1.169 1999/06/17 19:03:13 cort Exp $
  *
  *  PowerPC version 
  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
@@ -265,12 +265,15 @@ void show_mem(void)
 #endif /* __SMP__ */
        printk("\n");
        for_each_task(p)
-       {       
+       {
                printk("%-8.8s %3d %3d %8ld %8ld %8ld %c%08lx %08lx ",
                       p->comm,p->pid,
-                      atomic_read(&p->mm->count),p->mm->context,
-                      p->mm->context<<4, p->tss.last_syscall,
-                      user_mode(p->tss.regs) ? 'u' : 'k', p->tss.regs->nip,
+                      (p->mm)?atomic_read(&p->mm->count):0,
+                      (p->mm)?p->mm->context:0,
+                      (p->mm)?(p->mm->context<<4):0,
+                      p->tss.last_syscall,
+                      (p->tss.regs)?user_mode(p->tss.regs) ? 'u' : 'k' : '?',
+                      (p->tss.regs)?p->tss.regs->nip:0,
                       (ulong)p);
                {
                        int iscur = 0;
@@ -282,7 +285,7 @@ void show_mem(void)
                                iscur = 1;
                                printk("current");
                        }
-#else          
+#else
                        if ( p == current )
                        {
                                iscur = 1;
@@ -345,6 +348,13 @@ __ioremap(unsigned long addr, unsigned long size, unsigned long flags)
        p = addr & PAGE_MASK;
        size = PAGE_ALIGN(addr + size) - p;
 
+       /*
+        * If the address lies within the first 16 MB, assume it's in ISA
+        * memory space
+        */
+       if (p < 16*1024*1024)
+           p += _ISA_MEM_BASE;
+
        /*
         * Don't allow anybody to remap normal RAM that we're using.
         * mem_init() sets high_memory so only do the check after that.
@@ -371,7 +381,7 @@ __ioremap(unsigned long addr, unsigned long size, unsigned long flags)
         * same virt address (and this is contiguous).
         *  -- Cort
         */
-       if ( (v = p_mapped_by_bats(addr)) /*&& p_mapped_by_bats(addr+(size-1))*/ )
+       if ( (v = p_mapped_by_bats(p)) /*&& p_mapped_by_bats(p+size-1)*/ )
                goto out;
 #endif /* CONFIG_8xx */
        
index f89f2c1932d452bfbda82d599664d7f1c9afb888..5615716394579730fe5aa56ece442d388d4dacad 100644 (file)
@@ -32,7 +32,7 @@ xmon_map_scc(void)
 #ifdef CHRP_ESCC
                unsigned long addr = 0xc1013020;
 #else
-               unsigned long addr = 0xf3013030;
+               unsigned long addr = 0xf3013020;
 #endif
                TXRDY = 4;
                RXRDY = 1;
index a7c572ad7e5d02530cb90afef447fb8bfb547317..0e9a432cb293fa5fa6d753d862c7564442a4a3dc 100644 (file)
@@ -91,7 +91,6 @@ extern void longjmp(u_int *, int);
 static char *help_string = "\
 Commands:\n\
   d    dump bytes\n\
-  dc   dump characters\n\
   di   dump instructions\n\
   df   dump float values\n\
   dd   dump double values\n\
@@ -518,7 +517,7 @@ excprint(struct pt_regs *fp)
 {
        printf("vector: %x at pc = %x, msr = %x, sp = %x [%x]\n",
               fp->trap, fp->nip, fp->msr, fp->gpr[1], fp);
-       if ((fp->trap == 0x300) || (fp->trap == 0x600) || (fp->trap == 0x200))
+       if (fp->trap == 0x300 || fp->trap == 0x600)
                printf("dar = %x, dsisr = %x\n", fp->dar, fp->dsisr);
        if (current)
                printf("current = %x, pid = %d, comm = %s\n",
@@ -991,15 +990,16 @@ bsesc()
        return c;
 }
 
-#define isxdigit(c)    ('0' <= (c) && (c) <= '9' || 'a' <= (c) && (c) <= 'f' \
-                        || 'A' <= (c) && (c) <= 'F')
+#define isxdigit(c)    (('0' <= (c) && (c) <= '9') \
+                        || ('a' <= (c) && (c) <= 'f') \
+                        || ('A' <= (c) && (c) <= 'F'))
 void
 dump()
 {
        int c;
 
        c = inchar();
-       if ((isxdigit(c) && (c != 'f') && (c != 'd')) || (c == '\n'))
+       if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
                termch = c;
        scanhex(&adrs);
        if( termch != '\n')
index 0efffa1de164b5becfe70a7f5726f402e845b172..69682437ed019c175c30ae34fa7b67d02c102125 100644 (file)
@@ -318,7 +318,7 @@ struct inode_operations proc_ringbuf_inode_operations = {
        NULL,                   /* mknod */
        NULL,                   /* rename */
        NULL,                   /* readlink */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index c801ab8144f533b0bcc61571c15ec86f8cf9d3e1..1eebf20a1284b52a0cb54876bd10af03f5293018 100644 (file)
@@ -221,11 +221,6 @@ static void extended_partition(struct gendisk *hd, kdev_t dev)
                        return;
                if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
                        return;
-         /*
-          * This block is from a device that we're about to stomp on.
-          * So make sure nobody thinks this block is usable.
-          */
-               bh->b_state = 0;
 
                if ((*(unsigned short *) (bh->b_data+510)) != cpu_to_le16(MSDOS_LABEL_MAGIC))
                        goto done;
@@ -285,10 +280,12 @@ static void extended_partition(struct gendisk *hd, kdev_t dev)
                hd->part[current_minor].start_sect = first_sector + START_SECT(p) * sector_size;
                this_sector = first_sector + START_SECT(p) * sector_size;
                dev = MKDEV(hd->major, current_minor);
-               brelse(bh);
+
+               /* Use bforget(), as we have changed the disk geometry */
+               bforget(bh);
        }
 done:
-       brelse(bh);
+       bforget(bh);
 }
 
 #ifdef CONFIG_SOLARIS_X86_PARTITION
@@ -386,7 +383,6 @@ static void bsd_disklabel_partition(struct gendisk *hd, kdev_t dev,
 
        if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
                return;
-       bh->b_state = 0;
        l = (struct bsd_disklabel *) (bh->b_data+512);
        if (l->d_magic != BSD_DISKMAGIC) {
                brelse(bh);
@@ -402,7 +398,9 @@ static void bsd_disklabel_partition(struct gendisk *hd, kdev_t dev,
                if (p->p_fstype != BSD_FS_UNUSED) 
                        check_and_add_bsd_partition(hd, p, dev);
        }
-       brelse(bh);
+
+       /* Use bforget(), as we have changed the disk setup */
+       bforget(bh);
 
 }
 #endif
@@ -421,7 +419,6 @@ static void unixware_partition(struct gendisk *hd, kdev_t dev)
 
        if (!(bh = bread(dev, 14, get_ptable_blocksize(dev))))
                return;
-       bh->b_state = 0;
        l = (struct unixware_disklabel *) (bh->b_data+512);
        if (le32_to_cpu(l->d_magic) != UNIXWARE_DISKMAGIC ||
            le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_DISKMAGIC2) {
@@ -441,7 +438,8 @@ static void unixware_partition(struct gendisk *hd, kdev_t dev)
                }
                p++;
        }
-       brelse(bh);
+       /* Use bforget, as we have changed the disk setup */
+       bforget(bh);
        printk(" >");
 }
 #endif
@@ -469,15 +467,12 @@ read_mbr:
                return -1;
        }
        data = bh->b_data;
-       /* In some cases we modify the geometry    */
-       /*  of the drive (below), so ensure that   */
-       /*  nobody else tries to re-use this data. */
-       bh->b_state = 0;
 #ifdef CONFIG_BLK_DEV_IDE
 check_table:
 #endif
+       /* Use bforget(), because we have potentially changed the disk geometry */
        if (*(unsigned short *)  (0x1fe + data) != cpu_to_le16(MSDOS_LABEL_MAGIC)) {
-               brelse(bh);
+               bforget(bh);
                return 0;
        }
        p = (struct partition *) (0x1be + data);
@@ -515,7 +510,7 @@ check_table:
                         * adjustments to fool fdisk/LILO and partition check.
                         */
                        if (ide_xlate_1024(dev, 1, " [DM6:DDO]")) {
-                               brelse(bh);
+                               bforget(bh);
                                goto read_mbr;  /* start over with new MBR */
                        }
                } else if (sig <= 0x1ae &&
@@ -627,7 +622,7 @@ check_table:
                }
        }
        printk("\n");
-       brelse(bh);
+       bforget(bh);
        return 1;
 }
 
index 80ec703511c7e1d79ce82ff664a1cf9cd2df6941..ef91ff6c985f9e2bcff96773441e4e44eb8ca82b 100644 (file)
@@ -112,7 +112,7 @@ static struct inode_operations ftape_proc_inode_operations =
        NULL,                   /* mknod */
        NULL,                   /* rename */
        NULL,                   /* readlink */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 33497880186c98d8290b774b368e5577bee097f8..3951b542274eec8c0821f61bb4323c7b4c57d5fd 100644 (file)
@@ -628,10 +628,12 @@ static ssize_t tty_read(struct file * file, char * buf, size_t count,
                        return -ERESTARTSYS;
                }
 #endif
+       lock_kernel();
        if (tty->ldisc.read)
                i = (tty->ldisc.read)(tty,file,buf,count);
        else
                i = -EIO;
+       unlock_kernel();
        if (i > 0)
                inode->i_atime = CURRENT_TIME;
        return i;
@@ -658,7 +660,9 @@ static inline ssize_t do_tty_write(
                unsigned long size = PAGE_SIZE*2;
                if (size > count)
                        size = count;
+               lock_kernel();
                ret = write(tty, file, buf, size);
+               unlock_kernel();
                if (ret <= 0)
                        break;
                written += ret;
index c3701e230423dd575546e05f293075a1ffd5e0c1..68250ade1d35c5d53c937eb56cbfbb7bd56e0695 100644 (file)
                            by <tymm@computer.org> 
       0.451    5-Nov-98   Fixed mca stuff cuz I'm a dummy. <tymm@computer.org>
       0.5     14-Nov-98   Re-spin for 2.1.x kernels.
+      0.51    27-Jun-99   Correct received packet length for CRC from
+                           report by <worm@dkik.dk>
 
     =========================================================================
 */
 
-static const char *version = "depca.c:v0.5 1998/11/14 davies@maniac.ultranet.com\n";
+static const char *version = "depca.c:v0.51 1999/6/27 davies@maniac.ultranet.com\n";
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -947,7 +949,7 @@ depca_rx(struct device *dev)
        if (status & R_CRC)  lp->stats.rx_crc_errors++;
        if (status & R_BUFF) lp->stats.rx_fifo_errors++;
       } else { 
-       short len, pkt_len = readw(&lp->rx_ring[entry].msg_length);
+       short len, pkt_len = readw(&lp->rx_ring[entry].msg_length) - 4;
        struct sk_buff *skb;
 
        skb = dev_alloc_skb(pkt_len+2);
index 75b637786524a1139984e177d58fc3a85a947bd0..3a7ef777c0e905003cc71ed0b45ec472f62a96c6 100644 (file)
@@ -222,7 +222,7 @@ static struct inode_operations proc_bus_pci_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index c03ce5adf5b05dc45fdbdde3e2233755fc6de077..48233703c2d3bf20aa0ef09f0bc62bd8303bf3bd 100644 (file)
@@ -20,6 +20,7 @@
 
 /* 4/4/1999 added data toggle for interrupt pipes -keryan */
 /* 5/16/1999 added global toggles for bulk and control */
+/* 6/25/1999 added fix for data toggles on bidirectional bulk endpoints */ 
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -105,7 +106,7 @@ static int uhci_td_result(struct uhci_device *dev, struct uhci_td *td, unsigned
                        if (uhci_debug) {
                            printk("Set toggle from %x rval %d\n", (unsigned int)tmp, rval ? *rval : 0);
                        }
-                       usb_settoggle(dev->usb, usb_pipeendpoint(tmp->info), (tmp->info >> 19) & 1);
+                       usb_settoggle(dev->usb, usb_pipeendpoint(tmp->info), usb_pipeout(tmp->info), (tmp->info >> 19) & 1);
                        break;
                } else {
                    if(rval)
@@ -372,7 +373,7 @@ static int uhci_request_irq(struct usb_device *usb_dev, unsigned int pipe, usb_d
 
        td->link = 1;
        td->status = status;                    /* In */
-       td->info = destination | (7 << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe)) << 19);    /* 8 bytes of data */
+       td->info = destination | (7 << 21) | (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << 19); /* 8 bytes of data */
        td->buffer = virt_to_bus(dev->data);
        td->first = td;
        td->qh = interrupt_qh;
@@ -991,7 +992,7 @@ static int uhci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *da
 
                td->status = status;                                    /* Status */
                td->info = destination | ((pktsze-1) << 21) |
-                        (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe)) << 19); /* pktsze bytes of data */
+                        (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)) << 19); /* pktsze bytes of data */
                td->buffer = virt_to_bus(data);
                td->backptr = &prevtd->link;
                td->first = first;
@@ -1006,7 +1007,7 @@ static int uhci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *da
                }
 
                /* Alternate Data0/1 (start with Data0) */
-               usb_dotoggle(usb_dev, usb_pipeendpoint(pipe));
+               usb_dotoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
        }
        td->link = 1;                           /* Terminate */
        td->status |= (1 << 24);                /* IOC */
@@ -1267,9 +1268,9 @@ static void uhci_interrupt_notify(struct uhci *uhci)
                                if (!(td->status & (1 << 25))) {
                                        struct uhci_qh *interrupt_qh = td->qh;
 
-                                       usb_dotoggle(td->dev, usb_pipeendpoint(td->info));
+                                       usb_dotoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info));
                                        td->info &= ~(1 << 19); /* clear data toggle */
-                                       td->info |= usb_gettoggle(td->dev, usb_pipeendpoint(td->info)) << 19; /* toggle between data0 and data1 */
+                                       td->info |= usb_gettoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info)) << 19; /* toggle between data0 and data1 */
                                        td->status = (td->status & 0x2f000000) | (1 << 23) | (1 << 24); /* active */
 
                                        /* Remove then readd? Is that necessary */
@@ -1280,7 +1281,7 @@ static void uhci_interrupt_notify(struct uhci *uhci)
                                struct uhci_qh *interrupt_qh = td->qh;
                                /* marked for removal */
                                td->inuse &= ~2;
-                               usb_dotoggle(td->dev, usb_pipeendpoint(td->info));
+                               usb_dotoggle(td->dev, usb_pipeendpoint(td->info), usb_pipeout(td->info));
                                uhci_remove_qh(interrupt_qh->skel, interrupt_qh);
                                uhci_qh_deallocate(interrupt_qh);
                                uhci_td_deallocate(td);
index b291c04c649f59441b822aab34d15e7e3cc9693f..4be88f74ebfd27731aa9b727b26095bf510ba057 100644 (file)
@@ -773,7 +773,7 @@ int usb_clear_halt(struct usb_device *dev, int endp)
 
        /* toggle is reset on clear */
 
-       usb_settoggle(dev, endp & 0x0f, 0);
+       usb_settoggle(dev, endp & 0x0f, ((endp >> 7) & 1) ^ 1, 0);
 
        return 0;
 }
@@ -823,7 +823,8 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
                return -1;
 
        dev->actconfig = cp;
-       dev->toggle = 0;
+       dev->toggle[0] = 0;
+       dev->toggle[1] = 0;
        usb_set_maxpacket(dev);
        return 0;
 }
index a6bf78e4af25d88d4ff59e51a485d8f2190fb059..5c36dad34fc565b4a5be2decf57e954293e758e5 100644 (file)
@@ -276,7 +276,7 @@ struct usb_device {
        int devnum;                     /* Device number on USB bus */
        int slow;                       /* Slow device? */
        int maxpacketsize;              /* Maximum packet size */
-       int toggle;                     /* one bit for each endpoint */
+       int toggle[2];                  /* one bit for each endpoint ([0] = IN, [1] = OUT) */
        int halted;                     /* endpoint halts */
        struct usb_config_descriptor *actconfig;/* the active configuration */
        int epmaxpacket[16];            /* endpoint specific maximums */
@@ -362,7 +362,7 @@ extern void usb_destroy_configuration(struct usb_device *dev);
 #define usb_pipedevice(pipe)   (((pipe) >> 8) & 0x7f)
 #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
 #define usb_pipedata(pipe)     (((pipe) >> 19) & 1)
-#define usb_pipeout(pipe)      (((pipe) & 0x80) == 0)
+#define usb_pipeout(pipe)      ((((pipe) >> 7) & 1) ^ 1)
 #define usb_pipeslow(pipe)     (((pipe) >> 26) & 1)
 
 #define usb_pipetype(pipe)     (((pipe) >> 30) & 3)
@@ -374,9 +374,9 @@ extern void usb_destroy_configuration(struct usb_device *dev);
 #define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
 
 /* The D0/D1 toggle bits */
-#define usb_gettoggle(dev, ep) (((dev)->toggle >> ep) & 1)
-#define        usb_dotoggle(dev, ep)   ((dev)->toggle ^= (1 << ep))
-#define usb_settoggle(dev, ep, bit) ((dev)->toggle = ((dev)->toggle & ~(1 << ep)) | ((bit) << ep))
+#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
+#define        usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
+#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
 
 /* Endpoint halt */
 #define usb_endpoint_halt(dev, ep) ((dev)->halted |= (1 << (ep)))
index e7e15140551328637de8a3cd530800dc8193c457..9d9f0242dacb6ab76c9fba4b446924254b950563 100644 (file)
@@ -89,7 +89,7 @@ static struct inode_operations proc_bus_zorro_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 25a0eb4b4ddcd865024db2f7b4fb3c7c541817f2..0d0d11a06f1640566c3d99767cb920ec68b8e52e 100644 (file)
@@ -51,7 +51,7 @@ struct inode_operations adfs_dir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* read link */
        NULL,                   /* follow link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* read page */
        NULL,                   /* write page */
        NULL,                   /* flush page */
index 3963de876c155a9c0cd3403b7309c49350c49b18..c415597e3b98bde0c5cb623babea8b78707b5c90 100644 (file)
@@ -61,7 +61,7 @@ struct inode_operations adfs_file_inode_operations = {
        NULL,                   /* rename                       */
        NULL,                   /* readlink                     */
        NULL,                   /* follow_link                  */
-       adfs_bmap,              /* bmap                         */
+       adfs_bmap,              /* get_block                    */
        block_read_full_page,   /* readpage                     */
        NULL,                   /* writepage                    */
        NULL,                   /* flushpage                    */
index 206cc1ec85721ecfb9e9ddac329a3420cc394375..b88eac7706d2655fb611194dc80efa425181ea5c 100644 (file)
@@ -57,7 +57,7 @@ struct inode_operations affs_dir_inode_operations = {
        affs_rename,            /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 8dbb341a01031ae72f4bca7bc97673339d62e6ee..358c1c56cccd09ac185e5e0fe30f8b99bf2d22ca 100644 (file)
@@ -74,7 +74,7 @@ struct inode_operations affs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       affs_bmap,              /* bmap */
+       affs_bmap,              /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -115,7 +115,7 @@ struct inode_operations affs_file_inode_operations_ofs = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 9ab825b7f242ecfea46b0a9e7f1e2dc5819499d4..18c03730f4789ac862dbffb93135427fb4f6f584 100644 (file)
@@ -35,7 +35,7 @@ struct inode_operations affs_symlink_inode_operations = {
        NULL,                   /* rename */
        affs_readlink,          /* readlink */
        affs_follow_link,       /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 1ab08339091330b42dfe7dd3ae76c001761efde8..a8262e7018c9cb5f52a9b9c779802927ae57b1d5 100644 (file)
@@ -73,7 +73,7 @@ struct inode_operations autofs_dir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index ab574e0fabad297b11c8f9f98646384251daeec7..c6034c7548bb1ad2cb7b57e0c0b0eb1d13d2c094 100644 (file)
@@ -54,7 +54,7 @@ struct inode_operations autofs_root_inode_operations = {
         NULL,                   /* rename */
         NULL,                   /* readlink */
         NULL,                   /* follow_link */
-        NULL,                   /* bmap */
+        NULL,                   /* get_block */
         NULL,                   /* readpage */
         NULL,                   /* writepage */
         NULL,                   /* flushpage */
index 545b0f5f797ec1f528efffbc36253a89c815317f..6ca720527314e29ce0668e6965def473fec89c4d 100644 (file)
@@ -49,7 +49,7 @@ struct inode_operations autofs_symlink_inode_operations = {
        NULL,                   /* rename */
        autofs_readlink,        /* readlink */
        autofs_follow_link,     /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index a535eabd7c8e037a2e3b676fa5ef90250b4567aa..4313edb692c8cfed2e38f8e32e8f3dd0840dd4e6 100644 (file)
@@ -77,7 +77,7 @@ struct inode_operations coda_dir_inode_operations =
        coda_rename,            /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 000d441ae6052eb099a1afd269b04923b517f551..54a87e334d94eaf5fab2599f06f58d226e790b6d 100644 (file)
@@ -47,7 +47,7 @@ struct inode_operations coda_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        coda_readpage,          /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index ac0e704fb76b596a12443a9a6b96b6c1c1e9bb89..3e6924f15f6dd6ed4f2677905f33c6005404bfe7 100644 (file)
@@ -46,7 +46,7 @@ struct inode_operations coda_ioctl_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 9d2f1e55ebf9f5f440427e3742c2dc30a359bea8..cfe0dbcb759f916c21d6239af7b86228d7cd5715 100644 (file)
@@ -42,7 +42,7 @@ struct inode_operations coda_symlink_inode_operations = {
        NULL,                   /* rename */
        coda_readlink,          /* readlink */
        coda_follow_link,       /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index cddac24c901052fe1d92193f484d9f167418a5d5..9b5408235f842e3276e1906809fda40007c744fd 100644 (file)
@@ -51,7 +51,7 @@ struct inode_operations devpts_root_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 84a141b67bea54398b23af97d6ec6fe53ce51771..29f2ebbc3f339bcb400b938363b7d152f977f8ed 100644 (file)
@@ -25,6 +25,8 @@ static struct file_operations efs_dir_operations = {
        NULL                    /* revalidate */
 };
 
+extern int efs_get_block(struct inode *, long, struct buffer_head *, int);
+
 struct inode_operations efs_dir_inode_operations = {
        &efs_dir_operations,    /* default directory file-ops */
        NULL,                   /* create */
@@ -38,7 +40,7 @@ struct inode_operations efs_dir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       efs_bmap,               /* bmap */
+       efs_get_block,          /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 8aa91f29c52566d3e35205ab2500cbec2431b578..b86965f8fa8ed2e24f3acf9b6fa588cdc320e1ce 100644 (file)
@@ -8,6 +8,59 @@
 
 #include <linux/efs_fs.h>
 
+int efs_get_block(struct inode *inode, long iblock,
+                 struct buffer_head *bh_result, int create)
+{
+       int error = -EROFS;
+       long phys;
+
+       if (create)
+               return error;
+       if (iblock >= inode->i_blocks) {
+#ifdef DEBUG
+               /*
+                * i have no idea why this happens as often as it does
+                */
+               printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
+                       block,
+                       inode->i_blocks,
+                       inode->i_size);
+#endif
+               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);
+       }
+       return 0;
+}
+
+int efs_bmap(struct inode *inode, efs_block_t block) {
+
+       if (block < 0) {
+               printk(KERN_WARNING "EFS: bmap(): block < 0\n");
+               return 0;
+       }
+
+       /* are we about to read past the end of a file ? */
+       if (!(block < inode->i_blocks)) {
+#ifdef DEBUG
+               /*
+                * i have no idea why this happens as often as it does
+                */
+               printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
+                       block,
+                       inode->i_blocks,
+                       inode->i_size);
+#endif
+               return 0;
+       }
+
+       return efs_map_block(inode, block);
+}
+
 static struct file_operations efs_file_operations = {
        NULL,                   /* lseek */
        generic_file_read,      /* read */
@@ -38,7 +91,7 @@ struct inode_operations efs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       efs_bmap,               /* bmap */
+       efs_get_block,          /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -47,28 +100,3 @@ struct inode_operations efs_file_inode_operations = {
        NULL,                   /* smap */
        NULL                    /* revalidate */
 };
-int efs_bmap(struct inode *inode, efs_block_t block) {
-
-       if (block < 0) {
-               printk(KERN_WARNING "EFS: bmap(): block < 0\n");
-               return 0;
-       }
-
-       /* are we about to read past the end of a file ? */
-       if (!(block < inode->i_blocks)) {
-#ifdef DEBUG
-               /*
-                * i have no idea why this happens as often as it does
-                */
-               printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
-                       block,
-                       inode->i_blocks,
-                       inode->i_size);
-#endif
-               return 0;
-       }
-
-       return efs_map_block(inode, block);
-}
-
index ac54f60344a096cff997949ebd6179677de089af..69ddda45b164df3801e502f23fdfa81664b2acb0 100644 (file)
@@ -26,7 +26,7 @@ struct inode_operations efs_symlink_inode_operations = {
        NULL,                   /* rename */
        efs_readlink,           /* readlink */
        efs_follow_link,        /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 94ea36adfa4ef914f54dd489328c0c9981c387ef..5d964da2b56f1d504b609a8763d126ca6551cf07 100644 (file)
@@ -57,7 +57,7 @@ struct inode_operations fat_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       fat_bmap,               /* bmap */
+       fat_bmap,               /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -109,7 +109,7 @@ struct inode_operations fat_file_inode_operations_1024 = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -146,7 +146,7 @@ struct inode_operations fat_file_inode_operations_readpage = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        fat_readpage,           /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 45b68daecbd3992f3fe84b674a7a01c6b0c6193c..80c3a08bab79891c9bafab74ef332df16e4fc404 100644 (file)
@@ -80,7 +80,7 @@ struct file * get_empty_filp(void)
                nr_free_files--;
        new_one:
                memset(f, 0, sizeof(*f));
-               f->f_count = 1;
+               atomic_set(&f->f_count, 1);
                f->f_version = ++event;
                f->f_uid = current->fsuid;
                f->f_gid = current->fsgid;
@@ -120,7 +120,7 @@ int init_private_file(struct file *filp, struct dentry *dentry, int mode)
 {
        memset(filp, 0, sizeof(*filp));
        filp->f_mode   = mode;
-       filp->f_count  = 1;
+       atomic_set(&filp->f_count, 1);
        filp->f_dentry = dentry;
        filp->f_uid    = current->fsuid;
        filp->f_gid    = current->fsgid;
@@ -133,21 +133,17 @@ int init_private_file(struct file *filp, struct dentry *dentry, int mode)
 
 void fput(struct file *file)
 {
-       int count = file->f_count-1;
-
-       if (!count) {
+       if (atomic_dec_and_test(&file->f_count)) {
                locks_remove_flock(file);
                __fput(file);
-               file->f_count = 0;
                remove_filp(file);
                insert_file_free(file);
-       } else
-               file->f_count = count;
+       }
 }
 
 void put_filp(struct file *file)
 {
-       if(--file->f_count == 0) {
+       if (atomic_dec_and_test(&file->f_count)) {
                remove_filp(file);
                insert_file_free(file);
        }
index a60b057cae98a05d90c2d3b84f19f72ae52581cc..a5ce908a7622f5db2d1583b32d0169b295889d7b 100644 (file)
@@ -87,7 +87,7 @@ struct inode_operations hfs_cap_ndir_inode_operations = {
        hfs_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -110,7 +110,7 @@ struct inode_operations hfs_cap_fdir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -133,7 +133,7 @@ struct inode_operations hfs_cap_rdir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 20c418c1a9375b21eb7c32d1ff244ccc039b904f..d68f7ed6a9c6e5c96a244c62686e8fc201f7910c 100644 (file)
@@ -86,7 +86,7 @@ struct inode_operations hfs_dbl_dir_inode_operations = {
        dbl_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 94292cd5d63bb4f8dbf0f08c5e8fd46c31d240b6..aa8a90220b577bbd7665755cd056e67dbb20357e 100644 (file)
@@ -93,7 +93,7 @@ struct inode_operations hfs_nat_ndir_inode_operations = {
        hfs_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -116,7 +116,7 @@ struct inode_operations hfs_nat_hdir_inode_operations = {
        nat_hdr_rename,         /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 0ef1bd34c6b0d2f7e3ccf4fcd5e79a574c23fe5a..6b01cd9e0dd5500dfb0f098aad1ee1f6e9d545c3 100644 (file)
@@ -63,7 +63,7 @@ struct inode_operations hfs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       hfs_bmap,               /* bmap */
+       hfs_bmap,               /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 040369fd586b8c02b2b8e1b422c1eed27626b744..e96dd7f20beeac899b8b84310c12b9cb4ee6a012 100644 (file)
@@ -77,7 +77,7 @@ struct inode_operations hfs_cap_info_inode_operations = {
        NULL,                           /* rename */
        NULL,                           /* readlink */
        NULL,                           /* follow_link */
-       NULL,                           /* bmap - none */
+       NULL,                           /* get_block - none */
        NULL,                           /* readpage */
        NULL,                           /* writepage */
        NULL,                           /* flushpage */
index e262136bb671c8b00575a0895714b87c3a80a034..58a12133a57e3bfd06407f7aca411110f426b8b1 100644 (file)
@@ -78,7 +78,7 @@ struct inode_operations hfs_hdr_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap - XXX: not available since
+       NULL,                   /* get_block - XXX: not available since
                                   header part has no disk block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
index f2c4a353273378bde861bb9d131dbd9e6b1fde6c..62410ca2667f002252a87f7fc368b76d6b230332 100644 (file)
@@ -301,13 +301,20 @@ void hpfs_remove_btree(struct super_block *s, struct bplus_header *btree)
                anode = hpfs_map_anode(s, ano, &bh);
                btree1 = &anode->btree;
        } else btree1 = btree;
-       for (i = 0; i < btree1->n_used_nodes; i++)
-               if (btree1->u.internal[i].down == oano)
-                       if ((pos = i + 1) < btree1->n_used_nodes) goto go_down;
-                       else goto go_up;
-       hpfs_error(s, "reference to anode %08x not found in anode %08x (probably bad up pointer)",
-               oano, level ? ano : -1);
-       if (level) brelse(bh);
+       for (i = 0; i < btree1->n_used_nodes; i++) {
+               if (btree1->u.internal[i].down == oano) {
+                       if ((pos = i + 1) < btree1->n_used_nodes)
+                               goto go_down;
+                       else
+                               goto go_up;
+               }
+       }
+       hpfs_error(s,
+                  "reference to anode %08x not found in anode %08x "
+                  "(probably bad up pointer)",
+                  oano, level ? ano : -1);
+       if (level)
+               brelse(bh);
 }
 
 /* Just a wrapper around hpfs_bplus_lookup .. used for reading eas */
index 6dac91fd8d93cfd063d1648c6a769b6925bfddc5..d7abdc991f7fee6037c362812f8266069457c9b0 100644 (file)
@@ -233,10 +233,10 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, char *key, char *data
                                goto bail;
                        fnode->ea_anode = 0;
                        len++;
-               }
-               else if (!fnode->ea_anode)
-                       if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) len++;
-                       else {
+               } else if (!fnode->ea_anode) {
+                       if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) {
+                               len++;
+                       else {
                                /* Aargh... don't know how to create ea anodes :-( */
                                /*struct buffer_head *bh;
                                struct anode *anode;
@@ -280,10 +280,15 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, char *key, char *data
                                fnode->ea_secno = new_sec;
                                len = (pos + 511) >> 9;
                        }
-               if (fnode->ea_anode)
-                       if (hpfs_add_sector_to_btree(s, fnode->ea_secno, 0, len) != -1)
+               }
+               if (fnode->ea_anode) {
+                       if (hpfs_add_sector_to_btree(s, fnode->ea_secno,
+                                                    0, len) != -1) {
                                len++;
-                       else goto bail;
+                       } else {
+                               goto bail;
+                       }
+               }
        }
        h[0] = 0;
        h[1] = strlen(key);
index 88bd8b88697623c5db911bd105d0db4ec13ec32b..fbb1f2f6c9cc594246a6350d9536d72e2b58369a 100644 (file)
@@ -137,24 +137,14 @@ static int hpfs_get_block(struct inode *inode, unsigned long block, struct buffe
        return buffer_uptodate(bh) ? 0 : -EIO;
 }
 
-int hpfs_writepage(struct file *file, struct page *page)
-{
-       return block_write_full_page(file, page, hpfs_get_block);
-}
-
-long hpfs_write_one_page (struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf)
-{
-        return block_write_partial_page(file, page, offset, bytes, buf, hpfs_get_block);
-}
-
-
 ssize_t hpfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
        ssize_t retval;
-       struct inode *inode = file->f_dentry->d_inode;
-       retval = generic_file_write(file, buf, count, ppos, hpfs_write_one_page);
+
+       retval = generic_file_write(file, buf, count,
+                                   ppos, block_write_partial_page);
        if (retval > 0) {
-               /*remove_suid(inode);*/
+               struct inode *inode = file->f_dentry->d_inode;
                inode->i_mtime = CURRENT_TIME;
                inode->i_hpfs_dirty = 1;
        }
index b3132c450f587d637a98cb8932f7cea1c331b8e5..efc776218d8291e27091f6215cf1e97e6cb467f8 100644 (file)
@@ -42,7 +42,8 @@ static const struct inode_operations hpfs_file_iops =
        NULL,                           /* readlink */
        NULL,                           /* follow_link */
        (int (*)(struct inode *, int))
-       &hpfs_bmap,                     /* bmap */
+#warning Someone needs to code up hpfs_get_block properly... -DaveM
+       &hpfs_bmap,                     /* get_block */
        block_read_full_page,           /* readpage */
        hpfs_writepage,                 /* writepage */
        block_flushpage,                /* flushpage */
@@ -85,7 +86,7 @@ static const struct inode_operations hpfs_dir_iops =
        hpfs_rename,                    /* rename */
        NULL,                           /* readlink */
        NULL,                           /* follow_link */
-       NULL,                           /* bmap */
+       NULL,                           /* get_block */
        NULL,                           /* readpage */
        NULL,                           /* writepage */
        NULL,                           /* flushpage */
@@ -109,7 +110,7 @@ const struct inode_operations hpfs_symlink_iops =
        NULL,                           /* rename */
        hpfs_readlink,                  /* readlink */
        hpfs_follow_link,               /* follow_link */
-       NULL,                           /* bmap */
+       NULL,                           /* get_block */
        NULL,                           /* readpage */
        NULL,                           /* writepage */
        NULL,                           /* flushpage */
index a50f2a49b90e4394652c4080983a0166a91d9253..c6291c83a96a1e82a3a4cbb431b43d984926860a 100644 (file)
@@ -283,7 +283,7 @@ int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask,
        return 1;
 }
 
-static inline void hpfs_help()
+static inline void hpfs_help(void)
 {
        printk("\n\
 HPFS filesystem options:\n\
index 6085fc6b3cce32926bbe6243455d8099211a26f0..bc64dfdd587b6cc1cf1c8bff9a17a83b2675a706 100644 (file)
@@ -57,7 +57,7 @@ struct inode_operations isofs_dir_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index d0bfa299ecaae104624cdb06dd827fd7b7e6423d..fd9b124ed53c48a2f2a8a2c7e932a173bca517fe 100644 (file)
@@ -48,7 +48,7 @@ struct inode_operations isofs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       isofs_bmap,             /* bmap */
+       isofs_get_block,        /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 01d37a849be284d510974e415a5f4c03bba4b438..1cf86ae6366c777fbb9b98a01bd0b5ccfeb3a1e7 100644 (file)
@@ -55,7 +55,7 @@ static int isofs_cmpi_ms(struct dentry *dentry, struct qstr *a, struct qstr *b);
 static int isofs_cmp_ms(struct dentry *dentry, struct qstr *a, struct qstr *b);
 #endif
 
-void isofs_put_super(struct super_block *sb)
+static void isofs_put_super(struct super_block *sb)
 {
 #ifdef CONFIG_JOLIET
        if (sb->u.isofs_sb.s_nls_iocharset) {
@@ -73,6 +73,9 @@ void isofs_put_super(struct super_block *sb)
        return;
 }
 
+static void isofs_read_inode(struct inode *);
+static int isofs_statfs (struct super_block *, struct statfs *, int);
+
 static struct super_operations isofs_sops = {
        isofs_read_inode,
        NULL,                   /* write_inode */
@@ -487,8 +490,8 @@ static unsigned int isofs_get_last_session(kdev_t dev,s32 session )
  * Note: a check_disk_change() has been done immediately prior
  * to this call, so we don't need to check again.
  */
-struct super_block *isofs_read_super(struct super_block *s, void *data,
-                                    int silent)
+static struct super_block *isofs_read_super(struct super_block *s, void *data,
+                                           int silent)
 {
        kdev_t                          dev = s->s_dev;
        struct buffer_head            * bh = NULL, *pri_bh = NULL;
@@ -894,7 +897,7 @@ out_unlock:
        return NULL;
 }
 
-int isofs_statfs (struct super_block *sb, struct statfs *buf, int bufsiz)
+static int isofs_statfs (struct super_block *sb, struct statfs *buf, int bufsiz)
 {
        struct statfs tmp;
 
@@ -910,96 +913,115 @@ int isofs_statfs (struct super_block *sb, struct statfs *buf, int bufsiz)
        return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
 }
 
-static int do_isofs_bmap(struct inode * inode,int block)
+/* Life is simpler than for other filesystem since we never
+ * have to create a new block, only find an existing one.
+ */
+int isofs_get_block(struct inode *inode, long iblock,
+                   struct buffer_head *bh_result, int create)
 {
-       off_t b_off, offset, size;
-       struct inode *ino;
+       off_t b_off, offset, sect_size;
        unsigned int firstext;
        unsigned long nextino;
-       int i;
+       int i, err;
 
-       if (block<0) {
-               printk("_isofs_bmap: block<0");
-               return 0;
-       }
+       lock_kernel();
 
-       b_off = block << ISOFS_BUFFER_BITS(inode);
+       err = -EROFS;
+       if (create)
+               goto abort_create_attempted;
 
-       /*
-        * If we are beyond the end of this file, don't give out any
+       err = -EIO;
+       if (iblock < 0)
+               goto abort_negative;
+
+       b_off = iblock << ISOFS_BUFFER_BITS(inode);
+
+       /* If we are beyond the end of this file, don't give out any
         * blocks.
         */
-       if( b_off > inode->i_size )
-         {
-           off_t       max_legal_read_offset;
-
-           /*
-            * If we are *way* beyond the end of the file, print a message.
-            * Access beyond the end of the file up to the next page boundary
-            * is normal, however because of the way the page cache works.
-            * In this case, we just return 0 so that we can properly fill
-            * the page with useless information without generating any
-            * I/O errors.
-            */
-           max_legal_read_offset = (inode->i_size + PAGE_SIZE - 1)
-             & ~(PAGE_SIZE - 1);
-           if( b_off >= max_legal_read_offset )
-             {
-
-               printk("_isofs_bmap: block>= EOF(%d, %ld)\n", block,
-                      inode->i_size);
-             }
-           return 0;
-         }
+       if (b_off > inode->i_size) {
+               off_t max_legal_read_offset;
+
+               /* If we are *way* beyond the end of the file, print a message.
+                * Access beyond the end of the file up to the next page boundary
+                * is normal, however because of the way the page cache works.
+                * In this case, we just return 0 so that we can properly fill
+                * the page with useless information without generating any
+                * I/O errors.
+                */
+               max_legal_read_offset = (inode->i_size + PAGE_SIZE - 1)
+                       & ~(PAGE_SIZE - 1);
+               if (b_off >= max_legal_read_offset)
+                       goto abort_beyond_end;
+       }
+
+       offset    = 0;
+       firstext  = inode->u.isofs_i.i_first_extent;
+       sect_size = inode->u.isofs_i.i_section_size;
+       nextino   = inode->u.isofs_i.i_next_section_ino;
 
-       offset = 0;
-       firstext = inode->u.isofs_i.i_first_extent;
-       size = inode->u.isofs_i.i_section_size;
-       nextino = inode->u.isofs_i.i_next_section_ino;
-#ifdef DEBUG
-       printk("first inode: inode=%x nextino=%x firstext=%u size=%lu\n",
-               inode->i_ino, nextino, firstext, size);
-#endif
        i = 0;
        if (nextino) {
-               while(b_off >= offset + size) {
-                       offset += size;
-
-                       if(nextino == 0) return 0;
-                       ino = iget(inode->i_sb, nextino);
-                       if(!ino) return 0;
-                       firstext = ino->u.isofs_i.i_first_extent;
-                       size = ino->u.isofs_i.i_section_size;
-#ifdef DEBUG
-                       printk("read inode: inode=%lu ino=%lu nextino=%lu firstext=%u size=%lu\n",
-                              inode->i_ino, nextino, ino->u.isofs_i.i_next_section_ino, firstext, size);
-#endif
-                       nextino = ino->u.isofs_i.i_next_section_ino;
-                       iput(ino);
-               
-                       if(++i > 100) {
-                               printk("isofs_bmap: More than 100 file sections ?!?, aborting...\n");
-                               printk("isofs_bmap: ino=%lu block=%d firstext=%u size=%u nextino=%lu\n",
-                                      inode->i_ino, block, firstext, (unsigned)size, nextino);
-                               return 0;
-                       }
+               while (b_off >= (offset + sect_size)) {
+                       struct inode *ninode;
+
+                       offset += sect_size;
+                       if (nextino == 0)
+                               goto abort;
+                       ninode = iget(inode->i_sb, nextino);
+                       if (!ninode)
+                               goto abort;
+                       firstext  = ninode->u.isofs_i.i_first_extent;
+                       sect_size = ninode->u.isofs_i.i_section_size;
+                       nextino   = ninode->u.isofs_i.i_next_section_ino;
+                       iput(ninode);
+
+                       if (++i > 100)
+                               goto abort_too_many_sections;
                }
        }
-#ifdef DEBUG
-       printk("isofs_bmap: mapped inode:block %x:%d to block %lu\n",
-               inode->i_ino, block, (b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode));
-#endif
-       return (b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode);
-}
 
-int isofs_bmap(struct inode * inode,int block)
-{
-       int retval;
+       bh_result->b_dev = inode->i_dev;
+       bh_result->b_blocknr =
+               (b_off - offset + firstext) >> ISOFS_BUFFER_BITS(inode);
+       bh_result->b_state |= (1UL << BH_Mapped);
+       err = 0;
 
-       lock_kernel();
-       retval = do_isofs_bmap(inode, block);
+abort:
        unlock_kernel();
-       return retval;
+       return err;
+
+abort_create_attempted:
+       printk("_isofs_bmap: Kernel tries to allocate a block\n");
+       goto abort;
+
+abort_negative:
+       printk("_isofs_bmap: block < 0\n");
+       goto abort;
+
+abort_beyond_end:
+       printk("_isofs_bmap: block >= EOF (%ld, %ld)\n",
+              iblock, inode->i_size);
+       goto abort;
+
+abort_too_many_sections:
+       printk("isofs_bmap: More than 100 file sections ?!?, aborting...\n");
+       printk("isofs_bmap: ino=%lu block=%ld firstext=%u sect_size=%u nextino=%lu\n",
+              inode->i_ino, iblock, firstext, (unsigned) sect_size, nextino);
+       goto abort;
+}
+
+int isofs_bmap(struct inode *inode, int block)
+{
+       struct buffer_head dummy;
+       int error;
+
+       dummy.b_state = 0;
+       dummy.b_blocknr = -1000;
+       error = isofs_get_block(inode, block, &dummy, 0);
+       if (!error)
+               return dummy.b_blocknr;
+       return 0;
 }
 
 static void test_and_set_uid(uid_t *p, uid_t value)
@@ -1101,7 +1123,7 @@ out_toomany:
        goto out;
 }
 
-void isofs_read_inode(struct inode * inode)
+static void isofs_read_inode(struct inode * inode)
 {
        struct super_block *sb = inode->i_sb;
        unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
index e5fc7fcbd896ac68dd9acbb2dd96c4aa0aace66f..e5a7a2c726d749ddfec7b6c922be4b2b1f583002 100644 (file)
@@ -38,7 +38,7 @@ struct inode_operations isofs_symlink_inode_operations = {
        NULL,                   /* rename */
        isofs_readlink,         /* readlink */
        isofs_follow_link,      /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 301b92c9eaacc67a65a8627775f667cdf3b9052a..728985c34b67ccb0782e8567d799d73ae1a8c872 100644 (file)
@@ -563,11 +563,14 @@ int locks_verify_area(int read_write, struct inode *inode, struct file *filp,
        /* Candidates for mandatory locking have the setgid bit set
         * but no group execute bit -  an otherwise meaningless combination.
         */
-       if (IS_MANDLOCK(inode) &&
-           (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
-               return (locks_mandatory_area(read_write, inode, filp, offset,
-                                            count));
-       return (0);
+       if (IS_MANDLOCK(inode) && (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) {
+               int retval;
+               lock_kernel();
+               retval = locks_mandatory_area(read_write, inode, filp, offset, count);
+               unlock_kernel();
+               return retval;
+       }
+       return 0;
 }
 
 int locks_mandatory_locked(struct inode *inode)
index 532215faf942ffe84149aedcd94dc6a9b60c4361..a44d5d69d5d5d6158ae57d92df989bc249bb3aea 100644 (file)
@@ -52,7 +52,7 @@ struct inode_operations minix_dir_inode_operations = {
        minix_rename,           /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 1f2758a20db17b52007ebc136a16dc4de537fe22..14d478bde77f57257e70771f981c06f9ee82d081 100644 (file)
 #include <linux/fs.h>
 #include <linux/minix_fs.h>
 
-static int minix_writepage(struct file *file, struct page *page)
-{
-       return block_write_full_page(file, page, minix_getblk_block);
-}
-
-static long minix_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf)
-{
-       return block_write_partial_page(file, page, offset, bytes, buf, minix_getblk_block);
-}
-
 /*
  * Write to a file (through the page cache).
  */
 static ssize_t
 minix_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
-       return generic_file_write(file, buf, count, ppos, minix_write_one_page);
+       return generic_file_write(file, buf, count,
+                                 ppos, block_write_partial_page);
 }
 
 /*
@@ -80,9 +71,9 @@ struct inode_operations minix_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       minix_bmap,             /* bmap */
+       minix_get_block,        /* get_block */
        block_read_full_page,   /* readpage */
-       minix_writepage,        /* writepage */
+       block_write_full_page,  /* writepage */
        block_flushpage,        /* flushpage */
        minix_truncate,         /* truncate */
        NULL,                   /* permission */
index 088de42dcbd21594076316d8b890ce1456bcf528..e5352090d9858e96db92b98ae6517edd6a41b44b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/stat.h>
 #include <linux/locks.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -361,112 +362,127 @@ static int V1_block_bmap(struct buffer_head * bh, int nr)
        return tmp;
 }
 
-static int V1_minix_bmap(struct inode * inode,int block)
+static int V1_minix_block_map(struct inode * inode, long block)
 {
-       int i;
+       int i, ret;
 
-       if (block<0) {
+       ret = 0;
+       lock_kernel();
+       if (block < 0) {
                printk("minix_bmap: block<0");
-               return 0;
+               goto out;
        }
        if (block >= (inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)) {
                printk("minix_bmap: block>big");
-               return 0;
+               goto out;
+       }
+       if (block < 7) {
+               ret = V1_inode_bmap(inode,block);
+               goto out;
        }
-       if (block < 7)
-               return V1_inode_bmap(inode,block);
        block -= 7;
        if (block < 512) {
                i = V1_inode_bmap(inode,7);
                if (!i)
-                       return 0;
-               return V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block);
+                       goto out;
+               ret = V1_block_bmap(bread(inode->i_dev, i,
+                                         BLOCK_SIZE), block);
+               goto out;
        }
        block -= 512;
        i = V1_inode_bmap(inode,8);
        if (!i)
-               return 0;
+               goto out;
        i = V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block>>9);
        if (!i)
-               return 0;
-       return V1_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 511);
+               goto out;
+       ret = V1_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                           block & 511);
+out:
+       unlock_kernel();
+       return ret;
 }
 
 /*
  * The minix V2 fs bmap functions.
  */
-#define V2_inode_bmap(inode,nr) (((unsigned long  *)(inode)->u.minix_i.u.i2_data)[(nr)])
+#define V2_inode_bmap(inode,nr) (((unsigned int *)(inode)->u.minix_i.u.i2_data)[(nr)])
 static int V2_block_bmap(struct buffer_head * bh, int nr)
 {
        int tmp;
 
        if (!bh)
                return 0;
-       tmp = ((unsigned long *) bh->b_data)[nr];
+       tmp = ((unsigned int *) bh->b_data)[nr];
        brelse(bh);
        return tmp;
 }
 
-static int V2_minix_bmap(struct inode * inode, int block)
+static int V2_minix_block_map(struct inode * inode, int block)
 {
-       int i;
+       int i, ret;
 
-       if (block<0) {
+       ret = 0;
+       lock_kernel();
+       if (block < 0) {
                printk("minix_bmap: block<0");
-               return 0;
+               goto out;
        }
        if (block >= (inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)) {
                printk("minix_bmap: block>big");
-               return 0;
+               goto out;
+       }
+       if (block < 7) {
+               ret = V2_inode_bmap(inode,block);
+               goto out;
        }
-       if (block < 7)
-               return V2_inode_bmap(inode,block);
        block -= 7;
        if (block < 256) {
-               i = V2_inode_bmap(inode,7);
+               i = V2_inode_bmap(inode, 7);
                if (!i)
-                       return 0;
-               return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block);
+                       goto out;
+               ret = V2_block_bmap(bread(inode->i_dev, i,
+                                         BLOCK_SIZE), block);
+               goto out;
        }
        block -= 256;
-       if (block < 256*256) {
-               i = V2_inode_bmap(inode,8);
+       if (block < (256 * 256)) {
+               i = V2_inode_bmap(inode, 8);
                if (!i)
-                       return 0;
-               i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block >> 8);
+                       goto out;
+               i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                                 block >> 8);
                if (!i)
-                       return 0;
-               return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 255);
+                       goto out;
+               ret = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                                   block & 255);
+               goto out;
        }
-       block -= 256*256;
-       i = V2_inode_bmap(inode,9);
+       block -= (256 * 256);
+       i = V2_inode_bmap(inode, 9);
        if (!i)
-               return 0;
-       i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block >> 16);
+               goto out;
+       i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                         block >> 16);
        if (!i)
-               return 0;
-       i = V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),(block >> 8) & 255);
+               goto out;
+       i = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                         (block >> 8) & 255);
        if (!i)
-               return 0;
-       return V2_block_bmap(bread(inode->i_dev,i,BLOCK_SIZE),block & 255);
-}
-
-/*
- * The global minix fs bmap function.
- */
-int minix_bmap(struct inode * inode, int block)
-{
-       if (INODE_VERSION(inode) == MINIX_V1)
-               return V1_minix_bmap(inode, block);
-       else
-               return V2_minix_bmap(inode, block);
+               goto out;
+       ret = V2_block_bmap(bread(inode->i_dev, i, BLOCK_SIZE),
+                           block & 255);
+out:
+       unlock_kernel();
+       return ret;
 }
 
 /*
  * The minix V1 fs getblk functions.
  */
-static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr, int create,
-                                           int metadata, int *phys_block, int *created)
+static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr,
+                                           int new_block, int *err,
+                                           int metadata, int *phys, int *new)
 {
        int tmp;
        unsigned short *p;
@@ -483,15 +499,30 @@ repeat:
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
+                       *phys = tmp;
                        return NULL;
                }
        }
-       if (!create)
-               return NULL;
+       *err = -EFBIG;
+
+       /* Check file limits.. */
+       {
+               unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+               if (limit < RLIM_INFINITY) {
+                       limit >>= BLOCK_SIZE_BITS;
+                       if (new_block >= limit) {
+                               send_sig(SIGXFSZ, current, 0);
+                               *err = -EFBIG;
+                               return NULL;
+                       }
+               }
+       }
+
        tmp = minix_new_block(inode->i_sb);
-       if (!tmp)
+       if (!tmp) {
+               *err = -ENOSPC;
                return NULL;
+       }
        if (metadata) {
                result = getblk(inode->i_dev, tmp, BLOCK_SIZE);
                if (*p) {
@@ -504,12 +535,18 @@ repeat:
                mark_buffer_dirty(result, 1);
        } else {
                if (*p) {
+                       /*
+                        * Nobody is allowed to change block allocation
+                        * state from under us:
+                        */
+                       BUG();
                        minix_free_block(inode->i_sb, tmp);
                        goto repeat;
                }
-               *phys_block = tmp;
+               *phys = tmp;
                result = NULL;
-               *created = 1;
+               *err = 0;
+               *new = 1;
        }
        *p = tmp;
 
@@ -519,22 +556,22 @@ repeat:
 }
 
 static struct buffer_head * V1_block_getblk(struct inode * inode,
-       struct buffer_head * bh, int nr, int create,
-       int metadata, int *phys_block, int *created)
+       struct buffer_head * bh, int nr, int new_block, int *err,
+       int metadata, int *phys, int *new)
 {
        int tmp;
        unsigned short *p;
        struct buffer_head * result;
+       unsigned long limit;
 
+       result = NULL;
        if (!bh)
-               return NULL;
+               goto out;
        if (!buffer_uptodate(bh)) {
                ll_rw_block(READ, 1, &bh);
                wait_on_buffer(bh);
-               if (!buffer_uptodate(bh)) {
-                       brelse(bh);
-                       return NULL;
-               }
+               if (!buffer_uptodate(bh))
+                       goto out;
        }
        p = nr + (unsigned short *) bh->b_data;
 repeat:
@@ -542,27 +579,29 @@ repeat:
        if (tmp) {
                if (metadata) {
                        result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
-                       if (tmp == *p) {
-                               brelse(bh);
-                               return result;
-                       }
+                       if (tmp == *p)
+                               goto out;
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
-                       brelse(bh);
-                       return NULL;
+                       *phys = tmp;
+                       goto out;
                }
        }
-       if (!create) {
-               brelse(bh);
-               return NULL;
+       *err = -EFBIG;
+
+       limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+       if (limit < RLIM_INFINITY) {
+               limit >>= BLOCK_SIZE_BITS;
+               if (new_block >= limit) {
+                       send_sig(SIGXFSZ, current, 0);
+                       goto out;
+               }
        }
+
        tmp = minix_new_block(inode->i_sb);
-       if (!tmp) {
-               brelse(bh);
-               return NULL;
-       }
+       if (!tmp)
+               goto out;
        if (metadata) {
                result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
                if (*p) {
@@ -574,69 +613,118 @@ repeat:
                mark_buffer_uptodate(result, 1);
                mark_buffer_dirty(result, 1);
        } else {
-               if (*p) {
-                       minix_free_block(inode->i_sb, tmp);
-                       goto repeat;
-               }
-               *phys_block = tmp;
-               result = NULL;
-               *created = 1;
+               *phys = tmp;
+               *new = 1;
+       }
+       if (*p) {
+               minix_free_block(inode->i_sb, tmp);
+               brelse(result);
+               goto repeat;
        }
 
        *p = tmp;
        mark_buffer_dirty(bh, 1);
+       *err = 0;
+out:
        brelse(bh);
        return result;
 }
 
-int V1_getblk_block(struct inode * inode, long block, int create, int *err, int *created)
+static int V1_get_block(struct inode * inode, long block,
+                       struct buffer_head *bh_result, int create)
 {
-       struct buffer_head *bh, *tmp;
-       int phys_block;
+       int ret, err, new, phys, ptr;
+       struct buffer_head *bh;
 
-       *err = -EIO;
-       if (block < 0) {
-               printk("minix_getblk: block<0");
-               return 0;
-       }
-       if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE) {
-               printk("minix_getblk: block>big");
+       if (!create) {
+               phys = V1_minix_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);
+               }
                return 0;
        }
-       *created = 0;
-       if (block < 7) {
-               tmp = V1_inode_getblk(inode, block, create,
-                                     0, &phys_block, created);
+
+       err = -EIO;
+       new = 0;
+       ret = 0;
+       bh = NULL;
+
+       lock_kernel();
+       if (block < 0)
+               goto abort_negative;
+       if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)
+               goto abort_too_big;
+
+       err = 0;
+       ptr = block;
+       /*
+        * ok, these macros clean the logic up a bit and make
+        * it much more readable:
+        */
+#define GET_INODE_DATABLOCK(x) \
+               V1_inode_getblk(inode, x, block, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+               V1_inode_getblk(inode, x, block, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+               V1_block_getblk(inode, bh, x, block, &err, 0, &phys, &new)
+#define GET_INDIRECT_PTR(x) \
+               V1_block_getblk(inode, bh, x, block, &err, 1, NULL, NULL)
+
+       if (ptr < 7) {
+               bh = GET_INODE_DATABLOCK(ptr);
                goto out;
        }
-       block -= 7;
-       if (block < 512) {
-               bh = V1_inode_getblk(inode, 7, create, 1, NULL, NULL);
-               tmp = V1_block_getblk(inode, bh, block, create,
-                                     0, &phys_block, created);
-               goto out;
+       ptr -= 7;
+       if (ptr < 512) {
+               bh = GET_INODE_PTR(7);
+               goto get_indirect;
        }
-       block -= 512;
-       bh = V1_inode_getblk(inode, 8, create, 1, NULL, NULL);
-       bh = V1_block_getblk(inode, bh, (block>>9) & 511, create, 1, NULL, NULL);
-       tmp = V1_block_getblk(inode, bh, block & 511, create, 0, &phys_block, created);
+       ptr -= 512;
+       bh = GET_INODE_PTR(8);
+       bh = GET_INDIRECT_PTR((ptr >> 9) & 511);
+get_indirect:
+       bh = GET_INDIRECT_DATABLOCK(ptr & 511);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
 
 out:
-       *err = 0;
-       return phys_block;
+       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);
+abort:
+       unlock_kernel();
+       return err;
+
+abort_negative:
+       printk("minix_getblk: block<0");
+       goto abort;
+
+abort_too_big:
+       printk("minix_getblk: block>big");
+       goto abort;
 }
 
 /*
  * The minix V2 fs getblk functions.
  */
-static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr, int create,
-                                           int metadata, int *phys_block, int *created)
+static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr,
+                                           int new_block, int *err,
+                                           int metadata, int *phys, int *new)
 {
        int tmp;
-       unsigned long *p;
+       unsigned int *p;
        struct buffer_head * result;
 
-       p = (unsigned long *) inode->u.minix_i.u.i2_data + nr;
+       p = (unsigned int *) inode->u.minix_i.u.i2_data + nr;
 repeat:
        tmp = *p;
        if (tmp) {
@@ -647,15 +735,30 @@ repeat:
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
+                       *phys = tmp;
                        return NULL;
                }
        }
-       if (!create)
-               return NULL;
+       *err = -EFBIG;
+
+       /* Check file limits.. */
+       {
+               unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+               if (limit < RLIM_INFINITY) {
+                       limit >>= BLOCK_SIZE_BITS;
+                       if (new_block >= limit) {
+                               send_sig(SIGXFSZ, current, 0);
+                               *err = -EFBIG;
+                               return NULL;
+                       }
+               }
+       }
+
        tmp = minix_new_block(inode->i_sb);
-       if (!tmp)
+       if (!tmp) {
+               *err = -ENOSPC;
                return NULL;
+       }
        if (metadata) {
                result = getblk(inode->i_dev, tmp, BLOCK_SIZE);
                if (*p) {
@@ -668,12 +771,18 @@ repeat:
                mark_buffer_dirty(result, 1);
        } else {
                if (*p) {
+                       /*
+                        * Nobody is allowed to change block allocation
+                        * state from under us:
+                        */
+                       BUG();
                        minix_free_block(inode->i_sb, tmp);
                        goto repeat;
                }
-               *phys_block = tmp;
+               *phys = tmp;
                result = NULL;
-               *created = 1;
+               *err = 0;
+               *new = 1;
        }
        *p = tmp;
 
@@ -683,50 +792,52 @@ repeat:
 }
 
 static struct buffer_head * V2_block_getblk(struct inode * inode,
-       struct buffer_head * bh, int nr, int create,
-       int metadata, int *phys_block, int *created)
+       struct buffer_head * bh, int nr, int new_block, int *err,
+       int metadata, int *phys, int *new)
 {
        int tmp;
-       unsigned long *p;
+       unsigned int *p;
        struct buffer_head * result;
+       unsigned long limit;
 
+       result = NULL;
        if (!bh)
-               return NULL;
+               goto out;
        if (!buffer_uptodate(bh)) {
                ll_rw_block(READ, 1, &bh);
                wait_on_buffer(bh);
-               if (!buffer_uptodate(bh)) {
-                       brelse(bh);
-                       return NULL;
-               }
+               if (!buffer_uptodate(bh))
+                       goto out;
        }
-       p = nr + (unsigned long *) bh->b_data;
+       p = nr + (unsigned int *) bh->b_data;
 repeat:
        tmp = *p;
        if (tmp) {
                if (metadata) {
                        result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
-                       if (tmp == *p) {
-                               brelse(bh);
-                               return result;
-                       }
+                       if (tmp == *p)
+                               goto out;
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
-                       brelse(bh);
-                       return NULL;
+                       *phys = tmp;
+                       goto out;
                }
        }
-       if (!create) {
-               brelse(bh);
-               return NULL;
+       *err = -EFBIG;
+
+       limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+       if (limit < RLIM_INFINITY) {
+               limit >>= BLOCK_SIZE_BITS;
+               if (new_block >= limit) {
+                       send_sig(SIGXFSZ, current, 0);
+                       goto out;
+               }
        }
+
        tmp = minix_new_block(inode->i_sb);
-       if (!tmp) {
-               brelse(bh);
-               return NULL;
-       }
+       if (!tmp)
+               goto out;
        if (metadata) {
                result = getblk(bh->b_dev, tmp, BLOCK_SIZE);
                if (*p) {
@@ -738,103 +849,151 @@ repeat:
                mark_buffer_uptodate(result, 1);
                mark_buffer_dirty(result, 1);
        } else {
-               if (*p) {
-                       minix_free_block(inode->i_sb, tmp);
-                       goto repeat;
-               }
-               *phys_block = tmp;
-               result = NULL;
-               *created = 1;
+               *phys = tmp;
+               *new = 1;
+       }
+       if (*p) {
+               minix_free_block(inode->i_sb, tmp);
+               brelse(result);
+               goto repeat;
        }
 
        *p = tmp;
        mark_buffer_dirty(bh, 1);
+       *err = 0;
+out:
        brelse(bh);
        return result;
 }
 
-int V2_getblk_block(struct inode * inode, int block, int create, int *err, int *created)
+static int V2_get_block(struct inode * inode, long block,
+                       struct buffer_head *bh_result, int create)
 {
-       struct buffer_head * bh, *tmp;
-       int phys_block;
+       int ret, err, new, phys, ptr;
+       struct buffer_head * bh;
 
-       *err = -EIO;
-       if (block < 0) {
-               printk("minix_getblk: block<0");
-               return 0;
-       }
-       if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE) {
-               printk("minix_getblk: block>big");
+       if (!create) {
+               phys = V2_minix_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);
+               }
                return 0;
        }
-       *created = 0;
-       if (block < 7) {
-               tmp = V2_inode_getblk(inode, block, create,
-                                     0, &phys_block, created);
+
+       err = -EIO;
+       new = 0;
+       ret = 0;
+       bh = NULL;
+
+       lock_kernel();
+       if (block < 0)
+               goto abort_negative;
+       if (block >= inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)
+               goto abort_too_big;
+
+       err = 0;
+       ptr = block;
+       /*
+        * ok, these macros clean the logic up a bit and make
+        * it much more readable:
+        */
+#define GET_INODE_DATABLOCK(x) \
+               V2_inode_getblk(inode, x, block, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+               V2_inode_getblk(inode, x, block, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+               V2_block_getblk(inode, bh, x, block, &err, 0, &phys, &new)
+#define GET_INDIRECT_PTR(x) \
+               V2_block_getblk(inode, bh, x, block, &err, 1, NULL, NULL)
+
+       if (ptr < 7) {
+               bh = GET_INODE_DATABLOCK(ptr);
                goto out;
        }
-       block -= 7;
-       if (block < 256) {
-               bh = V2_inode_getblk(inode, 7, create, 1, NULL, NULL);
-               tmp = V2_block_getblk(inode, bh, block, create,
-                                     0, &phys_block, created);
-               goto out;
+       ptr -= 7;
+       if (ptr < 256) {
+               bh = GET_INODE_PTR(7);
+               goto get_indirect;
        }
-       block -= 256;
-       if (block < 256*256) {
-               bh = V2_inode_getblk(inode, 8, create, 1, NULL, NULL);
-               bh = V2_block_getblk(inode, bh, (block>>8) & 255, create,
-                                    1, NULL, NULL);
-               tmp = V2_block_getblk(inode, bh, block & 255, create,
-                                     0, &phys_block, created);
-               goto out;
+       ptr -= 256;
+       if (ptr < 256*256) {
+               bh = GET_INODE_PTR(8);
+               goto get_double;
        }
-       block -= 256*256;
-       bh = V2_inode_getblk(inode, 9, create, 1, NULL, NULL);
-       bh = V2_block_getblk(inode, bh, (block >> 16) & 255, create, 1, NULL, NULL);
-       bh = V2_block_getblk(inode, bh, (block >> 8) & 255, create, 1, NULL, NULL);
-       tmp = V2_block_getblk(inode, bh, block & 255, create, 0, &phys_block, created);
+       ptr -= 256*256;
+       bh = GET_INODE_PTR(9);
+       bh = GET_INDIRECT_PTR((ptr >> 16) & 255);
+get_double:
+       bh = GET_INDIRECT_PTR((ptr >> 8) & 255);
+get_indirect:
+       bh = GET_INDIRECT_DATABLOCK(ptr & 255);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
 
 out:
-       *err = 0;
-       return phys_block;
+       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);
+abort:
+       unlock_kernel();
+       return err;
+
+abort_negative:
+       printk("minix_getblk: block<0");
+       goto abort;
+
+abort_too_big:
+       printk("minix_getblk: block>big");
+       goto abort;
 }
 
-int minix_getblk_block (struct inode *inode, long block,
-                       int create, int *err, int *created)
+int minix_get_block(struct inode *inode, long block,
+                   struct buffer_head *bh_result, int create)
 {
        if (INODE_VERSION(inode) == MINIX_V1)
-               return V1_getblk_block(inode, block, create, err, created);
+               return V1_get_block(inode, block, bh_result, create);
        else
-               return V2_getblk_block(inode, block, create, err, created);
+               return V2_get_block(inode, block, bh_result, create);
 }
 
 /*
  * the global minix fs getblk function.
  */
-struct buffer_head *minix_getblk (struct inode *inode, int block, int create)
+struct buffer_head *minix_getblk(struct inode *inode, int block, int create)
 {
-       struct buffer_head *tmp = NULL;
-       int phys_block;
-       int err, created;
-
-       phys_block = minix_getblk_block(inode, block, create, &err, &created);
-       if (phys_block) {
-               tmp = getblk(inode->i_dev, phys_block, BLOCK_SIZE);
-               if (created) {
-                       memset(tmp->b_data, 0, BLOCK_SIZE);
-                       mark_buffer_uptodate(tmp, 1);
-                       mark_buffer_dirty(tmp, 1);
+       struct buffer_head dummy;
+       int error;
+
+       dummy.b_state = 0;
+       dummy.b_blocknr = -1000;
+       error = minix_get_block(inode, block, &dummy, create);
+       if (!error && buffer_mapped(&dummy)) {
+               struct buffer_head *bh;
+               bh = getblk(dummy.b_dev, dummy.b_blocknr, BLOCK_SIZE);
+               if (buffer_new(&dummy)) {
+                       memset(bh->b_data, 0, BLOCK_SIZE);
+                       mark_buffer_uptodate(bh, 1);
+                       mark_buffer_dirty(bh, 1);
                }
+               return bh;
        }
-       return tmp;
+       return NULL;
 }
 
 struct buffer_head * minix_bread(struct inode * inode, int block, int create)
 {
        struct buffer_head * bh;
 
-       bh = minix_getblk(inode,block,create);
+       bh = minix_getblk(inode, block, create);
        if (!bh || buffer_uptodate(bh))
                return bh;
        ll_rw_block(READ, 1, &bh);
index a46ba219e436b538475b136d80e2e496cc53c8ee..3a8951b096dd35a5fe1870f4ed6d90ff5a22550a 100644 (file)
@@ -33,7 +33,7 @@ struct inode_operations minix_symlink_inode_operations = {
        NULL,                   /* rename */
        minix_readlink,         /* readlink */
        minix_follow_link,      /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 6000b0f6f4b588e983989d22836cbb0b225795fb..fa5e4aed50779e38d548e5fe641622f1a19c67eb 100644 (file)
@@ -627,7 +627,7 @@ struct inode_operations msdos_dir_inode_operations = {
        msdos_rename,           /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index d22487002af211ab0433823b5bfeb515f3b5379e..1f92a89fba2eab14de07daaf9ce4481bc811ea54 100644 (file)
@@ -92,7 +92,7 @@ struct inode_operations ncp_dir_inode_operations =
        ncp_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 916567597392522b005373d253dcc4aefb77007c..3e16cf4083b8639a638e5261c0d145216bc32aa3 100644 (file)
@@ -296,7 +296,7 @@ struct inode_operations ncp_file_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index ec56f0e678e0770f2c29f375841d624c2087a72f..578b2b9859a9a0e565e49493826b336f72c9a975 100644 (file)
@@ -59,7 +59,7 @@ struct inode_operations ncp_symlink_inode_operations={
        NULL,                   /* rename */
        ncp_readlink,           /* readlink */
        ncp_follow_link,        /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 911a5261e738f43ec71574cd23df14afa15ecc41..8b63cbf662c3f20084f2da62281be244c8dd1e97 100644 (file)
@@ -467,7 +467,7 @@ nfs_updatepage(struct file *file, struct page *page, unsigned long offset, unsig
         * The IO completion will then free the page and the dentry.
         */
        get_page(page);
-       file->f_count++;
+       atomic_inc(&file->f_count);
 
        /* Schedule request */
        synchronous = schedule_write_request(req, synchronous);
index 0a63da2c110ba18f0f2500d95550d55144ceb927..cc6bfe2e3a9781712f735ce95d6e39e1c4a805ff 100644 (file)
@@ -439,7 +439,7 @@ static struct inode_operations ntfs_inode_operations_nobmap = {
        NULL, /* rename */
        NULL, /* readlink */
        NULL, /* follow_link */
-       NULL, /* bmap */
+       NULL, /* get_block */
        NULL, /* readpage */
        NULL, /* writepage */
        NULL, /* flushpage */
@@ -622,8 +622,8 @@ static struct inode_operations ntfs_inode_operations = {
        NULL, /* rename */
        NULL, /* readlink */
        NULL, /* follow_link */
-       ntfs_bmap,
-       block_read_full_page,
+       ntfs_bmap, /* get_block */
+       block_read_full_page, /* readpage */
        NULL, /* writepage */
        NULL, /* flushpage */
        NULL, /* truncate */
@@ -671,7 +671,7 @@ static struct inode_operations ntfs_dir_inode_operations = {
        NULL, /* rename */
        NULL, /* readlink */
        NULL, /* follow_link */
-       NULL, /* bmap */
+       NULL, /* get_block */
        NULL, /* readpage */
        NULL, /* writepage */
        NULL, /* flushpage */
index e9da4e32d6859b032aff67f467fa0edb3630aa61..deb898f768dd07c803cbcf77b75dc8a6537729d8 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -790,7 +790,7 @@ int filp_close(struct file *filp, fl_owner_t id)
        int retval;
        struct dentry *dentry = filp->f_dentry;
 
-       if (filp->f_count == 0) {
+       if (!atomic_read(&filp->f_count)) {
                printk("VFS: Close: file count is 0\n");
                return 0;
        }
index c68114035f40116fd51f7237fca9f4ff41d72481..71f20bec52ffcacd8fb0a919dfa4e69e86270e26 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -8,6 +8,7 @@
 #include <linux/file.h>
 #include <linux/poll.h>
 #include <linux/malloc.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
 /* in case of paging and multiple read/write on the same pipe. (FGC)         */
 
 
-static ssize_t pipe_read(struct file * filp, char * buf,
-                        size_t count, loff_t *ppos)
+static ssize_t do_pipe_read(struct file * filp, char * buf, size_t count)
 {
        struct inode * inode = filp->f_dentry->d_inode;
        ssize_t chars = 0, size = 0, read = 0;
         char *pipebuf;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (filp->f_flags & O_NONBLOCK) {
                if (PIPE_LOCK(*inode))
                        return -EAGAIN;
@@ -82,17 +79,13 @@ static ssize_t pipe_read(struct file * filp, char * buf,
                return -EAGAIN;
        return 0;
 }
-       
-static ssize_t pipe_write(struct file * filp, const char * buf,
-                         size_t count, loff_t *ppos)
+
+static ssize_t do_pipe_write(struct file * filp, const char * buf, size_t count)
 {
        struct inode * inode = filp->f_dentry->d_inode;
        ssize_t chars = 0, free = 0, written = 0, err=0;
        char *pipebuf;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (!PIPE_READERS(*inode)) { /* no readers */
                send_sig(SIGPIPE,current,0);
                return -EPIPE;
@@ -147,6 +140,32 @@ errout:
        return written ? written : err;
 }
 
+static ssize_t pipe_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
+{
+       ssize_t retval;
+
+       if (ppos != &filp->f_pos)
+               return -ESPIPE;
+
+       lock_kernel();
+       retval = do_pipe_read(filp, buf, count);
+       unlock_kernel();
+       return retval;
+}
+
+static ssize_t pipe_write(struct file * filp, const char * buf, size_t count, loff_t *ppos)
+{
+       ssize_t retval;
+
+       if (ppos != &filp->f_pos)
+               return -ESPIPE;
+
+       lock_kernel();
+       retval = do_pipe_write(filp, buf, count);
+       unlock_kernel();
+       return retval;
+}
+
 static long long pipe_lseek(struct file * file, long long offset, int orig)
 {
        return -ESPIPE;
index ddf8ff0360c7fb110efcacad4f32ad4828502bcd..8b27142a32852e033235b978bb386d6508d9c407 100644 (file)
@@ -114,7 +114,7 @@ struct inode_operations qnx4_dir_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index dafe212f106222dc399d4711124845a74c52dce4..2e2b9c2fbf7dd33fa0f82697998f051ceee5d051 100644 (file)
@@ -189,7 +189,7 @@ struct inode_operations qnx4_file_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       qnx4_bmap,              /* bmap */
+       qnx4_bmap,              /* get_block */
        qnx4_readpage,          /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 7fedc276092da9889b7e25bc77038a4068782507..c360d8b722a7d30f73bf550dda9be6fbe29ad475 100644 (file)
@@ -43,7 +43,7 @@ struct inode_operations qnx4_symlink_inode_operations =
        NULL,                   /* rename */
        qnx4_readlink,          /* readlink */
        qnx4_follow_link,       /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index c7ea90a69d757396e5662e9858be22ce941bdb32..cf207fed0085c9b65fbebf65d8712d14b51b6ac7 100644 (file)
@@ -117,28 +117,22 @@ asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count)
 {
        ssize_t ret;
        struct file * file;
-       ssize_t (*read)(struct file *, char *, size_t, loff_t *);
-
-       lock_kernel();
 
        ret = -EBADF;
        file = fget(fd);
-       if (!file)
-               goto bad_file;
-       if (!(file->f_mode & FMODE_READ))
-               goto out;
-       ret = locks_verify_area(FLOCK_VERIFY_READ, file->f_dentry->d_inode,
-                               file, file->f_pos, count);
-       if (ret)
-               goto out;
-       ret = -EINVAL;
-       if (!file->f_op || !(read = file->f_op->read))
-               goto out;
-       ret = read(file, buf, count, &file->f_pos);
-out:
-       fput(file);
-bad_file:
-       unlock_kernel();
+       if (file) {
+               if (file->f_mode & FMODE_READ) {
+                       ret = locks_verify_area(FLOCK_VERIFY_READ, file->f_dentry->d_inode,
+                                               file, file->f_pos, count);
+                       if (!ret) {
+                               ssize_t (*read)(struct file *, char *, size_t, loff_t *);
+                               ret = -EINVAL;
+                               if (file->f_op && (read = file->f_op->read) != NULL)
+                                       ret = read(file, buf, count, &file->f_pos);
+                       }
+               }
+               fput(file);
+       }
        return ret;
 }
 
@@ -146,31 +140,23 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count)
 {
        ssize_t ret;
        struct file * file;
-       struct inode * inode;
-       ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
-
-       lock_kernel();
 
        ret = -EBADF;
        file = fget(fd);
-       if (!file)
-               goto bad_file;
-       if (!(file->f_mode & FMODE_WRITE))
-               goto out;
-       inode = file->f_dentry->d_inode;
-       ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file,
+       if (file) {
+               if (file->f_mode & FMODE_WRITE) {
+                       struct inode *inode = file->f_dentry->d_inode;
+                       ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file,
                                file->f_pos, count);
-       if (ret)
-               goto out;
-       ret = -EINVAL;
-       if (!file->f_op || !(write = file->f_op->write))
-               goto out;
-
-       ret = write(file, buf, count, &file->f_pos);
-out:
-       fput(file);
-bad_file:
-       unlock_kernel();
+                       if (!ret) {
+                               ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
+                               ret = -EINVAL;
+                               if (file->f_op && (write = file->f_op->write) != NULL)
+                                       ret = write(file, buf, count, &file->f_pos);
+                       }
+               }
+               fput(file);
+       }
        return ret;
 }
 
index abb55b76246739ac511ed433f9b3f3d49ef53a71..e16802e97a4871173011f044205639b103045a77 100644 (file)
@@ -521,7 +521,7 @@ static struct inode_operations romfs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap -- not really */
+       NULL,                   /* get_block -- not really */
        romfs_readpage,         /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -565,7 +565,7 @@ static struct inode_operations romfs_dir_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -588,7 +588,7 @@ static struct inode_operations romfs_link_inode_operations = {
        NULL,                   /* rename */
        romfs_readlink,         /* readlink */
        romfs_follow_link,      /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 2c4299918100ffdf3aaffe42ab345ffdc20dc33e..4cb1a6d5515302c3dec87a9cf1c487df6a295923 100644 (file)
@@ -64,9 +64,9 @@ void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table
                if (p->nr < __MAX_POLL_TABLE_ENTRIES) {
                        struct poll_table_entry * entry;
 ok_table:
-                       entry = p->entry + p->nr;
-                       entry->filp = filp;
-                       filp->f_count++;
+                       entry = p->entry + p->nr;
+                       entry->filp = filp;
+                       atomic_inc(&filp->f_count);
                        entry->wait_address = wait_address;
                        init_waitqueue_entry(&entry->wait, current);
                        add_wait_queue(wait_address,&entry->wait);
index d945be585528dbdc0fb5158a9652b72e80f1462a..cbaa646b397d2e9a2143f0495b03a1f7e136ead2 100644 (file)
@@ -59,7 +59,7 @@ struct inode_operations smb_dir_inode_operations =
        smb_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 802012a3b9b071e8d435196fc2440379fc3e0b2c..682b511f66d4bdc690f108a2f1d4d3b4deceaa73 100644 (file)
@@ -404,7 +404,7 @@ struct inode_operations smb_file_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        smb_readpage,           /* readpage */
        smb_writepage,          /* writepage */
        NULL,                   /* flushpage */
index 93920fe0f2ed0f33a64db857cc43a6289f66fe0f..d76f1d6b3729a4848fe65393325d2036899957ca 100644 (file)
@@ -59,7 +59,7 @@ struct inode_operations sysv_dir_inode_operations = {
        sysv_rename,            /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 1c0ae0b6a4da9f57e56dd4cc2225f47bc2dbece1..3019c913faab050d0dd5840d211d8c74a1b6f317 100644 (file)
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
 
-static int sysv_writepage (struct file * file, struct page * page)
-{
-       return block_write_full_page(file, page, sysv_getblk_block);
-}
-
-static long sysv_write_one_page (struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
-{
-       return block_write_partial_page(file, page, offset, bytes, buf, sysv_getblk_block);
-}
-
 /*
  * Write to a file (through the page cache).
  */
 static ssize_t
 sysv_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
-       return generic_file_write(file, buf, count, ppos, sysv_write_one_page);
+       return generic_file_write(file, buf, count,
+                                 ppos, block_write_partial_page);
 }
 
 /*
@@ -86,9 +77,9 @@ struct inode_operations sysv_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       sysv_bmap,              /* bmap */
+       sysv_get_block,         /* get_block */
        block_read_full_page,   /* readpage */
-       sysv_writepage,         /* writepage */
+       block_write_full_page,  /* writepage */
        block_flushpage,        /* flushpage */
        sysv_truncate,          /* truncate */
        NULL,                   /* permission */
index d335b5b501ec352398252d0b5b2d2c92297b3ce6..ff10e778ddc70af79dbb31f8d0f5cedbb263a9c4 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/string.h>
 #include <linux/locks.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <asm/byteorder.h>
 #include <asm/uaccess.h>
 
@@ -62,6 +63,11 @@ static void sysv_delete_inode(struct inode *inode)
        sysv_free_inode(inode);
 }
 
+static void sysv_put_super(struct super_block *);
+static void sysv_write_super(struct super_block *);
+static void sysv_read_inode(struct inode *);
+static int sysv_notify_change(struct dentry *, struct iattr *);
+static int sysv_statfs(struct super_block *, struct statfs *, int);
 
 static struct super_operations sysv_sops = {
        sysv_read_inode,
@@ -338,8 +344,8 @@ static struct super_block * detected_coherent (struct super_block *sb, struct bu
        return sb;
 }
 
-struct super_block *sysv_read_super(struct super_block *sb,void *data,
-                                    int silent)
+static struct super_block *sysv_read_super(struct super_block *sb,
+                                          void *data, int silent)
 {
        struct buffer_head *bh;
        const char *found;
@@ -519,7 +525,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
 }
 
 /* This is only called on sync() and umount(), when s_dirt=1. */
-void sysv_write_super (struct super_block *sb)
+static void sysv_write_super(struct super_block *sb)
 {
        lock_super(sb);
        if (buffer_dirty(sb->sv_bh1) || buffer_dirty(sb->sv_bh2)) {
@@ -542,7 +548,7 @@ void sysv_write_super (struct super_block *sb)
        unlock_super(sb);
 }
 
-void sysv_put_super(struct super_block *sb)
+static void sysv_put_super(struct super_block *sb)
 {
        /* we can assume sysv_write_super() has already been called,
           and that the superblock is locked */
@@ -555,7 +561,7 @@ void sysv_put_super(struct super_block *sb)
        MOD_DEC_USE_COUNT;
 }
 
-int sysv_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+static int sysv_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
 {
        struct statfs tmp;
 
@@ -597,59 +603,72 @@ static int block_bmap(struct super_block * sb, struct buffer_head * bh, int nr,
        return tmp + sb->sv_block_base;
 }
 
-int sysv_bmap(struct inode * inode,int block_nr)
+static unsigned int sysv_block_map(struct inode *inode, unsigned int block)
 {
-       unsigned int block = block_nr;
-       struct super_block * sb = inode->i_sb;
-       int convert;
-       int i;
-       struct buffer_head * bh;
+       struct super_block *sb;
+       int i, ret, convert;
 
-       if (block < 10)
-               return inode_bmap(sb,inode,block);
+       ret = 0;
+       lock_kernel();
+       sb = inode->i_sb;
+       if (block < 10) {
+               ret = inode_bmap(sb, inode, block);
+               goto out;
+       }
        block -= 10;
        convert = sb->sv_convert;
        if (block < sb->sv_ind_per_block) {
-               i = inode_bmap(sb,inode,10);
+               i = inode_bmap(sb, inode, 10);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               return block_bmap(sb, bh, block, convert);
+                       goto out;
+               ret = block_bmap(sb,
+                                bread(inode->i_dev, i, sb->sv_block_size),
+                                block, convert);
+               goto out;
        }
        block -= sb->sv_ind_per_block;
        if (block < sb->sv_ind_per_block_2) {
-               i = inode_bmap(sb,inode,11);
+               i = inode_bmap(sb, inode, 11);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               i = block_bmap(sb, bh, block >> sb->sv_ind_per_block_bits, convert);
+                       goto out;
+               i = block_bmap(sb,
+                              bread(inode->i_dev, i, sb->sv_block_size),
+                              (block >> sb->sv_ind_per_block_bits), convert);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               return block_bmap(sb, bh, block & sb->sv_ind_per_block_1, convert);
+                       goto out;
+               ret = block_bmap(sb,
+                                bread(inode->i_dev, i, sb->sv_block_size),
+                                (block & sb->sv_ind_per_block_1), convert);
+               goto out;
        }
        block -= sb->sv_ind_per_block_2;
        if (block < sb->sv_ind_per_block_3) {
-               i = inode_bmap(sb,inode,12);
+               i = inode_bmap(sb, inode, 12);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               i = block_bmap(sb, bh, block >> sb->sv_ind_per_block_2_bits, convert);
+                       goto out;
+               i = block_bmap(sb,
+                              bread(inode->i_dev, i, sb->sv_block_size),
+                              (block >> sb->sv_ind_per_block_2_bits), convert);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               i = block_bmap(sb, bh, (block >> sb->sv_ind_per_block_bits) & sb->sv_ind_per_block_1,convert);
+                       goto out;
+               ret = block_bmap(sb,
+                                bread(inode->i_dev, i, sb->sv_block_size),
+                                ((block >> sb->sv_ind_per_block_bits) &
+                                 sb->sv_ind_per_block_1), convert);
                if (!i)
-                       return 0;
-               bh = bread(inode->i_dev,i,sb->sv_block_size);
-               return block_bmap(sb, bh, block & sb->sv_ind_per_block_1, convert);
-       }
-       if ((int)block<0) {
-               printk("sysv_bmap: block<0");
-               return 0;
+                       goto out;
+               ret = block_bmap(sb,
+                                bread(inode->i_dev, i, sb->sv_block_size),
+                                (block & sb->sv_ind_per_block_1), convert);
+               goto out;
        }
-       printk("sysv_bmap: block>big");
-       return 0;
+       if ((int)block < 0)
+               printk("sysv_block_map: block < 0\n");
+       else
+               printk("sysv_block_map: block > big\n");
+out:
+       unlock_kernel();
+       return ret;
 }
 
 /* End of bmap support. */
@@ -657,8 +676,8 @@ int sysv_bmap(struct inode * inode,int block_nr)
 
 /* Access selected blocks of regular files (or directories) */
 
-static struct buffer_head * inode_getblk(struct inode * inode, int nr, int create,
-                                        int metadata, int *phys_block, int *created)
+static struct buffer_head *inode_getblk(struct inode *inode, int nr, int new_block,
+       int *err, int metadata, long *phys, int *new)
 {
        struct super_block *sb;
        u32 tmp;
@@ -677,15 +696,30 @@ repeat:
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
+                       *phys = tmp;
                        return NULL;
                }
        }
-       if (!create)
-               return NULL;
+       *err = -EFBIG;
+
+       /* Check file limits.. */
+       {
+               unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+               if (limit < RLIM_INFINITY) {
+                       limit >>= sb->sv_block_size_bits;
+                       if (new_block >= limit) {
+                               send_sig(SIGXFSZ, current, 0);
+                               *err = -EFBIG;
+                               return NULL;
+                       }
+               }
+       }
+
        tmp = sysv_new_block(sb);
-       if (!tmp)
+       if (!tmp) {
+               *err = -ENOSPC;
                return NULL;
+       }
        if (metadata) {
                result = sv_getblk(sb, inode->i_dev, tmp);
                if (*p) {
@@ -695,12 +729,18 @@ repeat:
                }
        } else {
                if (*p) {
+                       /*
+                        * Nobody is allowed to change block allocation
+                        * state from under us:
+                        */
+                       BUG();
                        sysv_free_block(sb, tmp);
                        goto repeat;
                }
-               *phys_block = tmp;
+               *phys = tmp;
                result = NULL;
-               *created = 1;
+               *err = 0;
+               *new = 1;
        }
        *p = tmp;
 
@@ -709,24 +749,24 @@ repeat:
        return result;
 }
 
-static struct buffer_head * block_getblk(struct inode * inode,
-       struct buffer_head * bh, int nr, int create,
-       int metadata, int *phys_block, int *created)
+static struct buffer_head *block_getblk(struct inode *inode,
+       struct buffer_head *bh, int nr, int new_block, int *err,
+       int metadata, long *phys, int *new)
 {
        struct super_block *sb;
        u32 tmp, block;
        sysv_zone_t *p;
        struct buffer_head * result;
+       unsigned long limit;
 
+       result = NULL;
        if (!bh)
-               return NULL;
+               goto out;
        if (!buffer_uptodate(bh)) {
                ll_rw_block(READ, 1, &bh);
                wait_on_buffer(bh);
-               if (!buffer_uptodate(bh)) {
-                       brelse(bh);
-                       return NULL;
-               }
+               if (!buffer_uptodate(bh))
+                       goto out;
        }
        sb = inode->i_sb;
        p = nr + (sysv_zone_t *) bh->b_data;
@@ -737,120 +777,175 @@ repeat:
        if (tmp) {
                if (metadata) {
                        result = sv_getblk(sb, bh->b_dev, block);
-                       if (tmp == *p) {
-                               brelse(bh);
-                               return result;
-                       }
+                       if (tmp == *p)
+                               goto out;
                        brelse(result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
-                       brelse(bh);
-                       return NULL;
+                       *phys = tmp;
+                       goto out;
                }
        }
-       if (!create) {
-               brelse(bh);
-               return NULL;
+       *err = -EFBIG;
+
+       limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+       if (limit < RLIM_INFINITY) {
+               limit >>= sb->sv_block_size_bits;
+               if (new_block >= limit) {
+                       send_sig(SIGXFSZ, current, 0);
+                       goto out;
+               }
        }
+
        block = sysv_new_block(sb);
-       if (!block) {
-               brelse(bh);
-               return NULL;
-       }
+       if (!block)
+               goto out;
        if (metadata) {
                result = sv_getblk(sb, bh->b_dev, block);
                if (*p) {
-                       sysv_free_block(sb,block);
+                       sysv_free_block(sb, block);
                        brelse(result);
                        goto repeat;
                }
+               memset(result->b_data, 0, sb->sv_block_size);
+               mark_buffer_uptodate(result, 1);
+               mark_buffer_dirty(result, 1);
        } else {
-               *phys_block = tmp;
-               result = NULL;
-               *created = 1;
+               *phys = tmp;
+               *new = 1;
+       }
+       if (*p) {
+               sysv_free_block(sb, block);
+               brelse(result);
+               goto repeat;
        }
        *p = (sb->sv_convert ? to_coh_ulong(block) : block);
        mark_buffer_dirty(bh, 1);
+       *err = 0;
+out:
        brelse(bh);
        return result;
 }
 
-int sysv_getblk_block(struct inode *inode, long block, int create,
-                     int *err, int *created)
+int sysv_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
 {
-       struct super_block *sb = inode->i_sb;
-       struct buffer_head *bh, *tmp;
-       int phys_block;
+       struct super_block *sb;
+       int ret, err, new;
+       struct buffer_head *bh;
+       unsigned long ptr, phys;
 
-       *err = -EIO;
-       if (block < 0) {
-               printk("sysv_getblk: block<0");
-               return 0;
-       }
-       if (block > sb->sv_ind_per_block_3) {
-               printk("sysv_getblk: block>big");
+       if (!create) {
+               phys = sysv_block_map(inode, iblock);
+               if (phys) {
+                       bh_result->b_dev = inode->i_dev;
+                       bh_result->b_blocknr = phys;
+                       bh_result->b_state |= (1UL << BH_Mapped);
+               }
                return 0;
        }
-       if (block < 10) {
-               tmp = inode_getblk(inode, block, create,
-                                  0, &phys_block, created);
+
+       err = -EIO;
+       new = 0;
+       ret = 0;
+       bh = NULL;
+
+       lock_kernel();
+       sb = inode->i_sb;
+       if (iblock < 0)
+               goto abort_negative;
+       if (iblock > sb->sv_ind_per_block_3)
+               goto abort_too_big;
+
+       err = 0;
+       ptr = iblock;
+
+       /*
+        * ok, these macros clean the logic up a bit and make
+        * it much more readable:
+        */
+#define GET_INODE_DATABLOCK(x) \
+               inode_getblk(inode, x, iblock, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+               inode_getblk(inode, x, iblock, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+               block_getblk (inode, bh, x, iblock, &err, 0, &phys, &new);
+#define GET_INDIRECT_PTR(x) \
+               block_getblk (inode, bh, x, iblock, &err, 1, NULL, NULL);
+
+       if (ptr < 10) {
+               bh = GET_INODE_DATABLOCK(ptr);
                goto out;
        }
-       block -= 10;
-       if (block < sb->sv_ind_per_block) {
-               bh = inode_getblk(inode, 10, create, 1, NULL, NULL);
-               tmp = block_getblk(inode, bh, block, create,
-                                  0, &phys_block, created);
-               goto out;
+       ptr -= 10;
+       if (ptr < sb->sv_ind_per_block) {
+               bh = GET_INODE_PTR(10);
+               goto get_indirect;
        }
-       block -= sb->sv_ind_per_block;
-       if (block < sb->sv_ind_per_block_2) {
-               bh = inode_getblk(inode, 11, create, 1, NULL, NULL);
-               bh = block_getblk(inode, bh, block >> sb->sv_ind_per_block_bits, create,
-                                 1, NULL, NULL);
-               tmp = block_getblk(inode, bh, block & sb->sv_ind_per_block_1, create,
-                                  0, &phys_block, created);
-               goto out;
+       ptr -= sb->sv_ind_per_block;
+       if (ptr < sb->sv_ind_per_block_2) {
+               bh = GET_INODE_PTR(11);
+               goto get_double;
        }
-       block -= sb->sv_ind_per_block_2;
-       bh = inode_getblk(inode, 12, create, 1, NULL, NULL);
-       bh = block_getblk(inode, bh, block >> sb->sv_ind_per_block_2_bits, create,
-                         1, NULL, NULL);
-       bh = block_getblk(inode, bh,
-                         (block >> sb->sv_ind_per_block_bits) & sb->sv_ind_per_block_1,
-                         create, 1, NULL, NULL);
-       tmp = block_getblk(inode, bh, block & sb->sv_ind_per_block_1, create,
-                          0, &phys_block, created);
+       ptr -= sb->sv_ind_per_block_2;
+       bh = GET_INODE_PTR(12);
+       bh = GET_INDIRECT_PTR(ptr >> sb->sv_ind_per_block_2_bits);
+get_double:
+       bh = GET_INDIRECT_PTR((ptr >> sb->sv_ind_per_block_bits) & sb->sv_ind_per_block_1);
+get_indirect:
+       bh = GET_INDIRECT_DATABLOCK(ptr & sb->sv_ind_per_block_1);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
 
 out:
-       *err = 0;
-       return phys_block;
+       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);
+abort:
+       unlock_kernel();
+       return err;
+
+abort_negative:
+       printk("sysv_getblk: block < 0\n");
+       goto abort;
+
+abort_too_big:
+       printk("sysv_getblk: block > big\n");
+       goto abort;
 }
 
-struct buffer_head *sysv_getblk (struct inode *inode, unsigned int block, int create)
+struct buffer_head *sysv_getblk(struct inode *inode, unsigned int block, int create)
 {
-       struct buffer_head *tmp = NULL;
-       int phys_block;
-       int err, created;
-
-       phys_block = sysv_getblk_block(inode, block, create, &err, &created);
-       if (phys_block) {
-               tmp = getblk(inode->i_dev, phys_block, BLOCK_SIZE);
-               if (created) {
-                       memset(tmp->b_data, 0, BLOCK_SIZE);
-                       mark_buffer_uptodate(tmp, 1);
-                       mark_buffer_dirty(tmp, 1);
+       struct buffer_head dummy;
+       int error;
+
+       dummy.b_state = 0;
+       dummy.b_blocknr = -1000;
+       error = sysv_get_block(inode, block, &dummy, create);
+       if (!error && buffer_mapped(&dummy)) {
+               struct buffer_head *bh;
+               bh = getblk(dummy.b_dev, dummy.b_blocknr, BLOCK_SIZE);
+               if (buffer_new(&dummy)) {
+                       memset(bh->b_data, 0, BLOCK_SIZE);
+                       mark_buffer_uptodate(bh, 1);
+                       mark_buffer_dirty(bh, 1);
                }
+               return bh;
        }
-       return tmp;
+       return NULL;
 }
 
-struct buffer_head * sysv_file_bread(struct inode * inode, int block, int create)
+struct buffer_head *sysv_file_bread(struct inode *inode, int block, int create)
 {
-       struct buffer_head * bh;
+       struct buffer_head *bh;
 
-       bh = sysv_getblk(inode,block,create);
+       bh = sysv_getblk(inode, block, create);
        if (!bh || buffer_uptodate(bh))
                return bh;
        ll_rw_block(READ, 1, &bh);
@@ -903,7 +998,7 @@ static inline void coh_write3byte (unsigned char * p, unsigned long val)
        *(unsigned short *)(p+1) = (unsigned short) val;
 }
 
-void sysv_read_inode(struct inode * inode)
+static void sysv_read_inode(struct inode *inode)
 {
        struct super_block * sb = inode->i_sb;
        struct buffer_head * bh;
@@ -971,7 +1066,7 @@ void sysv_read_inode(struct inode * inode)
 }
 
 /* To avoid inconsistencies between inodes in memory and inodes on disk. */
-int sysv_notify_change(struct dentry *dentry, struct iattr *attr)
+static int sysv_notify_change(struct dentry *dentry, struct iattr *attr)
 {
        struct inode *inode = dentry->d_inode;
        int error;
index 2e793aaa015579cfe50f6d149413e9954b170e9b..df611d589944bfa6f9d295e0d75acff1ccbe93f5 100644 (file)
@@ -39,7 +39,7 @@ struct inode_operations sysv_symlink_inode_operations = {
        NULL,                   /* rename */
        sysv_readlink,          /* readlink */
        sysv_follow_link,       /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index abf6765d79b2093b0d234cc74d51710a6ab42671..b93d04f0bb1bf9c314896ba2f06b84f2e9794cce 100644 (file)
@@ -55,10 +55,8 @@ ufs_readdir (struct file * filp, void * dirent, filldir_t filldir)
 
        while (!error && !stored && filp->f_pos < inode->i_size) {
                lblk = (filp->f_pos) >> sb->s_blocksize_bits;
-               /* XXX - ufs_bmap() call needs error checking */
-               blk = ufs_bmap(inode, lblk);
-               bh = bread (sb->s_dev, blk, sb->s_blocksize);
-               if (!bh) {
+               blk = ufs_frag_map(inode, lblk);
+               if (!blk || !(bh = bread (sb->s_dev, blk, sb->s_blocksize))) {
                        /* XXX - error - skip to the next block */
                        printk("ufs_readdir: "
                               "dir inode %lu has a hole at offset %lu\n",
@@ -209,7 +207,7 @@ struct inode_operations ufs_dir_inode_operations = {
        ufs_rename,             /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 0a1dd64ce2e6d35d803b234ac70a04906f2e8505..33d68ba5d00055298bffb230d5f279e91eb8c096 100644 (file)
@@ -87,23 +87,16 @@ static inline void remove_suid(struct inode *inode)
        }
 }
 
-static int ufs_writepage (struct file *file, struct page *page)
-{
-       return block_write_full_page(file, page, ufs_getfrag_block);
-}
-
-static long ufs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf)
-{
-       return block_write_partial_page(file, page, offset, bytes, buf, ufs_getfrag_block);
-}
-
 /*
  * Write to a file (through the page cache).
  */
 static ssize_t
 ufs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
-       ssize_t retval = generic_file_write(file, buf, count, ppos, ufs_write_one_page);
+       ssize_t retval;
+
+       retval = generic_file_write(file, buf, count,
+                                   ppos, block_write_partial_page);
        if (retval > 0) {
                struct inode *inode = file->f_dentry->d_inode;
                remove_suid(inode);
@@ -157,12 +150,12 @@ struct inode_operations ufs_file_inode_operations = {
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       ufs_bmap,               /* bmap */
+       ufs_getfrag_block,      /* get_block */
        block_read_full_page,   /* readpage */
-       ufs_writepage,          /* writepage */
+       block_write_full_page,  /* writepage */
        block_flushpage,        /* flushpage */
        ufs_truncate,           /* truncate */
        NULL,                   /* permission */
        NULL,                   /* smap */
-       NULL,                   /* revalidate */
+       NULL                    /* revalidate */
 };
index 636b0aabd551a004ec1f7290344a163f0644e1b7..3d9c8f6026e56b0279b56cd95f56a95dde802594 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/string.h>
 #include <linux/locks.h>
 #include <linux/mm.h>
+#include <linux/smp_lock.h>
 
 #include "swab.h"
 #include "util.h"
@@ -82,10 +83,10 @@ static void ufs_print_inode(struct inode * inode)
 #define ufs_inode_bmap(inode, nr) \
        (SWAB32((inode)->u.ufs_i.i_u1.i_data[(nr) >> uspi->s_fpbshift]) + ((nr) & uspi->s_fpbmask))
 
-static inline unsigned ufs_block_bmap (struct buffer_head * bh, unsigned nr, 
+static inline unsigned int ufs_block_bmap (struct buffer_head * bh, unsigned nr, 
        struct ufs_sb_private_info * uspi, unsigned swab)
 {
-       unsigned tmp;
+       unsigned int tmp;
 
        UFSD(("ENTER, nr %u\n", nr))
        if (!bh)
@@ -96,86 +97,90 @@ static inline unsigned ufs_block_bmap (struct buffer_head * bh, unsigned nr,
        return tmp;
 }
 
-int ufs_bmap (struct inode * inode, int fragment)
+int ufs_frag_map(struct inode *inode, int frag)
 {
-       struct super_block * sb;
-       struct ufs_sb_private_info * uspi;
-       unsigned tmp;
-       unsigned swab;
+       struct super_block *sb;
+       struct ufs_sb_private_info *uspi;
+       unsigned int swab;
+       int i, ret;
+
+       ret = 0;
+       lock_kernel();
        
        sb = inode->i_sb;
        uspi = sb->u.ufs_sb.s_uspi;
        swab = sb->u.ufs_sb.s_swab;
-
-       UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment))
-       
-       if (fragment >= ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb) << uspi->s_fpbshift)) {
-               ufs_warning (sb, "ufs_bmap", "block > big");
-               return 0;
+       if (frag < 0) {
+               ufs_warning(sb, "ufs_frag_map", "frag < 0");
+               goto out;
        }
-
-       /*
-        * direct fragment
-        */
-       if (fragment < UFS_NDIR_FRAGMENT)
-               return (uspi->s_sbbase + ufs_inode_bmap (inode, fragment));
-
-       /*
-        * indirect fragment
-        */     
-       fragment -= UFS_NDIR_FRAGMENT;
-       if (fragment < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) {
-               tmp = ufs_inode_bmap (inode, 
-                       UFS_IND_FRAGMENT + (fragment >> uspi->s_apbshift));
-               if (!tmp)
-                       return 0;
-               return (uspi->s_sbbase + 
-                       ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-                       fragment & uspi->s_apbmask, uspi, swab));
+       if (frag >=
+           ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb)
+            << uspi->s_fpbshift)) {
+               ufs_warning(sb, "ufs_frag_map", "frag > big");
+               goto out;
        }
 
-       /*
-        * dindirect fragment
-        */
-       fragment -= 1 << (uspi->s_apbshift + uspi->s_fpbshift);
-       if (fragment < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) {
-               tmp = ufs_inode_bmap (inode,
-                       UFS_DIND_FRAGMENT + (fragment >> uspi->s_2apbshift));
-               if (!tmp)
-                       return 0;
-               tmp = ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-                       (fragment >> uspi->s_apbshift) & uspi->s_apbmask, uspi, swab);
-               if (!tmp)
-                       return 0;
-               return (uspi->s_sbbase + 
-                       ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-                       fragment & uspi->s_apbmask, uspi, swab));
+       if (frag < UFS_NDIR_FRAGMENT) {
+               ret = uspi->s_sbbase + ufs_inode_bmap(inode, frag);
+               goto out;
        }
 
-       /*
-        * tindirect fragment
-        */
-       fragment -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift);
-       tmp = ufs_inode_bmap (inode, 
-               UFS_TIND_FRAGMENT + (fragment >> uspi->s_3apbshift));
-       if (!tmp)
-               return 0;
-       tmp = ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-               (fragment >> uspi->s_2apbshift) & uspi->s_apbmask, uspi, swab);
-       if (!tmp)
-               return 0;
-       tmp = ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-               (fragment >> uspi->s_apbshift) & uspi->s_apbmask, uspi, swab);
-       if (!tmp)
-               return 0;
-       return (uspi->s_sbbase + 
-               ufs_block_bmap (bread (sb->s_dev, uspi->s_sbbase + tmp, sb->s_blocksize),
-               fragment & uspi->s_apbmask, uspi, swab));
+       frag -= UFS_NDIR_FRAGMENT;
+       if (frag < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) {
+               i = ufs_inode_bmap(inode,
+                                  UFS_IND_FRAGMENT + (frag >> uspi->s_apbshift));
+               if (!i)
+                       goto out;
+               ret = (uspi->s_sbbase +
+                      ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i,
+                                           sb->s_blocksize),
+                                     frag & uspi->s_apbmask, uspi, swab));
+       }
+       frag -= 1 << (uspi->s_apbshift + uspi->s_fpbshift);
+       if (frag < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) {
+               i = ufs_inode_bmap (inode,
+                                   UFS_DIND_FRAGMENT + (frag >> uspi->s_2apbshift));
+               if (!i)
+                       goto out;
+               i = ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i,
+                                        sb->s_blocksize),
+                                  (frag >> uspi->s_apbshift) & uspi->s_apbmask,
+                                  uspi, swab);
+               if (!i)
+                       goto out;
+               ret = (uspi->s_sbbase +
+                      ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i,
+                                           sb->s_blocksize),
+                                     (frag & uspi->s_apbmask), uspi, swab));
+               goto out;
+       }
+       frag -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift);
+       i = ufs_inode_bmap(inode,
+                          UFS_TIND_FRAGMENT + (frag >> uspi->s_3apbshift));
+       if (!i)
+               goto out;
+       i = ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i, sb->s_blocksize),
+                          (frag >> uspi->s_2apbshift) & uspi->s_apbmask,
+                          uspi, swab);
+       if (!i)
+               goto out;
+       i = ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i, sb->s_blocksize),
+                          (frag >> uspi->s_apbshift) & uspi->s_apbmask,
+                          uspi, swab);
+       if (!i)
+               goto out;
+       ret = (uspi->s_sbbase +
+              ufs_block_bmap(bread(sb->s_dev, uspi->s_sbbase + i, sb->s_blocksize),
+                             (frag & uspi->s_apbmask), uspi, swab));
+out:
+       unlock_kernel();
+       return ret;
 }
 
-static struct buffer_head * ufs_inode_getfrag (struct inode * inode, 
-       unsigned fragment, unsigned new_fragment, int create, 
-       unsigned required, int *err, int metadata, int *phys_block, int *created)
+static struct buffer_head * ufs_inode_getfrag (struct inode *inode,
+       unsigned int fragment, unsigned int new_fragment,
+       unsigned int required, int *err, int metadata, long *phys, int *new)
 {
        struct super_block * sb;
        struct ufs_sb_private_info * uspi;
@@ -184,7 +189,7 @@ static struct buffer_head * ufs_inode_getfrag (struct inode * inode,
        unsigned block, blockoff, lastfrag, lastblock, lastblockoff;
        unsigned tmp, goal;
        u32 * p, * p2;
-       unsigned swab;
+       unsigned int swab;
 
        UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u, required %u\n",
                inode->i_ino, fragment, new_fragment, required))         
@@ -206,18 +211,17 @@ repeat:
                                         sb->s_blocksize);
                        if (tmp == SWAB32(*p)) {
                                UFSD(("EXIT, result %u\n", tmp + blockoff))
-                                       return result;
+                               return result;
                        }
                        brelse (result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
+                       *phys = tmp;
                        return NULL;
                }
        }
        *err = -EFBIG;
-       if (!create)
-               return NULL;
+
        limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
        if (limit < RLIM_INFINITY) {
                limit >>= sb->s_blocksize_bits;
@@ -226,6 +230,7 @@ repeat:
                        return NULL;
                }
        }
+
        lastblock = ufs_fragstoblks (lastfrag);
        lastblockoff = ufs_fragnum (lastfrag);
        /*
@@ -270,10 +275,10 @@ repeat:
        }
        if (!tmp) {
                if ((!blockoff && SWAB32(*p)) || 
-               (blockoff && lastfrag != inode->u.ufs_i.i_lastfrag))
+                   (blockoff && lastfrag != inode->u.ufs_i.i_lastfrag))
                        goto repeat;
-               else
-                       return NULL;
+               *err = -ENOSPC;
+               return NULL;
        }
 
        /* The nullification of framgents done in ufs/balloc.c is
@@ -283,10 +288,10 @@ repeat:
        if (metadata) {
                result = getblk (inode->i_dev, tmp + blockoff, sb->s_blocksize);
        } else {
-               *phys_block = tmp;
+               *phys = tmp;
                result = NULL;
                *err = 0;
-               *created = 1;
+               *new = 1;
        }
 
        inode->i_ctime = CURRENT_TIME;
@@ -297,16 +302,16 @@ repeat:
        return result;
 }
 
-static struct buffer_head * ufs_block_getfrag (struct inode * inode,
-       struct buffer_head * bh, unsigned fragment, unsigned new_fragment, 
-       int create, unsigned blocksize, int * err, int metadata, int *phys_block, int *created)
+static struct buffer_head * ufs_block_getfrag (struct inode *inode,
+       struct buffer_head *bh, unsigned int fragment, unsigned int new_fragment, 
+       unsigned int blocksize, int * err, int metadata, long *phys, int *new)
 {
        struct super_block * sb;
        struct ufs_sb_private_info * uspi;
        struct buffer_head * result;
        unsigned tmp, goal, block, blockoff;
        u32 * p;
-       unsigned swab;
+       unsigned int swab;
 
        sb = inode->i_sb;
        swab = sb->u.ufs_sb.s_swab;
@@ -316,15 +321,14 @@ static struct buffer_head * ufs_block_getfrag (struct inode * inode,
 
        UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u\n", inode->i_ino, fragment, new_fragment))  
 
+       result = NULL;
        if (!bh)
-               return NULL;
+               goto out;
        if (!buffer_uptodate(bh)) {
                ll_rw_block (READ, 1, &bh);
                wait_on_buffer (bh);
-               if (!buffer_uptodate(bh)) {
-                       brelse (bh);
-                       return NULL;
-               }
+               if (!buffer_uptodate(bh))
+                       goto out;
        }
 
        p = (u32 *) bh->b_data + block;
@@ -334,24 +338,18 @@ repeat:
                if (metadata) {
                        result = getblk (bh->b_dev, uspi->s_sbbase + tmp + blockoff,
                                         sb->s_blocksize);
-                       if (tmp == SWAB32(*p)) {
-                               brelse (bh);
-                               UFSD(("EXIT, result %u\n", tmp + blockoff))
-                               return result;
-                       }
+                       if (tmp == SWAB32(*p))
+                               goto out;
                        brelse (result);
                        goto repeat;
                } else {
-                       *phys_block = tmp;
-                       brelse (bh);
-                       return NULL;
+                       *phys = tmp;
+                       goto out;
                }
        }
        *err = -EFBIG;
-       if (!create) {
-               brelse (bh);
-               return NULL;
-       } else {
+
+       {
                unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
                if (limit < RLIM_INFINITY) {
                        limit >>= sb->s_blocksize_bits;
@@ -368,12 +366,9 @@ repeat:
                goal = bh->b_blocknr + uspi->s_fpb;
        tmp = ufs_new_fragments (inode, p, ufs_blknum(new_fragment), goal, uspi->s_fpb, err);
        if (!tmp) {
-               if (SWAB32(*p)) {
+               if (SWAB32(*p))
                        goto repeat;
-               } else {
-                       brelse (bh);
-                       return NULL;
-               }
+               goto out;
        }               
 
        /* The nullification of framgents done in ufs/balloc.c is
@@ -383,10 +378,8 @@ repeat:
        if (metadata) {
                result = getblk (bh->b_dev, tmp + blockoff, sb->s_blocksize);
        } else {
-               *phys_block = tmp;
-               result = NULL;
-               *err = 0;
-               *created = 1;
+               *phys = tmp;
+               *new = 1;
        }
 
        mark_buffer_dirty(bh, 1);
@@ -396,122 +389,137 @@ repeat:
        }
        inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(inode);
+out:
        brelse (bh);
        UFSD(("EXIT, result %u\n", tmp + blockoff))
        return result;
 }
 
-int ufs_getfrag_block (struct inode * inode, long fragment,
-                      int create, int * err, int *created)
+int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create)
 {
        struct super_block * sb;
        struct ufs_sb_private_info * uspi;
-       struct buffer_head * bh, * tmp;
-       unsigned f;
-       unsigned swab;
-       int phys_block;
+       struct buffer_head * bh;
+       unsigned int swab;
+       int ret, err, new;
+       unsigned long ptr, phys;
        
        sb = inode->i_sb;
        uspi = sb->u.ufs_sb.s_uspi;
        swab = sb->u.ufs_sb.s_swab;
-       *err = -EIO;
 
-       UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment))
-       if (fragment < 0) {
-               ufs_warning (sb, "ufs_getblk", "block < 0");
-               return 0;
-       }
-       if (fragment > ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb) << uspi->s_fpbshift)) {
-               ufs_warning (sb, "ufs_getblk", "block > big");
+       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);
+               }
                return 0;
        }
 
-       *err = -ENOSPC;
-       f = fragment;
-       *created = 0;
+       err = -EIO;
+       new = 0;
+       ret = 0;
+       bh = NULL;
+
+       lock_kernel();
+
+       UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment))
+       if (fragment < 0)
+               goto abort_negative;
+       if (fragment >
+           ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb)
+            << uspi->s_fpbshift))
+               goto abort_too_big;
+
+       err = 0;
+       ptr = fragment;
          
        /*
-        * Direct fragment
-        */
-       if (fragment < UFS_NDIR_FRAGMENT) {
-               tmp = ufs_inode_getfrag (inode, fragment, fragment, create, 1,
-                                        err, 0, &phys_block, created);
-               goto out;
-       }
-       /*
-        * Indirect fragment
-        */
-       fragment -= UFS_NDIR_FRAGMENT;
-       if (fragment < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) {
-               bh = ufs_inode_getfrag (inode, 
-                       UFS_IND_FRAGMENT + (fragment >> uspi->s_apbshift),
-                       f, create, uspi->s_fpb, err, 1, NULL, NULL);
-               tmp = ufs_block_getfrag (inode, bh, 
-                                        fragment & uspi->s_apbmask,
-                                        f, create, sb->s_blocksize,
-                                        err, 0, &phys_block, created);
-               goto out;
-       }
-       /*
-        * Dindirect fragment
+        * ok, these macros clean the logic up a bit and make
+        * it much more readable:
         */
-       fragment -= 1 << (uspi->s_apbshift + uspi->s_fpbshift);
-       if ( fragment < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) {
-               bh = ufs_inode_getfrag (inode,
-                       UFS_DIND_FRAGMENT + (fragment >> uspi->s_2apbshift),
-                       f, create, uspi->s_fpb, err,
-                       1, NULL, NULL);
-               bh = ufs_block_getfrag (inode, bh,
-                       (fragment >> uspi->s_apbshift) & uspi->s_apbmask, 
-                       f, create, sb->s_blocksize, err,
-                       1, NULL, NULL);
-               tmp = ufs_block_getfrag (inode, bh, 
-                       fragment & uspi->s_apbmask,
-                       f, create, sb->s_blocksize, err,
-                       0, &phys_block, created);
+#define GET_INODE_DATABLOCK(x) \
+               ufs_inode_getfrag(inode, x, fragment, 1, &err, 0, &phys, &new)
+#define GET_INODE_PTR(x) \
+               ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, 1, NULL, NULL)
+#define GET_INDIRECT_DATABLOCK(x) \
+               ufs_block_getfrag(inode, bh, x, fragment, sb->s_blocksize, \
+                                 &err, 0, &phys, &new);
+#define GET_INDIRECT_PTR(x) \
+               ufs_block_getfrag(inode, bh, x, fragment, sb->s_blocksize, \
+                                 &err, 1, NULL, NULL);
+
+       if (ptr < UFS_NDIR_FRAGMENT) {
+               bh = GET_INODE_DATABLOCK(ptr);
                goto out;
        }
-       /*
-        * Tindirect fragment
-        */
-       fragment -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift);
-       bh = ufs_inode_getfrag (inode,
-               UFS_TIND_FRAGMENT + (fragment >> uspi->s_3apbshift), 
-               f, create, uspi->s_fpb, err, 1, NULL, NULL);
-       bh = ufs_block_getfrag (inode, bh,
-               (fragment >> uspi->s_2apbshift) & uspi->s_apbmask,
-               f, create, sb->s_blocksize, err, 1, NULL, NULL);
-       bh = ufs_block_getfrag (inode, bh,
-               (fragment >> uspi->s_apbshift) & uspi->s_apbmask, 
-               f, create, sb->s_blocksize, err, 1, NULL, NULL);
-       tmp = ufs_block_getfrag (inode, bh,
-               fragment & uspi->s_apbmask, 
-               f, create, sb->s_blocksize, err, 0, &phys_block, created);
+       ptr -= UFS_NDIR_FRAGMENT;
+       if (ptr < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) {
+               bh = GET_INODE_PTR(UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift));
+               goto get_indirect;
+       }
+       ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift);
+       if (ptr < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) {
+               bh = GET_INODE_PTR(UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift));
+               goto get_double;
+       }
+       ptr -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift);
+       bh = GET_INODE_PTR(UFS_TIND_FRAGMENT + (ptr >> uspi->s_3apbshift));
+       bh = GET_INDIRECT_PTR((ptr >> uspi->s_2apbshift) & uspi->s_apbmask);
+get_double:
+       bh = GET_INDIRECT_PTR((ptr >> uspi->s_apbshift) & uspi->s_apbmask);
+get_indirect:
+       bh = GET_INDIRECT_DATABLOCK(ptr & uspi->s_apbmask);
+
+#undef GET_INODE_DATABLOCK
+#undef GET_INODE_PTR
+#undef GET_INDIRECT_DATABLOCK
+#undef GET_INDIRECT_PTR
 
 out:
-       if (!phys_block)
-               return 0;
-       if (*err)
-               return 0;
-       return phys_block;
+       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);
+abort:
+       unlock_kernel();
+       return err;
+
+abort_negative:
+       ufs_warning(sb, "ufs_get_block", "block < 0");
+       goto abort;
+
+abort_too_big:
+       ufs_warning(sb, "ufs_get_block", "block > big");
+       goto abort;
 }
 
 struct buffer_head *ufs_getfrag(struct inode *inode, unsigned int fragment,
                                int create, int *err)
 {
-       struct buffer_head *tmp = NULL;
-       int phys_block, created;
-
-       phys_block = ufs_getfrag_block(inode, fragment, create, err, &created);
-       if (phys_block) {
-               tmp = getblk(inode->i_dev, phys_block, inode->i_sb->s_blocksize);
-               if (created) {
-                       memset(tmp->b_data, 0, inode->i_sb->s_blocksize);
-                       mark_buffer_uptodate(tmp, 1);
-                       mark_buffer_dirty(tmp, 1);
+       struct buffer_head dummy;
+       int error;
+
+       dummy.b_state = 0;
+       dummy.b_blocknr = -1000;
+       error = ufs_getfrag_block(inode, fragment, &dummy, create);
+       *err = error;
+       if (!error && buffer_mapped(&dummy)) {
+               struct buffer_head *bh;
+               bh = getblk(dummy.b_dev, dummy.b_blocknr, inode->i_sb->s_blocksize);
+               if (buffer_new(&dummy)) {
+                       memset(bh->b_data, 0, inode->i_sb->s_blocksize);
+                       mark_buffer_uptodate(bh, 1);
+                       mark_buffer_dirty(bh, 1);
                }
+               return bh;
        }
-       return tmp;
+       return NULL;
 }
 
 struct buffer_head * ufs_bread (struct inode * inode, unsigned fragment,
index cfebdf20d2003f99c02b82cb8a07fa99dbf0a0a5..3df5c40a6c3bd4b643c69fcfc7a45406d37de03f 100644 (file)
@@ -129,7 +129,7 @@ struct inode_operations ufs_symlink_inode_operations = {
        NULL,                   /* rename */
        ufs_readlink,           /* readlink */
        ufs_follow_link,        /* follow_link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 51247073127ae9c7216ae1fd5a2041c36c9c1286..34fe302d7c778cc846f1056a1d90067e5b58adcf 100644 (file)
@@ -832,7 +832,7 @@ struct inode_operations umsdos_dir_inode_operations =
        UMSDOS_rename,          /* rename */
        NULL,                   /* readlink */
        NULL,                   /* followlink */
-       fat_bmap,               /* bmap */
+       fat_bmap,               /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 0d417facb3c77cfa42d6a321fa8af92f1b18e85d..d3d8a74e641aac4cb91a8bbf1d02f67eda465165 100644 (file)
@@ -99,7 +99,7 @@ struct inode_operations umsdos_file_inode_operations =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow_link */
-       fat_bmap,               /* bmap */
+       fat_bmap,               /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -139,7 +139,7 @@ struct inode_operations umsdos_file_inode_operations_no_bmap =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
@@ -179,7 +179,7 @@ struct inode_operations umsdos_file_inode_operations_readpage =
        NULL,                   /* rename */
        NULL,                   /* readlink */
        NULL,                   /* follow link */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        fat_readpage,           /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 7951bb8f82745c41a00b9a00fd558925801c0243..c7bb8fb1bd92c724118312f3d7515f4fd5092631 100644 (file)
@@ -249,7 +249,7 @@ struct inode_operations umsdos_rdir_inode_operations =
        NULL,                   /* followlink */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* truncate */
        NULL,                   /* permission */
        NULL,                   /* smap */
index 0372eef2ae589663dca2dc9f91fd7ea6c9f32904..2d08a35d81d9a669e0bee88ba75174befc8f5794 100644 (file)
@@ -135,7 +135,7 @@ struct inode_operations umsdos_symlink_inode_operations =
        NULL,                   /* rename */
        UMSDOS_readlink,        /* readlink */
        UMSDOS_followlink,      /* followlink */
-       fat_bmap,               /* bmap */
+       fat_bmap,               /* get_block */
        block_read_full_page,   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index 5d5bcdd2d44cf743c96de5acccdc4bdc34f3378c..ad241c3cd4c30a8b21d1132a0a9852b1013fe8f1 100644 (file)
@@ -1232,7 +1232,7 @@ struct inode_operations vfat_dir_inode_operations = {
        vfat_rename,            /* rename */
        NULL,                   /* readlink */
        NULL,                   /* followlink */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
        NULL,                   /* flushpage */
index cb195c5f78b83d62aacd5470dd6b33844c7770f1..ac5ac69fc18d0f8b8e187e821f7bac70642af74f 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_HARDIRQ_H
 #define __ASM_HARDIRQ_H
 
+#include <asm/smp.h>
+
 extern unsigned int ppc_local_irq_count[NR_CPUS];
 
 /*
index 2f6303350fb147c649507560b0865941640da62d..68a814b5b81634b3986c8015845dc50530fd8f86 100644 (file)
@@ -85,13 +85,13 @@ extern volatile struct Hydra *Hydra;
 #define HYDRA_INT_VIA          9
 #define HYDRA_INT_ADB          10
 #define HYDRA_INT_ADB_NMI      11
-#define HYDRA_INT_EXT1         12
-#define HYDRA_INT_EXT2         13
-#define HYDRA_INT_EXT3         14
-#define HYDRA_INT_EXT4         15
-#define HYDRA_INT_EXT5         16
-#define HYDRA_INT_EXT6         17
-#define HYDRA_INT_EXT7         18
+#define HYDRA_INT_EXT1         12      /* PCI IRQW */
+#define HYDRA_INT_EXT2         13      /* PCI IRQX */
+#define HYDRA_INT_EXT3         14      /* PCI IRQY */
+#define HYDRA_INT_EXT4         15      /* PCI IRQZ */
+#define HYDRA_INT_EXT5         16      /* IDE Primay/Secondary */
+#define HYDRA_INT_EXT6         17      /* IDE Secondary */
+#define HYDRA_INT_EXT7         18      /* Power Off Request */
 #define HYDRA_INT_SPARE                19
 
 extern int hydra_init(void);
index 39d48b6d1cddb6aa44fc6beeab28075957bf9a98..4bca472e1c4a8d3433f754177730d00dbc94f41c 100644 (file)
@@ -1,8 +1,7 @@
 /*
  *  linux/include/asm-ppc/ide.h
  *
- *  Copyright (C) 1994-1996  Linus Torvalds & authors
- */
+ *  Copyright (C) 1994-1996 Linus Torvalds & authors */
 
 /*
  *  This file contains the ppc architecture specific IDE code.
@@ -42,11 +41,11 @@ struct ide_machdep_calls {
         void        (*outsw)(ide_ioreg_t port, void *buf, int ns);
         int         (*default_irq)(ide_ioreg_t base);
         ide_ioreg_t (*default_io_base)(int index);
-        int         (*check_region)(ide_ioreg_t from, unsigned int extent);
-        void        (*request_region)(ide_ioreg_t from,
+        int         (*ide_check_region)(ide_ioreg_t from, unsigned int extent);
+        void        (*ide_request_region)(ide_ioreg_t from,
                                       unsigned int extent,
                                       const char *name);
-        void        (*release_region)(ide_ioreg_t from,
+        void        (*ide_release_region)(ide_ioreg_t from,
                                       unsigned int extent);
         void        (*fix_driveid)(struct hd_driveid *id);
         void        (*ide_init_hwif)(hw_regs_t *hw,
@@ -59,7 +58,6 @@ struct ide_machdep_calls {
 
 extern struct ide_machdep_calls ppc_ide_md;
 
-void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq);
 void ide_insw(ide_ioreg_t port, void *buf, int ns);
 void ide_outsw(ide_ioreg_t port, void *buf, int ns);
 void ppc_generic_ide_fix_driveid(struct hd_driveid *id);
@@ -97,6 +95,14 @@ static __inline__ ide_ioreg_t ide_default_io_base(int index)
                return -1;
 }
 
+static __inline__ void  ide_init_hwif_ports(hw_regs_t *hw,
+                                          ide_ioreg_t data_port,
+                                          ide_ioreg_t ctrl_port, int *irq)
+{
+       if (ppc_ide_md.ide_init_hwif != NULL)
+               ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq);
+}
+
 static __inline__ void ide_init_default_hwifs(void)
 {
 #ifdef __DO_I_NEED_THIS
@@ -113,22 +119,22 @@ static __inline__ void ide_init_default_hwifs(void)
 
 static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
 {
-       if ( ppc_ide_md.check_region )
-               return ppc_ide_md.check_region(from, extent);
+       if ( ppc_ide_md.ide_check_region )
+               return ppc_ide_md.ide_check_region(from, extent);
        else
                return -1;
 }
 
 static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
 {
-       if ( ppc_ide_md.request_region )
-               ppc_ide_md.request_region(from, extent, name);
+       if ( ppc_ide_md.ide_request_region )
+               ppc_ide_md.ide_request_region(from, extent, name);
 }
 
 static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
 {
-       if ( ppc_ide_md.release_region )
-               ppc_ide_md.release_region(from, extent);
+       if ( ppc_ide_md.ide_release_region )
+               ppc_ide_md.ide_release_region(from, extent);
 }
 
 static __inline__ void ide_fix_driveid (struct hd_driveid *id)
@@ -137,6 +143,7 @@ static __inline__ void ide_fix_driveid (struct hd_driveid *id)
                ppc_ide_md.fix_driveid(id);
 }
 
+#if 0  /* inb/outb from io.h is OK now -- paulus */
 #undef inb
 #define inb(port)      in_8((unsigned char *)((port) + ppc_ide_md.io_base))
 #undef inb_p
@@ -147,6 +154,7 @@ static __inline__ void ide_fix_driveid (struct hd_driveid *id)
        out_8((unsigned char *)((port) + ppc_ide_md.io_base), (val) )
 #undef outb_p
 #define outb_p(val, port)      outb(val, port)
+#endif
 
 typedef union {
        unsigned all                    : 8;    /* all of the bits together */
index 3a32490b5843d2b29eb21bdcb8ccc6289c9c5752..537f402f820ee058bfc46ae813b7eade9fb8b6f0 100644 (file)
@@ -6,6 +6,7 @@
 #include <asm/machdep.h>               /* ppc_md */
 
 extern void disable_irq(unsigned int);
+extern void disable_irq_nosync(unsigned int);
 extern void enable_irq(unsigned int);
 
 #ifndef CONFIG_8xx
index c427a35f876fb1b1e21652a0b9581a5210009dc6..6ce46e87c12423703fa961e67f94eb2b95431e68 100644 (file)
@@ -57,13 +57,9 @@ static inline void kbd_init_hw(void)
        ppc_md.kbd_init_hw();
 }
 
-#define kbd_sysrq_xlate        (ppc_md.kbd_sysrq_xlate)
+#define kbd_sysrq_xlate        (ppc_md.ppc_kbd_sysrq_xlate)
 
-#ifdef CONFIG_MAC_KEYBOARD
-# define SYSRQ_KEY 0x69
-#else
-# define SYSRQ_KEY 0x54
-#endif
+extern unsigned long SYSRQ_KEY;
 
 #endif /* CONFIG_APUS */
 
index 78f35e285817a33aeac098c83e82bc5a2f6294a6..b47f36983ca35a3429c4b7b69a6994c1894afd0b 100644 (file)
@@ -35,6 +35,10 @@ struct machdep_calls {
        unsigned long   (*get_rtc_time)(void);
        void            (*calibrate_decr)(void);
 
+       void            (*heartbeat)(void);
+       unsigned long   heartbeat_reset;
+       unsigned long   heartbeat_count;
+
        unsigned char   (*nvram_read_val)(int addr);
        void            (*nvram_write_val)(int addr, unsigned char val);
 
@@ -49,7 +53,7 @@ struct machdep_calls {
        void            (*kbd_leds)(unsigned char leds);
        void            (*kbd_init_hw)(void);
 #ifdef CONFIG_MAGIC_SYSRQ
-       unsigned char   *kbd_sysrq_xlate;
+       unsigned char   *ppc_kbd_sysrq_xlate;
 #endif
 
        /* PCI interfaces */
index 81dadd22a4e7fa87c1060b6e30ec281544bf2ade..7355f3c8dc0ca398ef6bafdbb94f43ae3f5ed85a 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef _PPC_MMU_H_
 #define _PPC_MMU_H_
 
-#include <linux/config.h>
-
 #ifndef __ASSEMBLY__
 /* Hardware Page Table Entry */
 typedef struct _PTE {
index 12e576e8555ae155ad1c4540d9526992e743ed8d..70b710d77c09eef7f7b1f8869449b9103b268c3e 100644 (file)
 #ifndef __ASSEMBLY__
 #ifdef __KERNEL__
 
+#ifdef CONFIG_XMON
+#define BUG() do { \
+       printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+       xmon(0); \
+} while (0)
+#else
+#define BUG() do { \
+       printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+       __asm__ __volatile__(".long 0x0"); \
+}
+#endif
+#define PAGE_BUG(page) do { BUG(); } while (0)
+
 #define STRICT_MM_TYPECHECKS
 
 #ifdef STRICT_MM_TYPECHECKS
index 1f587a1512d0d55216ca42481aa89271acdfc25b..501a5b32c410d451a489bffea0c169108c0dfa97 100644 (file)
@@ -207,6 +207,11 @@ struct task_struct;
 void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
 void release_thread(struct task_struct *);
 
+/*
+ * Create a new kernel thread.
+ */
+extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
+
 /*
  * Bus types
  */
index 7ec33806a6ba740310cf71d4fa518a9f9008abf6..167c9aa60313d84ca8f0e73d7a040a6f7063e56e 100644 (file)
  * the PT_* values below.  This simplifies arch/ppc/kernel/ptrace.c.
  */
 
-#include <linux/config.h>
-
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PPC64
-#define REG unsigned long /*long*/
+#define PPC_REG unsigned long /*long*/
 #else
-#define REG unsigned long
+#define PPC_REG unsigned long
 #endif
 struct pt_regs {
-       REG gpr[32];
-       REG nip;
-       REG msr;
-       REG orig_gpr3;  /* Used for restarting system calls */
-       REG ctr;
-       REG link;
-       REG xer;
-       REG ccr;
-       REG mq;         /* 601 only (not used at present) */
-                       /* Used on APUS to hold IPL value. */
-       REG trap;       /* Reason for being here */
-       REG dar;        /* Fault registers */
-       REG dsisr;
-       REG result;     /* Result of a system call */
+       PPC_REG gpr[32];
+       PPC_REG nip;
+       PPC_REG msr;
+       PPC_REG orig_gpr3;      /* Used for restarting system calls */
+       PPC_REG ctr;
+       PPC_REG link;
+       PPC_REG xer;
+       PPC_REG ccr;
+       PPC_REG mq;             /* 601 only (not used at present) */
+                               /* Used on APUS to hold IPL value. */
+       PPC_REG trap;           /* Reason for being here */
+       PPC_REG dar;            /* Fault registers */
+       PPC_REG dsisr;
+       PPC_REG result;         /* Result of a system call */
 };
 #endif
 
index 373de23567391d648ef184fca183e569e6955701..73946f2066f979dd2d28828832a4e4f70e90c5e3 100644 (file)
@@ -4,11 +4,11 @@
 #include <asm/atomic.h>
 #include <asm/hardirq.h>
 
-extern unsigned int ppc_local_bh_count[NR_CPUS];
-
 #define get_active_bhs()       (bh_mask & bh_active)
 #define clear_active_bhs(x)    atomic_clear_mask((x),&bh_active)
 
+extern unsigned int ppc_local_bh_count[NR_CPUS];
+
 extern inline void init_bh(int nr, void (*routine)(void))
 {
        bh_base[nr] = routine;
@@ -20,7 +20,7 @@ extern inline void remove_bh(int nr)
 {
        bh_mask &= ~(1 << nr);
        wmb();
-       bh_base[nr] = NULL;
+       bh_base[nr] = 0;
 }
 
 extern inline void mark_bh(int nr)
@@ -55,7 +55,8 @@ static inline void end_bh_atomic(void)
 static inline int softirq_trylock(int cpu)
 {
        if (!test_and_set_bit(0,&global_bh_count)) {
-               if (atomic_read(&global_bh_lock) == 0) {
+               if (atomic_read(&global_bh_lock) &&
+                   ppc_local_bh_count[cpu] == 0) {
                        ++ppc_local_bh_count[cpu];
                        return 1;
                }
@@ -91,6 +92,9 @@ extern inline void end_bh_atomic(void)
 
 #endif /* SMP */
 
+#define local_bh_disable()     (ppc_local_bh_count[smp_processor_id()]++)
+#define local_bh_enable()      (ppc_local_bh_count[smp_processor_id()]--)
+
 /*
  * These use a mask count to correctly handle
  * nested disable/enable calls
index afaf5ebb357048df52e691bf92397b1b8ed1deeb..8332d34a72a5d8c94d40b9e1f48bd3bff2b92c63 100644 (file)
@@ -2,7 +2,6 @@
 #define __ASM_SPINLOCK_H
 
 #ifndef __SMP__
-
 /*
  * Your basic spinlocks, allowing only a single CPU anywhere
  *
 
 #define spin_lock_init(lock)   do { } while(0)
 #define spin_lock(lock)                do { } while(0)
-#define spin_trylock(lock)     do { } while(0)
+#define spin_trylock(lock)     (1)
 #define spin_unlock_wait(lock) do { } while(0)
 #define spin_unlock(lock)      do { } while(0)
 #define spin_lock_irq(lock)    cli()
 #define spin_unlock_irq(lock)  sti()
-
+#define spin_lock_bh(lock)     local_bh_disable()
+#define spin_unlock_bh(lock)   local_bh_enable()
 #define spin_lock_irqsave(lock, flags) \
        do { save_flags(flags); cli(); } while (0)
+
 #define spin_unlock_irqrestore(lock, flags) \
        restore_flags(flags)
 
 #define read_unlock_irq(lock)  sti()
 #define write_lock_irq(lock)   cli()
 #define write_unlock_irq(lock) sti()
+#define read_lock_bh(lock)     local_bh_disable()
+#define read_unlock_bh(lock)   local_bh_enable()
+#define write_lock_bh(lock)    local_bh_disable()
+#define write_unlock_bh(lock)  local_bh_enable()
 
 #define read_lock_irqsave(lock, flags) \
        do { save_flags(flags); cli(); } while (0)
@@ -94,8 +99,11 @@ extern int spin_trylock(spinlock_t *lock);
 
 #define spin_lock_irq(lock) \
        do { __cli(); spin_lock(lock); } while (0)
+#define spin_lock_bh(___lk) do { local_bh_disable(); spin_lock(___lk); } while(0)
+
 #define spin_unlock_irq(lock) \
        do { spin_unlock(lock); __sti(); } while (0)
+#define spin_unlock_bh(___lk) do { spin_unlock(___lk); local_bh_enable(); } while(0)
 
 #define spin_lock_irqsave(lock, flags) \
        do { __save_flags(flags); __cli(); spin_lock(lock); } while (0)
@@ -132,10 +140,13 @@ extern void _write_unlock(rwlock_t *rw);
 #define read_unlock(rw)                _read_unlock(rw)
 
 #define read_lock_irq(lock)    do { __cli(); read_lock(lock); } while (0)
+#define read_lock_bh(lock)     do { local_bh_disable(); read_lock(lock); } while (0)
 #define read_unlock_irq(lock)  do { read_unlock(lock); __sti(); } while (0)
+#define read_unlock_bh(lock)   do { read_unlock(lock); local_bh_enable(); } while (0)
 #define write_lock_irq(lock)   do { __cli(); write_lock(lock); } while (0)
+#define write_lock_bh(lock)    do { local_bh_disable(); write_lock(lock); } while(0)
 #define write_unlock_irq(lock) do { write_unlock(lock); __sti(); } while (0)
-
+#define write_unlock_bh(lock)  do { write_unlock(lock); local_bh_enable(); } while(0)
 #define read_lock_irqsave(lock, flags) \
        do { __save_flags(flags); __cli(); read_lock(lock); } while (0)
 #define read_unlock_irqrestore(lock, flags) \
@@ -147,12 +158,3 @@ extern void _write_unlock(rwlock_t *rw);
 
 #endif /* SMP */
 #endif /* __ASM_SPINLOCK_H */
-
-
-
-
-
-
-
-
-
index bc96d7fef88e30c88dd1ba68c6197d294fbba843..38372df08faee50aecf83c96e9f947686298b203 100644 (file)
@@ -377,16 +377,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)      \
  * the child.
  */
 
-/*
- * Create a new kernel thread.
- */
-extern long __kernel_thread(unsigned long, int (*)(void *), void *);
-
-static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
-       return __kernel_thread(flags | CLONE_VM, fn, arg);
-}
-
 /*
  * System call prototypes.
  */
index 0125f9087e95635184bc75e52cd666bf41a41ac6..5efa992964112311ccba234278f0b8f1a5b6ac2d 100644 (file)
@@ -26,18 +26,27 @@ extern inline struct file * fcheck_task(struct task_struct *p, unsigned int fd)
 extern inline struct file * fcheck(unsigned int fd)
 {
        struct file * file = NULL;
+       struct files_struct *files = current->files;
 
-       if (fd < current->files->max_fds)
-               file = current->files->fd[fd];
+       read_lock(&files->file_lock);
+       if (fd < files->max_fds)
+               file = files->fd[fd];
+       read_unlock(&files->file_lock);
        return file;
 }
 
 extern inline struct file * fget(unsigned int fd)
 {
-       struct file * file = fcheck(fd);
+       struct file * file = NULL;
+       struct files_struct *files = current->files;
 
-       if (file)
-               file->f_count++;
+       read_lock(&files->file_lock);
+       if (fd < files->max_fds) {
+               file = files->fd[fd];
+               if (file)
+                       atomic_inc(&file->f_count);
+       }
+       read_unlock(&files->file_lock);
        return file;
 }
 
@@ -46,7 +55,11 @@ extern inline struct file * fget(unsigned int fd)
  */
 extern inline void fd_install(unsigned int fd, struct file * file)
 {
-       current->files->fd[fd] = file;
+       struct files_struct *files = current->files;
+
+       write_lock(&files->file_lock);
+       files->fd[fd] = file;
+       write_unlock(&files->file_lock);
 }
 
 /*
index 472755e244de9c7d74622e87128ea6c4f2f6307b..228ede1ebde04f79bccc0ce153eb1e0028c7ac44 100644 (file)
@@ -407,9 +407,10 @@ struct file {
        struct file             *f_next, **f_pprev;
        struct dentry           *f_dentry;
        struct file_operations  *f_op;
+       atomic_t                f_count;
+       unsigned int            f_flags;
        mode_t                  f_mode;
        loff_t                  f_pos;
-       unsigned int            f_count, f_flags;
        unsigned long           f_reada, f_ramax, f_raend, f_ralen, f_rawin;
        struct fown_struct      f_owner;
        unsigned int            f_uid, f_gid;
index 0fcb4b822498accedc21bf6e1704ee4f6c04957c..e5b3a3d7b3b384b101e03bf68f782316171d63e0 100644 (file)
@@ -184,26 +184,10 @@ extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inod
 int get_joliet_filename(struct iso_directory_record *, struct inode *, unsigned char *);
 int get_acorn_filename(struct iso_directory_record *, char *, struct inode *);
 
-/* The stuff that follows may be totally unneeded. I have not checked to see 
- which prototypes we are still using.  */
-
-extern int isofs_open(struct inode * inode, struct file * filp);
-extern void isofs_release(struct inode * inode, struct file * filp);
-extern struct dentry *isofs_lookup(struct inode * dir, struct dentry *);
-extern unsigned long isofs_count_free_inodes(struct super_block *sb);
-extern int isofs_new_block(int dev);
-extern int isofs_free_block(int dev, int block);
-extern int isofs_bmap(struct inode *,int);
-
-extern void isofs_put_super(struct super_block *);
-extern struct super_block *isofs_read_super(struct super_block *,void *,int);
+extern struct dentry *isofs_lookup(struct inode *, struct dentry *);
+extern int isofs_get_block(struct inode *, long, struct buffer_head *, int);
+extern int isofs_bmap(struct inode *, int);
 extern int init_iso9660_fs(void);
-extern void isofs_read_inode(struct inode *);
-extern void isofs_put_inode(struct inode *);
-extern int isofs_statfs(struct super_block *, struct statfs *, int);
-
-extern int isofs_lseek(struct inode *, struct file *, off_t, int);
-extern int isofs_read(struct inode *, struct file *, char *, int);
 extern int isofs_lookup_grandparent(struct inode *, int);
 
 extern struct inode_operations isofs_file_inode_operations;
index 0b41889bd0bab941dc74e88e93811a769fe4c850..b730d20a3352896f58edfad98024c42f15d616be 100644 (file)
@@ -110,7 +110,7 @@ extern unsigned long minix_count_free_blocks(struct super_block *sb);
 extern int minix_bmap(struct inode *,int);
 
 extern struct buffer_head * minix_getblk(struct inode *, int, int);
-extern int minix_getblk_block (struct inode *, long, int, int *, int *);
+extern int minix_get_block(struct inode *, long, struct buffer_head *, int);
 extern struct buffer_head * minix_bread(struct inode *, int, int);
 
 extern void minix_truncate(struct inode *);
index 3872e95e4645be3f4ab2b8d2fbd25d6f7e51da4d..c621b325ef0edaa407d34877d3c9e4352a0e45de 100644 (file)
@@ -130,6 +130,7 @@ asmlinkage void schedule(void);
  */
 struct files_struct {
        atomic_t count;
+       rwlock_t file_lock;
        int max_fds;
        struct file ** fd;      /* current fd array */
        fd_set close_on_exec;
@@ -138,6 +139,7 @@ struct files_struct {
 
 #define INIT_FILES { \
        ATOMIC_INIT(1), \
+       RW_LOCK_UNLOCKED, \
        NR_OPEN, \
        &init_fd_array[0], \
        { { 0, } }, \
index d8c6eef5cb3a5766c2b5b4179c7fbf1baca5130b..cf9cab74915adb09cbabfd75c26ddf2cb7996031 100644 (file)
@@ -384,25 +384,15 @@ extern int sysv_new_block(struct super_block * sb);
 extern void sysv_free_block(struct super_block * sb, unsigned int block);
 extern unsigned long sysv_count_free_blocks(struct super_block *sb);
 
-extern int sysv_bmap(struct inode *,int);
-
 extern struct buffer_head * sysv_getblk(struct inode *, unsigned int, int);
-extern int sysv_getblk_block(struct inode *, long, int, int *, int *);
+extern int sysv_get_block(struct inode *, long, struct buffer_head *, int);
 extern struct buffer_head * sysv_file_bread(struct inode *, int, int);
-extern ssize_t sysv_file_read(struct file *, char *, size_t, loff_t *);
 
 extern void sysv_truncate(struct inode *);
-extern void sysv_put_super(struct super_block *);
-extern struct super_block *sysv_read_super(struct super_block *,void *,int);
 extern int init_sysv_fs(void);
-extern void sysv_write_super(struct super_block *);
-extern void sysv_read_inode(struct inode *);
-extern int sysv_notify_change(struct dentry *, struct iattr *);
 extern void sysv_write_inode(struct inode *);
-extern int sysv_statfs(struct super_block *, struct statfs *, int);
 extern int sysv_sync_inode(struct inode *);
 extern int sysv_sync_file(struct file *, struct dentry *);
-extern int sysv_mmap(struct file *, struct vm_area_struct *);
 
 extern struct inode_operations sysv_file_inode_operations;
 extern struct inode_operations sysv_file_inode_operations_with_bmap;
index 56f39893e4575650ec19fd7fb2a2b009e8a37863..796749fdba0ff266803c7f21bf3239f4285b2bac 100644 (file)
@@ -71,7 +71,7 @@ extern inline void init_timer(struct timer_list * timer)
        timer->prev = NULL;
 }
 
-extern inline int timer_pending(struct timer_list * timer)
+extern inline int timer_pending(const struct timer_list * timer)
 {
        return timer->prev != NULL;
 }
index 2124c7e57b96ed0724d7b517d918a613b32f076a..4e85be8e7a750b2cc1253c691d05723fabff38ca 100644 (file)
@@ -529,7 +529,7 @@ extern void ufs_free_inode (struct inode *inode);
 extern struct inode * ufs_new_inode (const struct inode *, int, int *);
 
 /* inode.c */
-extern int ufs_bmap (struct inode *, int);
+extern int ufs_frag_map (struct inode *, int);
 extern void ufs_read_inode (struct inode *);
 extern void ufs_put_inode (struct inode *);
 extern void ufs_write_inode (struct inode *);
@@ -537,7 +537,7 @@ extern int ufs_sync_inode (struct inode *);
 extern void ufs_write_inode (struct inode *);
 extern void ufs_delete_inode (struct inode *);
 extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
-extern int ufs_getfrag_block (struct inode *, long, int, int *, int *);
+extern int ufs_getfrag_block (struct inode *, long, struct buffer_head *, int);
 extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
 
 /* namei.c */
index ff5fbb17060f1d23fc03092fc3d8c1afd9468517..7534f1d919e232963079d9348042357533cab306 100644 (file)
@@ -249,7 +249,7 @@ static inline int dup_mmap(struct mm_struct * mm)
                tmp->vm_next = NULL;
                file = tmp->vm_file;
                if (file) {
-                       file->f_count++;
+                       atomic_inc(&file->f_count);
                        if (tmp->vm_flags & VM_DENYWRITE)
                                file->f_dentry->d_inode->i_writecount--;
       
@@ -474,6 +474,7 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
        if (!new_fds)
                goto out_release;
 
+       newf->file_lock = RW_LOCK_UNLOCKED;
        atomic_set(&newf->count, 1);
        newf->max_fds = NR_OPEN;
        newf->fd = new_fds;
@@ -485,7 +486,7 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
                struct file *f = *old_fds++;
                *new_fds = f;
                if (f)
-                       f->f_count++;
+                       atomic_inc(&f->f_count);
                new_fds++;
        }
        /* This is long word aligned thus could use a optimized version */ 
index 7f71f266ce37b7df624ae450b4842a81d48b3faf..a5b5b01ddb4723ca7b7a1fac323fe3d02e91b064 100644 (file)
@@ -163,6 +163,9 @@ EXPORT_SYMBOL(__bforget);
 EXPORT_SYMBOL(ll_rw_block);
 EXPORT_SYMBOL(__wait_on_buffer);
 EXPORT_SYMBOL(add_blkdev_randomness);
+EXPORT_SYMBOL(block_read_full_page);
+EXPORT_SYMBOL(block_write_full_page);
+EXPORT_SYMBOL(block_flushpage);
 EXPORT_SYMBOL(generic_file_read);
 EXPORT_SYMBOL(generic_file_write);
 EXPORT_SYMBOL(generic_file_mmap);
index 34ff117a9578330a620147c39abc33143d4ace6e..e29d7416bb3f6d88f7b807531e90443503418c79 100644 (file)
@@ -1143,7 +1143,6 @@ ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *
 {
        ssize_t retval;
 
-       unlock_kernel();
        retval = -EFAULT;
        if (access_ok(VERIFY_WRITE, buf, count)) {
                retval = 0;
@@ -1161,7 +1160,6 @@ ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *
                                retval = desc.error;
                }
        }
-       lock_kernel();
        return retval;
 }
 
@@ -1486,7 +1484,7 @@ static int filemap_write_page(struct vm_area_struct * vma,
         * If a task terminates while we're swapping the page, the vma and
         * and file could be released ... increment the count to be safe.
         */
-       file->f_count++;
+       atomic_inc(&file->f_count);
        result = do_write_page(inode, file, (const char *) page, offset);
        fput(file);
        return result;
@@ -1834,8 +1832,6 @@ generic_file_write(struct file *file, const char *buf,
                count = limit - pos;
        }
 
-       unlock_kernel();
-
        while (count) {
                unsigned long bytes, pgpos, offset;
                /*
@@ -1897,7 +1893,6 @@ repeat_find:
                page_cache_free(page_cache);
 
        err = written ? written : status;
-       lock_kernel();
 out:
        return err;
 }
index 4a938c9585bdee7856ef9e049646f94857d855d0..7947031af1a6f50cacc175c93c16cbd8e830f3c3 100644 (file)
@@ -31,7 +31,7 @@ static inline int mlock_fixup_start(struct vm_area_struct * vma,
        vma->vm_offset += vma->vm_start - n->vm_start;
        n->vm_flags = newflags;
        if (n->vm_file)
-               n->vm_file->f_count++;
+               atomic_inc(&n->vm_file->f_count);
        if (n->vm_ops && n->vm_ops->open)
                n->vm_ops->open(n);
        insert_vm_struct(current->mm, n);
@@ -52,7 +52,7 @@ static inline int mlock_fixup_end(struct vm_area_struct * vma,
        n->vm_offset += n->vm_start - vma->vm_start;
        n->vm_flags = newflags;
        if (n->vm_file)
-               n->vm_file->f_count++;
+               atomic_inc(&n->vm_file->f_count);
        if (n->vm_ops && n->vm_ops->open)
                n->vm_ops->open(n);
        insert_vm_struct(current->mm, n);
@@ -82,7 +82,7 @@ static inline int mlock_fixup_middle(struct vm_area_struct * vma,
        right->vm_offset += right->vm_start - left->vm_start;
        vma->vm_flags = newflags;
        if (vma->vm_file)
-               vma->vm_file->f_count += 2;
+               atomic_add(2, &vma->vm_file->f_count);
 
        if (vma->vm_ops && vma->vm_ops->open) {
                vma->vm_ops->open(left);
index ac35cf0570440eff2861216dc72fb7dab5f741ee..360087abf0bf0e76c4254a1f44e3a176f5c21ae8 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -313,7 +313,7 @@ unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
                if (error)
                        goto unmap_and_free_vma;
                vma->vm_file = file;
-               file->f_count++;
+               atomic_inc(&file->f_count);
        }
 
        /*
@@ -547,7 +547,7 @@ static struct vm_area_struct * unmap_fixup(struct vm_area_struct *area,
                mpnt->vm_file = area->vm_file;
                mpnt->vm_pte = area->vm_pte;
                if (mpnt->vm_file)
-                       mpnt->vm_file->f_count++;
+                       atomic_inc(&mpnt->vm_file->f_count);
                if (mpnt->vm_ops && mpnt->vm_ops->open)
                        mpnt->vm_ops->open(mpnt);
                area->vm_end = addr;    /* Truncate area */
index b28237c09e2678a6815a5a334a1a05238df39afa..14073c0faa9a3666e2d00f08eb2499b569b1b257 100644 (file)
@@ -103,7 +103,7 @@ static inline int mprotect_fixup_start(struct vm_area_struct * vma,
        n->vm_flags = newflags;
        n->vm_page_prot = prot;
        if (n->vm_file)
-               n->vm_file->f_count++;
+               atomic_inc(&n->vm_file->f_count);
        if (n->vm_ops && n->vm_ops->open)
                n->vm_ops->open(n);
        insert_vm_struct(current->mm, n);
@@ -126,7 +126,7 @@ static inline int mprotect_fixup_end(struct vm_area_struct * vma,
        n->vm_flags = newflags;
        n->vm_page_prot = prot;
        if (n->vm_file)
-               n->vm_file->f_count++;
+               atomic_inc(&n->vm_file->f_count);
        if (n->vm_ops && n->vm_ops->open)
                n->vm_ops->open(n);
        insert_vm_struct(current->mm, n);
@@ -158,7 +158,7 @@ static inline int mprotect_fixup_middle(struct vm_area_struct * vma,
        vma->vm_flags = newflags;
        vma->vm_page_prot = prot;
        if (vma->vm_file)
-               vma->vm_file->f_count += 2;
+               atomic_add(2,&vma->vm_file->f_count);
        if (vma->vm_ops && vma->vm_ops->open) {
                vma->vm_ops->open(left);
                vma->vm_ops->open(right);
index b50e00dec6ae03f4c4dca509ad0ae05b1a7e1ba5..48d3e9f94e9c7bf2f370fec1b4eeea69b8fe2032 100644 (file)
@@ -136,7 +136,7 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
                        new_vma->vm_offset = vma->vm_offset + (addr - vma->vm_start);
                        lock_kernel();
                        if (new_vma->vm_file)
-                               new_vma->vm_file->f_count++;
+                               atomic_inc(&new_vma->vm_file->f_count);
                        if (new_vma->vm_ops && new_vma->vm_ops->open)
                                new_vma->vm_ops->open(new_vma);
                        insert_vm_struct(current->mm, new_vma);
index cdb5f3d03deb1abeaa806daae2a1de361dfff06a..7e9f466cad966765cc29d7788ce91dc0148fd482 100644 (file)
@@ -232,7 +232,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
                        break;
                }
                /* Bump the usage count and install the file. */
-               fp[i]->f_count++;
+               atomic_inc(&fp[i]->f_count);
                current->files->fd[new_fd] = fp[i];
        }
 
@@ -274,7 +274,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl)
                memcpy(new_fpl, fpl, sizeof(*fpl));
 
                for (i=fpl->count-1; i>=0; i--)
-                       fpl->fp[i]->f_count++;
+                       atomic_inc(&fpl->fp[i]->f_count);
        }
        return new_fpl;
 }
index cf02f93640cf84a18ea652f26a971378c765bed7..28c3093d5965a641d5a8e0deef923d0cc4f4b8a2 100644 (file)
@@ -315,9 +315,7 @@ static __inline__ const __u8 icmp_type_request(__u8 type)
  *     Will cycle in MASQ_PORT boundaries.
  */
 static __u16 masq_port = PORT_MASQ_BEGIN;
-#ifdef __SMP__
 static spinlock_t masq_port_lock = SPIN_LOCK_UNLOCKED;
-#endif
 
 /*
  *     free ports counters (UDP & TCP)
index ff07231fc1d22d5d7f61010e2b7867694842fe61..db6d66d0a9d8520eca276310a3dbe75bc7d6f3a8 100644 (file)
@@ -73,16 +73,12 @@ struct ip_masq_mfw {
        __u32 fwmark;                   /* key: firewall mark */
        struct list_head hosts;         /* list of forward-to hosts */
        atomic_t nhosts;                /* number of "" */
-#ifdef __SMP__
        rwlock_t lock;
-#endif
 };
 
 
 static DECLARE_MUTEX(mfw_sema);
-#ifdef __SMP__
 static rwlock_t mfw_lock = RW_LOCK_UNLOCKED;
-#endif
 
 static struct ip_masq_mfw *ip_masq_mfw_table[IP_MASQ_MFW_HSIZE];
 
@@ -143,9 +139,7 @@ static struct ip_masq_mfw * mfw_new(int fwmark)
        MOD_INC_USE_COUNT;
        memset(mfw, 0, sizeof(*mfw));
        mfw->fwmark = fwmark;
-#ifdef __SMP__
        mfw->lock = (rwlock_t) RW_LOCK_UNLOCKED;
-#endif
 
        INIT_LIST_HEAD(&mfw->hosts);
 out:
index 0053549447536e07c4381bfe4a41abadd257f068..654ab9ff7a806a660577fb7c175aee126ac63b32 100644 (file)
@@ -33,9 +33,7 @@ EXPORT_SYMBOL(unregister_ip_masq_mod);
 EXPORT_SYMBOL(ip_masq_mod_lkp_link);
 EXPORT_SYMBOL(ip_masq_mod_lkp_unlink);
 
-#ifdef __SMP__
 static spinlock_t masq_mod_lock = SPIN_LOCK_UNLOCKED;
-#endif
 
 /*
  *     Base pointer for registered modules
index ad26674013d897e445913d2ab78740a40ec2f382..91e1b726de436449d13467ed955452b56e748f45 100644 (file)
@@ -51,9 +51,7 @@ MODULE_PARM(debug, "i");
 /*
  *     Lock
  */
-#ifdef __SMP__
 static spinlock_t portfw_lock = SPIN_LOCK_UNLOCKED;
-#endif
 
 static struct list_head portfw_list[2];
 static __inline__ int portfw_idx(int protocol)
index 779c31cef6b11f48f22babbf07b42b6b4fc24325..4a1bdde4a95acd8cfcbb0e542079b03595ebbb57 100644 (file)
@@ -749,7 +749,6 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
        int mss_now;
        int err, copied;
 
-       unlock_kernel();
        lock_sock(sk);
 
        err = 0;
@@ -976,7 +975,6 @@ do_fault2:
 out:
        tcp_push_pending_frames(sk, tp);
        release_sock(sk);
-       lock_kernel();
        return err;
 }
 
@@ -1156,7 +1154,6 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
        if (flags & MSG_WAITALL)
                target=len;
 
-       unlock_kernel();
        add_wait_queue(sk->sleep, &wait);
        lock_sock(sk);
        
@@ -1355,7 +1352,6 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
        /* Clean up data we have read: This will do ACK frames. */
        cleanup_rbuf(sk, copied);
        release_sock(sk);
-       lock_kernel();
        return copied;
 }
 
index 1d12037dabd31c5fabd52befd76f17f45a5f6148..3d0f25fc9fbf0846b9d9e49aa5fbb4deca85090c 100644 (file)
 #include <net/scm.h>
 #include <linux/init.h>
 #include <linux/poll.h>
+#include <linux/smp_lock.h>
 
 #include <asm/checksum.h>
 
@@ -943,7 +944,7 @@ static void unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
  *     Send AF_UNIX data.
  */
 
-static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+static int do_unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
                              struct scm_cookie *scm)
 {
        struct sock *sk = sock->sk;
@@ -1040,6 +1041,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
        
        if (!unix_peer(sk))
                unix_unlock(other);
+
        return len;
 
 out_unlock:
@@ -1050,8 +1052,18 @@ out:
        return err;
 }
 
+static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+                             struct scm_cookie *scm)
+{
+       int retval;
+
+       lock_kernel();
+       retval = do_unix_dgram_sendmsg(sock, msg, len, scm);
+       unlock_kernel();
+       return retval;
+}
                
-static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+static int do_unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
                               struct scm_cookie *scm)
 {
        struct sock *sk = sock->sk;
@@ -1120,9 +1132,9 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
                
                if (skb==NULL)
                {
-                       if (sent)
-                               goto out;
-                       return err;
+                       if (!sent)
+                               sent = err;
+                       goto out;
                }
 
                /*
@@ -1141,9 +1153,9 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
 
                if (memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) {
                        kfree_skb(skb);
-                       if (sent)
-                               goto out;
-                       return -EFAULT;
+                       if (!sent)
+                               sent = -EFAULT;
+                       goto out;
                }
 
                other=unix_peer(sk);
@@ -1155,7 +1167,8 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
                                goto out;
                        if (!(msg->msg_flags&MSG_NOSIGNAL))
                                send_sig(SIGPIPE,current,0);
-                       return -EPIPE;
+                       sent = -EPIPE;
+                       goto out;
                }
 
                skb_queue_tail(&other->receive_queue, skb);
@@ -1166,6 +1179,17 @@ out:
        return sent;
 }
 
+static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+                              struct scm_cookie *scm)
+{
+       int retval;
+
+       lock_kernel();
+       retval = do_unix_stream_sendmsg(sock, msg, len, scm);
+       unlock_kernel();
+       return retval;
+}
+
 /*
  *     Sleep until data has arrive. But check for races..
  */
@@ -1180,7 +1204,7 @@ static void unix_data_wait(unix_socket * sk)
        }
 }
 
-static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+static int do_unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
                              int flags, struct scm_cookie *scm)
 {
        struct sock *sk = sock->sk;
@@ -1257,8 +1281,18 @@ out:
        return err;
 }
 
+static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+                             int flags, struct scm_cookie *scm)
+{
+       int retval;
 
-static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+       lock_kernel();
+       retval = do_unix_dgram_recvmsg(sock, msg, size, flags, scm);
+       unlock_kernel();
+       return retval;
+}
+
+static int do_unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
                               int flags, struct scm_cookie *scm)
 {
        struct sock *sk = sock->sk;
@@ -1275,8 +1309,7 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size
                return -EOPNOTSUPP;
        if (flags&MSG_WAITALL)
                target = size;
-               
-               
+
        msg->msg_namelen = 0;
 
        /* Lock the socket to prevent queue disordering
@@ -1392,6 +1425,17 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size
        return copied;
 }
 
+static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
+                              int flags, struct scm_cookie *scm)
+{
+       int retval;
+
+       lock_kernel();
+       retval = do_unix_stream_recvmsg(sock, msg, size, flags, scm);
+       unlock_kernel();
+       return retval;
+}
+
 static int unix_shutdown(struct socket *sock, int mode)
 {
        struct sock *sk = sock->sk;
index 4f659bd9f036859b0e3b973bd4ac6f0ee36dd4c2..fa5a21fe1f76a5c09249f8d44f721b41873f4b6c 100644 (file)
@@ -199,7 +199,7 @@ void unix_gc(void)
                 *      in flight we are in use.
                 */
                if(s->socket && s->socket->file &&
-                  s->socket->file->f_count > s->protinfo.af_unix.inflight)
+                  atomic_read(&s->socket->file->f_count) > s->protinfo.af_unix.inflight)
                        maybe_unmark_and_push(s);
        }
 
index 9aa0c348541821663f9a86fd44e44cb1d17426a8..d8bd1e33d9af75537e5b3c0c3f8fb09da9b81e77 100644 (file)
@@ -127,7 +127,7 @@ static struct inode_operations router_inode =
        NULL,                   /* readlink */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* truncate */
        router_proc_perms
 };
@@ -167,7 +167,7 @@ static struct inode_operations wandev_inode =
        NULL,                   /* follow_link */
        NULL,                   /* readpage */
        NULL,                   /* writepage */
-       NULL,                   /* bmap */
+       NULL,                   /* get_block */
        NULL,                   /* truncate */
        router_proc_perms
 };