]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.46 1.1.46
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:39 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:39 +0000 (15:09 -0500)
121 files changed:
CREDITS
Makefile
arch/i386/Makefile
arch/i386/boot/setup.S
arch/i386/config.in
drivers/FPU-emu/README
drivers/FPU-emu/fpu_etc.c
drivers/FPU-emu/get_address.c
drivers/FPU-emu/poly_tan.c
drivers/FPU-emu/reg_ld_str.c
drivers/FPU-emu/reg_round.S
drivers/block/hd.c
drivers/char/kbd_kern.h
drivers/char/keyboard.c
drivers/char/mem.c
drivers/char/tty_io.c
drivers/net/3c503.c
drivers/net/Space.c
drivers/net/net_init.c
drivers/net/slip.h
drivers/scsi/NCR5380.c
drivers/scsi/NCR5380.h
drivers/scsi/README.st
drivers/scsi/aha152x.c
drivers/scsi/aha1542.c
drivers/scsi/aha1542.h
drivers/scsi/aha1740.c
drivers/scsi/buslogic.c
drivers/scsi/buslogic.h
drivers/scsi/constants.c
drivers/scsi/fdomain.c
drivers/scsi/g_NCR5380.c
drivers/scsi/hosts.c
drivers/scsi/hosts.h
drivers/scsi/pas16.c
drivers/scsi/pas16.h
drivers/scsi/script_asm.pl
drivers/scsi/scsi.c
drivers/scsi/scsi.h
drivers/scsi/sd.c
drivers/scsi/seagate.c
drivers/scsi/sg.h
drivers/scsi/sr.c
drivers/scsi/t128.c
drivers/scsi/t128.h
drivers/scsi/ultrastor.c
drivers/scsi/wd7000.c
drivers/sound/CHANGELOG
drivers/sound/Readme
drivers/sound/Readme.linux
drivers/sound/Readme.v30
drivers/sound/ad1848.c
drivers/sound/configure.c
drivers/sound/dmabuf.c
drivers/sound/experimental.txt
drivers/sound/gus_wave.c
drivers/sound/opl3.h
drivers/sound/os.h
drivers/sound/pas.h
drivers/sound/pas2_mixer.c
drivers/sound/pas2_pcm.c
drivers/sound/patmgr.c
drivers/sound/pss.c
drivers/sound/sb_dsp.c
drivers/sound/sb_midi.c
drivers/sound/sequencer.c
drivers/sound/sound_config.h
fs/block_dev.c
fs/exec.c
fs/ext/dir.c
fs/ext/freelists.c
fs/ext/inode.c
fs/ext/namei.c
fs/ext2/CHANGES
fs/ext2/acl.c
fs/ext2/balloc.c
fs/ext2/dir.c
fs/ext2/file.c
fs/ext2/ialloc.c
fs/ext2/inode.c
fs/ext2/ioctl.c
fs/ext2/namei.c
fs/ext2/super.c
fs/ext2/symlink.c
fs/ext2/truncate.c
fs/fcntl.c
fs/hpfs/hpfs_fs.c
fs/msdos/misc.c
fs/msdos/namei.c
fs/namei.c
fs/open.c
fs/read_write.c
fs/sysv/dir.c
include/asm-i386/bitops.h
include/asm-i386/dma.h
include/asm-i386/string.h
include/asm-mips/mipsregs.h
include/linux/ext2_fs.h
include/linux/ext2_fs_i.h
include/linux/ext2_fs_sb.h
include/linux/fs.h
include/linux/msdos_fs.h
include/linux/pci.h
include/linux/sched.h
include/linux/soundcard.h
include/linux/tqueue.h
include/linux/types.h
include/linux/unistd.h
kernel/bios32.c
kernel/ksyms.c
kernel/sched.c
kernel/sys.c
kernel/sys_call.S
mm/swap.c
net/inet/README
net/inet/af_inet.c
net/inet/arp.c
net/inet/dev.c
net/inet/devinet.c
net/inet/ip.c
net/inet/tcp.c

diff --git a/CREDITS b/CREDITS
index d0f696d93407d1088c7e055f2519485dd9698456..9088ac34fdd34cb3828af391bd8e36b85b963d68 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -201,6 +201,14 @@ S: 301 Norwood Terrace, Apartment N226
 S: Boca Raton, Florida 33431-6588
 S: USA
 
+N: David Gentzel
+E: gentzel@nova.enet.dec.com
+D: BusLogic driver and original UltraStor driver
+S: Whitfield Software Services
+S: 631 Idlewood Avenue
+S: Carnegie, Pennsylvania   15106-1126
+S: USA
+
 N: Philip Gladstone
 E: philipg@onsett.com
 D: Kernel / timekeeping stuff
index 47e12760a18a2cf673ad45d7b182384e07b1e68a..06004edd4ce5351beb05ae5dd57349df781bb680 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 45
+SUBLEVEL = 46
 
 ARCH = i386
 
index 4576c28b1814d28215fc3932e8ac25060a25989a..c6bddc26f0f40d1f4d2d5f101540d79e5e87b784 100644 (file)
@@ -39,7 +39,6 @@ zlilo: $(CONFIGURE) zImage
        if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
        if [ -f $(INSTALL_PATH)/zSystem.map ]; then mv $(INSTALL_PATH)/zSystem.map $(INSTALL_PATH)/zSystem.old; fi
        cat zImage > $(INSTALL_PATH)/vmlinuz
-       cat zImage > $(INSTALL_PATH)/vmlinuz
        cp zSystem.map $(INSTALL_PATH)/
        if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
 
index 3c7a8eb427713921b7a6e6172e62924611efbdb2..02f53fa88c7438577002f7efb4e10c75de8a58fd 100644 (file)
@@ -45,6 +45,11 @@ begbss:
 
 entry start
 start:
+! Bootlin depends on this being done early
+       mov     ax,#0x01500
+       mov     dl,#0x81
+       int     0x13
+
 ! Check signature at end of setup
        mov     ax,#SETUPSEG
        mov     ds,ax
index 440c577135985f13ec26f914d52eb0a5719230d9..4da63891d13587f304eb1d4f4a75acd22292edbe 100644 (file)
@@ -24,7 +24,8 @@ bool 'Reverse ARP' CONFIG_INET_RARP n
 bool 'Assume subnets are local' CONFIG_INET_SNARL y
 bool 'Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF n
 fi
-bool 'The IPX protocol' CONFIG_IPX y
+bool 'The IPX protocol' CONFIG_IPX n
+bool 'RPC connections to old BSD systems' CONFIG_I_AM_A_BROKEN_BSD_WEENIE n
 #bool 'Amateur Radio AX.25 Level 2' CONFIG_AX25 n
 fi
 
index aa9a3e49ad5b4b4d1270d9a8a6cb68ecf8fe7ad3..2c0acb423f990b164b5369456a80a1808452126f 100644 (file)
@@ -346,7 +346,7 @@ f2xm1     (-1,1)      538847      4    481    6488   63.79  0.167709
 
 Tests performed on an 80486 FPU showed results of lower accuracy. The
 following table gives the results which were obtained with an AMD
-486DX2/66 (other tests indictate that an Intel 486DX produces
+486DX2/66 (other tests indicate that an Intel 486DX produces
 identical results).  The tests were basically the same as those used
 to measure the emulator (the values, being random, were in general not
 the same).  The total number of tests for each instruction are given
index c1e113a7f6fc65d7dab869a4dd6cde92d056a486..20e3294ca44bd055dd833bcd332509520f369bbd 100644 (file)
@@ -57,7 +57,7 @@ static void ftst_(FPU_REG *st0_ptr)
       if ( (st0_ptr->exp <= EXP_UNDER) && (denormal_operand()) )
        {
 #ifdef PECULIAR_486
-         /* This is wierd! */
+         /* This is weird! */
          if (st0_ptr->sign == SIGN_POS)
            setcc(SW_C3);
 #endif PECULIAR_486
index 79d01879ca4eb3566dbc6793022ab921af79aa86..6f3270ae30371f50aca5d9f839d74f6fdcb7b63d 100644 (file)
@@ -113,7 +113,7 @@ static int sib(int mod, unsigned long *fpu_eip)
     }
   else if (mod == 2 || base == 5) /* The second condition also has mod==0 */
     {
-      /* 32 bit displacment */
+      /* 32 bit displacement */
       RE_ENTRANT_CHECK_OFF;
       FPU_code_verify_area(4);
       offset += (signed) get_fs_long((unsigned long *) (*fpu_eip));
index 845b19bf865ef79dab8514b9ecdf9cecde63ea44..d9b09e438bed4bdc813a1437e71e312e9e4817e1 100644 (file)
@@ -135,7 +135,7 @@ void        poly_tan(FPU_REG const *arg, FPU_REG *result)
     {
       /* accumulatoro must contain 1.0 here, (actually, 0) but it
         really doesn't matter what value we use because it will
-        have neglibible effect in later calculations
+        have negligible effect in later calculations
         */
       XSIG_LL(accum) = 0x8000000000000000LL;
       accum.lsw = 0;
index 405a8745630e4c2ea41c2ee3180f5794dbaee60c..efec9e010e91be3e823b37f014e18d3d4f4fcfc4 100644 (file)
@@ -776,7 +776,7 @@ int reg_store_single(float *single, FPU_REG *st0_ptr)
                return 0;
 
              /* This is a special case: see sec 16.2.5.1 of the 80486 book. */
-             /* Masked respose is overflow to infinity. */
+             /* Masked response is overflow to infinity. */
              templ = 0x7f800000;
            }
          else
@@ -1085,7 +1085,7 @@ int reg_store_bcd(char *d, FPU_REG *st0_ptr)
    a non-zero value is returned */
 /* Overflow is signalled by a non-zero return value (in eax).
    In the case of overflow, the returned significand always has the
-   the largest possible value */
+   largest possible value */
 int round_to_int(FPU_REG *r)
 {
   char     very_big;
@@ -1374,7 +1374,7 @@ void fsave(fpu_addr_modes addr_modes, char *data_address)
 /*===========================================================================*/
 
 /*
-  A call to this function must be preceeded by a call to
+  A call to this function must be preceded by a call to
   FPU_verify_area() to verify access to the 10 bytes at d
   */
 static void write_to_extended(FPU_REG *rp, char *d)
index 33c4bd2bb4965ba7258cc1ac37f1472ad5a004a5..bd8a40dc423c28692a4e8f3a1908c7dd0929f8ed 100644 (file)
@@ -9,7 +9,7 @@
  |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
  |                                                                           |
  | This code has four possible entry points.                                 |
- | The following must be entered by a jmp intruction:                        |
+ | The following must be entered by a jmp instruction:                       |
  |   fpu_reg_round, fpu_reg_round_sqrt, and fpu_Arith_exit.                  |
  |                                                                           |
  | The _round_reg entry point is intended to be used by C code.              |
index ee25e9b243659753290a4830b98bb6d945fc4e8e..6dddcfaf36e718d9de5cde73b71eebafa8fa469a 100644 (file)
@@ -446,6 +446,7 @@ static void read_intr(void)
                printk("hd%c: read_intr: error = 0x%02x\n",dev+'a',hd_error);
        }
        bad_rw_intr();
+       cli();
        hd_request();
        return;
 ok_to_read:
@@ -538,6 +539,7 @@ static void multwrite_intr(void)
                printk("hd:%c multwrite_intr: error = 0x%02x\n",dev+'a',hd_error);
        }
        bad_rw_intr();
+       cli();
        hd_request();
 }
 
@@ -564,6 +566,7 @@ static void write_intr(void)
                printk("HD: write_intr: error = 0x%02x\n",hd_error);
        }
        bad_rw_intr();
+       cli();
        hd_request();
        return;
 ok_to_write:
index 4f852725c602953183d1113dd815558a06f55107..7253c8cbea3b3ef342b3073e4acb8a07d84a86ff 100644 (file)
  * Note: lockstate is used as index in the array key_map.
  */
 struct kbd_struct {
-        unsigned char ledstate;                /* 3 bits */
+       unsigned char ledstate;         /* 3 bits */
        unsigned char default_ledstate;
+       unsigned char lockstate;        /* 3 bits */ 
 #define VC_SCROLLOCK   0       /* scroll-lock mode */
 #define VC_NUMLOCK     1       /* numeric lock mode */
 #define VC_CAPSLOCK    2       /* capslock mode */
 
-       unsigned char lockstate;        /* 4 bits - must be in 0..15 */
-#define VC_SHIFTLOCK   KG_SHIFT        /* shift lock mode */
-#define VC_ALTGRLOCK   KG_ALTGR        /* altgr lock mode */
-#define VC_CTRLLOCK    KG_CTRL         /* control lock mode */
-#define VC_ALTLOCK     KG_ALT          /* alt lock mode */
 
        unsigned char modeflags;
 #define VC_APPLIC      0       /* application key mode */
index 698ed92cd9f89bf0ebbaaf436289a372a479ec1e..739507d1f07a1e2e5b197541cba82993d03fcde8 100644 (file)
@@ -344,15 +344,15 @@ static void keyboard_interrupt(int int_pt_regs)
                u_char type;
 
                /* the XOR below used to be an OR */
-               int shift_final = shift_state ^ kbd->lockstate;
+               int shift_final = shift_state ^ vc_kbd_lock(kbd,VC_CAPSLOCK);
 
                key_code = key_map[shift_final][scancode];
                type = KTYP(key_code);
 
                if (type == KT_LETTER) {
                    type = KT_LATIN;
-                   if (vc_kbd_led(kbd,VC_CAPSLOCK))
-                       key_code = key_map[shift_final ^ (1<<KG_SHIFT)][scancode];
+                   if (vc_kbd_lock(kbd,VC_CAPSLOCK))
+                       key_code = key_map[shift_final][scancode];
                }
                (*key_handler[type])(key_code & 0xff, up_flag);
        }
@@ -404,6 +404,7 @@ static void caps_toggle(void)
        if (rep)
                return;
        chg_vc_kbd_led(kbd,VC_CAPSLOCK);
+       chg_vc_kbd_lock(kbd,VC_CAPSLOCK);
 }
 
 static void caps_on(void)
@@ -411,6 +412,7 @@ static void caps_on(void)
        if (rep)
                return;
        set_vc_kbd_led(kbd,VC_CAPSLOCK);
+       set_vc_kbd_lock(kbd,VC_CAPSLOCK);
 }
 
 static void show_ptregs(void)
@@ -461,8 +463,10 @@ static void num(void)
                applkey('P', 1);
                return;
        }
-       if (!rep)       /* no autorepeat for numlock, ChN */
+       if (!rep) {     /* no autorepeat for numlock, ChN */
                chg_vc_kbd_led(kbd,VC_NUMLOCK);
+               chg_vc_kbd_lock(kbd,VC_NUMLOCK);
+       }
 }
 
 static void lastcons(void)
@@ -643,8 +647,7 @@ static void do_pad(unsigned char value, char up_flag)
                applkey(app_map[value], 1);
                return;
        }
-
-       if (!vc_kbd_led(kbd,VC_NUMLOCK))
+       if (!vc_kbd_lock(kbd,VC_NUMLOCK))
                switch (value) {
                        case KVAL(K_PCOMMA):
                        case KVAL(K_PDOT):
@@ -706,8 +709,10 @@ static void do_shift(unsigned char value, char up_flag)
        /* kludge... */
        if (value == KVAL(K_CAPSSHIFT)) {
                value = KVAL(K_SHIFT);
-               if (!up_flag)
+               if (!up_flag) {
                        clr_vc_kbd_led(kbd, VC_CAPSLOCK);
+                       clr_vc_kbd_lock(kbd, VC_CAPSLOCK);
+               }
        }
 
        if (up_flag) {
index 8830b2442b310cc627395e6b8c74732b4f415960..d80445ab2e0ee8be1531ee39f01683f9c9981fdb 100644 (file)
@@ -103,7 +103,7 @@ static int read_kmem(struct inode *inode, struct file *file, char *buf, int coun
        read1 = read_mem(inode, file, buf, count);
        if (read1 < 0)
                return read1;
-       read2 = vread(buf + read1, (char *) file->f_pos, count - read1);
+       read2 = vread(buf + read1, (char *) ((unsigned long) file->f_pos), count - read1);
        if (read2 < 0)
                return read2;
        file->f_pos += read2;
index 1cdaf1de996a2f2387cd1cf0efb474523f843fc5..fef159189b47ce3949957a455665b38e643d04fe 100644 (file)
@@ -1551,7 +1551,7 @@ int tty_register_driver(struct tty_driver *driver)
 /*
  * Initialize the console device. This is called *early*, so
  * we can't necessarily depend on lots of kernel help here.
- * Jus do some early initializations, and do the complex setup
+ * Just do some early initializations, and do the complex setup
  * later.
  */
 long console_init(long kmem_start, long kmem_end)
index 79e5aedc534c2a2760f5a6c9e2bdc5445750f451..b57c14f22736b3db975fb5cce6a6e38e5070d0db 100644 (file)
@@ -360,7 +360,7 @@ el2_block_output(struct device *dev, int count,
           | ECNTRL_START, E33G_CNTRL);
 
     /* This is the byte copy loop: it should probably be tuned for
-       for speed once everything is working.  I think it is possible
+       speed once everything is working.  I think it is possible
        to output 8 bytes between each check of the status bit. */
     for(i = 0; i < count; i++) {
        if (i % 8 == 0)
@@ -405,7 +405,7 @@ el2_block_input(struct device *dev, int count, char *buf, int ring_offset)
           | ECNTRL_START, E33G_CNTRL);
 
     /* This is the byte copy loop: it should probably be tuned for
-       for speed once everything is working. */
+       speed once everything is working. */
     for(i = 0; i < count; i++) {
        if (i % 8 == 0)
            while ((inb(E33G_STATUS) & ESTAT_DPRDY) == 0)
index 0d2251e22b0ac8d4f2f124ac83e70b8fd2b50112..3f05f253d6d1dff7ad01fbc6cc1a07007bb2c66a 100644 (file)
@@ -192,6 +192,25 @@ static struct device eth0_dev = {
 
 #if defined(SLIP) || defined(CONFIG_SLIP)
     extern int slip_init(struct device *);
+    
+#ifdef SL_SLIP_LOTS
+
+    static struct device slip15_dev={"sl15",0,0,0,0,15,0,0,0,0,NEXT_DEV,slip_init};
+    static struct device slip14_dev={"sl14",0,0,0,0,14,0,0,0,0,&slip15_dev,slip_init};
+    static struct device slip13_dev={"sl13",0,0,0,0,13,0,0,0,0,&slip14_dev,slip_init};
+    static struct device slip12_dev={"sl12",0,0,0,0,12,0,0,0,0,&slip13_dev,slip_init};
+    static struct device slip11_dev={"sl11",0,0,0,0,11,0,0,0,0,&slip12_dev,slip_init};
+    static struct device slip10_dev={"sl10",0,0,0,0,10,0,0,0,0,&slip11_dev,slip_init};
+    static struct device slip9_dev={"sl9",0,0,0,0,9,0,0,0,0,&slip10_dev,slip_init};
+    static struct device slip8_dev={"sl8",0,0,0,0,8,0,0,0,0,&slip9_dev,slip_init};
+    static struct device slip7_dev={"sl7",0,0,0,0,7,0,0,0,0,&slip8_dev,slip_init};
+    static struct device slip6_dev={"sl6",0,0,0,0,6,0,0,0,0,&slip7_dev,slip_init};
+    static struct device slip5_dev={"sl5",0,0,0,0,5,0,0,0,0,&slip6_dev,slip_init};
+    static struct device slip4_dev={"sl4",0,0,0,0,4,0,0,0,0,&slip5_dev,slip_init};
+#   undef      NEXT_DEV
+#   define     NEXT_DEV        (&slip4_dev)
+#endif /* SL_SLIP_LOTS */
+    
     static struct device slip3_dev = {
        "sl3",                  /* Internal SLIP driver, channel 3      */
        0x0,                    /* recv memory end                      */
index 72c7cbd2f6e9cf7239fd8f7ce252c6d7a681e5dd..8089240992101417fd0c52f7a586c0bf5a5e2bf0 100644 (file)
@@ -94,7 +94,7 @@ init_etherdev(struct device *dev, int sizeof_private, unsigned long *mem_startp)
        int i;
 
        if (dev == NULL) {
-               int alloc_size = sizeof(struct device) + sizeof("eth%d ")
+               int alloc_size = sizeof(struct device) + sizeof("eth%d   ")
                        + sizeof_private;
                if (mem_startp && *mem_startp ) {
                        dev = (struct device *)*mem_startp;
@@ -102,9 +102,9 @@ init_etherdev(struct device *dev, int sizeof_private, unsigned long *mem_startp)
                } else
                        dev = (struct device *)kmalloc(alloc_size, GFP_KERNEL);
                memset(dev, 0, sizeof(alloc_size));
-               dev->name = (char *)(dev + 1);
                if (sizeof_private)
-                       dev->priv = dev->name + sizeof("eth%d ");
+                       dev->priv = (void *) (dev + 1);
+               dev->name = sizeof_private + (char *)(dev + 1);
                new_device = 1;
        }
 
index 63d577250ce0af0638f1608324be944cbfcfeef8..8c2f3df96c1132bde06fc5a316880bad1e55e632 100644 (file)
@@ -9,6 +9,7 @@
  * Fixes:
  *             Alan Cox        :       Added slip mtu field.
  *             Matt Dillon     :       Printable slip (borrowed from net2e)
+ *             Alan Cox        :       Added SL_SLIP_LOTS
  *
  * Author:     Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  */
 #define _LINUX_SLIP_H
 
 /* SLIP configuration. */
+#ifndef SL_SLIP_LOTS
 #define SL_NRUNIT      4               /* number of SLIP channels      */
+#else
+#define SL_NRUNIT      16
+#endif
 #define SL_MTU         296             /* 296; I am used to 600- FvK   */
 
 /* SLIP protocol characters. */
index 462760bb63de24ced11a39a9695ec1424c734096..a0b8b40aca1a895abba0142ac046b1694e587a83 100644 (file)
@@ -12,7 +12,7 @@
  *     drew@colorado.edu
  *     +1 (303) 666-5836
  *
- * DISTRIBUTION REALEASE 6. 
+ * DISTRIBUTION RELEASE 6. 
  *
  * For more information, please consult 
  *
@@ -31,7 +31,7 @@
  * $Log: NCR5380.c,v $
  * Revision 1.5  1994/01/19  09:14:57  drew
  * Fixed udelay() hack that was being used on DATAOUT phases
- * instead of a propper wait for the final handshake.
+ * instead of a proper wait for the final handshake.
  *
  * Revision 1.4  1994/01/19  06:44:25  drew
  * *** empty log message ***
@@ -48,7 +48,7 @@
  */
 
 /*
- * Furthur development / testing that should be done : 
+ * Further development / testing that should be done : 
  * 1.  Cleanup the NCR5380_transfer_dma function and DMA operation complete
  *     code so that everything does the same thing that's done at the 
  *     end of a pseudo-DMA read operation.
@@ -86,7 +86,7 @@
  * adaptation to platforms like the Mac (Some of which use NCR5380's)
  * more difficult than it has to be.
  *
- * Also, many of the SCSI drivers were written before the command queing
+ * Also, many of the SCSI drivers were written before the command queuing
  * routines were implemented, meaning their implementations of queued 
  * commands were hacked on rather than designed in from the start.
  *
  * each 5380 in the system - commands that haven't been issued yet,
  * and commands that are currently executing.  This means that an 
  * unlimited number of commands may be queued, letting 
- * more commands propogate from the higher driver levels giving higher 
- * througput.  Note that both I_T_L and I_T_L_Q nexuses are supported, 
- * allowing multiple commands to propogate all the way to a SCSI-II device 
- * while a command is allready executing.
+ * more commands propagate from the higher driver levels giving higher 
+ * throughput.  Note that both I_T_L and I_T_L_Q nexuses are supported, 
+ * allowing multiple commands to propagate all the way to a SCSI-II device 
+ * while a command is already executing.
  *
  * To solve the multiple-boards-in-the-same-system problem, 
  * there is a separate instance structure for each instance
- * of a 5380 in the system.  So, mutliple NCR5380 drivers will
+ * of a 5380 in the system.  So, multiple NCR5380 drivers will
  * be able to coexist with appropriate changes to the high level
  * SCSI code.  
  *
  * brain dead (ie, many TEXEL CD ROM drives) and won't disconnect 
  * while doing long seek operations.
  * 
- * The workarround for this is to keep track of devices that have
+ * The workaround for this is to keep track of devices that have
  * disconnected.  If the device hasn't disconnected, for commands that
  * should disconnect, we do something like 
  *
  * on "time to data" would give the best results as long as short time
  * to datas (ie, on the same track) were considered, however these 
  * broken devices are the exception rather than the rule and I'd rather
- * spend my time optomizing for the normal case.
+ * spend my time optimizing for the normal case.
  *
  * Architecture :
  *
- * At the heart of the design is a corroutine, NCR5380_main,
+ * At the heart of the design is a coroutine, NCR5380_main,
  * which is started when not running by the interrupt handler,
  * timer, and queue command function.  It attempts to establish
  * I_T_L or I_T_L_Q nexuses by removing the commands from the 
  * will try to sleep.
  *
  * If a command has disconnected, eventually an interrupt will trigger,
- * calling NCR5380_intr()  which will inturn call NCR5380_reselect
- * to restablish a nexus.  This will run main if necessary.
+ * calling NCR5380_intr()  which will in turn call NCR5380_reselect
+ * to reestablish a nexus.  This will run main if necessary.
  *
  * On command termination, the done function will be called as 
  * appropriate.
  *     for commands that return with a CHECK CONDITION status. 
  *
  * DIFFERENTIAL - if defined, NCR53c81 chips will use external differential
- *     tracievers. 
+ *     transceivers. 
  *
  * LINKED - if defined, linked commands are supported.
  *
  *     rely on phase mismatch and EOP interrupts to determine end 
  *     of phase.
  *
- * SCSI2 - if defined, SCSI-2 tagged queing is used where possible
+ * SCSI2 - if defined, SCSI-2 tagged queuing is used where possible
  *
  * UNSAFE - leave interrupts enabled during pseudo-DMA transfers.  You
  *         only really want to use this if you're having a problem with
  *
  * If this is not done, the routines will be defined as static functions
  * with the NCR5380* names and the user must provide a globally
- * accessable wrapper function.
+ * accessible wrapper function.
  *
  * The generic driver is initialized by calling NCR5380_init(instance),
  * after setting the appropriate host specific fields and ID.  If the 
@@ -399,7 +399,7 @@ static void NCR5380_print_phase(struct Scsi_Host *instance) {
 #endif
 
 /*
- * We need to have our corroutine active given these constraints : 
+ * We need to have our coroutine active given these constraints : 
  * 1.  The mutex flag, main_running, can only be set when the main 
  *     routine can actually process data, otherwise SCSI commands
  *     will never get issued.
@@ -412,7 +412,7 @@ static void NCR5380_print_phase(struct Scsi_Host *instance) {
  *     even though it is only called in two places.
  *
  * So, the solution is to set the mutex in an inline wrapper for the 
- * main corroutine, and have the main corroutine exit with interrupts 
+ * main coroutine, and have the main coroutine exit with interrupts 
  * disabled after the final search through the queues so that no race 
  * conditions are possible.
  */
@@ -472,7 +472,7 @@ static struct Scsi_Host * expires_first = NULL;
 /* 
  * Function : int should_disconnect (unsigned char cmd)
  *
- * Purpose : decide weather a commmand would normally disconnect or 
+ * Purpose : decide weather a command would normally disconnect or 
  *     not, since if it won't disconnect we should go to sleep.
  *
  * Input : cmd - opcode of SCSI command
@@ -480,7 +480,7 @@ static struct Scsi_Host * expires_first = NULL;
  * Returns : DISCONNECT_LONG if we should disconnect for a really long 
  *     time (ie always, sleep, look for REQ active, sleep), 
  *     DISCONNECT_TIME_TO_DATA if we would only disconnect for a normal
- *     time-to-data dealy, DISCONNECT_NONE if this command would return
+ *     time-to-data delay, DISCONNECT_NONE if this command would return
  *     immediately.
  *
  *      Future sleep algorithms based on time to data can exploit 
@@ -537,7 +537,7 @@ static int NCR5380_set_timer (struct Scsi_Host *instance) {
     return 0;
 }    
 
-/* Doing something about unwanted rentrancy here might be useful */
+/* Doing something about unwanted reentrancy here might be useful */
 void NCR5380_timer_fn(void) {
     struct Scsi_Host *instance;
     cli();
@@ -586,7 +586,7 @@ static void NCR5380_all_init (void) {
  * Purpose : autoprobe for the IRQ line used by the NCR5380.  
  *
  * Inputs : instance - pointer to this instance of the NCR5380 driver,
- *          possible - bitmask of permissable interrupts.
+ *          possible - bitmask of permissible interrupts.
  *
  * Returns : number of the IRQ selected, IRQ_NONE if no interrupt fired.
  * 
@@ -744,7 +744,7 @@ static void NCR5380_print_status (struct Scsi_Host *instance) {
 /* 
  * Function : void NCR5380_init (struct Scsi_Host *instance, flags)
  *
- * Purpose : initializies *instance and corresponding 5380 chip,
+ * Purpose : initializes *instance and corresponding 5380 chip,
  *     with flags OR'd into the initial flags value.
  *
  * Inputs : instance - instantiation of the 5380 driver.  
@@ -802,7 +802,7 @@ static void NCR5380_init (struct Scsi_Host *instance, int flags) {
 #ifndef AUTOSENSE
     if ((instance->cmd_per_lun > 1) || instance->can_queue > 1)) 
         printk("scsi%d : WARNING : support for multiple outstanding commands enabled\n"
-               "         without AUTOSENSE option, contigent alligence conditions may\n"
+               "         without AUTOSENSE option, contingent allegiance conditions may\n"
                "         be incorrectly cleared.\n", instance->host_no);
 #endif /* def AUTOSENSE */
 
@@ -871,8 +871,8 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) {
     /* 
      * Insert the cmd into the issue queue. Note that REQUEST SENSE 
      * commands are added to the head of the queue since any command will
-     * clear the contingent allegience condition that exists and the 
-     * sense data is only guranteed to be valid while the condition exists.
+     * clear the contingent allegiance condition that exists and the 
+     * sense data is only guaranteed to be valid while the condition exists.
      */
 
     cli();
@@ -889,7 +889,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) {
        (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
 #endif
 
-/* Run the coroutine if it isn't allready running. */
+/* Run the coroutine if it isn't already running. */
     run_main();
     return 0;
 }
@@ -897,13 +897,13 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) {
 /*
  * Function : NCR5380_main (void) 
  *
- * Purpose : NCR5380_main is a corroutine that runs as long as more work can 
+ * Purpose : NCR5380_main is a coroutine that runs as long as more work can 
  *     be done on the NCR5380 host adapters in a system.  Both 
  *     NCR5380_queue_command() and NCR5380_intr() will try to start it 
  *     in case it is not running.
  * 
  * NOTE : NCR5380_main exits with interrupts *disabled*, the caller should 
- *  reenable them.  This prevents rentrancy and kernel stack overflow.
+ *  reenable them.  This prevents reentrancy and kernel stack overflow.
  */    
     
 static void NCR5380_main (void) {
@@ -951,7 +951,7 @@ static void NCR5380_main (void) {
                                hostdata->issue_queue = (Scsi_Cmnd *) tmp->host_scribble;
                        tmp->host_scribble = NULL;
 
-                       /* renable interrupts after finding one */
+                       /* reenable interrupts after finding one */
                        sti();
 
                        /* 
@@ -967,7 +967,7 @@ static void NCR5380_main (void) {
                        /* 
                         * REQUEST SENSE commands are issued without tagged
                         * queueing, even on SCSI-II devices because the 
-                        * contingent alligence condition exists for the 
+                        * contingent allegiance condition exists for the 
                         * entire unit.
                         */
                        
@@ -1017,7 +1017,7 @@ static void NCR5380_main (void) {
 /*
  * Function : void NCR5380_intr (int irq)
  * 
- * Purpose : handle interrupts, restablishing I_T_L or I_T_L_Q nexuses
+ * Purpose : handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
  *     from the disconnected queue, and restarting NCR5380_main() 
  *     as required.
  *
@@ -1069,7 +1069,7 @@ static void NCR5380_intr (int irq) {
                    } else {
 /*  
  * XXX the rest of the interrupt conditions should *only* occur during a 
- * DMA transfer, which I haven't gotten arround to fixing yet.
+ * DMA transfer, which I haven't gotten around to fixing yet.
  */
 
 #if defined(REAL_DMA)
@@ -1085,7 +1085,7 @@ static void NCR5380_intr (int irq) {
                            int transfered;
 
                            if (!hostdata->connected) 
-                               panic("scsi%d : recieved end of DMA interrupt with no connected cmd\n",
+                               panic("scsi%d : received end of DMA interrupt with no connected cmd\n",
                                    instance->hostno);
 
                            transfered = (hostdata->dmalen - NCR5380_dma_residual(instance));
@@ -1139,7 +1139,7 @@ static void NCR5380_intr (int irq) {
  *     the command that is presently connected.
  * 
  * Returns : -1 if selection could not execute for some reason,
- *     0 if selection succeeeded or failed because the target 
+ *     0 if selection succeeded or failed because the target 
  *     did not respond.
  *
  * Side effects : 
@@ -1220,7 +1220,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
 
     /* 
      * The arbitration delay is 2.2us, but this is a minimum and there is 
-     * no maximum so we can safely sleep for ceil(2.2) usecs to accomodate
+     * no maximum so we can safely sleep for ceil(2.2) usecs to accommodate
      * the integral nature of udelay().
      *
      */
@@ -1274,7 +1274,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
 
     /* 
      * Raise ATN while SEL is true before BSY goes false from arbitration,
-     * since this is the only way to gurantee that we'll get a MESSAGE OUT
+     * since this is the only way to guarantee that we'll get a MESSAGE OUT
      * phase immediately after selection.
      */
 
@@ -1293,13 +1293,13 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
        ICR_ASSERT_ATN | ICR_ASSERT_SEL));
 
     /* 
-     * Something wierd happens when we cease to drive BSY - looks
+     * Something weird happens when we cease to drive BSY - looks
      * like the board/chip is letting us do another read before the 
-     * appropriate propogation delay has expired, and we're confusing
+     * appropriate propagation delay has expired, and we're confusing
      * a BSY signal from ourselves as the target's response to SELECTION.
      *
      * A small delay (the 'C++' frontend breaks the pipeline with an
-     * unecessary jump, making it work on my 386-33/Trantor T128, the
+     * unnecessary jump, making it work on my 386-33/Trantor T128, the
      * tighter 'C' code breaks and requires this) solves the problem - 
      * the 1 us delay is arbitrary, and only used because this delay will 
      * be the same on other platforms and since it works here, it should 
@@ -1321,7 +1321,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
 
     /* 
      * XXX very interesting - we're seeing a bounce where the BSY we 
-     * asserted is being reflected / still asserted (propogation delay?)
+     * asserted is being reflected / still asserted (propagation delay?)
      * and it's detecting as true.  Sigh.
      */
 
@@ -1343,7 +1343,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
     if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
        NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
        if (hostdata->targets_present & (1 << cmd->target)) {
-           printk("scsi%d : wierdness\n", instance->host_no);
+           printk("scsi%d : weirdness\n", instance->host_no);
            if (hostdata->restart_select)
                printk("\trestart select\n");
 #ifdef NDEBUG
@@ -1371,12 +1371,12 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
      * transfer phase should be a MESSAGE OUT phase so that we can send the
      * IDENTIFY message.
      * 
-     * If SCSI-II tagged queing is enabled, we also send a SIMPLE_QUEUE_TAG
+     * If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG
      * message (2 bytes) with a tag ID that we increment with every command
      * until it wraps back to 0.
      *
      * XXX - it turns out that there are some broken SCSI-II devices,
-     *      which claim to support tagged queing but fail when more than
+     *      which claim to support tagged queuing but fail when more than
      *      some number of commands are issued at once.
      */
 
@@ -1441,7 +1441,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
  *     what phase is expected, *count - pointer to number of 
  *     bytes to transfer, **data - pointer to data pointer.
  * 
- * Returns : -1 when different phase is enterred without transfering
+ * Returns : -1 when different phase is entered without transferring
  *     maximum number of bytes, 0 if all bytes or transfered or exit
  *     is in same phase.
  *
@@ -1587,7 +1587,7 @@ static int NCR5380_transfer_pio (struct Scsi_Host *instance,
  *     what phase is expected, *count - pointer to number of 
  *     bytes to transfer, **data - pointer to data pointer.
  * 
- * Returns : -1 when different phase is enterred without transfering
+ * Returns : -1 when different phase is entered without transferring
  *     maximum number of bytes, 0 if all bytes or transfered or exit
  *     is in same phase.
  *
@@ -1658,8 +1658,8 @@ static int NCR5380_transfer_dma (struct Scsi_Host *instance,
 #endif
 
 /* 
- * FOO stuff. For some UNAPPARANT reason, I'm getting 
- * watchdog timers fired on bootup for NO APPARANT REASON, meaning it's
+ * FOO stuff. For some UNAPPARENT reason, I'm getting 
+ * watchdog timers fired on bootup for NO APPARENT REASON, meaning it's
  * probably a timing problem.
  *
  * Since this is the only place I have back-to-back writes, perhaps this 
@@ -1670,7 +1670,7 @@ static int NCR5380_transfer_dma (struct Scsi_Host *instance,
 #ifndef FOO
        udelay(1);
 #endif
-       NCR5380_write(START_DMA_INITIATOR_RECIEVE_REG, 0);
+       NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0);
     } else {
 #ifndef FOO
        udelay(1);
@@ -1723,7 +1723,7 @@ static int NCR5380_transfer_dma (struct Scsi_Host *instance,
   However, in order to handle scatter-reads, we must work around the
   problem.  The chosen fix is to DMA N-2 bytes, then check for the
   condition before taking the NCR5380 out of DMA mode.  One or two extra
-  bytes are tranferred via PIO as necessary to fill out the original
+  bytes are transferred via PIO as necessary to fill out the original
   request.
 */
 
@@ -1794,14 +1794,14 @@ static int NCR5380_transfer_dma (struct Scsi_Host *instance,
     if (p & SR_IO) {
        if (!(foo = NCR5380_pread(instance, d, c - 1))) {
            /*
-            * We can't disable DMA mode after successfully transfering 
+            * We can't disable DMA mode after successfully transferring 
             * what we plan to be the last byte, since that would open up
             * a race condition where if the target asserted REQ before 
             * we got the DMA mode reset, the NCR5380 would have latched
             * an additional byte into the INPUT DATA register and we'd
             * have dropped it.
             * 
-            * The workarround was to transfer one fewer bytes than we 
+            * The workaround was to transfer one fewer bytes than we 
             * intended to with the pseudo-DMA read function, wait for 
             * the chip to latch the last byte, read it, and then disable
             * pseudo-DMA mode.
@@ -1811,7 +1811,7 @@ static int NCR5380_transfer_dma (struct Scsi_Host *instance,
             * until ACK goes false.  Since the NCR5380 won't lower ACK
             * until DACK is asserted, which won't happen unless we twiddle
             * the DMA port or we take the NCR5380 out of DMA mode, we 
-            * can gurantee that we won't handshake another extra 
+            * can guarantee that we won't handshake another extra 
             * byte.
             */
 
@@ -1966,7 +1966,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                }
 
                /*
-                * The preffered transfer method is going to be 
+                * The prefered transfer method is going to be 
                 * PSEUDO-DMA for systems that are strictly PIO,
                 * since we can let the hardware do the handshaking.
                 *
@@ -2170,7 +2170,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                     */
                    NCR5380_write(TARGET_COMMAND_REG, 0);
  
-                   /* Enable reselect interupts */
+                   /* Enable reselect interrupts */
                    NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
                    /* Wait for bus free to avoid nasty timeouts */
                    while ((NCR5380_read(STATUS_REG) & SR_BSY) && 
@@ -2184,7 +2184,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                 * Unfortunately, some disks violate the SCSI spec and 
                 * don't issue the required SAVE_POINTERS message before
                 * disconnecting, and we have to break spec to remain 
-                * compatable.
+                * compatible.
                 */
                case SAVE_POINTERS:
                case RESTORE_POINTERS:
@@ -2247,7 +2247,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                            tmp = 0;
                        }
                    } else if (len) {
-                       printk("scsi%d: error recieving extended message\n",
+                       printk("scsi%d: error receiving extended message\n",
                            instance->host_no);
                        tmp = 0;
                    } else {
@@ -2258,7 +2258,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                /* Fall through to reject message */
                    
                /* 
-                * If we get something wierd that we aren't expecting, 
+                * If we get something weird that we aren't expecting, 
                 * reject it.
                 */
                default:
@@ -2270,7 +2270,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
                        printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n",
                            instance->host_no, tmp, cmd->target, cmd->lun);
                    else
-                       printk("scsi%d: rejecting unknown extended message code %02x, legnth %d from target %d, lun %d\n",
+                       printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n",
                            instance->host_no, extended_msg[1], extended_msg[0], cmd->target, cmd->lun);
    
                    msgout = MESSAGE_REJECT;
@@ -2351,7 +2351,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) {
  *
  * Purpose : does reselection, initializing the instance->connected 
  *     field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q 
- *     nexus has been restablished,
+ *     nexus has been reestablished,
  *     
  * Inputs : instance - this instance of the NCR5380.
  *
@@ -2436,7 +2436,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) {
 
        /* 
         * Find the command corresponding to the I_T_L or I_T_L_Q  nexus we 
-        * just restablished, and remove it from the disconnected queue.
+        * just reestablished, and remove it from the disconnected queue.
         */
 
 
@@ -2496,7 +2496,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) {
  * Inputs : instance - this instance of the NCR5380.
  *
  * Returns : pointer to the Scsi_Cmnd structure for which the I_T_L
- *     nexus has been restablished, on failure NULL is returned.
+ *     nexus has been reestablished, on failure NULL is returned.
  */
 
 #ifdef REAL_DMA
@@ -2657,7 +2657,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) {
  *     I_T_L_Q nexus associated with it, go into message out, and send 
  *      an abort message.
  *
- * This case is especially ugly. In order to resetablish the nexus, we
+ * This case is especially ugly. In order to reestablish the nexus, we
  * need to call NCR5380_select().  The easiest way to implement this 
  * function was to abort if the bus was busy, and let the interrupt
  * handler triggered on the SEL for reselect take care of lost arbitrations
@@ -2688,7 +2688,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) {
                return SCSI_ABORT_BUSY;
 
 #if (NDEBUG & NDEBUG_ABORT)
-    printk("scsi%d : nexus restablished.\n", instance->host_no);
+    printk("scsi%d : nexus reestablished.\n", instance->host_no);
 #endif
 
            msg = ABORT;
@@ -2719,7 +2719,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) {
  *
  * We probably reached this point because of an unlikely race condition
  * between the command completing successfully and the abortion code,
- * so we won't panic, but we will notify the user in case somethign really
+ * so we won't panic, but we will notify the user in case something really
  * broke.
  */
 
index 746bbadb22592853151ff65f920b02e7dbfa326c..400c49a870959c56361c03c97c06cc7aa3f271ee 100644 (file)
@@ -58,7 +58,7 @@
  * The contents of the OUTPUT DATA register are asserted on the bus when
  * either arbitration is occuring or the phase-indicating signals (
  * IO, CD, MSG) in the TARGET COMMAND register and the ASSERT DATA
- * bit in the INTITIATOR COMMAND register is set.
+ * bit in the INITIATOR COMMAND register is set.
  */
 
 #define OUTPUT_DATA_REG         0       /* wo DATA lines on SCSI bus */
@@ -92,7 +92,7 @@
 #define MR_TARGET              0x40    /* rw target mode */
 #define MR_ENABLE_PAR_CHECK   0x20     /* rw enable parity checking */
 #define MR_ENABLE_PAR_INTR     0x10    /* rw enable bad parity interrupt */
-#define MR_ENABLE_EOP_INTR     0x08    /* rw enabble eop interrupt */
+#define MR_ENABLE_EOP_INTR     0x08    /* rw enable eop interrupt */
 #define MR_MONITOR_BSY 0x04    /* rw enable int on unexpected bsy fail */
 #define MR_DMA_MODE            0x02    /* rw DMA / pseudo DMA mode */
 #define MR_ARBITRATE           0x01    /* rw start arbitration */
  */
 #define INPUT_DATA_REG                 6       /* ro */
 
-/* Write any value to this register to start a DMA recieve */
-#define START_DMA_TARGET_RECIEVE_REG   6       /* wo */
+/* Write any value to this register to start a DMA receive */
+#define START_DMA_TARGET_RECEIVE_REG   6       /* wo */
 
 /* Read this register to clear interrupt conditions */
 #define RESET_PARITY_INTERRUPT_REG     7       /* ro */
 
-/* Write any value to this register to start an ini mode DMA recieve */
-#define START_DMA_INITIATOR_RECIEVE_REG 7      /* wo */
+/* Write any value to this register to start an ini mode DMA receive */
+#define START_DMA_INITIATOR_RECEIVE_REG 7      /* wo */
 
 #ifdef NCR53C400
 #define C400_CONTROL_STATUS_REG                -8      /* rw */
 #define CSR_53C80_REG          0x80    /* ro  5380 registers busy */
 #define CSR_TRANS_DIR          0x40    /* rw  Data transfer direction */
 #define CSR_SCSI_BUFF_INTR     0x20    /* rw  Enable int on transfer ready */
-#define CSR_53C80_INTR         0x10    /* rw  Enable 53c80 interupts */
-#define CSR_SHARED_INTR                0x08    /* rw  Interupt sharing */
+#define CSR_53C80_INTR         0x10    /* rw  Enable 53c80 interrupts */
+#define CSR_SHARED_INTR                0x08    /* rw  Interrupt sharing */
 #define CSR_HOST_BUF_NOT_RDY   0x04    /* ro  Is Host buffer ready */
 #define CSR_SCSI_BUF_RDY       0x02    /* ro  SCSI buffer read */
 #define CSR_GATED_53C80_IRQ    0x01    /* ro  Last block xferred */
 
 #ifndef ASM
 struct NCR5380_hostdata {
-    NCR5380_implementation_fields;             /* implmenentation specific */
+    NCR5380_implementation_fields;             /* implementation specific */
     unsigned char id_mask, id_higher_mask;     /* 1 << id, all bits greater */
     unsigned char targets_present;             /* targets we have connected
                                                   to, so we can call a select
@@ -316,7 +316,7 @@ static __inline__ int NCR5380_i386_dma_setup (struct Scsi_Host *instance,
     if (count > limit) count = limit;
 
     if ((count & 1) || (((unsigned) ptr) & 1))
-       panic ("scsi%d : attmpted unaligned DMA transfer\n", instance->host_no);
+       panic ("scsi%d : attempted unaligned DMA transfer\n", instance->host_no);
     cli();
     disable_dma(instance->dma_channel);
     clear_dma_ff(instance->dma_channel);
index f576038dc0172c5b905a59faa9b6be8d6c060b08..ed2feee7813df56947b18a8232aec22ea63ae784 100644 (file)
@@ -4,7 +4,7 @@ Last modified: Wed Jun 22 23:38:47 1994 by root@kai.home
 BASICS
 
 The driver is generic. The state of a drive is not modified when the
-driver is initalized or a device is opened. The mode parameters of the
+driver is initialized or a device is opened. The mode parameters of the
 drive can be modified with ioctls. The driver supports fixed and
 variable block size (within buffer limits). Both the auto-rewind
 (minor equals device number) and non-rewind devices (minor is 128 +
index d73c76136d3a24c0dd6bc46ccefe6326a8040b5a..f239f5d785049c8bb3020afdca2fae6253f3d874 100644 (file)
@@ -314,7 +314,7 @@ static void *addresses[] =
 };
 #define ADDRESS_COUNT (sizeof( addresses ) / sizeof( unsigned ))
 
-/* possible i/o adresses for the AIC-6260 */
+/* possible i/o addresses for the AIC-6260 */
 static unsigned short ports[] =
 {
   0x340,      /* default first */
@@ -1094,7 +1094,7 @@ void aha152x_intr( int irqno )
 
   /* disconnected target is trying to reconnect.
      Only possible, if we have disconnected nexuses and
-     nothing is occuping the bus.
+     nothing is occupying the bus.
   */
   if( TESTHI( SSTAT0, SELDI ) &&
       disconnected_SC &&
@@ -1210,7 +1210,7 @@ void aha152x_intr( int irqno )
           sti();
 
 #if defined(DEBUG_INTR) || defined(DEBUG_SELECTION) || defined(DEBUG_PHASES)
-          printk("issueing command, ");
+          printk("issuing command, ");
 #endif
           current_SC->SCp.phase = in_selection;
 
index c93e36948ff75d5caa9d3349805be547521d00c1..3153056f5f2f063c6c1529c6b76e7b45592c9653 100644 (file)
@@ -194,7 +194,7 @@ static int makecode(unsigned hosterr, unsigned scsierr)
        break;
 
       case 0x12: /* Data overrun/underrun-The target attempted to transfer more data
-                   thean was allocated by the Data Length field or the sum of the
+                   than was allocated by the Data Length field or the sum of the
                    Scatter / Gather Data Length fields. */
 
       case 0x13: /* Unexpected bus free-The target dropped the SCSI BSY at an unexpected time. */
@@ -247,7 +247,7 @@ static int aha1542_test_port(int bse, struct Scsi_Host * shpnt)
     /* Quick and dirty test for presence of the card. */
     if(inb(STATUS(bse)) == 0xff) return 0;
 
-    /* Reset the adapter. I ought to make a hard reset, but it's not really nessesary */
+    /* Reset the adapter. I ought to make a hard reset, but it's not really necessary */
     
     /*  DEB(printk("aha1542_test_port called \n")); */
 
index 69440afe1c44c2602d700b294a9a76affa56f3bc..a41e755e57ff14b3bcfeb9a22900c28a2928c99f 100644 (file)
@@ -37,7 +37,7 @@
 /* READ */
 #define STATUS(base) base
 #define STST   0x80            /* Self Test in Progress */
-#define DIAGF  0x40            /* Internal Diagonostic Failure */
+#define DIAGF  0x40            /* Internal Diagnostic Failure */
 #define INIT   0x20            /* Mailbox Initialization Required */
 #define IDLE   0x10            /* SCSI Host Adapter Idle */
 #define CDF    0x08            /* Command/Data Out Port Full */
index 69751a63628d4d735b1260cf47311a501e74f4b7..7d37ef369517ae11bb8c3b7c16805c5d79707cec 100644 (file)
@@ -85,7 +85,7 @@ sense[0],sense[1],sense[2],sense[3]);
     {
        if ( (status[1]&0x18) || status_word.sc ) /*Additional info available*/
        {
-           /* Use the supplied info for futher diagnostics */
+           /* Use the supplied info for further diagnostics */
            switch ( status[2] )
            {
            case 0x12:
@@ -362,7 +362,7 @@ int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
          I when I wrote it, but the Adaptec Spec says the card is so fast,
          that this problem virtually never occurs so I've kept it.  We
           do printk a warning first, so that you'll know if it happens.
-         In practive the only time we've seen this message is when some-
+         In practice the only time we've seen this message is when some-
          thing else is in the driver was broken, like _makecode(), or
          when a scsi device hung the scsi bus.  Even under these conditions,
          The loop actually only cycled < 3 times (we instrumented it). */
index fefc131f36c15f332658f6ee611245b673c66746..372b7bb587b2be9c44f31bd7dd682bc3c10682de 100644 (file)
  *     BT-747D - 747S + differential termination.
  *     BT-757S - 747S + WIDE SCSI.
  *     BT-757D - 747D + WIDE SCSI.
+ *     BT-946C - PCI bus-master FAST SCSI. (??? Nothing else known.)
  *
  *    Should you require further information on any of these boards, BusLogic
  *    can be reached at (408)492-9090.
  *
  *    This driver SHOULD support all of these boards.  It has only been tested
- *    with a 747S.  An earlier version was tested with a 445S.
+ *    with a 747S and 445S.
  *
  *    Places flagged with a triple question-mark are things which are either
  *    unfinished, questionable, or wrong.
@@ -124,8 +125,8 @@ static const unsigned int bases[] = {
 #endif
 };
 
-#define BIOS_TRANSLATION_6432 0                /* Default case */
-#define BIOS_TRANSLATION_25563 1       /* Big disk case */
+#define BIOS_TRANSLATION_DEFAULT 0     /* Default case */
+#define BIOS_TRANSLATION_BIG 1         /* Big disk (> 1G) case */
 
 struct hostdata {
     unsigned char bus_type;
@@ -421,7 +422,7 @@ const char *buslogic_info(void)
 static void buslogic_interrupt(int junk)
 {
     void (*my_done)(Scsi_Cmnd *) = NULL;
-    int errstatus, mbistatus = 0, number_serviced, found;
+    int errstatus, mbistatus = MBX_NOT_IN_USE, number_serviced, found;
     size_t mbi, mbo = 0;
     struct Scsi_Host *shpnt;
     Scsi_Cmnd *sctmp;
@@ -528,7 +529,7 @@ static void buslogic_interrupt(int junk)
                            mb[mbi].status);
 #endif
 
-       if (mbistatus == 0x03)  /* ??? 0x03 == Aborted CCB not found. */
+       if (mbistatus == MBX_COMPLETION_NOT_FOUND)
            continue;
 
 #if BUSLOGIC_DEBUG
@@ -559,7 +560,7 @@ static void buslogic_interrupt(int junk)
 #endif
 
        /* ??? more error checking left out here */
-       if (mbistatus != 1)
+       if (mbistatus != MBX_COMPLETION_OK)
            /* ??? This is surely wrong, but I don't know what's right. */
            errstatus = makecode(ccb[mbo].hastat, ccb[mbo].tarstat);
        else
@@ -915,7 +916,7 @@ static int getconfig(unsigned int base, unsigned char *irq,
 
     /* We only need a DMA channel for ISA boards.  Some other types of boards
        (such as the 747S) have an option to report a DMA channel even though
-       none is used (for compatability with Adaptec drivers which require a
+       none is used (for compatibility with Adaptec drivers which require a
        DMA channel).  We ignore this. */
     if (*bus_type == 'A')
        switch (*dma) {
@@ -950,10 +951,13 @@ static int getconfig(unsigned int base, unsigned char *irq,
 
 static int get_translation(unsigned int base)
 {
-    /* ??? This is wrong if disk is configured for > 1G mapping.
-       Unfortunately, unlike UltraStor, I see know way of determining whether
-       > 1G mapping has been enabled. */
-    return BIOS_TRANSLATION_6432;
+    /* ??? Unlike UltraStor, I see no way of determining whether > 1G mapping
+       has been enabled.  However, it appears that BusLogic uses a mapping
+       scheme which varies with the disk size when > 1G mapping is enabled.
+       For disks <= 1G, this mapping is the same regardless of the setting of
+       > 1G mapping.  Therefore, we should be safe in always assuming that > 1G
+       mapping has been enabled. */
+    return BIOS_TRANSLATION_BIG;
 }
 
 /* Query the board to find out the model. */
@@ -971,7 +975,7 @@ static int buslogic_query(unsigned int base, int *trans)
     WAIT_UNTIL(INTERRUPT(base), CMDC);
     INTR_RESET(base);
 
-#if 1 /* ??? Temporary */
+#if 1  /* ??? Temporary */
     buslogic_printk("Inquiry Bytes: %02X %02X %02X %02X\n",
                    inquiry_result[0], inquiry_result[1],
                    inquiry_result[2], inquiry_result[3]);
@@ -1108,12 +1112,14 @@ int buslogic_detect(Scsi_Host_Template *tpnt)
            /* ??? If we can dynamically allocate the mailbox arrays, I'll
               probably bump up this number. */
            shpnt->hostt->can_queue = BUSLOGIC_MAILBOXES;
-           /*shpnt->base = ???;*/
+           /* No known way to determine BIOS base address, but we don't
+              care since we don't use it anyway. */
+           shpnt->base = NULL;
            shpnt->io_port = base;
            shpnt->dma_channel = dma;
            shpnt->irq = irq;
            HOSTDATA(shpnt)->bios_translation = trans;
-           if (trans == BIOS_TRANSLATION_25563)
+           if (trans == BIOS_TRANSLATION_BIG)
                buslogic_printk("Using extended bios translation.\n");
            HOSTDATA(shpnt)->last_mbi_used = 2 * BUSLOGIC_MAILBOXES - 1;
            HOSTDATA(shpnt)->last_mbo_used = BUSLOGIC_MAILBOXES - 1;
@@ -1179,8 +1185,8 @@ static int restart(struct Scsi_Host *shpnt)
        if (HOSTDATA(shpnt)->sc[i]
            && !HOSTDATA(shpnt)->sc[i]->device->soft_reset) {
 #if 0
-           HOSTDATA(shpnt)->mb[i].status = 1;  /* Indicate ready to
-                                                  restart... */
+           HOSTDATA(shpnt)->mb[i].status
+               = MBX_ACTION_START;     /* Indicate ready to restart... */
 #endif
            count++;
        }
@@ -1342,23 +1348,33 @@ int buslogic_reset(Scsi_Cmnd *scpnt)
 
 int buslogic_biosparam(Disk *disk, int dev, int *ip)
 {
-    int size = disk->capacity;
-    int translation_algorithm;
-
-    translation_algorithm = HOSTDATA(disk->device->host)->bios_translation;
-    /* ??? Should this be > 1024, or >= 1024?  Enquiring minds want to know. */
-    if ((size >> 11) > 1024
-       && translation_algorithm == BIOS_TRANSLATION_25563) {
-       /* Please verify that this is the same as what DOS returns */
-       ip[0] = 255;
-       ip[1] = 63;
-       ip[2] = size / 255 / 63;
+    /* ??? This truncates.  Should we round up to next MB? */
+    unsigned int mb = disk->capacity >> 11;
+
+    /* ip[0] == heads, ip[1] == sectors, ip[2] == cylinders */
+    if (HOSTDATA(disk->device->host)->bios_translation == BIOS_TRANSLATION_BIG
+       && mb > 1024) {
+       if (mb > 4096) {
+           ip[0] = 256;
+           ip[1] = 64;
+           ip[2] = mb >> 3;
+/*         if (ip[2] > 1024)
+               ip[2] = 1024; */
+       } else if (mb > 2048) {
+           ip[0] = 256;
+           ip[1] = 32;
+           ip[2] = mb >> 2;
+       } else {
+           ip[0] = 128;
+           ip[1] = 32;
+           ip[2] = mb >> 1;
+       }
     } else {
        ip[0] = 64;
        ip[1] = 32;
-       ip[2] = size >> 11;
+       ip[2] = mb;
+/*     if (ip[2] > 1024)
+           ip[2] = 1024; */
     }
-/*    if (ip[2] > 1024)
-      ip[2] = 1024; */
     return 0;
 }
index af509c3bdb271f27712c94eda0e9d8223a1745c3..6ab93d1d46835ce0d58df2d27994aac62a773349 100644 (file)
@@ -65,7 +65,7 @@ int buslogic_biosparam(Disk *, int, int *);
 /* READ */
 #define STATUS(base) (base)
 #define DACT 0x80              /* Diagnostic Active */
-#define DFAIL 0x40             /* Diagonostic Failure */
+#define DFAIL 0x40             /* Diagnostic Failure */
 #define INREQ 0x20             /* Initialization Required */
 #define HARDY 0x10             /* Host Adapter Ready */
 #define CPRBSY 0x08            /* Command/Parameter Register Busy */
@@ -114,9 +114,9 @@ int buslogic_biosparam(Disk *, int, int *);
 #define CMD_HA_OPTIONS 0x21    /* Host Adapter Options */
 #define CMD_INITEXTMB 0x81     /* Initialize Extended Mailbox */
 #define CMD_INQEXTSETUP 0x8D   /* Inquire Extended Set-up Information */
-#define CMD_WRITE_INQ_BUF 0x9A /* Write Inquery Data Buffer
+#define CMD_WRITE_INQ_BUF 0x9A /* Write Inquiry Data Buffer
                                   (Target Mode Only) */
-#define CMD_READ_INQ_BUF 0x9B  /* Read Inquery Data Buffer
+#define CMD_READ_INQ_BUF 0x9B  /* Read Inquiry Data Buffer
                                   (Target Mode Only) */
 
 #define MBX_NOT_IN_USE 0x00
index 962ddbf49a44e539766435353b994ea3e25b1848..b7e44fda50d45522d08d1dbfb4e9995085edafac 100644 (file)
@@ -44,7 +44,7 @@ static const char *group_1_commands[] = {
 /* 29-2d */ unknown, "Write (10)", "Seek (10)", unknown, unknown, 
 /* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal", 
 /* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position", 
-/* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Deffect Data", 
+/* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data", 
 /* 38-3c */ unknown, "Compare","Copy Verify", "Write Buffer", "Read Buffer", 
 /* 3d-39 */ unknown, "Read Long",  unknown,
 };
@@ -110,7 +110,7 @@ void print_command (unsigned char *command) {
 static const char * statuses[] = {
 /* 0-4 */ "Good", "Check Condition", "Condition Good", unknown, "Busy", 
 /* 5-9 */ unknown, unknown, unknown, "Intermediate Good", unknown, 
-/* a-d */ "Interemediate Good", unknown, "Reservation Conflict", unknown,
+/* a-d */ "Intermediate Good", unknown, "Reservation Conflict", unknown,
 /* e-f */ unknown, unknown,
 };
 #endif
@@ -206,7 +206,7 @@ static struct error_info additional[] =
   {0x11,0x04,D|W|O,"Unrecovered read error - auto reallocate failed"},
   {0x11,0x05,W|R|O,"L-ec uncorrectable error"},
   {0x11,0x06,W|R|O,"Circ unrecovered error"},
-  {0x11,0x07,W|O,"Data resychronization error"},
+  {0x11,0x07,W|O,"Data resynchronization error"},
   {0x11,0x08,T,"Incomplete block read"},
   {0x11,0x09,T,"No gap found"},
   {0x11,0x0A,D|T|O,"Miscorrected error"},
@@ -468,7 +468,7 @@ static const char *two_byte_msgs[] = {
 
 static const char *extended_msgs[] = {
 /* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request",
-/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Reqeust"
+/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request"
 };
 
 #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs)  / sizeof (const char *))
index be882679a858e6e19a98ecf47bf218ecf97fde55..ee6172a29a54d4051a1be75e5cccc77e4b1674ad 100644 (file)
 
  NOTES ON USER DEFINABLE OPTIONS:
 
- DEBUG: This turns on the printing of various debug informaiton.
+ DEBUG: This turns on the printing of various debug information.
 
  ENABLE_PARITY: This turns on SCSI parity checking.  With the current
  driver, all attached devices must support SCSI parity.  If none of your
  values.
 
  DO_DETECT: This activates some old scan code which was needed before the
- high level drivers got fixed.  If you are having toruble with the driver,
+ high level drivers got fixed.  If you are having trouble with the driver,
  turning this on should not hurt, and might help.  Please let me know if
  this is the case, since this code will be removed from future drivers.
 
@@ -344,7 +344,7 @@ struct signature {
    { "Future Domain Corp. V1.0008/18/93",                  26, 33,  3,  4, 1 },
    { "FUTURE DOMAIN TMC-18XX",                              5, 22, -1, -1, 0 },
 
-   /* READ NOTICE ABOVE *BEFORE* YOU WASTE YOUR TIME ADDING A SIGANTURE
+   /* READ NOTICE ABOVE *BEFORE* YOU WASTE YOUR TIME ADDING A SIGNATURE
     Also, fix the disk geometry code for your signature and send your
     changes for faith@cs.unc.edu.  Above all, do *NOT* change any old
     signatures!
index eea7bbb2c939f7bbf7e4285d044e88edf622dba3..73cf455d7e68b950c826ad13af1628de9242711a 100644 (file)
  *     used on the LILO command line to override the defaults.
  *
  * 2.  With the GENERIC_NCR5380_OVERRIDE compile time define.  This is 
- *     specified as an array of address, irq tupples.  Ie, for
+ *     specified as an array of address, irq tuples.  Ie, for
  *     one board at the default 0xcc000 address, IRQ5, no dma, I could 
  *     say  -DGENERIC_NCR5380_OVERRIDE={{0xcc000, 5, DMA_NONE}}
  * 
  * -1 should be specified for no or DMA interrupt, -2 to autoprobe for an 
- *     IRQ line if overriden on the command line.
+ *     IRQ line if overridden on the command line.
  */
  
 /*
@@ -86,7 +86,7 @@ static struct override {
  *
  * Purpose : LILO command line initialization of the overrides array,
  * 
- * Inputs : str - unused, ints - array of integer paramters with ints[0]
+ * Inputs : str - unused, ints - array of integer parameters with ints[0]
  *     equal to the number of ints.
  *
  */
@@ -105,7 +105,7 @@ void generic_NCR5380_setup(char *str, int *ints) {
 }
 
 /* 
- * Function : int generic_NCR5380_detect(Scsi_Host_Templace * tpnt)
+ * Function : int generic_NCR5380_detect(Scsi_Host_Template * tpnt)
  *
  * Purpose : initializes generic NCR5380 driver based on the 
  *     command line / compile time port and irq definitions.
index dc1a936f2225d7e5c62687bb6ad3e10e6420d2a5..572214362a5da88799ab7c4d8e03cc542f5a20bf 100644 (file)
@@ -91,8 +91,8 @@ static const char RCSid[] = "$Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/hos
  *     The scsi host entries should be in the order you wish the 
  *     cards to be detected.  A driver may appear more than once IFF
  *     it can deal with being detected (and therefore initialized) 
- *     with more than one simulatenous host number, can handle being
- *     rentrant, etc.
+ *     with more than one simultaneous host number, can handle being
+ *     reentrant, etc.
  *
  *     They may appear in any order, as each SCSI host  is told which host number it is
  *     during detection.
@@ -210,7 +210,7 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
        retval->hostt = tpnt;   
        retval->next = NULL;
 #ifdef DEBUG
-       printk("Register %x %x: %d %d\n", retval, retval->hostt, i, j);
+       printk("Register %x %x: %d\n", retval, retval->hostt, j);
 #endif
 
        /* The next three are the default values which can be overridden
index 229581590b2a294657c719c09fed751145229c5a..9f747e04c55c1b62f25a7709a689a504fe1d2783 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #ifndef _HOSTS_H
-       #define _HOSTS_H
+#define _HOSTS_H
 
 /*
        $Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/hosts.h,v 1.3 1993/09/24 12:21:00 drew Exp drew $
@@ -40,7 +40,7 @@
 
 /*
        The Scsi_Host_Template type has all that is needed to interface with a SCSI
-       host in a device independant matter.  There is one entry for each different
+       host in a device independent matter.  There is one entry for each different
        type of host adapter that is supported on the system.
 */
 
@@ -71,7 +71,7 @@ typedef struct  SHT
                functions to queue commands because things are not guaranteed
                to be set up yet.  The detect routine can send commands to
                the host adapter as long as the program control will not be
-               passed to scsi.c in the processesing of the command.  Note
+               passed to scsi.c in the processing of the command.  Note
                especially that scsi_malloc/scsi_free must not be called.
        */
 
@@ -159,7 +159,7 @@ typedef struct  SHT
        /*
                This determines if we will use a non-interrupt driven
                or an interrupt driven scheme,  It is set to the maximum number
-               of simulataneous commands a given host adapter will accept.
+               of simultaneous commands a given host adapter will accept.
        */
        int can_queue;
 
@@ -167,7 +167,7 @@ typedef struct  SHT
                In many instances, especially where disconnect / reconnect are 
                supported, our host also has an ID on the SCSI bus.  If this is 
                the case, then it must be reserved.  Please set this_id to -1 if
-               your settup is in single initiator mode, and the host lacks an 
+               your setup is in single initiator mode, and the host lacks an 
                ID.
        */
        
@@ -278,7 +278,6 @@ extern struct Scsi_Host * scsi_register(Scsi_Host_Template *, int j);
 extern void scsi_unregister(struct Scsi_Host * i);
 
 #define BLANK_HOST {"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#endif
 
 struct Scsi_Device_Template
 {
@@ -304,3 +303,5 @@ extern struct Scsi_Device_Template sr_template;
 extern struct Scsi_Device_Template sg_template;
 
 int scsi_register_device(struct Scsi_Device_Template * sdpnt);
+
+#endif
index a6c63f73a0f4ef6969fbb938924c7428d6d0fd04..e8fdb651ec8931ead08cad9fc8264aa5352869c3 100644 (file)
@@ -69,7 +69,7 @@
  *     used on the LILO command line to override the defaults.
  *
  * 3.  With the PAS16_OVERRIDE compile time define.  This is 
- *     specified as an array of address, irq tupples.  Ie, for
+ *     specified as an array of address, irq tuples.  Ie, for
  *     one board at the default 0x388 address, IRQ10, I could say 
  *     -DPAS16_OVERRIDE={{0x388, 10}}
  *     NOTE:  Untested.
@@ -154,10 +154,10 @@ unsigned short  pas16_offset[ 8 ] =
         0x3c00,    /* STATUS_REG ro, SELECT_ENABLE_REG wo */
         0x3c01,    /* BUS_AND_STATUS_REG ro, START_DMA_SEND_REG wo */
         0x3c02,    /* INPUT_DATA_REGISTER ro, (N/A on PAS16 ?)
-                    * START_DMA_TARGET_RECIEVE_REG wo
+                    * START_DMA_TARGET_RECEIVE_REG wo
                     */
         0x3c03,    /* RESET_PARITY_INTERRUPT_REG ro,
-                    * START_DMA_INITIATOR_RECIEVE_REG wo
+                    * START_DMA_INITIATOR_RECEIVE_REG wo
                     */
     };
 
@@ -214,7 +214,7 @@ void        init_board( unsigned short io_port, int irq, int force_irq )
            && !force_irq )
        {
            printk( "pas16: WARNING: Can't use same irq as sound "
-                   "driver -- interrupts diabled\n" );
+                   "driver -- interrupts disabled\n" );
            /* Set up the drive parameters, disable 5380 interrupts */
            outb( 0x4d, io_port + SYS_CONFIG_4 );
        }
@@ -280,7 +280,7 @@ int     pas16_hw_detect( unsigned short  board_num )
  *
  * Purpose : LILO command line initialization of the overrides array,
  * 
- * Inputs : str - unused, ints - array of integer paramters with ints[0]
+ * Inputs : str - unused, ints - array of integer parameters with ints[0]
  *     equal to the number of ints.
  *
  */
@@ -307,7 +307,7 @@ void pas16_setup(char *str, int *ints) {
  * Function : int pas16_detect(Scsi_Host_Template * tpnt)
  *
  * Purpose : detects and initializes PAS16 controllers
- *     that were autoprobed, overriden on the LILO command line, 
+ *     that were autoprobed, overridden on the LILO command line, 
  *     or specified at compile time.
  *
  * Inputs : tpnt - template for this SCSI adapter.
@@ -377,6 +377,7 @@ int pas16_detect(Scsi_Host_Template * tpnt) {
            printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
             /* Disable 5380 interrupts, leave drive params the same */
             outb( 0x4d, io_port + SYS_CONFIG_4 );
+           outb( (inb(io_port + IO_CONFIG_3) & 0x0f), io_port + IO_CONFIG_3 );
        }
 
 #if defined(PDEBUG) && (PDEBUG & PDEBUG_INIT)
@@ -403,13 +404,13 @@ int pas16_detect(Scsi_Host_Template * tpnt) {
 /*
  * Function : int pas16_biosparam(Disk *disk, int dev, int *ip)
  *
- * Purpose : Generates a BIOS / DOS compatable H-C-S mapping for 
+ * Purpose : Generates a BIOS / DOS compatible H-C-S mapping for 
  *     the specified device / size.
  * 
  * Inputs : size = size of device in sectors (512 bytes), dev = block device
  *     major / minor, ip[] = {heads, sectors, cylinders}  
  *
- * Returns : allways 0 (success), initializes ip
+ * Returns : always 0 (success), initializes ip
  *     
  */
 
@@ -449,14 +450,13 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
         P_DATA_REG_OFFSET);
     register i = len;
 
-    while ( inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY );
+    while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) );
 
-    for (; i; --i) 
-       *d++ = (unsigned char) inb(reg);
+    insb( reg, d, i );
 
     if ( inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) {
         outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET);
-       printk("scsi%d : watchdog timer fired in NCR5480_pread()\n",
+       printk("scsi%d : watchdog timer fired in NCR5380_pread()\n",
            instance->host_no);
        return -1;
     } else
@@ -482,13 +482,13 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
     register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET);
     register i = len;
 
-    while ( ( inb( instance->io_port + P_STATUS_REG_OFFSET ) ) & P_ST_RDY );
-    for (; i; --i)
-        outb( *s++, reg );
+    while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) );
+    outsb( reg, s, i );
 
     if (inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) {
         outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET);
-       printk("scsi%d : watchdog timer fired in NCR5480_pwrite()\n",
+       printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n",
            instance->host_no);
        return -1;
     } else 
@@ -498,7 +498,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
 /*
  * Function : const char *pas16_info(void)
  *
- * Purpose : provide furthur information about this driver.
+ * Purpose : provide further information about this driver.
  *
  * Returns : an empty string.
  */
index 2ff99327eb6ebea97afbfebf2ca1bedd7b3cf142..2dc04026b8d8278a16e3b0add9ed021ed1178429 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef PAS16_H
 #define PAS16_H
 
-#define PAS16_PUBLIC_RELEASE 2
+#define PAS16_PUBLIC_RELEASE 3
 
 #define PDEBUG_INIT    0x1
 #define PDEBUG_TRANSFER 0x2
  * The Pro Audio Spectrum boards are I/O mapped. They use a Zilog 5380
  * SCSI controller, which is the equivalent of NCR's 5380.  "Pseudo-DMA"
  * architecture is used, where a PAL drives the DMA signals on the 5380
- * allowing fast, blind transfers with propper handshaking. 
+ * allowing fast, blind transfers with proper handshaking. 
  */
 
 
 /* The Time-out Counter register is used to safe-guard against a stuck
- * bus (in the case of RDY driven hadnshake) or a stuck byte (if 16-Bit
+ * bus (in the case of RDY driven handshake) or a stuck byte (if 16-Bit
  * DMA conversion is used).  The counter uses a 28.224MHz clock
  * divided by 14 as its clock source.  In the case of a stuck byte in
  * the holding register, an interrupt is generated (and mixed with the
index ade2251e29d4dfd436082318a797059153b5de4d..37c120a555e8b04baf727fb412f5d8acd8468afe 100644 (file)
@@ -67,7 +67,7 @@ $prefix = '';         # define all arrays having this prefix so we
 # XXX - replace references to the *_810 constants with general constants
 # assigned at compile time based on chip type.
 
-# Table of operatoor encodings
+# Table of operator encodings
 # XXX - NCR53c710 only implements 
 #      move (nop) = 0x00_00_00_00
 #      or = 0x02_00_00_00
@@ -147,7 +147,7 @@ $operator = '\||OR|AND|XOR|\&|\+';
                                        # the index is the symbol name, 
                                        # and the contents a white space 
                                        # delimited list of address,size
-                                       # tupples where size is in bytes.
+                                       # tuples where size is in bytes.
 
 @code = ();                            # Array of 32 bit words for SIOP 
 
@@ -274,7 +274,7 @@ sub parse_conditional {
     $need_data = 0;
     if ($conditional =~ /^ATN\s*(.*)/i) {#
        die "$0 : syntax error in line $lineno : $_
-       WHEN conditional is incompatable with ATN 
+       WHEN conditional is incompatible with ATN 
 " if (!$allow_atn);
        $code[$address] |= 0x00_02_00_00;
        $conditional = $1;
@@ -539,7 +539,7 @@ print STDERR "data8 source\n" if ($debug);
                } else {
                    die
 "$0 : syntax error in $lineno : $_
-       WITH CARRY option is incompatable with the $op operator.
+       WITH CARRY option is incompatible with the $op operator.
 ";
                }
            }
@@ -909,7 +909,7 @@ foreach $i (sort @entry) {
 }
 
 #
-# NCR assembler outputs label patches in the form of indecies into 
+# NCR assembler outputs label patches in the form of indices into 
 # the code.
 #
 printf OUTPUT "unsigned long ".$prefix."LABELPATCHES[] = {\n";
index 1ca8746933fdede39ff30eae87abb6a533f8eb48..252b971b246c11e5dbf490effad5d04079152feb 100644 (file)
@@ -64,7 +64,7 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] =
 
 /*
        global variables : 
-       scsi_devices an array of these specifing the address for each 
+       scsi_devices an array of these specifying the address for each 
        (host, id, LUN)
 */
 
@@ -79,7 +79,7 @@ static unsigned char generic_sense[6] = {REQUEST_SENSE, 0,0,0, 255, 0};
 Scsi_Cmnd * last_cmnd = NULL;
 
 /*
- *     As the scsi do command functions are inteligent, and may need to 
+ *     As the scsi do command functions are intelligent, and may need to 
  *     redo a command, we need to keep track of the last command 
  *     executed on each one.
  */
@@ -409,7 +409,7 @@ static void scan_scsis (struct Scsi_Host * shpnt)
                  }
                  
 /*
- * Accomodate drivers that want to sleep when they should be in a polling
+ * Accommodate drivers that want to sleep when they should be in a polling
  * loop.
  */
 
@@ -757,7 +757,7 @@ update_timeout(SCpnt, SCpnt->timeout_per_command);
 
 /*
        We will use a queued command if possible, otherwise we will emulate the
-       queing and calling of completion function ourselves. 
+       queuing and calling of completion function ourselves. 
 */
 #ifdef DEBUG
        printk("internal_cmnd (host = %d, target = %d, command = %08x, buffer =  %08x, \n"
@@ -832,7 +832,7 @@ static void scsi_request_sense (Scsi_Cmnd * SCpnt)
 /*
        scsi_do_cmd sends all the commands out to the low-level driver.  It 
        handles the specifics required for each low level driver - ie queued 
-       or non queud.  It also prevents conflicts when different high level 
+       or non queued.  It also prevents conflicts when different high level 
        drivers go for the same host at the same time.
 */
 
@@ -865,7 +865,7 @@ void scsi_do_cmd (Scsi_Cmnd * SCpnt, const void *cmnd ,
 /*
        We must prevent reentrancy to the lowlevel host driver.  This prevents 
        it - we enter a loop until the host we want to talk to is not busy.   
-       Race conditions are prevented, as interrupts are disabled inbetween the
+       Race conditions are prevented, as interrupts are disabled in between the
        time we check for the host being not busy, and the time we mark it busy
        ourselves.
 */
@@ -1197,7 +1197,7 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
                        }
                        break;
                        default:
-                               panic("scsi: unsupported message byte %d recieved\n", msg_byte(result)); 
+                               panic("scsi: unsupported message byte %d received\n", msg_byte(result)); 
                        }
                        break;
        case DID_TIME_OUT:      
@@ -1352,7 +1352,7 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
        caller should deal with any error messages or status returned on the 
        next call.
        
-       This will not be called rentrantly for a given host.
+       This will not be called reentrantly for a given host.
 */
        
 /*
@@ -1718,7 +1718,7 @@ void * scsi_init_malloc(unsigned int size)
 
 
 void scsi_init_free(char * ptr, unsigned int size)
-{ /* FIXME - not right.  We need to comare addresses to see whether this was
+{ /* FIXME - not right.  We need to compare addresses to see whether this was
      kmalloc'd or not */
   if((unsigned int) ptr < scsi_loadable_module_flag) {
     kfree(ptr);
@@ -1729,7 +1729,7 @@ void scsi_init_free(char * ptr, unsigned int size)
 }
 
 /*
-       scsi_dev_init() is our initialization routine, which inturn calls host 
+       scsi_dev_init() is our initialization routine, which in turn calls host 
        initialization, bus scanning, and sd/st initialization routines.  It 
        should be called from main().
 */
index 6804bf9684c4f146d2cfaffff66a1d604ec21a09..9c96ccd19448d9bfb6aa8a2ec6a371fe147fc2b1 100644 (file)
@@ -62,7 +62,7 @@
 #define SET_LIMITS             0x33
 #define PRE_FETCH              0x34
 #define READ_POSITION          0x34
-#define SYNCRONIZE_CACHE       0x35
+#define SYNCHRONIZE_CACHE      0x35
 #define LOCK_UNLOCK_CACHE      0x36
 #define READ_DEFECT_DATA       0x37
 #define COMPARE                        0x39
@@ -144,7 +144,7 @@ extern const unsigned char scsi_command_size[8];
        lsb             msb
        status  msg     host code       
 
-        Our errors returned by OUR driver, NOT SCSI message.  Orr'd with
+        Our errors returned by OUR driver, NOT SCSI message.  Or'd with
         SCSI message passed back to driver <IF any>.
 */
 
@@ -284,8 +284,8 @@ typedef struct scsi_device {
        unsigned lockable:1;    /* Able to prevent media removal */
        unsigned borken:1;      /* Tell the Seagate driver to be 
                                   painfully slow on this device */ 
-       unsigned tagged_supported:1; /* Supports SCSI-II tagged queing */
-       unsigned tagged_queue:1;   /*SCSI-II tagged queing enabled */
+       unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */
+       unsigned tagged_queue:1;   /*SCSI-II tagged queuing enabled */
        unsigned disconnect:1;     /* can disconnect */
        unsigned soft_reset:1;          /* Uses soft reset option */
        unsigned char current_tag; /* current tag */
@@ -301,7 +301,7 @@ typedef struct scsi_device {
 #define msg_byte(result) (((result) >> 8) & 0xff)
 #define host_byte(result) (((result) >> 16) & 0xff)
 #define driver_byte(result) (((result) >> 24) & 0xff)
-#define sugestion(result) (driver_byte(result) & SUGGEST_MASK)
+#define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
 
 #define sense_class(sense) (((sense) >> 4) & 0x7)
 #define sense_error(sense) ((sense) & 0xf)
@@ -442,7 +442,7 @@ typedef struct scsi_cmnd {
        unsigned underflow;     /* Return error if less than this amount is 
                                   transfered */
 
-       unsigned transfersize;  /* How much we are guranteed to transfer with
+       unsigned transfersize;  /* How much we are guaranteed to transfer with
                                   each SCSI transfer (ie, between disconnect /
                                   reconnects.   Probably == sector size */
        
index a056e8365d17e2ed7388e10fcca06e40f0944e87..baa8afcaa381e745eff0c36c1e4fad7d4ce053dc 100644 (file)
@@ -262,7 +262,7 @@ static void rw_intr (Scsi_Cmnd *SCpnt)
 */
 
         if (driver_byte(result) != 0) {
-         if (sugestion(result) == SUGGEST_REMAP) {
+         if (suggestion(result) == SUGGEST_REMAP) {
 #ifdef REMAP
 /*
        Not yet implemented.  A read will fail after being remapped,
@@ -294,8 +294,8 @@ static void rw_intr (Scsi_Cmnd *SCpnt)
 
 /*     If we had an ILLEGAL REQUEST returned, then we may have
 performed an unsupported command.  The only thing this should be would
-be a ten byte read where only a six byte read was supportted.  Also,
-on a system where READ CAPACITY failed, we mave have read past the end
+be a ten byte read where only a six byte read was supported.  Also,
+on a system where READ CAPACITY failed, we have have read past the end
 of the         disk. 
 */
 
@@ -365,7 +365,7 @@ static void do_sd_request (void)
    accept another command.  If we find one, then we queue it. This can
    make a big difference on systems with more than one disk drive.  We want
    to have the interrupts off when monkeying with the request list, because
-   otherwise the kernel might try and slip in a request inbetween somewhere. */
+   otherwise the kernel might try and slip in a request in between somewhere. */
 
     if (!SCpnt && sd_template.nr_dev > 1){
       struct request *req1;
@@ -911,7 +911,7 @@ static int sd_init_onedisk(int i)
   /* Wake up a process waiting for device*/
 
   /*
-   *   The SCSI standard says "READ CAPACITY is necessary for self confuring software"
+   *   The SCSI standard says "READ CAPACITY is necessary for self configuring software"
    *   While not mandatory, support of READ CAPACITY is strongly encouraged.
    *   We used to die if we couldn't successfully do a READ CAPACITY.
    *   But, now we go on about our way.  The side effects of this are
index a8c67385319fac013090566a567f90b6f1e01243..42b2b6b846896220f71751bfeb8205fbfc71174c 100644 (file)
@@ -17,7 +17,7 @@
 /*
  * Configuration : 
  * To use without BIOS -DOVERRIDE=base_address -DCONTROLLER=FD or SEAGATE
- * -DIRQ will overide the default of 5.
+ * -DIRQ will override the default of 5.
  * Note: You can now set these options from the kernel's "command line".
  * The syntax is:
  *
  * -DFAST or -DFAST32 will use blind transfers where possible
  *
  * -DARBITRATE will cause the host adapter to arbitrate for the 
- *     bus for better SCSI-II compatability, rather than just 
+ *     bus for better SCSI-II compatibility, rather than just 
  *     waiting for BUS FREE and then doing its thing.  Should
  *     let us do one command per Lun when I integrate my 
  *     reorganization changes into the distribution sources.
  *
- * -DSLOW_HANDSHAKE will allow compatability with broken devices that don't 
+ * -DSLOW_HANDSHAKE will allow compatibility with broken devices that don't 
  *     handshake fast enough (ie, some CD ROM's) for the Seagate
  *     code.
  *
@@ -167,7 +167,7 @@ static const Signature signatures[] = {
 {"SEAGATE SCSI BIOS ",17, 17, SEAGATE},
 
 /*
- * However, future domain makes several incompatable SCSI boards, so specific
+ * However, future domain makes several incompatible SCSI boards, so specific
  * signatures must be used.
  */
 
@@ -224,7 +224,7 @@ static int fast = 1;
  * Wait for a low->high transition before continuing with that 
  * transfer.  If we timeout, continue anyways.  We don't need 
  * a long timeout, because REQ should only be asserted until the 
- * corresponding ACK is recieved and processed.
+ * corresponding ACK is received and processed.
  *
  * Note that we can't use the system timer for this, because of 
  * resolution, and we *really* can't use the timer chip since 
@@ -243,7 +243,7 @@ static void borken_init (void) {
 
 /* 
  * Ok, we now have a count for .25 seconds.  Convert to a 
- * count per second and divide by transer rate in K.
+ * count per second and divide by transfer rate in K.
  */
 
   borken_calibration =  (count * 4) / (SLOW_RATE*1024);
@@ -307,11 +307,11 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
        printk("Base address overridden to %x, controller type is %s\n",
                base_address,controller_type == SEAGATE ? "SEAGATE" : "FD");
 #endif 
-#else /* OVERIDE */    
+#else /* OVERRIDE */   
 /*
  *     To detect this card, we simply look for the signature
  *     from the BIOS version notice in all the possible locations
- *     of the ROM's.  This has a nice sideeffect of not trashing
+ *     of the ROM's.  This has a nice side effect of not trashing
  *     any register locations that might be used by something else.
  *
  * XXX - note that we probably should be probing the address
@@ -326,7 +326,7 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
                        base_address = (void *) seagate_bases[i];
                        controller_type = signatures[j].type;
                }
-#endif /* OVERIDE */
+#endif /* OVERRIDE */
        } /* (! controller_type) */
  
        tpnt->this_id = (controller_type == SEAGATE) ? 7 : 6;
@@ -646,7 +646,7 @@ static int internal_command(unsigned char target, unsigned char lun, const void
 
 /*
  *     We work it differently depending on if this is is "the first time,"
- *     or a reconnect.  If this is a reselct phase, then SEL will 
+ *     or a reconnect.  If this is a reselect phase, then SEL will 
  *     be asserted, and we must skip selection / arbitration phases.
  */
 
@@ -661,7 +661,7 @@ static int internal_command(unsigned char target, unsigned char lun, const void
  *     target's ID on the BUS, with BSY, SEL, and I/O signals asserted.
  *
  *     After ARBITRATION phase is completed, only SEL, BSY, and the 
- *     target ID are asserted.  A valid initator ID is not on the bus
+ *     target ID are asserted.  A valid initiator ID is not on the bus
  *     until IO is asserted, so we must wait for that.
  */
                clock = jiffies + 10;
@@ -830,7 +830,7 @@ connect_loop :
  *
  *     Note : the Seagate ST-01/02 product manual says that we should 
  *     twiddle the DATA register before the control register.  However,
- *     this does not work reliably so we do it the other way arround.
+ *     this does not work reliably so we do it the other way around.
  *
  *     Probably could be a problem with arbitration too, we really should
  *     try this with a SCSI protocol or logic analyzer to see what is 
@@ -1318,7 +1318,7 @@ if (fast && transfersize && !(len % transfersize) && (len >= transfersize)
 
                        CONTROL = BASE_CMD | CMD_DRVR_ENABLE;
 /*
- *     If we are reconecting, then we must send an IDENTIFY message in 
+ *     If we are reconnecting, then we must send an IDENTIFY message in 
  *      response  to MSGOUT.
  */
                        switch (reselect) {
@@ -1336,7 +1336,7 @@ if (fast && transfersize && !(len % transfersize) && (len >= transfersize)
                                reselect = CAN_RECONNECT;
                                goto connect_loop;
 #if (DEBUG & (PHASE_MSGOUT | DEBUG_LINKED))
-                               printk("scsi%d : sent ABORT message to cancle incorrect I_T_L nexus.\n", hostno);
+                               printk("scsi%d : sent ABORT message to cancel incorrect I_T_L nexus.\n", hostno);
 #endif
 #endif /* LINKED */
 #if (DEBUG & DEBUG_LINKED) 
@@ -1505,7 +1505,7 @@ else {
                                hostno);
 #endif
 /*
- * We also will need to adjust status to accomodate intermediate conditions.
+ * We also will need to adjust status to accommodate intermediate conditions.
  */
                        if ((status == INTERMEDIATE_GOOD) ||
                                (status == INTERMEDIATE_C_GOOD))
@@ -1614,7 +1614,7 @@ int seagate_st0x_biosparam(Disk * disk, int dev, int* ip) {
   cmd[5] = 0;
 
 /*
- * We are transfering 0 bytes in the out direction, and expect to get back
+ * We are transferring 0 bytes in the out direction, and expect to get back
  * 24 bytes for each mode page.
  */
 
@@ -1669,7 +1669,7 @@ printk("scsi%d : heads = %d cylinders = %d sectors = %d total = %d formatted = %
 
 /*
  * Now, we need to do a sanity check on the geometry to see if it is 
- * BIOS compatable.  The maximum BIOS geometry is 1024 cylinders * 
+ * BIOS compatible.  The maximum BIOS geometry is 1024 cylinders * 
  * 256 heads * 64 sectors. 
  */
 
index f6697287a17b0e6d124ed671a94edcea0c6f4e7f..76c186ba6898d7784509d5ea3fa1cba795364e8b 100644 (file)
@@ -6,7 +6,7 @@
 */
 
 /* 
- An SG device is accessed by writting "packets" to it, the replies
+ An SG device is accessed by writing "packets" to it, the replies
  are then read using the read call. The same header is used for 
  reply, just ignore reply_len field.
 */
index f10dfc711c38dadcc0e8ffd565541ce8242c94b6..e1b450b3958b8a0b0b43c34ead3d48e7d2afdc38 100644 (file)
@@ -327,7 +327,7 @@ static void do_sr_request (void)
    accept another command.  If we find one, then we queue it. This can
    make a big difference on systems with more than one disk drive.  We want
    to have the interrupts off when monkeying with the request list, because
-   otherwise the kernel might try and slip in a request inbetween somewhere. */
+   otherwise the kernel might try and slip in a request in between somewhere. */
 
     if (!SCpnt && sr_template.nr_dev > 1){
       struct request *req1;
index 5ad3679f51e1574ebe7dc872209b21e589533e47..5022d9b8fcb5a65f65997b0eef62c9fda1d8b555 100644 (file)
@@ -68,7 +68,7 @@
  *     used on the LILO command line to override the defaults.
  *
  * 3.  With the T128_OVERRIDE compile time define.  This is 
- *     specified as an array of address, irq tupples.  Ie, for
+ *     specified as an array of address, irq tuples.  Ie, for
  *     one board at the default 0xcc000 address, IRQ5, I could say 
  *     -DT128_OVERRIDE={{0xcc000, 5}}
  *     
@@ -155,7 +155,7 @@ static const struct signature {
  *
  * Purpose : LILO command line initialization of the overrides array,
  * 
- * Inputs : str - unused, ints - array of integer paramters with ints[0]
+ * Inputs : str - unused, ints - array of integer parameters with ints[0]
  *     equal to the number of ints.
  *
  */
@@ -182,7 +182,7 @@ void t128_setup(char *str, int *ints) {
  * Function : int t128_detect(Scsi_Host_Template * tpnt)
  *
  * Purpose : detects and initializes T128,T128F, or T228 controllers
- *     that were autoprobed, overriden on the LILO command line, 
+ *     that were autoprobed, overridden on the LILO command line, 
  *     or specified at compile time.
  *
  * Inputs : tpnt - template for this SCSI adapter.
@@ -272,13 +272,13 @@ int t128_detect(Scsi_Host_Template * tpnt) {
 /*
  * Function : int t128_biosparam(Disk * disk, int dev, int *ip)
  *
- * Purpose : Generates a BIOS / DOS compatable H-C-S mapping for 
+ * Purpose : Generates a BIOS / DOS compatible H-C-S mapping for 
  *     the specified device / size.
  * 
  * Inputs : size = size of device in sectors (512 bytes), dev = block device
  *     major / minor, ip[] = {heads, sectors, cylinders}  
  *
- * Returns : allways 0 (success), initializes ip
+ * Returns : always 0 (success), initializes ip
  *     
  */
 
@@ -388,7 +388,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
 /*
  * Function : const char *t128_info(void)
  *
- * Purpose : provide furthur information about this driver.
+ * Purpose : provide further information about this driver.
  *
  * Returns : an empty string.
  */
index c37a90a44b44cecd80a8a52d8c47ea93a91e1d78..59eebae62ebea161dee58feb0c187eea05b3a9ab 100644 (file)
@@ -51,7 +51,7 @@
  * equivalent (my sample board had part second sourced from ZILOG).
  * NCR's recommended "Pseudo-DMA" architecture is used, where 
  * a PAL drives the DMA signals on the 5380 allowing fast, blind
- * transfers with propper handshaking. 
+ * transfers with proper handshaking. 
  */
 
 /*
 
 #define T_STATUS_REG_OFFSET    0x1c20  /* ro */
 #define T_ST_BOOT              0x80    /* Boot switch */
-#define T_ST_S3                        0x40    /* User setable switches, */
+#define T_ST_S3                        0x40    /* User settable switches, */
 #define T_ST_S2                        0x20    /* read 0 when switch is on, 1 off */
 #define T_ST_S1                        0x10
 #define T_ST_PS2               0x08    /* Set for Microchannel 228 */
 #define T_ST_RDY               0x04    /* 5380 DRQ */
 #define T_ST_TIM               0x02    /* indicates 40us watchdog timer fired */
-#define T_ST_ZERO              0x01    /* Allways zero */
+#define T_ST_ZERO              0x01    /* Always zero */
 
 #define T_5380_OFFSET          0x1d00  /* 8 registers here, see NCR5380.h */
 
index bb25ba616c57698f08450eafd06f3869709d120b..0d5254e3554857a5b125e4bb0925d6e4cf63797d 100644 (file)
@@ -461,11 +461,11 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
        return FALSE;
     }
 
-    /* Final consistancy check, verify previous info. */
+    /* Final consistency check, verify previous info. */
     if (config.subversion != U34F)
        if (!config.dma_channel || !(config_2.tfr_port & 0x2)) {
 #if (ULTRASTOR_DEBUG & UD_DETECT)
-           printk("US14F: detect: consistancy check failed\n");
+           printk("US14F: detect: consistency check failed\n");
 #endif
            return FALSE;
        }
index 1ccaa8b61f197fc7a2fc95cc8ab5a0edeae033ac..e06ce4583d0f6c36ce78718db5e5bbe71b826a53 100644 (file)
@@ -6,7 +6,7 @@
  *     ( as close as different hardware allows on a lowlevel-driver :-) )
  *
  *  Revised (and renamed) by John Boyd <boyd@cis.ohio-state.edu> to
- *  accomodate Eric Youngdale's modifications to scsi.c.  Nov 1992.
+ *  accommodate Eric Youngdale's modifications to scsi.c.  Nov 1992.
  *
  *  Additional changes to support scatter/gather.  Dec. 1992.  tw/jb
  *
@@ -234,7 +234,7 @@ static const Signature signatures[] = {
  *  Unfortunately, I have no idea how to properly use some of these commands,
  *  as the OEM manual does not make it clear.  I have not been able to use
  *  enable/disable unsolicited interrupts or the reset commands with any
- *  discernable effect whatsoever.  I think they may be related to certain
+ *  discernible effect whatsoever.  I think they may be related to certain
  *  ICB commands, but again, the OEM manual doesn't make that clear.
  */
 #define NO_OP             0     /* NO-OP toggles CMD_RDY bit in ASC_STAT */
index fcdbb8e3eae6ea6bf552d48979a219d9745abe77..b04d7a8d64c95f6bd349609f1387367a110834b9 100644 (file)
@@ -52,7 +52,7 @@ Since 2.4
 - MIDI recording for SB and SB Pro. (Untested).
 - Some other fixes.
 - SB16 MIDI and DSP drivers only initialized if SB16 actually installed.
-- Implemented better detection for OPL-3. This should be usefull if you
+- Implemented better detection for OPL-3. This should be useful if you
   have an old SB Pro (the non-OPL-3 one) or a SB 2.0 clone which has a OPL-3.
 - SVR4.2 support by Ian Hartas. Initial ALPHA TEST version (untested).
 
index a4a084706e5ba8482f92696e97277c9b390d34e7..60d18cbe8327ef06ecec5eb9209537116f9d12fe 100644 (file)
@@ -38,14 +38,14 @@ Compatibility with the earlier versions
 This version is backward compatible with the version 2.X. All programs
 compiled with sys/soundcard.h of v2.X should work without problems.
 PROGRAMS COMPILED WITH THE sys/soundcard.h OF THIS VERSION WILL NOT
-WORK WITH v2.X DRIVER. BE CAREFULL WHEN DISTRIBUTING BINARIES COMPILED 
+WORK WITH v2.X DRIVER. BE CAREFUL WHEN DISTRIBUTING BINARIES COMPILED 
 FOR THIS VERSION.
 
 Contributors
 ------------
 
 This driver contains code by several contributors. In addition several other
-persons have given usefull suggestions. The following is a list of major
+persons have given useful suggestions. The following is a list of major
 contributors. (I could have forgotten some names.)
 
        Craig Metz      1/2 of the PAS16 Mixer and PCM support
index ab3740700119c64e420ccefdf9352f4cc506603d..18a33ec9f1511e9bd52564d44a3b3d606e558fbd 100644 (file)
@@ -5,7 +5,7 @@ Installation
   let's skip this step. To be serious, the sound driver belongs
   to linux/drivers/sound. 
 
-- To build the device files you need to run the enclosed shell scrip 
+- To build the device files you need to run the enclosed shell script 
   (see below).
 
 - If you are installing a separately distributed version, copy the
@@ -68,7 +68,7 @@ These are the configuration templates for various soundcards:
 
                sound=0x2220Id,0x138800   (remember to set the IRQ and DMA)
        or if you have SB16 or SB16ASP, you have to use the following:
-               (use the same IRQ (the I colums) in all three places. The
+               (use the same IRQ (the I columns) in all three places. The
                 the D is the 16 bit DMA channel (5 to 7) and the d is 
                 the 8 bit one (1 or 3). The X is the 2nd digit of the
                 midi IO address (3 or 0)).
@@ -134,7 +134,7 @@ command:
 
        cat /dev/sndstat 
 
-and look at the output. It should display some usefull info about the
+and look at the output. It should display some useful info about the
 driver configuration. If there is no /dev/sndstat 
 (/dev/sndstat: No such file or directory), ensure that you have executed the
 soundinstall script (at the end of this file). The message: 
@@ -147,7 +147,7 @@ Run the script at the end of this file.
 
 - /dev/???????: No such device.
 You have not booted with a kernel containing the driver or the I/O address
-configuration doesn't match your hardaware. 
+configuration doesn't match your hardware. 
 
 - The module player (str) plays just a second and then stops completely.
 You have incorrect IRQ settings (usual with SB cards).
@@ -159,7 +159,7 @@ You should use lower speed (-s speed), buy a faster computer or a Gravis
 UltraSound card. (If you already have GUS, you should use gmod and not the
 str). If the DSP_BUFFSIZE in the sound/local.h is less than (nr_channels*
 speed_in_Hz * (bits/8))/2, it could explain the pausing problem. Also check
-that the turbo swich is on and don't run applications like weather forecasting
+that the turbo switch is on and don't run applications like weather forecasting
 on background. Sometimes (very rarely) an IRQ conflict can cause similar
 problems with SB cards.
 If you want to play modules on a 386sx while recompiling the world, buy a GUS.
@@ -171,7 +171,7 @@ hannu@voxware.pp.fi
 ----------------- cut here ------------------------------
 #!/bin/sh
 #
-#      soudinstall             
+#      soundinstall            
 #
 #
 # Create the devices
index 45e7ef80cdf29533841740aee85f2167511db767..cade461d2a6d9eeff8c58edcf9728212783aece4 100644 (file)
@@ -1,7 +1,7 @@
 VoxWare v3.0
 ------------
 
-This is a PROTOTYPE of the VoxWare v3.0 to be relased late 94.
+This is a PROTOTYPE of the VoxWare v3.0 to be released late 94.
 
 All features of v2.5 should work as earlier. There could be some
 omissions but they are unintentional. I started this version thread
@@ -9,7 +9,7 @@ after v2.3 so all features implemented before it are there.
 
 Even this is a prototype, there should not be any fatal bugs. The
 prototype just means that I don't have implemented all features
-completely. Mainly in the /dev/sequener2 driver.
+completely. Mainly in the /dev/sequencer2 driver.
 For example recording from /dev/sequencer2 won't work
 with other cards than a full features MPU-401 or clones. As well the
 way how the MIDI controllers are handled will change.
@@ -32,7 +32,7 @@ applications like sequencers.
 /dev/midi##
 -----------
 
-This interface should be usefull for applications like MIDI sysex librarians.
+This interface should be useful for applications like MIDI sysex librarians.
 There are (currently) no timing features so making music could be impossible.
 
 There are as many /dev/midi## devices as there are MIDI ports in the system. 
@@ -67,7 +67,7 @@ It's not available for the so called MPU UART ports of some soundcards
 If this ioctl is called with mode=1, the interface is put to the intelligent
 (coprocessor) mode. NOTE! The MIDI port will be reset when this ioctl is called.
 It could have some strange effects if not called immediately after open. This
-vall returns EINVAL if the midi port doesn't support the MPU-401 intelligent
+call returns EINVAL if the midi port doesn't support the MPU-401 intelligent
 mode.
 
 ioctl(fd, SNDCTL_MIDI_MPUCMD, &cmdstruct) is valid only if the MIDI port
@@ -95,10 +95,10 @@ where:
        data            Buffer for the command arguments and returned
                        data.
 
-Be extremely carefull with the nr_args and nr_returns fields. They
+Be extremely careful with the nr_args and nr_returns fields. They
 must match the command. An incorrect value will put the card and
 the driver out of sync. Refer to the MPU-401/MQX-32M documentation for further
-datails.
+details.
 
 
 
@@ -113,7 +113,7 @@ the result is somewhere between the MIDI specification and the synth devices of
 /dev/sequencer. Both kind of devices are accessed using the SEQ_START_NOTE()
 like macros. The voice number parameters of the API macros have been redefined
 to denote MIDI channels. This means that the driver allocates voices for
-the channels automaticly (this is a responsibility/right of an application
+the channels automatically (this is a responsibility/right of an application
 with /dev/sequencer). The result is that a SEQ_START_NOTE() macro has
 similar effects for a synth channel than on a MIDI port. This kind of
 solution provides better device independence than the /dev/sequencer. The
@@ -130,12 +130,12 @@ return sum of internal synthesizers (GUS, OPL3) and MIDI ports in the systems.
 
 - The new interface is used much like the ordinary /dev/sequencer. The
 event format is new so you have to use the API macros defined in the 
-sys/soundcard.h. The interface is will propably change before the final 3.0
+sys/soundcard.h. The interface will probably change before the final 3.0
 release but using the API macros should ensure compatibility in source level.
 The new event format is not recognized by version 2.X so don't try to 
 distribute binaries compiled with soundcard.h of v3.X.
 
-- The basic API useage is similar to the current one. There are some new
+- The basic API usage is similar to the current one. There are some new
 macros but the older ones should work as earlier. The most important
 incompatibility is that the /dev/sequencer2 driver allocates voices itself.
 The other one is that the application must send SEQ_START_TIMER() as it's
index b08f5f76cc68cca0cf6156f6fe29083aefd8493f..d5c73f4ccfe9cd8603b15a77e7fa92c5a02d9374 100644 (file)
@@ -254,7 +254,7 @@ static int
 set_speed (ad1848_info * devc, int arg)
 {
   /*
- * The sampling speed is encoded in the least significant nible of I8. The
+ * The sampling speed is encoded in the least significant nibble of I8. The
  * LSB selects the clock source (0=24.576 MHz, 1=16.9344 Mhz) and other
  * three bits select the divisor (indirectly):
  *
@@ -602,7 +602,7 @@ ad1848_prepare_for_IO (int dev, int bsize, int bcount)
 
   ad_write (devc, 8, fs);
   /*
-   * Write to I8 starts resyncronization. Wait until it completes.
+   * Write to I8 starts resynchronization. Wait until it completes.
    */
   timeout = 10000;
   while (timeout > 0 && INB (devc->base) == 0x80)
@@ -624,7 +624,7 @@ ad1848_prepare_for_IO (int dev, int bsize, int bcount)
       ad_write (devc, 28, fs);
 
       /*
-   * Write to I28 starts resyncronization. Wait until it completes.
+   * Write to I28 starts resynchronization. Wait until it completes.
    */
       timeout = 10000;
       while (timeout > 0 && INB (devc->base) == 0x80)
index 5b7217bccb4668597a4e5493c5835039bcb41ba4..ca4732a6390803fc78c934f2b895452df6b69eda 100644 (file)
@@ -361,7 +361,7 @@ main (int argc, char *argv[])
              {
                FILE           *sf = fopen ("synth-ld.h", "w");
 
-               fprintf (sf, "/* automaticaly generated by configure */\n");
+               fprintf (sf, "/* automatically generated by configure */\n");
                fprintf (sf, "unsigned char pss_synth[] = {\n");
                while (1)
                  {
@@ -392,7 +392,7 @@ main (int argc, char *argv[])
        {
          FILE           *sf = fopen ("synth-ld.h", "w");
 
-         fprintf (sf, "/* automaticaly generated by configure */\n");
+         fprintf (sf, "/* automatically generated by configure */\n");
          fprintf (sf, "unsigned char pss_synth[1];\n"
                   "#define pss_synthLen 0\n");
          fclose (sf);
@@ -635,7 +635,7 @@ main (int argc, char *argv[])
   if (selected_options & B (OPT_UART6850))
     {
       fprintf (stderr, "\nI/O base for 6850 UART Midi?\n"
-              "Be carefull. No defaults.\n"
+              "Be careful. No defaults.\n"
               "Enter the 6850 UART I/O base: ");
 
       num = ask_value ("%x", 0);
index be24074f1b31cbc824a180683c8f368fd0639561..bd371d01c250527975c01a327c849d29a8fbfac4 100644 (file)
@@ -41,7 +41,7 @@ static struct dma_buffparms dmaps[MAX_AUDIO_DEV] =
 {0};                           /*
                 * Primitive way to allocate
                 * such a large array.
-                * Needs dynamic run-time alloction.
+                * Needs dynamic run-time allocation.
                 */
 
 static void
@@ -78,7 +78,7 @@ reorganize_buffers (int dev)
       sz = sr * nc * sz;
 
       /*
-   * Compute a buffer size for time not exeeding 1 second.
+   * Compute a buffer size for time not exceeding 1 second.
    * Usually this algorithm gives a buffer size for 0.5 to 1.0 seconds
    * of sound (using the current speed, sample size and #channels).
    */
@@ -106,8 +106,8 @@ reorganize_buffers (int dev)
   else
     {
       /*
- * The process has specified the buffer sice with SNDCTL_DSP_SETFRAGMENT or
- * the buffer sice computation has already been done.
+ * The process has specified the buffer size with SNDCTL_DSP_SETFRAGMENT or
+ * the buffer size computation has already been done.
  */
       if (dmap->fragment_size > audio_devs[dev]->buffsize)
        dmap->fragment_size = audio_devs[dev]->buffsize;
@@ -425,7 +425,7 @@ DMAbuf_ioctl (int dev, unsigned int cmd, unsigned int arg, int local)
          }
 
        if (dmap->subdivision != 0 ||
-           dmap->fragment_size)/* Loo late to change */
+           dmap->fragment_size)/* Too late to change */
          return RET_ERROR (EINVAL);
 
        if (fact > MAX_REALTIME_FACTOR)
@@ -448,7 +448,7 @@ DMAbuf_ioctl (int dev, unsigned int cmd, unsigned int arg, int local)
          return RET_ERROR (EIO);
 
        if (dmap->subdivision != 0 ||
-           dmap->fragment_size)/* Loo late to change */
+           dmap->fragment_size)/* Too late to change */
          return RET_ERROR (EINVAL);
 
        bytes = fact & 0xffff;
index 00462302e721239728352cd95d5c189007e4a797..180c868362bfbd8ba51f5a337051a2792ed2d959 100644 (file)
@@ -95,7 +95,7 @@ bytes each time (this is really important).
 
 
        2a) If the fragment gets played before the application writes a new
-       one, the device will be stoppen and restarted which causes a click.
+       one, the device will be stopped and restarted which causes a click.
        When the process calls write next time, it will be processes as 
        in step 1.
 
@@ -121,8 +121,8 @@ bytes each time (this is really important).
        the process blocks for at most the time required to play a
        buffer fragment.
 
-This method syncronizes the process and the audio device together 
-automaticly. The process will block at most the 'fragment_time'. Usually 
+This method synchronizes the process and the audio device together 
+automatically. The process will block at most the 'fragment_time'. Usually 
 less, depending on how much it needs time to do other things. The maximum
 delay between writing a byte and the time when it finally plays is
 at most 3 times the 'fragment_time'. 
@@ -142,7 +142,7 @@ ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag);
 ioctl(NDCTL_DSP_SPEED); /* And #channels & #bits if required */
 
 /*
- * Query the actual fragment sice since the driver may refuse
+ * Query the actual fragment size since the driver may refuse
  * the requested one (unlikely but possible?)
  */
 
index 1066bd7c4efd1924d9e2a536679887dda800bf25..1b95c0593713a69d3101e9f43d49537834292b9a 100644 (file)
@@ -2538,7 +2538,7 @@ guswave_patchmgr (int dev, struct patmgr_info *rec)
                                         */
 
        offs += sample_ptrs[sample];    /*
-                                        * Begin offsess + offset to DRAM
+                                        * Begin offset + offset to DRAM
                                         */
 
        for (n = 0; n < l; n++)
@@ -2583,7 +2583,7 @@ guswave_patchmgr (int dev, struct patmgr_info *rec)
                                         */
 
        offs += sample_ptrs[sample];    /*
-                                        * Begin offsess + offset to DRAM
+                                        * Begin offset + offset to DRAM
                                         */
 
        for (n = 0; n < l; n++)
index ea7901fc60a51f763d3d8616b6644c4a920c9bb9..21e6122da35246b2ebada00dedcaad0c9baa0392 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     The percussive mode is implemented in the left side only.
  *
- *     With the above exeptions the both sides can be operated independently.
+ *     With the above exceptions the both sides can be operated independently.
  *     
  *     A 4 OP voice can be created by setting the corresponding
  *     bit at offset 4 of the right side.
index bdd734e7559455e3061c9f43f5a3ce9376e34721..e1e9ac41006fdb252751e06f25006cc14172c507 100644 (file)
@@ -102,7 +102,7 @@ struct snd_wait {
 
 /* DISABLE_INTR is used to disable interrupts.
    These macros store the current flags to the (unsigned long) variable given
-   as a parameter. RESTORE_INTR returns the interrupt ebable bit to state
+   as a parameter. RESTORE_INTR returns the interrupt enable bit to state
    before DISABLE_INTR or ENABLE_INTR */
 
 #define DISABLE_INTR(flags)    __asm__ __volatile__("pushfl ; popl %0 ; cli":"=r" (flags));
index 70c61dc57f5c3811385c6fe9eb875b517ec20b24..585bc649bf3aa1912b9f0f82ec9e25b441e11892 100644 (file)
@@ -80,7 +80,7 @@
 
 #define OPERATION_MODE_1               0xEF8B          /* R    Control                                                         */
        #define O_M_1_CDROM_TYPE        0x03            /* R    CD-ROM          3=SCSI, 2=Sony, 0=no CD-ROM interface           */
-       #define O_M_1_FM_TYPE           0x04            /* R    FM              1=sterero, 0=mono FM chip                       */
+       #define O_M_1_FM_TYPE           0x04            /* R    FM              1=stereo, 0=mono FM chip                        */
        #define O_M_1_PCM_TYPE          0x08            /* R    PCM             1=16-bit Codec, 0=8-bit DAC                     */
 #define OPERATION_MODE_2               0xFF8B          /* R    Control                                                         */
        #define O_M_2_PCS_ENABLED       0x02            /* R    PC speaker      PC speaker emulation 1=enabled, 0=disabled      */
index df8aa3733d0c7ff563ae7be40cfb562325b959f4..bf0a20b6c97f986eee170e4a13d9a553c26ea043 100644 (file)
@@ -124,7 +124,7 @@ mixer_output (int right_vol, int left_vol, int div, int bits,
 
   if (bits == P_M_MV508_BASS || bits == P_M_MV508_TREBLE)
     {                          /*
-                                * Bass and trebble are mono devices
+                                * Bass and treble are mono devices
                                 */
       pas_write (P_M_MV508_ADDRESS | bits, PARALLEL_MIXER);
       pas_write (left, PARALLEL_MIXER);
index e4c9a63c384c66b59d03996b54ba1e1f94696330..e756431d6e355c7e5d058256d3b489531c1d2f9f 100644 (file)
@@ -79,7 +79,7 @@ pcm_set_speed (int arg)
   tmp = pas_read (FILTER_FREQUENCY);
 
   /*
- * Set anti-aliasing filters according to sample rate. You reall *NEED*
+ * Set anti-aliasing filters according to sample rate. You really *NEED*
  * to enable this feature for all normal recording unless you want to
  * experiment with aliasing effects.
  * These filters apply to the selected "recording" source.
index a77626609106a7144da657fab03a54bf68669ca6..97ca46536e739b0de87b6f310aaca05fe25a3b9d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * sound/patmgr.c
  *
- * The patch maneger interface for the /dev/sequencer
+ * The patch manager interface for the /dev/sequencer
  *
  * Copyright by Hannu Savolainen 1993
  *
index 6a0e7a8327ff1e1a45165a1677a16a7a2830d186..6e35d1b7f53038240c57869ee3081dc8442c5993 100644 (file)
@@ -8,7 +8,7 @@
    make the pss card to emulate the SB stuff.
 
    I have provided a simple interface to the PSS unlike the
-   DOG version.  to download a new algorithim just cat it to
+   DOG version.  to download a new algorithm just cat it to
    /dev/pss 14,9.
 
    You really need to rebuild this with the synth.ld file
@@ -27,7 +27,7 @@
 
    and everything will be okay.
 
-   At first I was going to wory about applications that were using
+   At first I was going to worry about applications that were using
    the sound stuff and disallow the use of /dev/pss.  But for
    now I figured it doesn't matter.
 
@@ -39,7 +39,7 @@
 
    Probably everything else can be done via mmap
 
-   Oh if you want to develope code for the ADSP-21xx or Program the
+   Oh if you want to develop code for the ADSP-21xx or Program the
    1848 just send me mail and I will hook you up.
 
                marc.hoffman@analog.com
@@ -123,7 +123,7 @@ PSS_write (int data)
 {
   int             i, limit;
 
-  limit = GET_TIME () + 10;    /* The timeout is 0.1 secods */
+  limit = GET_TIME () + 10;    /* The timeout is 0.1 seconds */
   /*
    * Note! the i<5000000 is an emergency exit. The dsp_command() is sometimes
    * called while interrupts are disabled. This means that the timer is
@@ -158,7 +158,7 @@ pss_setaddr (int addr, int configAddr)
 
 /*_____ pss_checkint
          This function tests an interrupt number to see if
-        it is availible. It takes the interrupt button
+        it is available. It takes the interrupt button
         as it's argument and returns TRUE if the interrupt
         is ok.
 */
@@ -215,7 +215,7 @@ pss_checkint (int intNum)
       pss_outpw (pss_base + PSS_CONFIG, val);
       break;
     default:
-      printk ("unknown interupt selected. %d\n", intNum);
+      printk ("unknown interrupt selected. %d\n", intNum);
       return 0;
     }
 
@@ -304,7 +304,7 @@ pss_setint (int intNum, int configAddress)
       pss_outpw (configAddress, val);
       break;
     default:
-      printk ("pss_setint unkown int\n");
+      printk ("pss_setint unknown int\n");
     }
 }
 
@@ -723,10 +723,10 @@ pss_download_boot (unsigned char *block, int size)
 
 
 /* The following is a simple device driver for the pss.
-   All I really care about is comunication to and from the pss.
+   All I really care about is communication to and from the pss.
 
    The ability to reinitialize the <synth.ld>  This will be
-   default when release is choosen.
+   default when release is chosen.
 
    SNDCTL_PSS_DOWNLOAD:
 
@@ -738,9 +738,9 @@ pss_download_boot (unsigned char *block, int size)
                          where a write operation would effectively
                         download a new ld.
 
-   14,0x09 -- /dev/psecho  would open up a comunication path to the
+   14,0x09 -- /dev/psecho  would open up a communication path to the
                          esc614 asic.  Given the ability to send
-                        messages to the asic and recive messages too.
+                        messages to the asic and receive messages too.
 
                         All messages would get read and written in the
                         same manner.  It would be up to the application
@@ -874,13 +874,13 @@ pss_ioctl (int dev, struct fileinfo *file,
 
 /* This is going to be used to implement
    waiting on messages sent from the DSP and to the
-   DSP when comunication is used via the pss directly.
+   DSP when communication is used via the pss directly.
 
-   We need to find out if the pss can generate a diffrent
-   interupt other than the one it has been setup for.
+   We need to find out if the pss can generate a different
+   interrupt other than the one it has been setup for.
 
    This way we can carry on a conversation with the pss
-   on a seprate chanel.  This would be usefull for debugging. */
+   on a separate channel.  This would be useful for debugging. */
 
 pss_select (int dev, struct fileinfo * file, int sel_type, select_table * wait)
 {
index a59a618738e8cdf82daa06442d91d90bd0678fde..cb491b5cc143e7e28e99e55028ee435e160deee8 100644 (file)
@@ -105,7 +105,7 @@ sb_dsp_command (unsigned char val)
   unsigned long   limit;
 
   limit = GET_TIME () + HZ / 10;/*
-                                          * The timeout is 0.1 secods
+                                          * The timeout is 0.1 seconds
                                         */
 
   /*
@@ -160,7 +160,7 @@ sbintr (int unit)
 
       if (!(src & 1))
        return;                 /*
-                                * Not a DSP interupt
+                                * Not a DSP interrupt
                                 */
     }
 #endif
index a78225ed2732a5ed527546e2a29c12010d6d85c8..51ebf789649e1b3e9996babd3b37303d7f1b09cf 100644 (file)
@@ -42,7 +42,7 @@
  * future version of this driver.
  */
 
-extern int      sb_dsp_ok;     /* Set to 1 atfer successful initialization */
+extern int      sb_dsp_ok;     /* Set to 1 after successful initialization */
 extern int      sbc_base;
 
 extern int      sb_midi_mode;
index 45f06c1edfbfb49e27aa1c6f3287ee5ea977865a..92e659f3fd856a506dc362925ab578a3c8b6ee17 100644 (file)
@@ -49,7 +49,7 @@ static int      max_synthdev = 0;
 /*
  * The seq_mode gives the operating mode of the sequencer:
  *      1 = level1 (the default)
- *      2 = level2 (extended capabilites)
+ *      2 = level2 (extended capabilities)
  */
 
 #define SEQ_1  1
@@ -483,19 +483,21 @@ seq_chn_voice_event (unsigned char *event)
     return;
 
   if (seq_mode == SEQ_2)
-    if (synth_devs[dev]->alloc_voice)
-      voice = find_voice (dev, chn, note);
-
-  if (cmd == MIDI_NOTEON && parm == 0)
     {
-      cmd = MIDI_NOTEOFF;
-      parm = 64;
+      if (synth_devs[dev]->alloc_voice)
+        voice = find_voice (dev, chn, note);
+
+      if (cmd == MIDI_NOTEON && parm == 0)
+        {
+          cmd = MIDI_NOTEOFF;
+          parm = 64;
+        }
     }
 
   switch (cmd)
     {
     case MIDI_NOTEON:
-      if (note > 127)
+      if (note > 127 && note != 255)
        return;
 
       if (voice == -1 && seq_mode == SEQ_2 && synth_devs[dev]->alloc_voice)
index 6c53c8cdd0cdc993bd80fc57207f0fd7cc7f5632..b2b0acc0883f4353efc5f23869da6dab4377f36f 100644 (file)
@@ -190,7 +190,7 @@ If your card has nonstandard I/O address or IRQ number, change defines
 #define SND_DEV_DSP16  5       /* Like /dev/dsp but 16 bits/sample */
 #define SND_DEV_STATUS 6       /* /dev/sndstat */
 /* #7 not in use now. Was in 2.4. Free for use after v3.0. */
-#define SND_DEV_SEQ2   8       /* /dev/sequecer, level 2 interface */
+#define SND_DEV_SEQ2   8       /* /dev/sequencer, level 2 interface */
 #define SND_DEV_SNDPROC 9      /* /dev/sndproc for programmable devices */
 #define SND_DEV_PSS    SND_DEV_SNDPROC
 
index 77a5720f721bd08e8cf00782530741c77150b8ff..bb98711852531e8b45fdaffedeb8d5d17b8cb599 100644 (file)
@@ -20,7 +20,7 @@ int block_write(struct inode * inode, struct file * filp, char * buf, int count)
 {
        int blocksize, blocksize_bits, i, j;
        int block, blocks;
-       int offset;
+       loff_t offset;
        int chars;
        int written = 0;
        int cluster_list[4];
@@ -51,7 +51,7 @@ int block_write(struct inode * inode, struct file * filp, char * buf, int count)
        offset = filp->f_pos & (blocksize-1);
 
        if (blk_size[MAJOR(dev)])
-               size = (blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS) >> blocksize_bits;
+               size = ((loff_t) blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS) >> blocksize_bits;
        else
                size = INT_MAX;
        while (count>0) {
@@ -126,7 +126,7 @@ int block_write(struct inode * inode, struct file * filp, char * buf, int count)
 int block_read(struct inode * inode, struct file * filp, char * buf, int count)
 {
        unsigned int block;
-       unsigned int offset;
+       loff_t offset;
        int blocksize;
        int blocksize_bits, i;
        unsigned int blocks, rblocks, left;
@@ -137,7 +137,7 @@ int block_read(struct inode * inode, struct file * filp, char * buf, int count)
        struct buffer_head * buflist[NBUF];
        struct buffer_head * bhreq[NBUF];
        unsigned int chars;
-       unsigned int size;
+       loff_t size;
        unsigned int dev;
        int read;
 
@@ -154,7 +154,7 @@ int block_read(struct inode * inode, struct file * filp, char * buf, int count)
 
        offset = filp->f_pos;
        if (blk_size[MAJOR(dev)])
-               size = blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS;
+               size = (loff_t) blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS;
        else
                size = INT_MAX;
 
index f116788777822807b93eb88caf9faf42ee7153a1..99b38210d4bcb508a22c377cb6be50dc88a4ef55 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -383,7 +383,7 @@ static int count(char ** argv)
  *    2          kernel space  kernel space
  * 
  * We do this by playing games with the fs segment register.  Since it
- * it is expensive to load a segment register, we try to avoid calling
+ * is expensive to load a segment register, we try to avoid calling
  * set_fs() unless we absolutely have to.
  */
 unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
index a7667a3c1867e5dc1fbe575b2f54b5e3318eacfe..0f387a80ba6186f4455fd64bda44787db30e9d52 100644 (file)
@@ -64,7 +64,8 @@ struct inode_operations ext_dir_inode_operations = {
 static int ext_readdir(struct inode * inode, struct file * filp,
        struct dirent * dirent, int count)
 {
-       unsigned int offset,i;
+       unsigned int i;
+       off_t offset;
        char c;
        struct buffer_head * bh;
        struct ext_dir_entry * de;
@@ -84,9 +85,9 @@ static int ext_readdir(struct inode * inode, struct file * filp,
                while (offset < 1024 && filp->f_pos < inode->i_size) {
                        if (de->rec_len < 8 || de->rec_len % 8 != 0 ||
                            de->rec_len < de->name_len + 8 ||
-                           (de->rec_len + filp->f_pos - 1) / 1024 > (filp->f_pos / 1024)) {
+                           (de->rec_len + (off_t) filp->f_pos - 1) / 1024 > ((off_t) filp->f_pos / 1024)) {
                                printk ("ext_readdir: bad dir entry, skipping\n");
-                               printk ("dev=%d, dir=%d, offset=%d, rec_len=%d, name_len=%d\n",
+                               printk ("dev=%d, dir=%ld, offset=%ld, rec_len=%d, name_len=%d\n",
                                        inode->i_dev, inode->i_ino, offset, de->rec_len, de->name_len);
                                filp->f_pos += 1024-offset;
                                if (filp->f_pos > inode->i_size)
index 8bc8e67e340546531b139176d54028af408bdf6a..13bc4de305e970fdd2cd0bd633c44d33c7a9f67e 100644 (file)
@@ -270,7 +270,7 @@ printk("ext_free_inode: inode empty, skipping to %d\n", efi->next);
 #endif
                j = sb->u.ext_sb.s_firstfreeinodenumber;
                if (efi->next > sb->u.ext_sb.s_ninodes) {
-                       printk ("efi->next = %d\n", efi->next);
+                       printk ("efi->next = %ld\n", efi->next);
                        panic ("ext_new_inode: bad inode number in free list\n");
                }
                sb->u.ext_sb.s_firstfreeinodenumber = efi->next;
index 891e1d567656ef3796f9fe345d3dedad5b4e349f..b3ca2e2cfa557e804170db8e03e81c6885ae57a0 100644 (file)
@@ -431,7 +431,7 @@ int ext_sync_inode (struct inode *inode)
                wait_on_buffer(bh);
                if (bh->b_req && !bh->b_uptodate)
                {
-                       printk ("IO error syncing ext inode [%04x:%08x]\n",
+                       printk ("IO error syncing ext inode [%04x:%08lx]\n",
                                inode->i_dev, inode->i_ino);
                        err = -1;
                }
index 324af160b5e4774f5cdc5452f843a997c5da817a..45f91cb9b93de9455750b1926982ddc11f622114 100644 (file)
@@ -127,7 +127,7 @@ static struct buffer_head * ext_find_entry(struct inode * dir,
                    de->rec_len < de->name_len + 8 ||
                    (((char *) de) + de->rec_len-1 >= BLOCK_SIZE+bh->b_data)) {
                        printk ("ext_find_entry: bad dir entry\n");
-                       printk ("dev=%d, dir=%d, offset=%d, rec_len=%d, name_len=%d\n",
+                       printk ("dev=%d, dir=%ld, offset=%ld, rec_len=%d, name_len=%d\n",
                                dir->i_dev, dir->i_ino, offset, de->rec_len, de->name_len);
                        de = (struct ext_dir_entry *) (bh->b_data+BLOCK_SIZE);
                        offset = ((offset / BLOCK_SIZE) + 1) * BLOCK_SIZE;
@@ -275,7 +275,7 @@ printk ("ext_add_entry : creating next block\n");
                    de->rec_len < de->name_len + 8 ||
                    (((char *) de) + de->rec_len-1 >= BLOCK_SIZE+bh->b_data)) {
                        printk ("ext_addr_entry: bad dir entry\n");
-                       printk ("dev=%d, dir=%d, offset=%d, rec_len=%d, name_len=%d\n",
+                       printk ("dev=%d, dir=%ld, offset=%ld, rec_len=%d, name_len=%d\n",
                                dir->i_dev, dir->i_ino, offset, de->rec_len, de->name_len);
                        brelse (bh);
                        return NULL;
@@ -504,7 +504,7 @@ static int empty_dir(struct inode * inode)
                if (de->rec_len < 8 || de->rec_len %4 != 0 ||
                    de->rec_len < de->name_len + 8) {
                        printk ("empty_dir: bad dir entry\n");
-                       printk ("dev=%d, dir=%d, offset=%d, rec_len=%d, name_len=%d\n",
+                       printk ("dev=%d, dir=%ld, offset=%ld, rec_len=%d, name_len=%d\n",
                                inode->i_dev, inode->i_ino, offset, de->rec_len, de->name_len);
                        brelse (bh);
                        return 1;
@@ -605,7 +605,7 @@ int ext_unlink(struct inode * dir, const char * name, int len)
        if (S_ISDIR(inode->i_mode))
                goto end_unlink;
        if (!inode->i_nlink) {
-               printk("Deleting nonexistent file (%04x:%d), %d\n",
+               printk("Deleting nonexistent file (%04x:%ld), %d\n",
                        inode->i_dev,inode->i_ino,inode->i_nlink);
                inode->i_nlink=1;
        }
index 2c37a2f948d6d8ae8b6518dea52700c7b659c79c..ec79354586fe73920978e83a4d9621947539845f 100644 (file)
@@ -1,3 +1,29 @@
+Changes from version 0.5 to version 0.5a
+========================================
+       - New mount options: `bsddf' and `minixdf'.  `bsddf' causes ext2fs
+         to remove the blocks used for FS structures from the total block
+         count in statfs.  With `minixdf', ext2fs mimics Minix behavior
+         in statfs (i.e. it returns the total number of blocks on the
+         partition).  This is intended to make bde happy :-)
+       - New file attributes:
+         - Immutable files cannot be modified.  Data cannot be written to
+           these files.  They cannot be removed, renamed and new links cannot
+           be created.  Even root cannot modify the files.  He has to remove
+           the immutable attribute first.
+         - Append-only files: can only be written in append-mode when writing.
+           They cannot be removed, renamed and new links cannot be created.
+           Note: files may only be added to an append-only directory.
+         - No-dump files: the attribute is not used by the kernel.  My port
+           of dump uses it to avoid backing up files which are not important.
+       - New check in ext2_check_dir_entry: the inode number is checked.
+       - Support for big file systems: the copy of the FS descriptor is now
+         dynamically allocated (previous versions used a fixed size array).
+         This allows to mount 2GB+ FS.
+       - Reorganization of the ext2_inode structure to allow other operating
+         systems to create specific fields if they use ext2fs as their native
+         file system.  Currently, ext2fs is only implemented in Linux but
+         will soon be part of Gnu Hurd and of Masix.
+
 Changes from version 0.4b to version 0.5
 ========================================
        - New superblock fields: s_lastcheck and s_checkinterval added
index 80a112845ae0a94545b8c614baab203beec9c553..91ef7c8cc27d913011ceb888cd080559d99c5b56 100644 (file)
@@ -26,6 +26,11 @@ int ext2_permission (struct inode * inode, int mask)
 {
        unsigned short mode = inode->i_mode;
 
+       /*
+        * Nobody gets write access to an immutable file
+        */
+       if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
+               return 0;
        /*
         * Special case, access is always granted for root
         */
index 626ae9c68e95131bc8edd54a9d24a1c65a7e92fc..60655968a14602a6edb72ae856defdfaba465127 100644 (file)
 
 #include <asm/bitops.h>
 
-#define clear_block(addr,size) \
-       __asm__("cld\n\t" \
-               "rep\n\t" \
-               "stosl" \
-               : \
-               :"a" (0), "c" (size / 4), "D" ((long) (addr)) \
-               :"cx", "di")
-
 #define in_range(b, first, len)                ((b) >= (first) && (b) <= (first) + (len) - 1)
 
-static inline int find_first_zero_bit (unsigned long * addr, unsigned size)
-{
-       int res;
-
-       if (!size)
-               return 0;
-       __asm__("
-               cld
-               movl $-1,%%eax
-               repe; scasl
-               je 1f
-               subl $4,%%edi
-               movl (%%edi),%%eax
-               notl %%eax
-               bsfl %%eax,%%edx
-               jmp 2f
-1:             xorl %%edx,%%edx
-2:             subl %%ebx,%%edi
-               shll $3,%%edi
-               addl %%edi,%%edx"
-               :"=d" (res)
-               :"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
-               :"ax", "bx", "cx", "di");
-       return res;
-}
-
-static inline int find_next_zero_bit (unsigned long * addr, int size,
-                                     int offset)
-{
-       unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
-       int set = 0, bit = offset & 31, res;
-       
-       if (bit) {
-               /*
-                * Look for zero in first byte
-                */
-               __asm__("
-                       bsfl %1,%0
-                       jne 1f
-                       movl $32, %0
-1:                     "
-                       : "=r" (set)
-                       : "r" (~(*p >> bit)));
-               if (set < (32 - bit))
-                       return set + offset;
-               set = 32 - bit;
-               p++;
-       }
-       /*
-        * No zero yet, search remaining full bytes for a zero
-        */
-       res = find_first_zero_bit (p, size - 32 * (p - addr));
-       return (offset + set + res);
-}
-
-static inline char * find_first_zero_byte (char * addr, int size)
-{
-       char *res;
-
-       if (!size)
-               return 0;
-       __asm__("
-               cld
-               mov $0,%%eax
-               repnz; scasb
-               jnz 1f
-               dec %%edi
-1:             "
-               : "=D" (res)
-               : "0" (addr), "c" (size)
-               : "ax");
-       return res;
-}
-
 static struct ext2_group_desc * get_group_desc (struct super_block * sb,
                                                unsigned int block_group,
                                                struct buffer_head ** bh)
@@ -421,8 +339,7 @@ repeat:
                 * cyclicly search through the rest of the groups.
                 */
                p = ((char *) bh->b_data) + (j >> 3);
-               r = find_first_zero_byte (p, 
-                                         (EXT2_BLOCKS_PER_GROUP(sb) - j + 7) >> 3);
+               r = memscan(p, 0, (EXT2_BLOCKS_PER_GROUP(sb) - j + 7) >> 3);
                k = (r - ((char *) bh->b_data)) << 3;
                if (k < EXT2_BLOCKS_PER_GROUP(sb)) {
                        j = k;
@@ -457,8 +374,7 @@ repeat:
        }
        bitmap_nr = load_block_bitmap (sb, i);
        bh = sb->u.ext2_sb.s_block_bitmap[bitmap_nr];
-       r = find_first_zero_byte (bh->b_data, 
-                                 EXT2_BLOCKS_PER_GROUP(sb) >> 3);
+       r = memscan(bh->b_data, 0, EXT2_BLOCKS_PER_GROUP(sb) >> 3);
        j = (r - bh->b_data) << 3;
        if (j < EXT2_BLOCKS_PER_GROUP(sb))
                goto search_back;
@@ -542,7 +458,7 @@ got_block:
                unlock_super (sb);
                return 0;
        }
-       clear_block (bh->b_data, sb->s_blocksize);
+       memset(bh->b_data, 0, sb->s_blocksize);
        bh->b_uptodate = 1;
        mark_buffer_dirty(bh, 1);
        brelse (bh);
index 1b84eda7d1aab6cc1568c685ca0c27125f1be3ec..58cdcc463d2860a2735ab14055dbfee0e46ee703 100644 (file)
@@ -40,7 +40,10 @@ static struct file_operations ext2_dir_operations = {
        NULL,                   /* mmap */
        NULL,                   /* no special open code */
        NULL,                   /* no special release code */
-       file_fsync              /* fsync */
+       file_fsync,             /* fsync */
+       NULL,                   /* fasync */
+       NULL,                   /* check_media_change */
+       NULL                    /* revalidate */
 };
 
 /*
@@ -61,7 +64,8 @@ struct inode_operations ext2_dir_inode_operations = {
        NULL,                   /* follow_link */
        NULL,                   /* bmap */
        ext2_truncate,          /* truncate */
-       ext2_permission         /* permission */
+       ext2_permission,        /* permission */
+       NULL                    /* smap */
 };
 
 int ext2_check_dir_entry (char * function, struct inode * dir,
@@ -79,6 +83,8 @@ int ext2_check_dir_entry (char * function, struct inode * dir,
        else if (dir && ((char *) de - bh->b_data) + de->rec_len >
                 dir->i_sb->s_blocksize)
                error_msg = "directory entry across blocks";
+       else if (dir && de->inode > dir->i_sb->u.ext2_sb.s_es->s_inodes_count)
+               error_msg = "inode out of bounds";
 
        if (error_msg != NULL)
                ext2_error (dir->i_sb, function, "bad directory entry: %s\n"
index 8cac492458495545e8341dc9bd157d22d4278ff7..1956cf3fec136bbe7a1820d1e6f67083796aaeb2 100644 (file)
@@ -51,7 +51,10 @@ static struct file_operations ext2_file_operations = {
        generic_mmap,           /* mmap */
        NULL,                   /* no special open is needed */
        ext2_release_file,      /* release */
-       ext2_sync_file          /* fsync */
+       ext2_sync_file,         /* fsync */
+       NULL,                   /* fasync */
+       NULL,                   /* check_media_change */
+       NULL                    /* revalidate */
 };
 
 struct inode_operations ext2_file_inode_operations = {
@@ -69,7 +72,8 @@ struct inode_operations ext2_file_inode_operations = {
        NULL,                   /* follow_link */
        ext2_bmap,              /* bmap */
        ext2_truncate,          /* truncate */
-       ext2_permission         /* permission */
+       ext2_permission,        /* permission */
+       NULL                    /* smap */
 };
 
 static int ext2_file_read (struct inode * inode, struct file * filp,
index f598fdecafbf44cded5e6291d71c73e8bdf4fda4..65cb77284356de2f26780fa65b0aa5a82abcef77 100644 (file)
 
 #include <asm/bitops.h>
 
-static inline int find_first_zero_bit (unsigned long * addr, unsigned size)
-{
-       int res;
-
-       if (!size)
-               return 0;
-       __asm__("
-               cld
-               movl $-1,%%eax
-               repe; scasl
-               je 1f
-               subl $4,%%edi
-               movl (%%edi),%%eax
-               notl %%eax
-               bsfl %%eax,%%edx
-               jmp 2f
-1:             xorl %%edx,%%edx
-2:             subl %%ebx,%%edi
-               shll $3,%%edi
-               addl %%edi,%%edx"
-               : "=d" (res)
-               : "c" ((size + 31) >> 5), "D" (addr), "b" (addr)
-               : "ax", "bx", "cx", "di");
-       return res;
-}
-
 static struct ext2_group_desc * get_group_desc (struct super_block * sb,
                                                unsigned int block_group,
                                                struct buffer_head ** bh)
@@ -491,8 +465,8 @@ repeat:
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
        inode->u.ext2_i.i_flags = dir->u.ext2_i.i_flags;
        inode->u.ext2_i.i_faddr = 0;
-       inode->u.ext2_i.i_frag = 0;
-       inode->u.ext2_i.i_fsize = 0;
+       inode->u.ext2_i.i_frag_no = 0;
+       inode->u.ext2_i.i_frag_size = 0;
        inode->u.ext2_i.i_file_acl = 0;
        inode->u.ext2_i.i_dir_acl = 0;
        inode->u.ext2_i.i_dtime = 0;
index 3818bce1f9e706907ecece21edf32b495626287d..9a126cf937aa6b223706c06278ec4888e5ccc965 100644 (file)
 #include <linux/string.h>
 #include <linux/locks.h>
 
-#define clear_block(addr,size) \
-       __asm__("cld\n\t" \
-               "rep\n\t" \
-               "stosl" \
-               : \
-               :"a" (0), "c" (size / 4), "D" ((long) (addr)) \
-               :"cx", "di")
-
 void ext2_put_inode (struct inode * inode)
 {
        ext2_discard_prealloc (inode);
@@ -107,7 +99,7 @@ static int ext2_alloc_block (struct inode * inode, unsigned long goal)
                                    "cannot get block %lu", result);
                        return 0;
                }
-               clear_block (bh->b_data, inode->i_sb->s_blocksize);
+               memset(bh->b_data, 0, inode->i_sb->s_blocksize);
                bh->b_uptodate = 1;
                mark_buffer_dirty(bh, 1);
                brelse (bh);
@@ -541,8 +533,8 @@ void ext2_read_inode (struct inode * inode)
        inode->i_version = ++event;
        inode->u.ext2_i.i_flags = raw_inode->i_flags;
        inode->u.ext2_i.i_faddr = raw_inode->i_faddr;
-       inode->u.ext2_i.i_frag = raw_inode->i_frag;
-       inode->u.ext2_i.i_fsize = raw_inode->i_fsize;
+       inode->u.ext2_i.i_frag_no = raw_inode->i_frag;
+       inode->u.ext2_i.i_frag_size = raw_inode->i_fsize;
        inode->u.ext2_i.i_file_acl = raw_inode->i_file_acl;
        inode->u.ext2_i.i_dir_acl = raw_inode->i_dir_acl;
        inode->u.ext2_i.i_version = raw_inode->i_version;
@@ -575,6 +567,10 @@ void ext2_read_inode (struct inode * inode)
                init_fifo(inode);
        if (inode->u.ext2_i.i_flags & EXT2_SYNC_FL)
                inode->i_flags |= MS_SYNC;
+       if (inode->u.ext2_i.i_flags & EXT2_APPEND_FL)
+               inode->i_flags |= S_APPEND;
+       if (inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)
+               inode->i_flags |= S_IMMUTABLE;
 }
 
 static struct buffer_head * ext2_update_inode (struct inode * inode)
@@ -625,8 +621,8 @@ static struct buffer_head * ext2_update_inode (struct inode * inode)
        raw_inode->i_dtime = inode->u.ext2_i.i_dtime;
        raw_inode->i_flags = inode->u.ext2_i.i_flags;
        raw_inode->i_faddr = inode->u.ext2_i.i_faddr;
-       raw_inode->i_frag = inode->u.ext2_i.i_frag;
-       raw_inode->i_fsize = inode->u.ext2_i.i_fsize;
+       raw_inode->i_frag = inode->u.ext2_i.i_frag_no;
+       raw_inode->i_fsize = inode->u.ext2_i.i_frag_size;
        raw_inode->i_file_acl = inode->u.ext2_i.i_file_acl;
        raw_inode->i_dir_acl = inode->u.ext2_i.i_dir_acl;
        raw_inode->i_version = inode->u.ext2_i.i_version;
index c562f333dab032accb70532745cce4c5482adec6..188b29daaba5c6b76b347bea3f8b428e4f9e8a50 100644 (file)
@@ -18,6 +18,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                unsigned long arg)
 {
        int err;
+       unsigned long flags;
 
        ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg);
 
@@ -28,11 +29,30 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                put_fs_long (inode->u.ext2_i.i_flags, (long *) arg);
                return 0;
        case EXT2_IOC_SETFLAGS:
-               if ((current->fsuid != inode->i_uid) && !fsuser())
-                       return -EPERM;
+               flags = get_fs_long ((long *) arg);
+               /*
+                * Only the super-user can change the IMMUTABLE flag
+                */
+               if (((flags & EXT2_IMMUTABLE_FL) &&
+                    !(inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)) ||
+                   (!(flags & EXT2_IMMUTABLE_FL) &&
+                    (inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL))) {
+                       if (!fsuser())
+                               return -EPERM;
+               } else
+                       if ((current->fsuid != inode->i_uid) && !fsuser())
+                               return -EPERM;
                if (IS_RDONLY(inode))
                        return -EROFS;
-               inode->u.ext2_i.i_flags = get_fs_long ((long *) arg);
+               inode->u.ext2_i.i_flags = flags;
+               if (flags & EXT2_APPEND_FL)
+                       inode->i_flags |= S_APPEND;
+               else
+                       inode->i_flags &= ~S_APPEND;
+               if (flags & EXT2_IMMUTABLE_FL)
+                       inode->i_flags |= S_IMMUTABLE;
+               else
+                       inode->i_flags &= ~S_IMMUTABLE;
                inode->i_ctime = CURRENT_TIME;
                inode->i_dirt = 1;
                return 0;
index 06c5457f735d59f6df352313f11f0ed1cf2a81ec..d1105202b147b547a485dba5a2f03da36c37e561 100644 (file)
@@ -43,8 +43,6 @@
 static int ext2_match (int len, const char * const name,
                       struct ext2_dir_entry * de)
 {
-       unsigned char same;
-
        if (!de || !de->inode || len > EXT2_NAME_LEN)
                return 0;
        /*
@@ -55,13 +53,7 @@ static int ext2_match (int len, const char * const name,
                return 1;
        if (len != de->name_len)
                return 0;
-       __asm__("cld\n\t"
-               "repe ; cmpsb\n\t"
-               "setz %0"
-               :"=q" (same)
-               :"S" ((long) name), "D" ((long) de->name), "c" (len)
-               :"cx", "di", "si");
-       return (int) same;
+       return !memcmp(name, de->name, len);
 }
 
 /*
@@ -704,6 +696,8 @@ repeat:
        retval = -EPERM;
        if (S_ISDIR(inode->i_mode))
                goto end_unlink;
+       if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
+               goto end_unlink;
        if (de->inode != inode->i_ino) {
                iput(inode);
                brelse(bh);
@@ -835,6 +829,11 @@ int ext2_link (struct inode * oldinode, struct inode * dir,
                iput (dir);
                return -EPERM;
        }
+       if (IS_APPEND(oldinode) || IS_IMMUTABLE(oldinode)) {
+               iput (oldinode);
+               iput (dir);
+               return -EPERM;
+       }
        if (oldinode->i_nlink >= EXT2_LINK_MAX) {
                iput (oldinode);
                iput (dir);
@@ -949,6 +948,8 @@ start_up:
            current->fsuid != old_inode->i_uid &&
            current->fsuid != old_dir->i_uid && !fsuser())
                goto end_rename;
+       if (IS_APPEND(old_inode) || IS_IMMUTABLE(old_inode))
+               goto end_rename;
        new_bh = ext2_find_entry (new_dir, new_name, new_len, &new_de);
        if (new_bh) {
                new_inode = __iget (new_dir->i_sb, new_de->inode, 0); /* no mntp cross */
index f5607c4a51faa91033bc62b5d34512c52705e22f..003eef185fa9a76f0aadada994442a91c73e79bc 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
+#include <linux/malloc.h>
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
@@ -89,6 +90,7 @@ void ext2_warning (struct super_block * sb, const char * function,
 
 void ext2_put_super (struct super_block * sb)
 {
+       int db_count;
        int i;
 
        lock_super (sb);
@@ -97,9 +99,12 @@ void ext2_put_super (struct super_block * sb)
                mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
        }
        sb->s_dev = 0;
-       for (i = 0; i < EXT2_MAX_GROUP_DESC; i++)
+       db_count = sb->u.ext2_sb.s_db_per_group;
+       for (i = 0; i < db_count; i++)
                if (sb->u.ext2_sb.s_group_desc[i])
                        brelse (sb->u.ext2_sb.s_group_desc[i]);
+       kfree_s (sb->u.ext2_sb.s_group_desc,
+                db_count * sizeof (struct buffer_head *));
        for (i = 0; i < EXT2_MAX_GROUP_LOADED; i++)
                if (sb->u.ext2_sb.s_inode_bitmap[i])
                        brelse (sb->u.ext2_sb.s_inode_bitmap[i]);
@@ -180,7 +185,9 @@ static int parse_options (char * options, unsigned long * sb_block,
             this_char = strtok (NULL, ",")) {
                if ((value = strchr (this_char, '=')) != NULL)
                        *value++ = 0;
-               if (!strcmp (this_char, "check")) {
+               if (!strcmp (this_char, "bsddf"))
+                       clear_opt (*mount_options, MINIX_DF);
+               else if (!strcmp (this_char, "check")) {
                        if (!value || !*value)
                                set_opt (*mount_options, CHECK_NORMAL);
                        else if (!strcmp (value, "none")) {
@@ -231,6 +238,8 @@ static int parse_options (char * options, unsigned long * sb_block,
                else if (!strcmp (this_char, "grpid") ||
                         !strcmp (this_char, "bsdgroups"))
                        set_opt (*mount_options, GRPID);
+               else if (!strcmp (this_char, "minixdf"))
+                       set_opt (*mount_options, MINIX_DF);
                else if (!strcmp (this_char, "nocheck")) {
                        clear_opt (*mount_options, CHECK_NORMAL);
                        clear_opt (*mount_options, CHECK_STRICT);
@@ -355,7 +364,7 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
        unsigned long sb_block = 1;
        unsigned long logic_sb_block = 1;
        int dev = sb->s_dev;
-       int bh_count;
+       int db_count;
        int i, j;
 #ifdef EXT2FS_PRE_02B_COMPAT
        int fs_converted = 0;
@@ -506,18 +515,17 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
                                        es->s_first_data_block +
                                       EXT2_BLOCKS_PER_GROUP(sb) - 1) /
                                       EXT2_BLOCKS_PER_GROUP(sb);
-       for (i = 0; i < EXT2_MAX_GROUP_DESC; i++)
-               sb->u.ext2_sb.s_group_desc[i] = NULL;
-       bh_count = (sb->u.ext2_sb.s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) /
+       db_count = (sb->u.ext2_sb.s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) /
                   EXT2_DESC_PER_BLOCK(sb);
-       if (bh_count > EXT2_MAX_GROUP_DESC) {
+       sb->u.ext2_sb.s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL);
+       if (sb->u.ext2_sb.s_group_desc == NULL) {
                sb->s_dev = 0;
                unlock_super (sb);
                brelse (bh);
-               printk ("EXT2-fs: file system is too big\n");
+               printk ("EXT2-fs: not enough memory\n");
                return NULL;
        }
-       for (i = 0; i < bh_count; i++) {
+       for (i = 0; i < db_count; i++) {
                sb->u.ext2_sb.s_group_desc[i] = bread (dev, logic_sb_block + i + 1,
                                                       sb->s_blocksize);
                if (!sb->u.ext2_sb.s_group_desc[i]) {
@@ -525,6 +533,8 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
                        unlock_super (sb);
                        for (j = 0; j < i; j++)
                                brelse (sb->u.ext2_sb.s_group_desc[j]);
+                       kfree_s (sb->u.ext2_sb.s_group_desc,
+                                db_count * sizeof (struct buffer_head *));
                        brelse (bh);
                        printk ("EXT2-fs: unable to read group descriptors\n");
                        return NULL;
@@ -533,8 +543,10 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
        if (!ext2_check_descriptors (sb)) {
                sb->s_dev = 0;
                unlock_super (sb);
-               for (j = 0; j < i; j++)
+               for (j = 0; j < db_count; j++)
                        brelse (sb->u.ext2_sb.s_group_desc[j]);
+               kfree_s (sb->u.ext2_sb.s_group_desc,
+                        db_count * sizeof (struct buffer_head *));
                brelse (bh);
                printk ("EXT2-fs: group descriptors corrupted !\n");
                return NULL;
@@ -547,6 +559,7 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
        }
        sb->u.ext2_sb.s_loaded_inode_bitmaps = 0;
        sb->u.ext2_sb.s_loaded_block_bitmaps = 0;
+       sb->u.ext2_sb.s_db_per_group = db_count;
        unlock_super (sb);
        /*
         * set up enough so that it can read an inode
@@ -555,16 +568,18 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
        sb->s_op = &ext2_sops;
        if (!(sb->s_mounted = iget (sb, EXT2_ROOT_INO))) {
                sb->s_dev = 0;
-               for (i = 0; i < EXT2_MAX_GROUP_DESC; i++)
+               for (i = 0; i < db_count; i++)
                        if (sb->u.ext2_sb.s_group_desc[i])
                                brelse (sb->u.ext2_sb.s_group_desc[i]);
+               kfree_s (sb->u.ext2_sb.s_group_desc,
+                        db_count * sizeof (struct buffer_head *));
                brelse (bh);
                printk ("EXT2-fs: get root inode failed\n");
                return NULL;
        }
 #ifdef EXT2FS_PRE_02B_COMPAT
        if (fs_converted) {
-               for (i = 0; i < bh_count; i++)
+               for (i = 0; i < db_count; i++)
                        mark_buffer_dirty(sb->u.ext2_sb.s_group_desc[i], 1);
                sb->s_dirt = 1;
        }
@@ -654,10 +669,28 @@ int ext2_remount (struct super_block * sb, int * flags, char * data)
 void ext2_statfs (struct super_block * sb, struct statfs * buf)
 {
        long tmp;
+       unsigned long overhead;
+       unsigned long overhead_per_group;
+
+       if (test_opt (sb, MINIX_DF))
+               overhead = 0;
+       else {
+               /*
+                * Compute the overhead (FS structures)
+                */
+               overhead_per_group = 1 /* super block */ +
+                                    sb->u.ext2_sb.s_db_per_group /* descriptors */ +
+                                    1 /* block bitmap */ +
+                                    1 /* inode bitmap */ +
+                                    sb->u.ext2_sb.s_itb_per_group /* inode table */;
+               overhead = sb->u.ext2_sb.s_es->s_first_data_block +
+                          sb->u.ext2_sb.s_groups_count * overhead_per_group;
+       }
 
        put_fs_long (EXT2_SUPER_MAGIC, &buf->f_type);
        put_fs_long (sb->s_blocksize, &buf->f_bsize);
-       put_fs_long (sb->u.ext2_sb.s_es->s_blocks_count, &buf->f_blocks);
+       put_fs_long (sb->u.ext2_sb.s_es->s_blocks_count - overhead,
+                    &buf->f_blocks);
        tmp = ext2_count_free_blocks (sb);
        put_fs_long (tmp, &buf->f_bfree);
        if (tmp >= sb->u.ext2_sb.s_es->s_r_blocks_count)
index d36f328e28d04946c1bb68ef6862883feb629e15..7d85ed74cf578a0b9da5e27bd6a3d8cbc979bc49 100644 (file)
@@ -44,7 +44,8 @@ struct inode_operations ext2_symlink_inode_operations = {
        ext2_follow_link,       /* follow_link */
        NULL,                   /* bmap */
        NULL,                   /* truncate */
-       NULL                    /* permission */
+       NULL,                   /* permission */
+       NULL                    /* smap */
 };
 
 static int ext2_follow_link(struct inode * dir, struct inode * inode,
index b4cddb696fdab31cd2734cda8e1186db0d6d8c9b..10a1fd2361a002ee70687c710e97e1e9fb72e10a 100644 (file)
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/locks.h>
-
-#define clear_block(addr,size,value) \
-       __asm__("cld\n\t" \
-               "rep\n\t" \
-               "stosl" \
-               : \
-               :"a" (value), "c" (size / 4), "D" ((long) (addr)) \
-               :"cx", "di")
+#include <linux/string.h>
 
 static int ext2_secrm_seed = 152;      /* Random generator base */
 
@@ -88,8 +81,7 @@ repeat:
                inode->i_blocks -= blocks;
                inode->i_dirt = 1;
                if (inode->u.ext2_i.i_flags & EXT2_SECRM_FL) {
-                       clear_block (bh->b_data, inode->i_sb->s_blocksize,
-                                    RANDOM_INT);
+                       memset(bh->b_data, RANDOM_INT, inode->i_sb->s_blocksize);
                        mark_buffer_dirty(bh, 1);
                }
                brelse (bh);
@@ -164,8 +156,7 @@ repeat:
                *ind = 0;
                mark_buffer_dirty(ind_bh, 1);
                if (inode->u.ext2_i.i_flags & EXT2_SECRM_FL) {
-                       clear_block (bh->b_data, inode->i_sb->s_blocksize,
-                                    RANDOM_INT);
+                       memset(bh->b_data, RANDOM_INT, inode->i_sb->s_blocksize);
                        mark_buffer_dirty(bh, 1);
                }
                brelse (bh);
@@ -333,6 +324,8 @@ void ext2_truncate (struct inode * inode)
        if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
            S_ISLNK(inode->i_mode)))
                return;
+       if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
+               return;
        ext2_discard_prealloc(inode);
        while (1) {
                down(&inode->i_sem);
index ef1c4060dff13b307b95959119c75cc3ac27abde..e737ac3225143110cf3864b335ffe6969852c3d1 100644 (file)
@@ -83,6 +83,12 @@ asmlinkage int sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
                case F_GETFL:
                        return filp->f_flags;
                case F_SETFL:
+                       /*
+                        * In the case of an append-only file, O_APPEND
+                        * cannot be cleared
+                        */
+                       if (IS_APPEND(filp->f_inode) && !(arg & O_APPEND))
+                               return -EPERM;
                        if ((arg & FASYNC) && !(filp->f_flags & FASYNC) &&
                            filp->f_op->fasync)
                                filp->f_op->fasync(filp->f_inode, filp, 1);
index 0e33711c642c111fb4942faddd79c5b4d2d787c0..36993d898cc465a8e322c5ee24f5d0d868bf0538 100644 (file)
@@ -242,7 +242,7 @@ static secno bplus_lookup(struct inode *inode, struct bplus_header *b,
 static struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno,
                                    const unsigned char *name, unsigned len,
                                      struct quad_buffer_head *qbh);
-static struct hpfs_dirent *map_pos_dirent(struct inode *inode, off_t *posp,
+static struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
                                          struct quad_buffer_head *qbh);
 static void write_one_dirent(struct dirent *dirent, const unsigned char *name,
                             unsigned namelen, ino_t ino, int lowercase);
@@ -874,7 +874,7 @@ static int hpfs_file_read(struct inode *inode, struct file *filp,
        /*
         * truncate count at EOF
         */
-       if (count > inode->i_size - filp->f_pos)
+       if (count > inode->i_size - (off_t) filp->f_pos)
                count = inode->i_size - filp->f_pos;
 
        start = buf;
@@ -920,7 +920,7 @@ static int hpfs_file_read(struct inode *inode, struct file *filp,
                         * squeeze out \r, output length varies
                         */
                        n0 = convcpy_tofs(buf, block + r, n);
-                       if (count > inode->i_size - filp->f_pos - n + n0)
+                       if (count > inode->i_size - (off_t) filp->f_pos - n + n0)
                                count = inode->i_size - filp->f_pos - n + n0;
                }
 
@@ -1341,7 +1341,7 @@ static int hpfs_readdir(struct inode *inode, struct file *filp,
 
        lc = inode->i_sb->s_hpfs_lowercase;
 
-       switch (filp->f_pos) {
+       switch ((off_t) filp->f_pos) {
        case 0:
                write_one_dirent(dirent, ".", 1, inode->i_ino, lc);
                filp->f_pos = -1;
@@ -1409,7 +1409,7 @@ static void write_one_dirent(struct dirent *dirent, const unsigned char *name,
  * increment *posp to point to the following dir entry. 
  */
 
-static struct hpfs_dirent *map_pos_dirent(struct inode *inode, off_t *posp,
+static struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
                                          struct quad_buffer_head *qbh)
 {
        unsigned pos, q, r;
index bc8d652a6b48e0bf812eac0568fa9091d5baf754..5571cc54f42f17825e13e7e647cbe62f3cc11734 100644 (file)
@@ -265,7 +265,7 @@ void date_unix2dos(int unix_date,unsigned short *time,
    non-NULL, it is brelse'd before. Pos is incremented. The buffer header is
    returned in bh. */
 
-int msdos_get_entry(struct inode *dir, off_t *pos,struct buffer_head **bh,
+int msdos_get_entry(struct inode *dir, loff_t *pos,struct buffer_head **bh,
     struct msdos_dir_entry **de)
 {
        int sector,offset;
index e82afee16fa3088f1a1088674ba6ef9b5cd000ee..c4977d4afa020ea55a2ff3b0dd0b3204ea63e255 100644 (file)
@@ -301,7 +301,7 @@ mkdir_error:
 
 static int msdos_empty(struct inode *dir)
 {
-       off_t pos;
+       loff_t pos;
        struct buffer_head *bh;
        struct msdos_dir_entry *de;
 
index 9dc66a77a6279dd85a9914d11c3d5d20da87e7f2..099f3ef96a462e8ccf5d0163b7f2e6bfe6b16668 100644 (file)
 
 #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
 
+/*
+ * How long a filename can we get from user space?
+ *  -EFAULT if invalid area
+ *  0 if ok (ENAMETOOLONG before EFAULT)
+ *  >0 EFAULT after xx bytes
+ */
+static inline int get_max_filename(unsigned long address)
+{
+       struct vm_area_struct * vma;
+
+       if (get_fs() == KERNEL_DS)
+               return 0;
+       for (vma = current->mm->mmap ; ; vma = vma->vm_next) {
+               if (!vma)
+                       return -EFAULT;
+               if (vma->vm_end > address)
+                       break;
+       }
+       if (vma->vm_start > address || !(vma->vm_page_prot & PAGE_USER))
+               return -EFAULT;
+       address = vma->vm_end - address;
+       if (address > PAGE_SIZE)
+               return 0;
+       if (vma->vm_next && vma->vm_next->vm_start == vma->vm_end &&
+          (vma->vm_next->vm_page_prot & PAGE_USER))
+               return 0;
+       return address;
+}
+
 /*
  * In order to reduce some races, while at the same time doing additional
  * checking and hopefully speeding things up, we copy filenames to the
  */
 int getname(const char * filename, char **result)
 {
-       int error;
-       unsigned long i, page;
+       int i, error;
+       unsigned long page;
        char * tmp, c;
 
-       i = (unsigned long) filename;
-       if (!i || i >= TASK_SIZE)
-               return -EFAULT;
-       i = TASK_SIZE - i;
+       i = get_max_filename((unsigned long) filename);
+       if (i < 0)
+               return i;
        error = -EFAULT;
-       if (i > PAGE_SIZE) {
-               i = PAGE_SIZE;
+       if (!i) {
                error = -ENAMETOOLONG;
+               i = PAGE_SIZE;
        }
        c = get_fs_byte(filename++);
        if (!c)
@@ -69,8 +97,8 @@ void putname(char * name)
  *
  * is used to check for read/write/execute permissions on a file.
  * We use "fsuid" for this, letting us set arbitrary permissions
- * permissions for filesystem access without changing the "normal"
- * uids which are used for other things..
+ * for filesystem access without changing the "normal" uids which
+ * are used for other things..
  */
 int permission(struct inode * inode,int mask)
 {
@@ -78,6 +106,8 @@ int permission(struct inode * inode,int mask)
 
        if (inode->i_op && inode->i_op->permission)
                return inode->i_op->permission(inode, mask);
+       else if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
+               return 0; /* Nobody gets write access to an immutable file */
        else if (current->fsuid == inode->i_uid)
                mode >>= 6;
        else if (in_group_p(inode->i_gid))
@@ -366,6 +396,13 @@ int open_namei(const char * pathname, int flag, int mode,
                        }
                }
        }
+       /*
+        * An append-only file must be opened in append mode for writing
+        */
+       if (IS_APPEND(inode) && ((flag & 2) && !(flag & O_APPEND))) {
+               iput(inode);
+               return -EPERM;
+       }
        if (flag & O_TRUNC) {
              inode->i_size = 0;
              if (inode->i_op && inode->i_op->truncate)
@@ -505,6 +542,13 @@ static int do_rmdir(const char * name)
                iput(dir);
                return -EACCES;
        }
+       /*
+        * A subdirectory cannot be removed from an append-only directory
+        */
+       if (IS_APPEND(dir)) {
+               iput(dir);
+               return -EPERM;
+       }
        if (!dir->i_op || !dir->i_op->rmdir) {
                iput(dir);
                return -EPERM;
@@ -546,6 +590,13 @@ static int do_unlink(const char * name)
                iput(dir);
                return -EACCES;
        }
+       /*
+        * A file cannot be removed from an append-only directory
+        */
+       if (IS_APPEND(dir)) {
+               iput(dir);
+               return -EPERM;
+       }
        if (!dir->i_op || !dir->i_op->unlink) {
                iput(dir);
                return -EPERM;
@@ -647,6 +698,14 @@ static int do_link(struct inode * oldinode, const char * newname)
                iput(oldinode);
                return -EACCES;
        }
+       /*
+        * A link to an append-only or immutable file cannot be created
+        */
+       if (IS_APPEND(oldinode) || IS_IMMUTABLE(oldinode)) {
+               iput(dir);
+               iput(oldinode);
+               return -EPERM;
+       }
        if (!dir->i_op || !dir->i_op->link) {
                iput(dir);
                iput(oldinode);
@@ -725,6 +784,14 @@ static int do_rename(const char * oldname, const char * newname)
                iput(new_dir);
                return -EROFS;
        }
+       /*
+        * A file cannot be removed from an append-only directory
+        */
+       if (IS_APPEND(old_dir)) {
+               iput(old_dir);
+               iput(new_dir);
+               return -EPERM;
+       }
        if (!old_dir->i_op || !old_dir->i_op->rename) {
                iput(old_dir);
                iput(new_dir);
index 227abce548e407e0894211840a5062aa7885b4f9..08d80514c2b6d69c2823d14253af2532ac678875 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -81,6 +81,10 @@ asmlinkage int sys_truncate(const char * path, unsigned int length)
                iput(inode);
                return -EROFS;
        }
+       if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
+               iput(inode);
+               return -EPERM;
+       }
        inode->i_size = length;
        if (inode->i_op && inode->i_op->truncate)
                inode->i_op->truncate(inode);
@@ -102,6 +106,8 @@ asmlinkage int sys_ftruncate(unsigned int fd, unsigned int length)
                return -ENOENT;
        if (S_ISDIR(inode->i_mode) || !(file->f_mode & 2))
                return -EACCES;
+       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
+               return -EPERM;
        inode->i_size = length;
        if (inode->i_op && inode->i_op->truncate)
                inode->i_op->truncate(inode);
@@ -294,6 +300,9 @@ asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
 {
        struct inode * inode;
        struct file * file;
+       uid_t old_user;
+       gid_t old_group;
+       int notify_flag = 0;
 
        if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
                return -EBADF;
@@ -301,6 +310,8 @@ asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
                return -ENOENT;
        if (IS_RDONLY(inode))
                return -EROFS;
+       old_user = inode->i_uid;
+       old_group = inode->i_gid;
        if (user == (uid_t) -1)
                user = inode->i_uid;
        if (group == (gid_t) -1)
@@ -310,9 +321,23 @@ asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
            fsuser()) {
                inode->i_uid = user;
                inode->i_gid = group;
+               /*
+                * If the owner has been changed, remove the setuid bit
+                */
+               if (old_user != inode->i_uid && inode->i_mode & S_ISUID) {
+                       inode->i_mode &= ~S_ISUID;
+                       notify_flag = NOTIFY_MODE;
+               }
+               /*
+                * If the group has been changed, remove the setgid bit
+                */
+               if (old_group != inode->i_gid && inode->i_mode & S_ISGID) {
+                       inode->i_mode &= ~S_ISGID;
+                       notify_flag = NOTIFY_MODE;
+               }
                inode->i_ctime = CURRENT_TIME;
                inode->i_dirt = 1;
-               return notify_change(NOTIFY_UIDGID, inode);
+               return notify_change(notify_flag | NOTIFY_UIDGID, inode);
        }
        return -EPERM;
 }
@@ -321,6 +346,9 @@ asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
 {
        struct inode * inode;
        int error;
+       uid_t old_user;
+       gid_t old_group;
+       int notify_flag = 0;
 
        error = lnamei(filename,&inode);
        if (error)
@@ -329,6 +357,8 @@ asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
                iput(inode);
                return -EROFS;
        }
+       old_user = inode->i_uid;
+       old_group = inode->i_uid;
        if (user == (uid_t) -1)
                user = inode->i_uid;
        if (group == (gid_t) -1)
@@ -338,9 +368,23 @@ asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
            fsuser()) {
                inode->i_uid = user;
                inode->i_gid = group;
+               /*
+                * If the owner has been changed, remove the setuid bit
+                */
+               if (old_user != inode->i_uid && inode->i_mode & S_ISUID) {
+                       inode->i_mode &= ~S_ISUID;
+                       notify_flag = NOTIFY_MODE;
+               }
+               /*
+                * If the group has been changed, remove the setgid bit
+                */
+               if (old_group != inode->i_gid && inode->i_mode & S_ISGID) {
+                       inode->i_mode &= ~S_ISGID;
+                       notify_flag = NOTIFY_MODE;
+               }
                inode->i_ctime = CURRENT_TIME;
                inode->i_dirt = 1;
-               error = notify_change(NOTIFY_UIDGID, inode);
+               error = notify_change(notify_flag | NOTIFY_UIDGID, inode);
                iput(inode);
                return error;
        }
index d36483a05a755098387c8fca0447548d35e1b9ed..48b1177e959e079adfba81381eb50cb6791fae33 100644 (file)
@@ -67,6 +67,44 @@ asmlinkage int sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
        return file->f_pos;
 }
 
+asmlinkage int sys_llseek(unsigned int fd, unsigned long offset_high,
+                         unsigned long offset_low, loff_t * result,
+                         unsigned int origin)
+{
+       struct file * file;
+       loff_t tmp = -1;
+       loff_t offset;
+       int err;
+
+       if (fd >= NR_OPEN || !(file=current->files->fd[fd]) || !(file->f_inode))
+               return -EBADF;
+       if (origin > 2)
+               return -EINVAL;
+       if ((err = verify_area(VERIFY_WRITE, result, sizeof(loff_t))))
+               return err;
+       offset = (loff_t) (((unsigned long long) offset_high << 32) | offset_low);
+/* there is no fs specific llseek handler */
+       switch (origin) {
+               case 0:
+                       tmp = offset;
+                       break;
+               case 1:
+                       tmp = file->f_pos + offset;
+                       break;
+               case 2:
+                       if (!file->f_inode)
+                               return -EINVAL;
+                       tmp = file->f_inode->i_size + offset;
+                       break;
+       }
+       if (tmp < 0)
+               return -EINVAL;
+       file->f_pos = tmp;
+       file->f_reada = 0;
+       memcpy_tofs(result, &file->f_pos, sizeof(loff_t));
+       return 0;
+}
+
 asmlinkage int sys_read(unsigned int fd,char * buf,unsigned int count)
 {
        int error;
@@ -92,6 +130,7 @@ asmlinkage int sys_write(unsigned int fd,char * buf,unsigned int count)
        int error;
        struct file * file;
        struct inode * inode;
+       int written;
        
        if (fd>=NR_OPEN || !(file=current->files->fd[fd]) || !(inode=file->f_inode))
                return -EBADF;
@@ -104,5 +143,14 @@ asmlinkage int sys_write(unsigned int fd,char * buf,unsigned int count)
        error = verify_area(VERIFY_READ,buf,count);
        if (error)
                return error;
-       return file->f_op->write(inode,file,buf,count);
+       written = file->f_op->write(inode,file,buf,count);
+       /*
+        * If data has been written to the file, remove the setuid and
+        * the setgid bits
+        */
+       if (written > 0 && !suser() && (inode->i_mode & (S_ISUID | S_ISGID))) {
+               inode->i_mode &= ~(S_ISUID | S_ISGID);
+               notify_change (NOTIFY_MODE, inode);
+       }
+       return written;
 }
index af6647e310596501805aee1531f5179b524a41cc..ef3c09abb2ee19158717a10eb1c1ee4af4c2061b 100644 (file)
@@ -95,7 +95,7 @@ static int sysv_readdir(struct inode * inode, struct file * filp,
                                if (i) {
                                        if (de->inode > inode->i_sb->sv_ninodes)
                                                printk("sysv_readdir: Bad inode number on dev 0x%04x, ino %ld, offset 0x%04lx: %d is out of range\n",
-                                                       inode->i_dev, inode->i_ino, filp->f_pos - SYSV_DIRSIZE, de->inode);
+                                                       inode->i_dev, inode->i_ino, (off_t) filp->f_pos - SYSV_DIRSIZE, de->inode);
                                        put_fs_long(de->inode,&dirent->d_ino);
                                        put_fs_byte(0,i+dirent->d_name);
                                        put_fs_word(i,&dirent->d_reclen);
index 375978340e048438ff91a7655d49425824f14b1f..fd417b810941257ae8eca3b27f90cab86418669a 100644 (file)
@@ -63,4 +63,62 @@ extern __inline__ int test_bit(int nr, void * addr)
        return oldbit;
 }
 
+/*
+ * Find-bit routines..
+ */
+extern inline int find_first_zero_bit (unsigned long * addr, unsigned size)
+{
+       int res;
+
+       if (!size)
+               return 0;
+       __asm__("
+               cld
+               movl $-1,%%eax
+               repe; scasl
+               je 1f
+               subl $4,%%edi
+               movl (%%edi),%%eax
+               notl %%eax
+               bsfl %%eax,%%edx
+               jmp 2f
+1:             xorl %%edx,%%edx
+2:             subl %%ebx,%%edi
+               shll $3,%%edi
+               addl %%edi,%%edx"
+               :"=d" (res)
+               :"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
+               :"ax", "bx", "cx", "di");
+       return res;
+}
+
+extern inline int find_next_zero_bit (unsigned long * addr, int size,
+                                     int offset)
+{
+       unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
+       int set = 0, bit = offset & 31, res;
+       
+       if (bit) {
+               /*
+                * Look for zero in first byte
+                */
+               __asm__("
+                       bsfl %1,%0
+                       jne 1f
+                       movl $32, %0
+1:                     "
+                       : "=r" (set)
+                       : "r" (~(*p >> bit)));
+               if (set < (32 - bit))
+                       return set + offset;
+               set = 32 - bit;
+               p++;
+       }
+       /*
+        * No zero yet, search remaining full bytes for a zero
+        */
+       res = find_first_zero_bit (p, size - 32 * (p - addr));
+       return (offset + set + res);
+}
+
 #endif /* _I386_BITOPS_H */
index a2d4a9e8094287f18359b84c2b7883acc03d8159..cfe8f9bb6acc2b9280695cc4eb00eaf25d282409 100644 (file)
@@ -12,7 +12,9 @@
 
 
 #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
-#define outb   outb_p
+#define dma_outb       outb_p
+#else
+#define dma_outb       outb
 #endif
 
 /*
 static __inline__ void enable_dma(unsigned int dmanr)
 {
        if (dmanr<=3)
-               outb(dmanr,  DMA1_MASK_REG);
+               dma_outb(dmanr,  DMA1_MASK_REG);
        else
-               outb(dmanr & 3,  DMA2_MASK_REG);
+               dma_outb(dmanr & 3,  DMA2_MASK_REG);
 }
 
 static __inline__ void disable_dma(unsigned int dmanr)
 {
        if (dmanr<=3)
-               outb(dmanr | 4,  DMA1_MASK_REG);
+               dma_outb(dmanr | 4,  DMA1_MASK_REG);
        else
-               outb((dmanr & 3) | 4,  DMA2_MASK_REG);
+               dma_outb((dmanr & 3) | 4,  DMA2_MASK_REG);
 }
 
 /* Clear the 'DMA Pointer Flip Flop'.
@@ -149,18 +151,18 @@ static __inline__ void disable_dma(unsigned int dmanr)
 static __inline__ void clear_dma_ff(unsigned int dmanr)
 {
        if (dmanr<=3)
-               outb(0,  DMA1_CLEAR_FF_REG);
+               dma_outb(0,  DMA1_CLEAR_FF_REG);
        else
-               outb(0,  DMA2_CLEAR_FF_REG);
+               dma_outb(0,  DMA2_CLEAR_FF_REG);
 }
 
 /* set mode (above) for a specific DMA channel */
 static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
 {
        if (dmanr<=3)
-               outb(mode | dmanr,  DMA1_MODE_REG);
+               dma_outb(mode | dmanr,  DMA1_MODE_REG);
        else
-               outb(mode | (dmanr&3),  DMA2_MODE_REG);
+               dma_outb(mode | (dmanr&3),  DMA2_MODE_REG);
 }
 
 /* Set only the page register bits of the transfer address.
@@ -172,25 +174,25 @@ static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
 {
        switch(dmanr) {
                case 0:
-                       outb(pagenr, DMA_PAGE_0);
+                       dma_outb(pagenr, DMA_PAGE_0);
                        break;
                case 1:
-                       outb(pagenr, DMA_PAGE_1);
+                       dma_outb(pagenr, DMA_PAGE_1);
                        break;
                case 2:
-                       outb(pagenr, DMA_PAGE_2);
+                       dma_outb(pagenr, DMA_PAGE_2);
                        break;
                case 3:
-                       outb(pagenr, DMA_PAGE_3);
+                       dma_outb(pagenr, DMA_PAGE_3);
                        break;
                case 5:
-                       outb(pagenr & 0xfe, DMA_PAGE_5);
+                       dma_outb(pagenr & 0xfe, DMA_PAGE_5);
                        break;
                case 6:
-                       outb(pagenr & 0xfe, DMA_PAGE_6);
+                       dma_outb(pagenr & 0xfe, DMA_PAGE_6);
                        break;
                case 7:
-                       outb(pagenr & 0xfe, DMA_PAGE_7);
+                       dma_outb(pagenr & 0xfe, DMA_PAGE_7);
                        break;
        }
 }
@@ -203,11 +205,11 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
 {
        set_dma_page(dmanr, a>>16);
        if (dmanr <= 3)  {
-           outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
-            outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
+           dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
+            dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
        }  else  {
-           outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
-           outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
+           dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
+           dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
        }
 }
 
@@ -224,11 +226,11 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
 {
         count--;
        if (dmanr <= 3)  {
-           outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
-           outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
+           dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
+           dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
         } else {
-           outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
-           outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
+           dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
+           dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
         }
 }
 
index fd774d471b84ff428466a6aeaa353f62be3e91af..4178c6b3c227873654f41b4c5a01cac874b0b877 100644 (file)
@@ -414,7 +414,7 @@ __asm__ __volatile__(
 return __res;
 }
 
-extern inline void * memset(void * s,char c,size_t count)
+extern inline void * __memset_generic(void * s,char c,size_t count)
 {
 __asm__ __volatile__(
        "cld\n\t"
@@ -426,4 +426,80 @@ __asm__ __volatile__(
 return s;
 }
 
+/* we might want to write optimized versions of these later */
+#define __constant_c_memset(s,c,count) __memset_generic((s),(c),(count))
+#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
+
+/*
+ * This looks horribly ugly, but the compiler can optimize it totally,
+ * as we by now know that both pattern and count is constant..
+ */
+extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
+{
+       switch (count) {
+               case 0:
+                       return s;
+               case 1:
+                       *(unsigned char *)s = pattern;
+                       return s;
+               case 2:
+                       *(unsigned short *)s = pattern;
+                       return s;
+               case 3:
+                       *(unsigned short *)s = pattern;
+                       *(2+(unsigned char *)s) = pattern >> 16;
+                       return s;
+               case 4:
+                       *(unsigned long *)s = pattern;
+                       return s;
+       }
+#define COMMON(x) \
+__asm__("cld\n\t" \
+       "rep ; stosl" \
+       x \
+       : /* no outputs */ \
+       : "a" (pattern),"c" (count/4),"D" ((long) s) \
+       : "cx","di","memory")
+
+       switch (count % 4) {
+               case 0: COMMON(""); return s;
+               case 1: COMMON("\n\tstosb"); return s;
+               case 2: COMMON("\n\tstosw"); return s;
+               case 3: COMMON("\n\tstosw\n\tstosb"); return s;
+       }
+#undef COMMON
+}
+
+#define __constant_c_x_memset(s, c, count) \
+(__builtin_constant_p(count) ? \
+ __constant_c_and_count_memset((s),(c),(count)) : \
+ __constant_c_memset((s),(c),(count)))
+
+#define __memset(s, c, count) \
+(__builtin_constant_p(count) ? \
+ __constant_count_memset((s),(c),(count)) : \
+ __memset_generic((s),(c),(count)))
+
+#define memset(s, c, count) \
+(__builtin_constant_p(c) ? \
+ __constant_c_x_memset((s),(0x01010101*(unsigned char)c),(count)) : \
+ __memset((s),(c),(count)))
+
+/*
+ * find the first occurrence of byte 'c', or 1 past the area if none
+ */
+extern inline char * memscan(void * addr, unsigned char c, int size)
+{
+       if (!size)
+               return addr;
+       __asm__("cld
+               repnz; scasb
+               jnz 1f
+               dec %%edi
+1:             "
+               : "=D" (addr), "=c" (size)
+               : "0" (addr), "1" (size), "a" (c));
+       return addr;
+}
+
 #endif
index c16c35ab46687037d559239679206645551d4b71..2fd47473e98d789d1e94a3114908dad365cb61e9 100644 (file)
@@ -12,7 +12,7 @@
 #define _ASM_MIPS_MIPSREGS_H_
 
 /*
- * The following macros are espacially usefull for __asm__
+ * The following macros are especially useful for __asm__
  * inline assembler.
  */
 
@@ -24,7 +24,7 @@
 #endif
 
 /*
- * Coprozessor 0 register names
+ * Coprocessor 0 register names
  */
 #define CP0_INDEX $0
 #define CP0_RANDOM $1
index 6792b45c316bb4528c4722b855e7ef4cf27f5788..4430379cb8699a6aa393e77ba76e033b1b192fcc 100644 (file)
@@ -47,8 +47,8 @@
 /*
  * The second extended file system version
  */
-#define EXT2FS_DATE            "94/03/10"
-#define EXT2FS_VERSION         "0.5"
+#define EXT2FS_DATE            "94/08/12"
+#define EXT2FS_VERSION         "0.5a"
 
 /*
  * Debug code
@@ -190,10 +190,13 @@ struct ext2_group_desc
 /*
  * Inode flags
  */
-#define        EXT2_SECRM_FL                   0x0001  /* Secure deletion */
-#define        EXT2_UNRM_FL                    0x0002  /* Undelete */
-#define        EXT2_COMPR_FL                   0x0004  /* Compress file */
-#define EXT2_SYNC_FL                   0x0008  /* Synchronous updates */
+#define        EXT2_SECRM_FL                   0x00000001 /* Secure deletion */
+#define        EXT2_UNRM_FL                    0x00000002 /* Undelete */
+#define        EXT2_COMPR_FL                   0x00000004 /* Compress file */
+#define EXT2_SYNC_FL                   0x00000008 /* Synchronous updates */
+#define EXT2_IMMUTABLE_FL              0x00000010 /* Immutable file */
+#define EXT2_APPEND_FL                 0x00000020 /* writes to file may only append */
+#define EXT2_NODUMP_FL                 0x00000040 /* do not dump file */
 
 /*
  * ioctl commands
@@ -218,18 +221,69 @@ struct ext2_inode {
        unsigned short i_links_count;   /* Links count */
        unsigned long  i_blocks;        /* Blocks count */
        unsigned long  i_flags;         /* File flags */
-       unsigned long  i_reserved1;
+       union {
+               struct {
+                       unsigned long  l_i_reserved1;
+               } linux1;
+               struct {
+                       unsigned long  h_i_translator;
+               } hurd1;
+               struct {
+                       unsigned long  m_i_reserved1;
+               } masix1;
+       } osd1;                         /* OS dependent 1 */
        unsigned long  i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
        unsigned long  i_version;       /* File version (for NFS) */
        unsigned long  i_file_acl;      /* File ACL */
        unsigned long  i_dir_acl;       /* Directory ACL */
        unsigned long  i_faddr;         /* Fragment address */
-       unsigned char  i_frag;          /* Fragment number */
-       unsigned char  i_fsize;         /* Fragment size */
-       unsigned short i_pad1;
-       unsigned long  i_reserved2[2];
+       union {
+               struct {
+                       unsigned char  l_i_frag;        /* Fragment number */
+                       unsigned char  l_i_fsize;       /* Fragment size */
+                       unsigned short i_pad1;
+                       unsigned long  l_i_reserved2[2];
+               } linux2;
+               struct {
+                       unsigned char  h_i_frag;        /* Fragment number */
+                       unsigned char  h_i_fsize;       /* Fragment size */
+                       unsigned short h_i_mode_high;
+                       unsigned short h_i_uid_high;
+                       unsigned short h_i_gid_high;
+                       unsigned long  h_i_author;
+               } hurd2;
+               struct {
+                       unsigned char  m_i_frag;        /* Fragment number */
+                       unsigned char  m_i_fsize;       /* Fragment size */
+                       unsigned short m_pad1;
+                       unsigned long  m_i_reserved2[2];
+               } masix2;
+       } osd2;                         /* OS dependent 2 */
 };
 
+#ifdef __linux__
+#define i_reserved1    osd1.linux1.l_i_reserved1
+#define i_frag         osd2.linux2.l_i_frag
+#define i_fsize                osd2.linux2.l_i_fsize
+#define i_reserved2    osd2.linux2.l_i_reserved2
+#endif
+
+#ifdef __hurd__
+#define i_translator   osd1.hurd1.h_i_translator
+#define i_frag         osd2.hurd2.h_i_frag;
+#define i_fsize                osd2.hurd2.h_i_fsize;
+#define i_uid_high     osd2.hurd2.h_i_uid_high
+#define i_gid_high     osd2.hurd2.h_i_gid_high
+#define i_author       osd2.hurd2.h_i_author
+#endif
+
+#ifdef __masix__
+#define i_reserved1    osd1.masix1.m_i_reserved1
+#define i_frag         osd2.masix2.m_i_frag
+#define i_fsize                osd2.masix2.m_i_fsize
+#define i_reserved2    osd2.masix2.m_i_reserved2
+#endif
+
 /*
  * File system states
  */
@@ -248,6 +302,7 @@ struct ext2_inode {
 #define EXT2_MOUNT_ERRORS_CONT         0x0010  /* Continue on errors */
 #define EXT2_MOUNT_ERRORS_RO           0x0020  /* Remount fs ro on errors */
 #define EXT2_MOUNT_ERRORS_PANIC                0x0040  /* Panic on errors */
+#define EXT2_MOUNT_MINIX_DF            0x0080  /* Mimics the Minix statfs */
 
 #define clear_opt(o, opt)              o &= ~EXT2_MOUNT_##opt
 #define set_opt(o, opt)                        o |= EXT2_MOUNT_##opt
@@ -292,9 +347,14 @@ struct ext2_super_block {
        unsigned short s_pad;
        unsigned long  s_lastcheck;     /* time of last check */
        unsigned long  s_checkinterval; /* max. time between checks */
-       unsigned long  s_reserved[238]; /* Padding to the end of the block */
+       unsigned long  s_creator_os;    /* OS */
+       unsigned long  s_reserved[237]; /* Padding to the end of the block */
 };
 
+#define EXT2_OS_LINUX          0
+#define EXT2_OS_HURD           1
+#define EXT2_OS_MASIX          2
+
 /*
  * Structure of a directory entry
  */
@@ -386,7 +446,6 @@ extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
                       unsigned long);
 
 /* namei.c */
-extern int ext2_open (struct inode *, struct file *);
 extern void ext2_release (struct inode *, struct file *);
 extern int ext2_lookup (struct inode *,const char *, int, struct inode **);
 extern int ext2_create (struct inode *,const char *, int, int,
index 777b37bd296f2f51f7abdaa7cc3b4abc0e5177e5..4b55539585db52ae65930a37c7b4ea89f70ecfae 100644 (file)
@@ -22,8 +22,8 @@ struct ext2_inode_info {
        unsigned long  i_data[15];
        unsigned long  i_flags;
        unsigned long  i_faddr;
-       unsigned char  i_frag;
-       unsigned char  i_fsize;
+       unsigned char  i_frag_no;
+       unsigned char  i_frag_size;
        unsigned short i_pad1;
        unsigned long  i_file_acl;
        unsigned long  i_dir_acl;
index 33af8388424c16ede94ee9461a26f14fabf2c720..7bf2b903c0a5094711bbe7bbf62a22822e04a394 100644 (file)
 #ifndef _LINUX_EXT2_FS_SB
 #define _LINUX_EXT2_FS_SB
 
-#define EXT2_MAX_GROUP_DESC    8
+/*
+ * The following is not needed anymore since the descriptors buffer
+ * heads are now dynamically allocated
+ */
+/* #define EXT2_MAX_GROUP_DESC 8 */
+
 #define EXT2_MAX_GROUP_LOADED  8
 
 /*
@@ -29,11 +34,12 @@ struct ext2_sb_info {
        unsigned long s_blocks_per_group;/* Number of blocks in a group */
        unsigned long s_inodes_per_group;/* Number of inodes in a group */
        unsigned long s_itb_per_group;  /* Number of inode table blocks per group */
+       unsigned long s_db_per_group;   /* Number of descriptor blocks per group */
        unsigned long s_desc_per_block; /* Number of group descriptors per block */
        unsigned long s_groups_count;   /* Number of groups in the fs */
        struct buffer_head * s_sbh;     /* Buffer containing the super block */
        struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
-       struct buffer_head * s_group_desc[EXT2_MAX_GROUP_DESC];
+       struct buffer_head ** s_group_desc;
        unsigned short s_loaded_inode_bitmaps;
        unsigned short s_loaded_block_bitmaps;
        unsigned long s_inode_bitmap_number[EXT2_MAX_GROUP_LOADED];
index c01b34d6f6cdbf5f38c539a5fc77ae9c215da533..e689bd41e0d3e72370fa6a33ff8a325ba098cf84 100644 (file)
@@ -71,6 +71,9 @@ extern unsigned long name_cache_init(unsigned long start, unsigned long end);
 #define MS_SYNC     16 /* writes are synced at once */
 #define        MS_REMOUNT  32 /* alter flags of a mounted FS */
 
+#define S_APPEND    256 /* append-only file */
+#define S_IMMUTABLE 512 /* immutable file */
+
 /*
  * Flags that can be altered by MS_REMOUNT
  */
@@ -96,6 +99,9 @@ extern unsigned long name_cache_init(unsigned long start, unsigned long end);
 #define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC)
 #define IS_SYNC(inode) ((inode)->i_flags & MS_SYNC)
 
+#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
+#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
+
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */
 
@@ -219,7 +225,7 @@ struct inode {
 
 struct file {
        mode_t f_mode;
-       off_t f_pos;
+       loff_t f_pos;
        unsigned short f_flags;
        unsigned short f_count;
        off_t f_reada;
index 59d15a709742682d5beb9b7dbf82689955bec96f..f66ccc2899302377cfadbe03f9f1572d67156b5b 100644 (file)
@@ -133,7 +133,7 @@ extern int msdos_add_cluster(struct inode *inode);
 extern int date_dos2unix(unsigned short time,unsigned short date);
 extern void date_unix2dos(int unix_date,unsigned short *time,
     unsigned short *date);
-extern int msdos_get_entry(struct inode *dir,off_t *pos,struct buffer_head **bh,
+extern int msdos_get_entry(struct inode *dir,loff_t *pos,struct buffer_head **bh,
     struct msdos_dir_entry **de);
 extern int msdos_scan(struct inode *dir,char *name,struct buffer_head **res_bh,
     struct msdos_dir_entry **res_de,int *ino);
index b6658dec3b5f207d6e0ab714b5b14617c6143511..47cfd5f933743fb2150f7a8933ac250cf72ca81e 100644 (file)
 
 extern int pcibios_present (void);
 
-#define PCIBIOS_SUCCESFUL              0x00
+#define PCIBIOS_SUCCESSFUL             0x00
 #define PCIBIOS_FUNC_NOT_SUPPORTED     0x81
 #define PCIBIOS_BAD_VENDOR_ID          0x83
 #define PCIBIOS_DEVICE_NOT_FOUND       0x86
index d565d506ca7267d6e125b37ce41b4e837b3a864e..935d1fbd2ee68e5642c9563e6643d57eb457b966 100644 (file)
@@ -229,6 +229,8 @@ struct mm_struct {
        struct vm_area_struct * mmap;
 };
 
+#define INIT_MMAP { &init_task, 0, 0x40000000, PAGE_SHARED, }
+
 #define INIT_MM { \
                0, \
                0, 0, 0, \
@@ -238,7 +240,7 @@ struct mm_struct {
 /* ?_flt */    0, 0, 0, 0, \
                0, \
 /* swap */     0, 0, 0, 0, \
-               NULL }
+               &init_mmap }
 
 struct task_struct {
 /* these are hardcoded - don't touch */
index da873dd73e2c837cfff9d60f4d763966b07ab5b8..db62e8ac3289487cd4d7534c2f46bf2c2c5090e8 100644 (file)
@@ -37,7 +37,7 @@
   * hannu@voxware.pp.fi
   */
 
-#define SOUND_VERSION  203
+#define SOUND_VERSION  300
 #define VOXWARE
 
 #include <sys/ioctl.h>
index 14afba5ae11ff47bde325019ba436677ba01326f..538e939258a079dabcfca7a022fc24134c393ad5 100644 (file)
@@ -13,6 +13,9 @@
 #ifndef _LINUX_TQUEUE_H
 #define _LINUX_TQUEUE_H
 
+#include <asm/bitops.h>
+#include <asm/system.h>
+
 #ifdef INCLUDE_INLINE_FUNCS
 #define _INLINE_ extern
 #else
@@ -92,16 +95,10 @@ struct tq_struct tq_last = {
 _INLINE_ void queue_task_irq(struct tq_struct *bh_pointer,
                               task_queue *bh_list)
 {
-       int l1;
-
-       __asm__ __volatile__ (
-       "btsl $0,%1\n\t"        /* bottom half already marked? */
-       "jc 1f\n\t"
-       "leal %2,%3\n\t"        /* address of the "next" field of bh_struct */
-       "xchgl %3,%0\n\t"       /* link bottom half into list */
-       "movl %3,%2\n1:"        /* save the pointer to next bottom half */
-       : "=m" (*bh_list), "=m" (bh_pointer -> sync), "=m" (bh_pointer -> next),
-         "=r" (l1) );
+       if (!set_bit(0,&bh_pointer->sync)) {
+               bh_pointer->next = *bh_list;
+               *bh_list = bh_pointer;
+       }
 }
 
 /*
@@ -111,17 +108,11 @@ _INLINE_ void queue_task_irq(struct tq_struct *bh_pointer,
 _INLINE_ void queue_task_irq_off(struct tq_struct *bh_pointer,
                                 task_queue *bh_list)
 {
-       int l1;
-
-       __asm__ __volatile__ (
-       "testl $1,%1\n\t"       /* bottom half already marked? */
-       "jne 1f\n\t"
-       "movl $1,%1\n\t"                              
-       "leal %2,%3\n\t"        /* address of the "next" field of bh_struct */
-       "xchgl %3,%0\n\t"       /* link bottom half into list */
-       "movl %3,%2\n1:"        /* save the pointer to next bottom half */
-       : "=m" (*bh_list), "=m" (bh_pointer -> sync), "=m" (bh_pointer -> next),
-         "=r" (l1) );
+       if (!(bh_pointer->sync & 1)) {
+               bh_pointer->sync = 1;
+               bh_pointer->next = *bh_list;
+               *bh_list = bh_pointer;
+       }
 }
 
 
@@ -131,19 +122,14 @@ _INLINE_ void queue_task_irq_off(struct tq_struct *bh_pointer,
 _INLINE_ void queue_task(struct tq_struct *bh_pointer,
                           task_queue *bh_list)
 {
-       int l1;
-
-       __asm__ __volatile__ (
-       "btsl $0,%1\n\t"
-       "jc 1f\n\t"
-       "leal %2,%3\n\t"
-       "pushfl\n\t"            /* save interrupt flag */
-       "cli\n\t"               /* turn off interrupts */
-       "xchgl %3,%0\n\t"
-       "movl %3,%2\n\t"        /* now the linking step is really atomic! */
-       "popfl\n1:"             /* restore interrupt flag */
-       : "=m" (*bh_list), "=m" (bh_pointer -> sync), "=m" (bh_pointer -> next),
-         "=r" (l1) );
+       if (!set_bit(0,&bh_pointer->sync)) {
+               unsigned long flags;
+               save_flags(flags);
+               cli();
+               bh_pointer->next = *bh_list;
+               *bh_list = bh_pointer;
+               restore_flags(flags);
+       }
 }
 
 /*
index 70071cedb8565a01583ce510a37500a9cbe75ce5..e3072ae5ec34f5ab4124255d3bdad6c946e7abe8 100644 (file)
@@ -44,6 +44,8 @@ typedef unsigned short umode_t;
 typedef unsigned short nlink_t;
 typedef int daddr_t;
 typedef long off_t;
+#define _LOFF_T
+typedef long long loff_t;
 
 /* bsd */
 typedef unsigned char u_char;
index 0732498d4fb65a839c174e333caba52dd35d29b9..8ac5e047450c4894229a0021d04343e67eedb9b4 100644 (file)
 #define __NR_afs_syscall       137 /* Syscall for Andrew File System */
 #define __NR_setfsuid          138
 #define __NR_setfsgid          139
+#define __NR__llseek           140
 
 extern int errno;
 
index f5062d9c4d8a3459763cc8957a5b7fb456f352c8..6d3b97cbf0bc1a03b54e83f9e43d51035b1fe38d 100644 (file)
@@ -395,8 +395,8 @@ char *pcibios_strerror (int error)
        static char buf[80];
 
        switch (error) {
-               case PCIBIOS_SUCCESFUL:
-                       return "SUCCESFUL";
+               case PCIBIOS_SUCCESSFUL:
+                       return "SUCCESSFUL";
 
                case PCIBIOS_FUNC_NOT_SUPPORTED:
                        return "FUNC_NOT_SUPPORTED";
index 16f373772ae33db54679dd3f08e098097553a17f..2b6ed2c184052bed41365d0050f993b9631a7937 100644 (file)
@@ -174,7 +174,6 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */
        X(dev_rint),
        X(dev_tint),
        X(irq2dev_map),
-       X(dev_kfree_skb),
 #endif
 
        /********************************************************
index f5a3bc14c8cc47c5e5d6214c5ed0e13695042b45..666962dc996d3d17136ae408c137ab3d846e19af 100644 (file)
@@ -90,6 +90,7 @@ extern int timer_interrupt(void);
 asmlinkage int system_call(void);
 
 static unsigned long init_kernel_stack[1024] = { STACK_MAGIC, };
+static struct vm_area_struct init_mmap = INIT_MMAP;
 struct task_struct init_task = INIT_TASK;
 
 unsigned long volatile jiffies=0;
index f76f5b98f7961bc8d49460cc1c5e470e22473c54..3aac92a0e3965b3710124b046fe1d4caa704aa7c 100644 (file)
@@ -350,7 +350,7 @@ asmlinkage int sys_setuid(uid_t uid)
 
 /*
  * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
- * is used for "access()" and for the NFS deamon (letting nfsd stay at
+ * is used for "access()" and for the NFS daemon (letting nfsd stay at
  * whatever uid it wants to). It normally shadows "euid", except when
  * explicitly set by setfsuid() or for access..
  */
index ae1102c4ed67c9f8cd06d33bcd0624301016f534..5193d1149cb7701964058e00770bbbb4b346c0ac 100644 (file)
@@ -540,5 +540,6 @@ _sys_call_table:
        .long 0                         /* for afs_syscall */
        .long _sys_setfsuid
        .long _sys_setfsgid
-
-       .space (NR_syscalls-137)*4
+       .long _sys_llseek               /* 140 */
+       .space (NR_syscalls-139)*4
+       .space (NR_syscalls-140)*4
index f276a83fcb56f6fbc32fcf27380caaa099c19bdf..0d7291fc3b12ac20fe9c58375284274b1b707b02 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -280,9 +280,9 @@ unsigned long swap_in(unsigned long entry)
        }
        read_swap_page(entry, (char *) page);
        if (add_to_swap_cache(page, entry))
-               return page | PAGE_PRIVATE;
+               return page | PAGE_PRESENT;
        swap_free(entry);
-       return page | PAGE_DIRTY | PAGE_PRIVATE;
+       return page | PAGE_DIRTY | PAGE_PRESENT;
 }
 
 static inline int try_to_swap_out(unsigned long * table_ptr)
index cce3362ea549750997f614ed9c9d08dbc6adcd0a..091899f7bff2efa6e224cd14cedfd7da6a5a9770 100644 (file)
@@ -129,7 +129,7 @@ o   AX.25 builds fine without SLIP driver (just PI)
 o      MTU recognized in routing table (but only by TCP currently)
 o      AX.25 PI driver merged into AX.25 code and kernel stubs
 o      UNIX /proc trap hopefully fixed
-o      DDI removed totally ready to use the PCMICA people's stuff
+o      DDI removed totally ready to use the PCMCIA people's stuff
 o      Unix domain lock/unlock now static (needlessly visible before)
 o      Split net/inet/sock.c into generic and IP components
 o      NFS client works correctly with 8K NFS
@@ -142,7 +142,7 @@ o   Loopback maintains IFF_LOOPBACK flag
 o      Johnathon Naylor(G4KLX) AX.25 changes
 o      Out of sync bug in lance driver fixed.
 o      First cut at ethernet loadable modules
-o      PCMICA people have ifmap stuff. Will extend this to other drivers.
+o      PCMCIA people have ifmap stuff. Will extend this to other drivers.
 o      New de600.c
 o      Clean up of IP layer - sorted a lot of redundant and duplicated code
        out.
index f10996fd69aae1d4c9b826a3387bfc1d7d539652..23e9f20d3fe0851b53b50d1c6446b8aa2b50344b 100644 (file)
@@ -260,21 +260,30 @@ void destroy_sock(struct sock *sk)
                IS_SKB(skb);
                kfree_skb(skb, FREE_WRITE);
        }
+       
+       /*
+        *      Don't discard received data until the user side kills its
+        *      half of the socket.
+        */
 
-       while((skb=skb_dequeue(&sk->receive_queue))!=NULL) {
-       /*
-        * This will take care of closing sockets that were
-        * listening and didn't accept everything.
-        */
-               if (skb->sk != NULL && skb->sk != sk) 
-               {
+       if (sk->dead) 
+       {
+               while((skb=skb_dequeue(&sk->receive_queue))!=NULL) 
+               {
+               /*
+                * This will take care of closing sockets that were
+                * listening and didn't accept everything.
+                */
+                       if (skb->sk != NULL && skb->sk != sk) 
+                       {
+                               IS_SKB(skb);
+                               skb->sk->dead = 1;
+                               skb->sk->prot->close(skb->sk, 0);
+                       }
                        IS_SKB(skb);
-                       skb->sk->dead = 1;
-                       skb->sk->prot->close(skb->sk, 0);
+                       kfree_skb(skb, FREE_READ);
                }
-               IS_SKB(skb);
-               kfree_skb(skb, FREE_READ);
-       }
+       }       
 
        /* Now we need to clean up the send head. */
        cli();
index 339d95ca481fda807df65a5f9a7def9915e04941..b58bef9e3ab7e5c821b5076b8c122cf8768f33e6 100644 (file)
@@ -28,7 +28,8 @@
  *              Ross Martin     :       Rewrote arp_rcv() and arp_get_info()
  *             Stephen Henson  :       Add AX25 support to arp_get_info()
  *             Alan Cox        :       Drop data when a device is downed.
- *             Alan Cox        :       Use init_timer()
+ *             Alan Cox        :       Use init_timer().
+ *             Alan Cox        :       Double lock fixes.
  */
 
 #include <linux/types.h>
@@ -808,7 +809,10 @@ int arp_find(unsigned char *haddr, unsigned long paddr, struct device *dev,
                         */
                        
                        if (skb != NULL)
+                       {
                                skb_queue_tail(&entry->skb, skb);
+                               skb_device_unlock(skb);
+                       }
                        sti();
                        return 1;
                }
@@ -850,7 +854,10 @@ int arp_find(unsigned char *haddr, unsigned long paddr, struct device *dev,
                entry->retries = ARP_MAX_TRIES;
                skb_queue_head_init(&entry->skb);
                if (skb != NULL)
+               {
                        skb_queue_tail(&entry->skb, skb);
+                       skb_device_unlock(skb);
+               }
        }
        else
        {
index 7d5f0a10272105bbfdfa85b3f1dcd00efc24aaff..4654a41d234cb93d568d70e2da056c4a4bbf8494 100644 (file)
@@ -20,6 +20,7 @@
  *             Alan Cox        :       device private ioctl copies fields back.
  *             Alan Cox        :       Transmit queue code does relevant stunts to
  *                                     keep the queue safe.
+ *             Alan Cox        :       Fixed double lock.
  *
  *     Cleaned up and recommented by Alan Cox 2nd April 1994. I hope to have
  *     the rest as well commented in the end.
@@ -401,7 +402,6 @@ void dev_queue_xmit(struct sk_buff *skb, struct device *dev, int pri)
         */
         
        if (!skb->arp && dev->rebuild_header(skb->data, dev, skb->raddr, skb)) {
-               skb_device_unlock(skb); /* It's now safely on the arp queue */
                return;
        }
 
@@ -1429,7 +1429,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
  *     unhooks any devices that fail to initialise (normally hardware not 
  *     present) and leaves us with a valid list of present and active devices.
  *
- *     The PCMICA code may need to change this a little, and add a pair
+ *     The PCMCIA code may need to change this a little, and add a pair
  *     of register_inet_device() unregister_inet_device() calls. This will be
  *     needed for ethernet as modules support.
  */
index fd4e3fb068f468a8d6b8c8a83aa161b7e4c1f1a7..d22227b3ca4aa9c2342f51d11439167b37e62302 100644 (file)
@@ -120,9 +120,11 @@ int ip_chk_addr(unsigned long addr)
         *      (Support old BSD in other words). This old BSD 
         *      support will go very soon as it messes other things
         *      up.
+        *      Also accept `loopback broadcast' as BROADCAST.
         */
 
-       if (addr == INADDR_ANY || addr == INADDR_BROADCAST)
+       if (addr == INADDR_ANY || addr == INADDR_BROADCAST ||
+           addr == htonl(0x7FFFFFFFL))
                return IS_BROADCAST;
 
        mask = ip_get_mask(addr);
index d11e9f5dda9cc1856c0e4476a426a63614e14fe3..182c19bf19aa2157774d56fb5b3867ca12ee58dd 100644 (file)
@@ -53,6 +53,7 @@
  *             Alan Cox        :       Always defrag, moved IP_FORWARD to the config.in file
  *             Alan Cox        :       IP options adjust sk->priority.
  *             Pedro Roque     :       Fix mtu/length error in ip_forward.
+ *             Alan Cox        :       Avoid ip_chk_addr when possible.
  *
  * To Fix:
  *             IP option processing is mostly not needed. ip_forward needs to know about routing rules
@@ -1434,7 +1435,7 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
        struct inet_protocol *ipprot;
        static struct options opt; /* since we don't use these yet, and they
                                take up stack space. */
-       int brd;
+       int brd=IS_MYADDR;
        int is_frag=0;
 
 
@@ -1502,9 +1503,13 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
         *      This is inefficient. While finding out if it is for us we could also compute
         *      the routing table entry. This is where the great unified cache theory comes
         *      in as and when someone implements it
+        *
+        *      For most hosts over 99% of packets match the first conditional
+        *      and don't go via ip_chk_addr. Note: brd is set to IS_MYADDR at
+        *      function entry.
         */
 
-       if ((brd = ip_chk_addr(iph->daddr)) == 0)
+       if ( iph->daddr != skb->dev->pa_addr && (brd = ip_chk_addr(iph->daddr)) == 0)
        {
                /*
                 *      Don't forward multicast or broadcast frames.
index a2bc8ef35883e0b343ccffce479340c6b0f0bc6b..69391233500135978539d43ef76cd71f112644e6 100644 (file)
@@ -79,6 +79,7 @@
  *             Alan Cox        :       TCP fast path debugging
  *             Alan Cox        :       Window clamping
  *             Michael Riepe   :       Bug in tcp_check()
+ *             Matt Dillon     :       More TCP improvements and RST bug fixes
  *
  *
  * To Fix:
@@ -173,6 +174,20 @@ static __inline__ int min(unsigned int a, unsigned int b)
        return(b);
 }
 
+#undef STATE_TRACE
+
+static __inline__ void tcp_set_state(struct sock *sk, int state)
+{
+       if(sk->state==TCP_ESTABLISHED)
+               tcp_statistics.TcpCurrEstab--;
+#ifdef STATE_TRACE
+       if(sk->debug)
+               printk("TCP sk=%s, State %d -> %d\n",sk, sk->state,state);
+#endif 
+       sk->state=state;
+       if(state==TCP_ESTABLISHED)
+               tcp_statistics.TcpCurrEstab++;
+}
 
 /* This routine picks a TCP windows for a socket based on
    the following constraints
@@ -215,7 +230,7 @@ int tcp_select_window(struct sock *sk)
 
 static void tcp_time_wait(struct sock *sk)
 {
-       sk->state = TCP_TIME_WAIT;
+       tcp_set_state(sk,TCP_TIME_WAIT);
        sk->shutdown = SHUTDOWN_MASK;
        if (!sk->dead)
                sk->state_change(sk);
@@ -304,7 +319,7 @@ void tcp_err(int err, unsigned char *header, unsigned long daddr,
                if (sk->state == TCP_SYN_SENT) 
                {
                        tcp_statistics.TcpAttemptFails++;
-                       sk->state = TCP_CLOSE;
+                       tcp_set_state(sk,TCP_CLOSE);
                        sk->error_report(sk);           /* Wake people up to see the error (see connect in sock.c) */
                }
                sk->err = icmp_err_convert[err & 0xff].errno;           
@@ -1647,11 +1662,11 @@ void tcp_shutdown(struct sock *sk, int how)
                prot->wfree(sk,buff->mem_addr, buff->mem_len);
 
                if (sk->state == TCP_ESTABLISHED)
-                       sk->state = TCP_FIN_WAIT1;
+                       tcp_set_state(sk,TCP_FIN_WAIT1);
                else if(sk->state == TCP_CLOSE_WAIT)
-                       sk->state = TCP_LAST_ACK;
+                       tcp_set_state(sk,TCP_LAST_ACK);
                else
-                       sk->state = TCP_FIN_WAIT2;
+                       tcp_set_state(sk,TCP_FIN_WAIT2);
 
                release_sock(sk);
                return;
@@ -1694,11 +1709,11 @@ void tcp_shutdown(struct sock *sk, int how)
        }
 
        if (sk->state == TCP_ESTABLISHED) 
-               sk->state = TCP_FIN_WAIT1;
+               tcp_set_state(sk,TCP_FIN_WAIT1);
        else if (sk->state == TCP_CLOSE_WAIT)
-               sk->state = TCP_LAST_ACK;
+               tcp_set_state(sk,TCP_LAST_ACK);
        else
-               sk->state = TCP_FIN_WAIT2;
+               tcp_set_state(sk,TCP_FIN_WAIT2);
 
        release_sock(sk);
 }
@@ -2174,25 +2189,30 @@ static void tcp_close(struct sock *sk, int timeout)
        if (!sk->dead) 
                sk->state_change(sk);
 
-       /*
-        *      We need to flush the recv. buffs. 
-        */
-
-       if (skb_peek(&sk->receive_queue) != NULL) 
+       if (timeout == 0) 
        {
-               struct sk_buff *skb;
-               if(sk->debug)
-                       printk("Clean rcv queue\n");
-               while((skb=skb_dequeue(&sk->receive_queue))!=NULL)
+               /*
+                *  We need to flush the recv. buffs.  We do this only on the
+                *  descriptor close, not protocol-sourced closes, because the
+                *  reader process may not have drained the data yet!
+                */
+
+               if (skb_peek(&sk->receive_queue) != NULL) 
                {
-                       /* The +1 is not needed because the FIN takes up sequence space and
-                          is not read!!! */
-                       if(skb->len > 0 && after(skb->h.th->seq + skb->len/* + 1 */ , sk->copied_seq))
-                               need_reset = 1;
-                       kfree_skb(skb, FREE_READ);
+                       struct sk_buff *skb;
+                       if(sk->debug)
+                               printk("Clean rcv queue\n");
+                       while((skb=skb_dequeue(&sk->receive_queue))!=NULL)
+                       {
+                               /* The +1 is not needed because the FIN takes up seq
+                                  is not read!!! */
+                               if(skb->len > 0 && after(skb->h.th->seq + skb->len , sk->copied_seq))
+                                       need_reset = 1;
+                               kfree_skb(skb, FREE_READ);
+                       }
+                       if(sk->debug)
+                               printk("Cleaned.\n");
                }
-               if(sk->debug)
-                       printk("Cleaned.\n");
        }
 
        /*
@@ -2248,12 +2268,12 @@ static void tcp_close(struct sock *sk, int timeout)
                         */
                        if (timeout) 
                        {
-                               sk->state = TCP_CLOSE;
+                               tcp_set_state(sk,TCP_CLOSE);
                        }
                        release_sock(sk);
                        return;
                case TCP_LISTEN:
-                       sk->state = TCP_CLOSE;
+                       tcp_set_state(sk,TCP_CLOSE);
                        release_sock(sk);
                        return;
                case TCP_CLOSE:
@@ -2273,7 +2293,7 @@ static void tcp_close(struct sock *sk, int timeout)
                                   first. Anyway it might work now */
                                release_sock(sk);
                                if (sk->state != TCP_CLOSE_WAIT)
-                                       sk->state = TCP_ESTABLISHED;
+                                       tcp_set_state(sk,TCP_ESTABLISHED);
                                reset_timer(sk, TIME_CLOSE, 100);
                                return;
                        }
@@ -2300,9 +2320,9 @@ static void tcp_close(struct sock *sk, int timeout)
                                 */
 
                                if(sk->state==TCP_ESTABLISHED)
-                                       sk->state=TCP_FIN_WAIT1;
+                                       tcp_set_state(sk,TCP_FIN_WAIT1);
                                else
-                                       sk->state=TCP_FIN_WAIT2;
+                                       tcp_set_state(sk,TCP_FIN_WAIT2);
                                reset_timer(sk, TIME_CLOSE,4*sk->rto);
                                if(timeout)
                                        tcp_time_wait(sk);
@@ -2358,11 +2378,11 @@ static void tcp_close(struct sock *sk, int timeout)
                         */
 
                        if (sk->state == TCP_ESTABLISHED)
-                           sk->state = TCP_FIN_WAIT1;
+                               tcp_set_state(sk,TCP_FIN_WAIT1);
                        else if (sk->state == TCP_CLOSE_WAIT)
-                           sk->state = TCP_LAST_ACK;
+                               tcp_set_state(sk,TCP_LAST_ACK);
                        else if (sk->state != TCP_CLOSING)
-                           sk->state = TCP_FIN_WAIT2;
+                               tcp_set_state(sk,TCP_FIN_WAIT2);
        }
        release_sock(sk);
 }
@@ -2515,23 +2535,21 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
        {
                if(sk->debug)
                        printk("Ack ignored %lu %lu\n",ack,sk->sent_seq);
+                       
                /*
-                * What is all this crap? the ack sequence number is bad or
-                * old, we should return 0 to ignore the packet. XXX
+                *      Keepalive processing.
                 */
-               return(0);
-#ifdef NOTDEF
-               if (after(ack, sk->sent_seq) ||
-                  (sk->state != TCP_ESTABLISHED && sk->state != TCP_CLOSE_WAIT)) 
+                
+               if (after(ack, sk->sent_seq) || (sk->state != TCP_ESTABLISHED && sk->state != TCP_CLOSE_WAIT)) 
                {
                        return(0);
                }
                if (sk->keepopen) 
                {
-                       reset_timer(sk, TIME_KEEPOPEN, TCP_TIMEOUT_LEN);
+                       if(sk->timeout==TIME_KEEPOPEN)
+                               reset_timer(sk, TIME_KEEPOPEN, TCP_TIMEOUT_LEN);
                }
                return(1);
-#endif
        }
 
        if (len != th->doff*4) 
@@ -2915,7 +2933,7 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
                if (sk->rcv_ack_seq == sk->write_seq && sk->acked_seq == sk->fin_seq) 
                {
                        flag |= 1;
-                       sk->state = TCP_CLOSE;
+                       tcp_set_state(sk,TCP_CLOSE);
                        sk->shutdown = SHUTDOWN_MASK;
                }
        }
@@ -2941,7 +2959,7 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
                        else
                        {
                                sk->shutdown = SHUTDOWN_MASK;
-                               sk->state = TCP_FIN_WAIT2;
+                               tcp_set_state(sk,TCP_FIN_WAIT2);
                        }
                }
        }
@@ -3055,7 +3073,7 @@ static int tcp_data(struct sk_buff *skb, struct sock *sk,
                        tcp_reset(sk->saddr, sk->daddr, skb->h.th,
                                sk->prot, NULL, skb->dev, sk->ip_tos, sk->ip_ttl);
                        tcp_statistics.TcpEstabResets++;
-                       sk->state = TCP_CLOSE;
+                       tcp_set_state(sk,TCP_CLOSE);
                        sk->err = EPIPE;
                        sk->shutdown = SHUTDOWN_MASK;
                        kfree_skb(skb, FREE_READ);
@@ -3393,8 +3411,7 @@ static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th,
                         */
                        reset_timer(sk, TIME_CLOSE, TCP_TIMEOUT_LEN);
                        /*sk->fin_seq = th->seq+1;*/
-                       tcp_statistics.TcpCurrEstab--;
-                       sk->state = TCP_CLOSE_WAIT;
+                       tcp_set_state(sk,TCP_CLOSE_WAIT);
                        if (th->rst)
                                sk->shutdown = SHUTDOWN_MASK;
                        break;
@@ -3422,10 +3439,9 @@ static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th,
                         * XXX timeout not set properly
                         */
 
-                       tcp_statistics.TcpCurrEstab--;
                        reset_timer(sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
                        /*sk->fin_seq = th->seq+1;*/
-                       sk->state = TCP_CLOSING;
+                       tcp_set_state(sk,TCP_CLOSING);
                        break;
                case TCP_FIN_WAIT2:
                        /*
@@ -3433,7 +3449,7 @@ static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th,
                         */
                        reset_timer(sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
                        /*sk->fin_seq = th->seq+1;*/
-                       sk->state = TCP_TIME_WAIT;
+                       tcp_set_state(sk,TCP_TIME_WAIT);
                        break;
                case TCP_CLOSE:
                        /*
@@ -3441,7 +3457,7 @@ static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th,
                         */
                        break;
                default:
-                       sk->state = TCP_LAST_ACK;
+                       tcp_set_state(sk,TCP_LAST_ACK);
        
                        /* Start the timers. */
                        reset_timer(sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
@@ -3661,7 +3677,7 @@ static int tcp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len)
         *      This must go first otherwise a really quick response will get reset. 
         */
 
-       sk->state = TCP_SYN_SENT;
+       tcp_set_state(sk,TCP_SYN_SENT);
 /*     sk->rtt = TCP_CONNECT_TIME;*/
        sk->rto = TCP_TIMEOUT_INIT;
        reset_timer(sk, TIME_WRITE, sk->rto);   /* Timer for repeating the SYN until an answer */
@@ -3959,7 +3975,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                        {
                                sk->zapped=1;
                                sk->err = ECONNRESET;
-                               sk->state = TCP_CLOSE;
+                               tcp_set_state(sk,TCP_CLOSE);
                                sk->shutdown = SHUTDOWN_MASK;
                                if (!sk->dead) 
                                {
@@ -3986,7 +4002,6 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                        if (th->rst) 
                        {
                                tcp_statistics.TcpEstabResets++;
-                               tcp_statistics.TcpCurrEstab--;
                                sk->zapped=1;
                                /* This means the thing should really be closed. */
                                sk->err = ECONNRESET;
@@ -3999,7 +4014,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                                 * A reset with a fin just means that
                                 * the data was not all read.
                                 */
-                               sk->state = TCP_CLOSE;
+                               tcp_set_state(sk,TCP_CLOSE);
                                sk->shutdown = SHUTDOWN_MASK;
                                if (!sk->dead) 
                                {
@@ -4011,10 +4026,9 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                        }
                        if (th->syn) 
                        {
-                               tcp_statistics.TcpCurrEstab--;
                                tcp_statistics.TcpEstabResets++;
                                sk->err = ECONNRESET;
-                               sk->state = TCP_CLOSE;
+                               tcp_set_state(sk,TCP_CLOSE);
                                sk->shutdown = SHUTDOWN_MASK;
                                tcp_reset(daddr, saddr,  th, sk->prot, opt,dev, sk->ip_tos,sk->ip_ttl);
                                if (!sk->dead) {
@@ -4121,7 +4135,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                        {
                                tcp_statistics.TcpAttemptFails++;
                                sk->err = ECONNREFUSED;
-                               sk->state = TCP_CLOSE;
+                               tcp_set_state(sk,TCP_CLOSE);
                                sk->shutdown = SHUTDOWN_MASK;
                                sk->zapped = 1;
                                if (!sk->dead) 
@@ -4136,7 +4150,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                        {
                                if (th->syn) 
                                {
-                                       sk->state = TCP_SYN_RECV;
+                                       tcp_set_state(sk,TCP_SYN_RECV);
                                }
                                kfree_skb(skb, FREE_READ);
                                release_sock(sk);
@@ -4184,8 +4198,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
                                                return(0);
                                        }
        
-                                       tcp_statistics.TcpCurrEstab++;
-                                       sk->state = TCP_ESTABLISHED;
+                                       tcp_set_state(sk,TCP_ESTABLISHED);
        
                                        /*
                                         *      Now we need to finish filling out