]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.16 1.1.16
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:30 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:30 +0000 (15:09 -0500)
36 files changed:
Makefile
drivers/block/sbpcd.c
drivers/char/n_tty.c
drivers/char/serial.c
drivers/char/tpqic02.c
drivers/char/tty_io.c
drivers/net/3c501.c
drivers/net/MODULES
drivers/net/Makefile
drivers/net/Space.c
drivers/net/net_init.c
drivers/net/plip.c
drivers/net/ppp.c
fs/proc/net.c
fs/super.c
include/linux/netdevice.h
include/linux/sbpcd.h
include/linux/skbuff.h
include/linux/termios.h
include/linux/tty.h
include/linux/tty_driver.h
include/linux/tty_ldisc.h
modules/NET_MODULES
net/inet/README
net/inet/dev.c
net/inet/eth.c
net/inet/ip.c
net/inet/ipx.c
net/inet/ipx.h
net/inet/proc.c
net/inet/skbuff.c
net/inet/sock.h
net/inet/tcp.c
net/inet/tcp.h
zBoot/inflate.c
zBoot/misc.c

index b81c1bea38d430839a8bf8c082e24440f3d0ccba..0a139d6aceb232e6db6167f58ce2449b583c109c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 15
+SUBLEVEL = 16
 
 all:   Version zImage
 
index 4a7cfea2e87cd41b724dcb733c02f6b9609866b5..9e2246a71c82ea6be1734db37a769d93d7e6ff88 100644 (file)
@@ -327,7 +327,7 @@ static u_char drv_pattern[4]={ 0x80, 0x80, 0x80, 0x80 }; /* auto speed */
 /*
  * drive space begins here (needed separate for each unit) 
  */
-static int d=0; /* DS index: drive number */
+static int d=0; /* DriveStruct index: drive number */
 
 static struct {
   char drv_minor; /* minor number or -1 */
@@ -405,7 +405,7 @@ static struct {
   
   int in_SpinUp;
   
-} DS[4];
+} DriveStruct[4];
 
 /*
  * drive space ends here (needed separate for each unit)
@@ -557,7 +557,7 @@ static int sta2err(int sta)
   if (sta==0x0f) return (-11);
   if (sta==0x10) return (-11);
   if (sta>=0x16) return (-12);
-  DS[d].CD_changed=0xFF;
+  DriveStruct[d].CD_changed=0xFF;
   if (sta==0x11) return (-15);
   return (-2);
 }
@@ -669,14 +669,14 @@ static int EvaluateStatus(int st)
 {
   if (!new_drive)
     {
-      DS[d].status_byte=0;
-      if (st&p_caddin_old) DS[d].status_byte |= p_door_closed|p_caddy_in;
-      if (st&p_spinning) DS[d].status_byte |= p_spinning;
-      if (st&p_check) DS[d].status_byte |= p_check;
-      if (st&p_busy_old) DS[d].status_byte |= p_busy_new;
-      if (st&p_disk_ok) DS[d].status_byte |= p_disk_ok;
+      DriveStruct[d].status_byte=0;
+      if (st&p_caddin_old) DriveStruct[d].status_byte |= p_door_closed|p_caddy_in;
+      if (st&p_spinning) DriveStruct[d].status_byte |= p_spinning;
+      if (st&p_check) DriveStruct[d].status_byte |= p_check;
+      if (st&p_busy_old) DriveStruct[d].status_byte |= p_busy_new;
+      if (st&p_disk_ok) DriveStruct[d].status_byte |= p_disk_ok;
     }
-  else { DS[d].status_byte=st;
+  else { DriveStruct[d].status_byte=st;
         st=p_success_old; /* for new drives: fake "successful" bit of old drives */
        }
   return (st);
@@ -770,13 +770,13 @@ int xx_ReadError(void)
       flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus;
     }
   i=cmd_out();
-  DS[d].error_byte=0;
+  DriveStruct[d].error_byte=0;
   DPRINTF((DBG_ERR,"SBPCD: xx_ReadError: cmd_out(82) returns %d (%02X)\n",i,i));
   if (i<0) return (i);
   if (new_drive) i=2;
   else i=1;
-  DS[d].error_byte=infobuf[i];
-  DPRINTF((DBG_ERR,"SBPCD: xx_ReadError: infobuf[%d] is %d (%02X)\n",i,DS[d].error_byte,DS[d].error_byte));
+  DriveStruct[d].error_byte=infobuf[i];
+  DPRINTF((DBG_ERR,"SBPCD: xx_ReadError: infobuf[%d] is %d (%02X)\n",i,DriveStruct[d].error_byte,DriveStruct[d].error_byte));
   i=sta2err(infobuf[i]);
   return (i);
 }
@@ -811,7 +811,7 @@ int cmd_out(void)
       else i=ResponseInfo();
       if (i<0) return (-9);
     }
-  if (DS[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to CDi_stat_loop.\n"));
+  if (DriveStruct[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to CDi_stat_loop.\n"));
   if (flags_cmd_out&f_lopsta)
     {
       i=CDi_stat_loop();
@@ -820,13 +820,13 @@ int cmd_out(void)
   if (!(flags_cmd_out&f_getsta)) goto LOC_229;
   
 LOC_228:
-  if (DS[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to xx_ReadStatus.\n"));
+  if (DriveStruct[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to xx_ReadStatus.\n"));
   xx_ReadStatus();
 
 LOC_229:
   if (flags_cmd_out&f_ResponseStatus) 
     {
-      if (DS[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to ResponseStatus.\n"));
+      if (DriveStruct[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to ResponseStatus.\n"));
       i=ResponseStatus();
                    /* builds status_byte, returns orig. status or p_busy_new */
       if (i<0) return (-9);
@@ -843,9 +843,9 @@ LOC_229:
 LOC_232:
   if (!(flags_cmd_out&f_obey_p_check)) return (0);
   if (!st_check) return (0);
-  if (DS[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to xx_ReadError.\n"));
+  if (DriveStruct[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to xx_ReadError.\n"));
   i=xx_ReadError();
-  if (DS[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to cmd_out OK.\n"));
+  if (DriveStruct[d].in_SpinUp != 0) DPRINTF((DBG_SPI,"SBPCD: to cmd_out OK.\n"));
   return (i);
 }
 /*==========================================================================*/
@@ -883,7 +883,7 @@ static int xx_SpinUp(void)
   int i;
 
   DPRINTF((DBG_SPI,"SBPCD: SpinUp.\n"));
-  DS[d].in_SpinUp = 1;
+  DriveStruct[d].in_SpinUp = 1;
   clr_cmdbuf();
   if (!new_drive)
     {
@@ -897,7 +897,7 @@ static int xx_SpinUp(void)
     }
   response_count=0;
   i=cmd_out();
-  DS[d].in_SpinUp = 0;
+  DriveStruct[d].in_SpinUp = 0;
   return (i);
 }
 /*==========================================================================*/
@@ -937,15 +937,15 @@ static int xx_SetVolume(void)
   u_char channel0,channel1,volume0,volume1;
   u_char control0,value0,control1,value1;
 
-  DS[d].diskstate_flags &= ~volume_bit;
+  DriveStruct[d].diskstate_flags &= ~volume_bit;
   clr_cmdbuf();
-  channel0=DS[d].vol_chan0;
-  volume0=DS[d].vol_ctrl0;
-  channel1=control1=DS[d].vol_chan1;
-  volume1=value1=DS[d].vol_ctrl1;
+  channel0=DriveStruct[d].vol_chan0;
+  volume0=DriveStruct[d].vol_ctrl0;
+  channel1=control1=DriveStruct[d].vol_chan1;
+  volume1=value1=DriveStruct[d].vol_ctrl1;
   control0=value0=0;
 
-  if (((DS[d].drv_options&sax_a)!=0)&&(DS[d].drv_type>=drv_211))
+  if (((DriveStruct[d].drv_options&sax_a)!=0)&&(DriveStruct[d].drv_type>=drv_211))
     {
       if ((volume0!=0)&&(volume1==0))
        {
@@ -987,7 +987,7 @@ static int xx_SetVolume(void)
     }
   else 
     {
-      if (DS[d].drv_type>=drv_300)
+      if (DriveStruct[d].drv_type>=drv_300)
        {
          control0=volume0&0xFC;
          value0=volume1&0xFC;
@@ -999,7 +999,7 @@ static int xx_SetVolume(void)
       else
        {
          value0=(volume0>volume1)?volume0:volume1;
-         if (DS[d].drv_type<drv_211)
+         if (DriveStruct[d].drv_type<drv_211)
            {
              if (channel0!=0)
                {
@@ -1032,14 +1032,14 @@ static int xx_SetVolume(void)
              if (volume0==0xFF) volume1=0xFF;
              else if (volume1==0xFF) volume0=0xFF;
            }
-         else if (DS[d].drv_type<drv_201) volume0=volume1=value0;
+         else if (DriveStruct[d].drv_type<drv_201) volume0=volume1=value0;
 
-         if (DS[d].drv_type>=drv_201)
+         if (DriveStruct[d].drv_type>=drv_201)
            {
              if (volume0==0) control0 |= 0x80;
              if (volume1==0) control0 |= 0x40;
            }
-         if (DS[d].drv_type>=drv_211)
+         if (DriveStruct[d].drv_type>=drv_211)
            {
              if (channel0!=0) control0 |= 0x20;
              if (channel1!=1) control0 |= 0x10;
@@ -1055,7 +1055,7 @@ static int xx_SetVolume(void)
   response_count=0;
   i=cmd_out();
   if (i>0) return (i);
-  DS[d].diskstate_flags |= volume_bit;
+  DriveStruct[d].diskstate_flags |= volume_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1087,7 +1087,7 @@ static int xy_DriveReset(void)
   flush_status();
   i=GetStatus();
   if (i>=0) return -1;
-  if (DS[d].error_byte!=aud_12) return -1;
+  if (DriveStruct[d].error_byte!=aud_12) return -1;
   return (0);
 }
 /*==========================================================================*/
@@ -1095,12 +1095,12 @@ static int SetSpeed(void)
 {
   int i, speed;
 
-  if (!(DS[d].drv_options&(speed_auto|speed_300|speed_150))) return (0);
+  if (!(DriveStruct[d].drv_options&(speed_auto|speed_300|speed_150))) return (0);
   speed=speed_auto;
-  if (!(DS[d].drv_options&speed_auto))
+  if (!(DriveStruct[d].drv_options&speed_auto))
     {
       speed |= speed_300;
-      if (!(DS[d].drv_options&speed_300)) speed=0;
+      if (!(DriveStruct[d].drv_options&speed_300)) speed=0;
     }
   i=yy_SetSpeed(speed,0,0);
   return (i);
@@ -1119,7 +1119,7 @@ static int DriveReset(void)
       if (!st_caddy_in) break;
     }
   while (!st_diskok);
-  DS[d].CD_changed=1;
+  DriveStruct[d].CD_changed=1;
   i=SetSpeed();
   if (i<0) return (-2);
   return (0);
@@ -1165,7 +1165,7 @@ static int xx_ReadSubQ(void)
 {
   int i,j;
 
-  DS[d].diskstate_flags &= ~subq_bit;
+  DriveStruct[d].diskstate_flags &= ~subq_bit;
   for (j=255;j>0;j--)
     {
       clr_cmdbuf();
@@ -1193,22 +1193,22 @@ static int xx_ReadSubQ(void)
       if (infobuf[0]!=0) break;
       if ((!st_spinning) || (j==1))
        {
-         DS[d].SubQ_ctl_adr=DS[d].SubQ_trk=DS[d].SubQ_pnt_idx=DS[d].SubQ_whatisthis=0;
-         DS[d].SubQ_run_tot=DS[d].SubQ_run_trk=0;
+         DriveStruct[d].SubQ_ctl_adr=DriveStruct[d].SubQ_trk=DriveStruct[d].SubQ_pnt_idx=DriveStruct[d].SubQ_whatisthis=0;
+         DriveStruct[d].SubQ_run_tot=DriveStruct[d].SubQ_run_trk=0;
          return (0);
        }
     }
-  DS[d].SubQ_ctl_adr=swap_nibbles(infobuf[1]);
-  DS[d].SubQ_trk=byt2bcd(infobuf[2]);
-  DS[d].SubQ_pnt_idx=byt2bcd(infobuf[3]);
+  DriveStruct[d].SubQ_ctl_adr=swap_nibbles(infobuf[1]);
+  DriveStruct[d].SubQ_trk=byt2bcd(infobuf[2]);
+  DriveStruct[d].SubQ_pnt_idx=byt2bcd(infobuf[3]);
   i=4;
   if (!new_drive) i=5;
-  DS[d].SubQ_run_tot=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2])); /* msf-bin */
+  DriveStruct[d].SubQ_run_tot=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2])); /* msf-bin */
   i=7;
   if (!new_drive) i=9;
-  DS[d].SubQ_run_trk=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2])); /* msf-bin */
-  DS[d].SubQ_whatisthis=infobuf[i+3];
-  DS[d].diskstate_flags |= subq_bit;
+  DriveStruct[d].SubQ_run_trk=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2])); /* msf-bin */
+  DriveStruct[d].SubQ_whatisthis=infobuf[i+3];
+  DriveStruct[d].diskstate_flags |= subq_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1216,7 +1216,7 @@ static int xx_ModeSense(void)
 {
   int i;
 
-  DS[d].diskstate_flags &= ~frame_size_bit;
+  DriveStruct[d].diskstate_flags &= ~frame_size_bit;
   clr_cmdbuf();
   if (new_drive)
     {
@@ -1235,8 +1235,8 @@ static int xx_ModeSense(void)
   i=cmd_out();
   if (i<0) return (i);
   i=0;
-  if (new_drive) DS[d].sense_byte=infobuf[i++];
-  DS[d].frame_size=make16(infobuf[i],infobuf[i+1]);
+  if (new_drive) DriveStruct[d].sense_byte=infobuf[i++];
+  DriveStruct[d].frame_size=make16(infobuf[i],infobuf[i+1]);
 
   DPRINTF((DBG_XA,"SBPCD: xx_ModeSense: "));
   for (i=0;i<(new_drive?5:2);i++)
@@ -1245,7 +1245,7 @@ static int xx_ModeSense(void)
     }
   DPRINTF((DBG_XA,"\n"));
 
-  DS[d].diskstate_flags |= frame_size_bit;
+  DriveStruct[d].diskstate_flags |= frame_size_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1254,35 +1254,35 @@ static int xx_ModeSelect(int framesize)
 {
   int i;
 
-  DS[d].diskstate_flags &= ~frame_size_bit;
+  DriveStruct[d].diskstate_flags &= ~frame_size_bit;
   clr_cmdbuf();
-  DS[d].frame_size=framesize;
+  DriveStruct[d].frame_size=framesize;
 
   DPRINTF((DBG_XA,"SBPCD: xx_ModeSelect: %02X %04X\n",
-          DS[d].sense_byte, DS[d].frame_size));
+          DriveStruct[d].sense_byte, DriveStruct[d].frame_size));
 
   if (new_drive)
     {
       drvcmd[0]=0x09;
       drvcmd[1]=0x00;
-      drvcmd[2]=DS[d].sense_byte;
-      drvcmd[3]=(DS[d].frame_size>>8)&0xFF;
-      drvcmd[4]=DS[d].frame_size&0xFF;
+      drvcmd[2]=DriveStruct[d].sense_byte;
+      drvcmd[3]=(DriveStruct[d].frame_size>>8)&0xFF;
+      drvcmd[4]=DriveStruct[d].frame_size&0xFF;
       flags_cmd_out=f_putcmd|f_ResponseStatus|f_obey_p_check;
     }
   else
     {
       drvcmd[0]=0x84;
       drvcmd[1]=0x00;
-      drvcmd[2]=(DS[d].frame_size>>8)&0xFF;
-      drvcmd[3]=DS[d].frame_size&0xFF;
+      drvcmd[2]=(DriveStruct[d].frame_size>>8)&0xFF;
+      drvcmd[3]=DriveStruct[d].frame_size&0xFF;
       drvcmd[4]=0x00;
       flags_cmd_out=f_putcmd|f_getsta|f_ResponseStatus|f_obey_p_check;
     }
   response_count=0;
   i=cmd_out();
   if (i<0) return (i);
-  DS[d].diskstate_flags |= frame_size_bit;
+  DriveStruct[d].diskstate_flags |= frame_size_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1293,7 +1293,7 @@ static int xx_TellVolume(void)
   u_char switches;
   u_char chan0,vol0,chan1,vol1;
 
-  DS[d].diskstate_flags &= ~volume_bit;
+  DriveStruct[d].diskstate_flags &= ~volume_bit;
   clr_cmdbuf();
   if (new_drive)
     {
@@ -1335,14 +1335,14 @@ static int xx_TellVolume(void)
       chan0=0;
       chan1=1;
       vol0=vol1=infobuf[1];
-      if (DS[d].drv_type>=drv_201)
+      if (DriveStruct[d].drv_type>=drv_201)
        {
-         if (DS[d].drv_type<drv_300)
+         if (DriveStruct[d].drv_type<drv_300)
            {
              switches=infobuf[0];
              if ((switches&0x80)!=0) vol0=0;
              if ((switches&0x40)!=0) vol1=0;
-             if (DS[d].drv_type>=drv_211)
+             if (DriveStruct[d].drv_type>=drv_211)
                {
                  if ((switches&0x20)!=0) chan0=1;
                  if ((switches&0x10)!=0) chan1=0;
@@ -1360,15 +1360,15 @@ static int xx_TellVolume(void)
            }
        }
     }
-  DS[d].vol_chan0=chan0;
-  DS[d].vol_ctrl0=vol0;
-  DS[d].vol_chan1=chan1;
-  DS[d].vol_ctrl1=vol1;
-  DS[d].vol_chan2=2;
-  DS[d].vol_ctrl2=0xFF;
-  DS[d].vol_chan3=3;
-  DS[d].vol_ctrl3=0xFF;
-  DS[d].diskstate_flags |= volume_bit;
+  DriveStruct[d].vol_chan0=chan0;
+  DriveStruct[d].vol_ctrl0=vol0;
+  DriveStruct[d].vol_chan1=chan1;
+  DriveStruct[d].vol_ctrl1=vol1;
+  DriveStruct[d].vol_chan2=2;
+  DriveStruct[d].vol_ctrl2=0xFF;
+  DriveStruct[d].vol_chan3=3;
+  DriveStruct[d].vol_ctrl3=0xFF;
+  DriveStruct[d].diskstate_flags |= volume_bit;
   return (0);
 }
 #endif
@@ -1377,7 +1377,7 @@ static int xx_ReadCapacity(void)
 {
   int i;
 
-  DS[d].diskstate_flags &= ~cd_size_bit;
+  DriveStruct[d].diskstate_flags &= ~cd_size_bit;
   clr_cmdbuf();
   if (new_drive)
     {
@@ -1392,11 +1392,11 @@ static int xx_ReadCapacity(void)
   response_count=5;
   i=cmd_out();
   if (i<0) return (i);
-  DS[d].CDsize_blk=make32(make16(0,infobuf[0]),make16(infobuf[1],infobuf[2]));
-  if (new_drive) DS[d].CDsize_blk=msf2blk(DS[d].CDsize_blk);
-  DS[d].CDsize_frm = (DS[d].CDsize_blk * make16(infobuf[3],infobuf[4])) / CD_FRAMESIZE;
-  DS[d].CDsize_blk += 151;
-  DS[d].diskstate_flags |= cd_size_bit;
+  DriveStruct[d].CDsize_blk=make32(make16(0,infobuf[0]),make16(infobuf[1],infobuf[2]));
+  if (new_drive) DriveStruct[d].CDsize_blk=msf2blk(DriveStruct[d].CDsize_blk);
+  DriveStruct[d].CDsize_frm = (DriveStruct[d].CDsize_blk * make16(infobuf[3],infobuf[4])) / CD_FRAMESIZE;
+  DriveStruct[d].CDsize_blk += 151;
+  DriveStruct[d].diskstate_flags |= cd_size_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1404,7 +1404,7 @@ static int xx_ReadTocDescr(void)
 {
   int i;
 
-  DS[d].diskstate_flags &= ~toc_bit;
+  DriveStruct[d].diskstate_flags &= ~toc_bit;
   clr_cmdbuf();
   if (new_drive)
     {
@@ -1419,14 +1419,14 @@ static int xx_ReadTocDescr(void)
   response_count=6;
   i=cmd_out();
   if (i<0) return (i);
-  DS[d].xa_byte=infobuf[0];
-  DS[d].n_first_track=infobuf[1];
-  DS[d].n_last_track=infobuf[2];
-  DS[d].size_msf=make32(make16(0,infobuf[3]),make16(infobuf[4],infobuf[5]));
-  DS[d].size_blk=msf2blk(DS[d].size_msf);
-  DS[d].diskstate_flags |= toc_bit;
+  DriveStruct[d].xa_byte=infobuf[0];
+  DriveStruct[d].n_first_track=infobuf[1];
+  DriveStruct[d].n_last_track=infobuf[2];
+  DriveStruct[d].size_msf=make32(make16(0,infobuf[3]),make16(infobuf[4],infobuf[5]));
+  DriveStruct[d].size_blk=msf2blk(DriveStruct[d].size_msf);
+  DriveStruct[d].diskstate_flags |= toc_bit;
   DPRINTF((DBG_TOC,"SBPCD: TocDesc: %02X %02X %02X %08X\n",
-        DS[d].xa_byte,DS[d].n_first_track,DS[d].n_last_track,DS[d].size_msf));
+        DriveStruct[d].xa_byte,DriveStruct[d].n_first_track,DriveStruct[d].n_last_track,DriveStruct[d].size_msf));
   return (0);
 }
 /*==========================================================================*/
@@ -1450,16 +1450,16 @@ static int xx_ReadTocEntry(int num)
   response_count=8;
   i=cmd_out();
   if (i<0) return (i);
-  DS[d].TocEnt_nixbyte=infobuf[0];
-  DS[d].TocEnt_ctl_adr=swap_nibbles(infobuf[1]);
-  DS[d].TocEnt_number=infobuf[2];
-  DS[d].TocEnt_format=infobuf[3];
+  DriveStruct[d].TocEnt_nixbyte=infobuf[0];
+  DriveStruct[d].TocEnt_ctl_adr=swap_nibbles(infobuf[1]);
+  DriveStruct[d].TocEnt_number=infobuf[2];
+  DriveStruct[d].TocEnt_format=infobuf[3];
   if (new_drive) i=4;
   else i=5;
-  DS[d].TocEnt_address=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2]));
+  DriveStruct[d].TocEnt_address=make32(make16(0,infobuf[i]),make16(infobuf[i+1],infobuf[i+2]));
   DPRINTF((DBG_TOC,"SBPCD: TocEntry: %02X %02X %02X %02X %08X\n",
-          DS[d].TocEnt_nixbyte,DS[d].TocEnt_ctl_adr,DS[d].TocEnt_number,
-          DS[d].TocEnt_format,DS[d].TocEnt_address));
+          DriveStruct[d].TocEnt_nixbyte,DriveStruct[d].TocEnt_ctl_adr,DriveStruct[d].TocEnt_number,
+          DriveStruct[d].TocEnt_format,DriveStruct[d].TocEnt_address));
   return (0);
 }
 /*==========================================================================*/
@@ -1483,14 +1483,14 @@ static int convert_UPC(u_char *p)
   if (!new_drive) p[13]=0;
   for (i=0;i<7;i++)
     {
-      if (new_drive) DS[d].UPC_buf[i]=swap_nibbles(*p++);
+      if (new_drive) DriveStruct[d].UPC_buf[i]=swap_nibbles(*p++);
       else
        {
-         DS[d].UPC_buf[i]=((*p++)<<4)&0xFF;
-         DS[d].UPC_buf[i] |= *p++;
+         DriveStruct[d].UPC_buf[i]=((*p++)<<4)&0xFF;
+         DriveStruct[d].UPC_buf[i] |= *p++;
        }
     }
-  DS[d].UPC_buf[6] &= 0xF0;
+  DriveStruct[d].UPC_buf[6] &= 0xF0;
   return (0);
 }
 /*==========================================================================*/
@@ -1501,7 +1501,7 @@ static int xx_ReadUPC(void)
   int block, checksum;
 #endif TEST_UPC
 
-  DS[d].diskstate_flags &= ~upc_bit;
+  DriveStruct[d].diskstate_flags &= ~upc_bit;
 #if TEST_UPC
   for (block=CD_BLOCK_OFFSET+1;block<CD_BLOCK_OFFSET+200;block++)
     {
@@ -1553,24 +1553,24 @@ static int xx_ReadUPC(void)
       if ((checksum&0x7F)!=0) break;
     }
 #endif TEST_UPC
-  DS[d].UPC_ctl_adr=0;
+  DriveStruct[d].UPC_ctl_adr=0;
   if (new_drive) i=0;
   else i=2;
   if ((infobuf[i]&0x80)!=0)
     {
       convert_UPC(&infobuf[i]);
-      DS[d].UPC_ctl_adr = (DS[d].TocEnt_ctl_adr & 0xF0) | 0x02;
+      DriveStruct[d].UPC_ctl_adr = (DriveStruct[d].TocEnt_ctl_adr & 0xF0) | 0x02;
     }
 
   DPRINTF((DBG_UPC,"SBPCD: UPC code: "));
-  DPRINTF((DBG_UPC,"(%02X) ", DS[d].UPC_ctl_adr));
+  DPRINTF((DBG_UPC,"(%02X) ", DriveStruct[d].UPC_ctl_adr));
   for (i=0;i<7;i++)
     {
-      DPRINTF((DBG_UPC,"%02X ", DS[d].UPC_buf[i]));
+      DPRINTF((DBG_UPC,"%02X ", DriveStruct[d].UPC_buf[i]));
     }
   DPRINTF((DBG_UPC,"\n"));
 
-  DS[d].diskstate_flags |= upc_bit;
+  DriveStruct[d].diskstate_flags |= upc_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1578,8 +1578,8 @@ static int yy_CheckMultiSession(void)
 {
   int i;
 
-  DS[d].diskstate_flags &= ~multisession_bit;
-  DS[d].f_multisession=0;
+  DriveStruct[d].diskstate_flags &= ~multisession_bit;
+  DriveStruct[d].f_multisession=0;
   clr_cmdbuf();
   if (new_drive)
     {
@@ -1593,12 +1593,12 @@ static int yy_CheckMultiSession(void)
          DPRINTF((DBG_MUL,"SBPCD: MultiSession CD detected: %02X %02X %02X %02X %02X %02X\n",
                          infobuf[0], infobuf[1], infobuf[2],
                         infobuf[3], infobuf[4], infobuf[5]));
-         DS[d].f_multisession=1;
-         DS[d].lba_multi=msf2blk(make32(make16(0,infobuf[1]),
+         DriveStruct[d].f_multisession=1;
+         DriveStruct[d].lba_multi=msf2blk(make32(make16(0,infobuf[1]),
                                    make16(infobuf[2],infobuf[3])));
        }
     }
-  DS[d].diskstate_flags |= multisession_bit;
+  DriveStruct[d].diskstate_flags |= multisession_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -1610,7 +1610,7 @@ static int yy_SubChanInfo(int frame, int count, u_char *buffer)
 
   if (!new_drive) return (-3);
 #if 0
-  if (DS[d].audio_state!=audio_playing) return (-2);
+  if (DriveStruct[d].audio_state!=audio_playing) return (-2);
 #endif
   clr_cmdbuf();
   drvcmd[0]=0x11;
@@ -1621,7 +1621,7 @@ static int yy_SubChanInfo(int frame, int count, u_char *buffer)
   drvcmd[6]=count&0xFF;
   flags_cmd_out=f_putcmd|f_respo2|f_ResponseStatus|f_obey_p_check;
   cmd_type=READ_SC;
-  DS[d].frame_size=CD_FRAMESIZE_SUB;
+  DriveStruct[d].frame_size=CD_FRAMESIZE_SUB;
   i=cmd_out(); /* read directly into user's buffer */
   return (i);
 }
@@ -1697,37 +1697,37 @@ static int check_version(void)
   for (i=0;i<4;i++) if (infobuf[i]!=drive_family[i]) break;
   if (i==4)
     {
-      DS[d].drive_model[0]=infobuf[i++];
-      DS[d].drive_model[1]=infobuf[i++];
-      DS[d].drive_model[2]='-';
-      DS[d].drive_model[3]='x';
-      DS[d].drv_type=drv_new;
+      DriveStruct[d].drive_model[0]=infobuf[i++];
+      DriveStruct[d].drive_model[1]=infobuf[i++];
+      DriveStruct[d].drive_model[2]='-';
+      DriveStruct[d].drive_model[3]='x';
+      DriveStruct[d].drv_type=drv_new;
     }
   else
     {
       for (i=0;i<8;i++) if (infobuf[i]!=drive_vendor[i]) break;
       if (i!=8) return (-1);
-      DS[d].drive_model[0]='2';
-      DS[d].drive_model[1]='x';
-      DS[d].drive_model[2]='-';
-      DS[d].drive_model[3]='x';
-      DS[d].drv_type=drv_old;
-    }
-  for (j=0;j<4;j++) DS[d].firmware_version[j]=infobuf[i+j];
-  j = (DS[d].firmware_version[0] & 0x0F) * 100 +
-      (DS[d].firmware_version[2] & 0x0F) *10 +
-      (DS[d].firmware_version[3] & 0x0F);
+      DriveStruct[d].drive_model[0]='2';
+      DriveStruct[d].drive_model[1]='x';
+      DriveStruct[d].drive_model[2]='-';
+      DriveStruct[d].drive_model[3]='x';
+      DriveStruct[d].drv_type=drv_old;
+    }
+  for (j=0;j<4;j++) DriveStruct[d].firmware_version[j]=infobuf[i+j];
+  j = (DriveStruct[d].firmware_version[0] & 0x0F) * 100 +
+      (DriveStruct[d].firmware_version[2] & 0x0F) *10 +
+      (DriveStruct[d].firmware_version[3] & 0x0F);
   if (new_drive)
     {
-      if (j<100) DS[d].drv_type=drv_099;
-      else DS[d].drv_type=drv_100;
+      if (j<100) DriveStruct[d].drv_type=drv_099;
+      else DriveStruct[d].drv_type=drv_100;
     }
-  else if (j<200) DS[d].drv_type=drv_199;
-  else if (j<201) DS[d].drv_type=drv_200;
-  else if (j<210) DS[d].drv_type=drv_201;
-  else if (j<211) DS[d].drv_type=drv_210;
-  else if (j<300) DS[d].drv_type=drv_211;
-  else DS[d].drv_type=drv_300;
+  else if (j<200) DriveStruct[d].drv_type=drv_199;
+  else if (j<201) DriveStruct[d].drv_type=drv_200;
+  else if (j<210) DriveStruct[d].drv_type=drv_201;
+  else if (j<211) DriveStruct[d].drv_type=drv_210;
+  else if (j<300) DriveStruct[d].drv_type=drv_211;
+  else DriveStruct[d].drv_type=drv_300;
   return (0);
 }
 /*==========================================================================*/
@@ -1740,7 +1740,7 @@ static int switch_drive(int num)
   i=num;
   if (sbpro_type) i=(i&0x01)<<1|(i&0x02)>>1;
   OUT(CDo_enable,i);
-  DPRINTF((DBG_DID,"SBPCD: switch_drive: drive %d activated.\n",DS[d].drv_minor));
+  DPRINTF((DBG_DID,"SBPCD: switch_drive: drive %d activated.\n",DriveStruct[d].drv_minor));
   return (0);
 }
 /*==========================================================================*/
@@ -1757,7 +1757,7 @@ static int check_drives(void)
   ndrives=0;
   for (j=0;j<NR_SBPCD;j++)
     {
-      DS[j].drv_minor=j;
+      DriveStruct[j].drv_minor=j;
       switch_drive(j);
       DPRINTF((DBG_ID,"SBPCD: check_drives: drive %d activated.\n",j));
       i=check_version();
@@ -1765,16 +1765,16 @@ static int check_drives(void)
       if (i>=0)
        {
          ndrives++;
-         DS[d].drv_options=drv_pattern[j];
-         if (!new_drive) DS[d].drv_options&=~(speed_auto|speed_300|speed_150);
+         DriveStruct[d].drv_options=drv_pattern[j];
+         if (!new_drive) DriveStruct[d].drv_options&=~(speed_auto|speed_300|speed_150);
          printk("%sDrive %d: %s%.4s (%.4s)\n", printk_header,
-                DS[d].drv_minor,
+                DriveStruct[d].drv_minor,
                  drive_family,
-                 DS[d].drive_model,
-                 DS[d].firmware_version);
+                 DriveStruct[d].drive_model,
+                 DriveStruct[d].firmware_version);
          printk_header="       - ";
        }
-      else DS[d].drv_minor=-1;
+      else DriveStruct[d].drv_minor=-1;
     }
   if (ndrives==0) return (-1);
   return (0);
@@ -1914,7 +1914,7 @@ static int seek_pos_audio_end(void)
 {
   int i;
 
-  i=msf2blk(DS[d].pos_audio_end)-1;
+  i=msf2blk(DriveStruct[d].pos_audio_end)-1;
   if (i<0) return (-1);
   i=xx_Seek(i,0);
   return (i);
@@ -1923,27 +1923,27 @@ static int seek_pos_audio_end(void)
 static int ReadToC(void)
 {
   int i, j;
-  DS[d].diskstate_flags &= ~toc_bit;
-  DS[d].ored_ctl_adr=0;
-  for (j=DS[d].n_first_track;j<=DS[d].n_last_track;j++)
+  DriveStruct[d].diskstate_flags &= ~toc_bit;
+  DriveStruct[d].ored_ctl_adr=0;
+  for (j=DriveStruct[d].n_first_track;j<=DriveStruct[d].n_last_track;j++)
     {
       i=xx_ReadTocEntry(j);
       if (i<0) return (i);
-      DS[d].TocBuffer[j].nixbyte=DS[d].TocEnt_nixbyte;
-      DS[d].TocBuffer[j].ctl_adr=DS[d].TocEnt_ctl_adr;
-      DS[d].TocBuffer[j].number=DS[d].TocEnt_number;
-      DS[d].TocBuffer[j].format=DS[d].TocEnt_format;
-      DS[d].TocBuffer[j].address=DS[d].TocEnt_address;
-      DS[d].ored_ctl_adr |= DS[d].TocEnt_ctl_adr;
+      DriveStruct[d].TocBuffer[j].nixbyte=DriveStruct[d].TocEnt_nixbyte;
+      DriveStruct[d].TocBuffer[j].ctl_adr=DriveStruct[d].TocEnt_ctl_adr;
+      DriveStruct[d].TocBuffer[j].number=DriveStruct[d].TocEnt_number;
+      DriveStruct[d].TocBuffer[j].format=DriveStruct[d].TocEnt_format;
+      DriveStruct[d].TocBuffer[j].address=DriveStruct[d].TocEnt_address;
+      DriveStruct[d].ored_ctl_adr |= DriveStruct[d].TocEnt_ctl_adr;
     }
 /* fake entry for LeadOut Track */
-  DS[d].TocBuffer[j].nixbyte=0;
-  DS[d].TocBuffer[j].ctl_adr=0;
-  DS[d].TocBuffer[j].number=0;
-  DS[d].TocBuffer[j].format=0;
-  DS[d].TocBuffer[j].address=DS[d].size_msf;
+  DriveStruct[d].TocBuffer[j].nixbyte=0;
+  DriveStruct[d].TocBuffer[j].ctl_adr=0;
+  DriveStruct[d].TocBuffer[j].number=0;
+  DriveStruct[d].TocBuffer[j].format=0;
+  DriveStruct[d].TocBuffer[j].address=DriveStruct[d].size_msf;
 
-  DS[d].diskstate_flags |= toc_bit;
+  DriveStruct[d].diskstate_flags |= toc_bit;
   return (0);
 }
 /*==========================================================================*/
@@ -2004,7 +2004,7 @@ static int DiskInfo(void)
       DPRINTF((DBG_INF,"SBPCD: DiskInfo: yy_CheckMultiSession returns %d\n", i));
       return (i);
     }
-  i=xx_ReadTocEntry(DS[d].n_first_track);
+  i=xx_ReadTocEntry(DriveStruct[d].n_first_track);
   if (i<0)
     {
       DPRINTF((DBG_INF,"SBPCD: DiskInfo: xx_ReadTocEntry(1) returns %d\n", i));
@@ -2017,7 +2017,7 @@ static int DiskInfo(void)
       return (i);
     }
 #ifdef XA_TEST2
-  if ((!new_drive) && (DS[d].xa_byte==0x20)) /* XA disk with old drive */
+  if ((!new_drive) && (DriveStruct[d].xa_byte==0x20)) /* XA disk with old drive */
       {
        xx_ModeSelect(CD_FRAMESIZE_XA);
        xx_ModeSense();
@@ -2041,13 +2041,13 @@ static int prepare(u_char func, u_char subfunc)
       if (i&s_attention) GetStatus();
     }
   else GetStatus();
-  if (DS[d].CD_changed==0xFF)
+  if (DriveStruct[d].CD_changed==0xFF)
     {
 #if MANY_SESSION
 #else
-      DS[d].diskstate_flags=0;
+      DriveStruct[d].diskstate_flags=0;
 #endif MANY_SESSION
-      DS[d].audio_state=0;
+      DriveStruct[d].audio_state=0;
       if (!st_diskok)
        {
          i=check_allowed1(func,subfunc);
@@ -2058,7 +2058,7 @@ static int prepare(u_char func, u_char subfunc)
          i=check_allowed3(func,subfunc);
          if (i<0)
            {
-             DS[d].CD_changed=1;
+             DriveStruct[d].CD_changed=1;
              return (-15);
            }
        }
@@ -2069,9 +2069,9 @@ static int prepare(u_char func, u_char subfunc)
        {
 #if MANY_SESSION
 #else
-         DS[d].diskstate_flags=0;
+         DriveStruct[d].diskstate_flags=0;
 #endif MANY_SESSION
-         DS[d].audio_state=0;
+         DriveStruct[d].audio_state=0;
          i=check_allowed1(func,subfunc);
          if (i<0) return (-2);
        }
@@ -2079,7 +2079,7 @@ static int prepare(u_char func, u_char subfunc)
        { 
          if (st_busy)
            {
-             if (DS[d].audio_state!=audio_pausing)
+             if (DriveStruct[d].audio_state!=audio_pausing)
                {
                  i=check_allowed2(func,subfunc);
                  if (i<0) return (-2);
@@ -2087,8 +2087,8 @@ static int prepare(u_char func, u_char subfunc)
            }
          else
            {
-             if (DS[d].audio_state==audio_playing) seek_pos_audio_end();
-             DS[d].audio_state=0;
+             if (DriveStruct[d].audio_state==audio_playing) seek_pos_audio_end();
+             DriveStruct[d].audio_state=0;
            }
          if (!frame_size_valid)
            {
@@ -2097,9 +2097,9 @@ static int prepare(u_char func, u_char subfunc)
                {
 #if MANY_SESSION
 #else
-                 DS[d].diskstate_flags=0;
+                 DriveStruct[d].diskstate_flags=0;
 #endif MANY_SESSION
-                 DS[d].audio_state=0;
+                 DriveStruct[d].audio_state=0;
                  i=check_allowed1(func,subfunc);
                  if (i<0) return (-2);
                }
@@ -2113,7 +2113,7 @@ static int xx_PlayAudioMSF(int pos_audio_start,int pos_audio_end)
 {
   int i;
 
-  if (DS[d].audio_state==audio_playing) return (-EINVAL);
+  if (DriveStruct[d].audio_state==audio_playing) return (-EINVAL);
   clr_cmdbuf();
   if (new_drive)
     {
@@ -2185,18 +2185,18 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       /* or reset the starting and ending locations when in PAUSED mode. */
       /* If applicable, at the next stopping point it reaches            */
       /* the drive will discontinue playing.                             */
-      switch (DS[d].audio_state)
+      switch (DriveStruct[d].audio_state)
        {
        case audio_playing:
          i=xx_Pause_Resume(1);
          if (i<0) return (-EIO);
-         DS[d].audio_state=audio_pausing;
+         DriveStruct[d].audio_state=audio_pausing;
          i=xx_ReadSubQ();
          if (i<0) return (-EIO);
-         DS[d].pos_audio_start=DS[d].SubQ_run_tot;
+         DriveStruct[d].pos_audio_start=DriveStruct[d].SubQ_run_tot;
          return (0);
        case audio_pausing:
-         i=xx_Seek(DS[d].pos_audio_start,1);
+         i=xx_Seek(DriveStruct[d].pos_audio_start,1);
          if (i<0) return (-EIO);
          return (0);
        default:
@@ -2208,46 +2208,46 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       /* resume playing audio tracks when a previous PLAY AUDIO call has  */
       /* been paused with a PAUSE command.                                */
       /* It will resume playing from the location saved in SubQ_run_tot.  */
-      if (DS[d].audio_state!=audio_pausing) return -EINVAL;
+      if (DriveStruct[d].audio_state!=audio_pausing) return -EINVAL;
       i=xx_Pause_Resume(3);
       if (i<0) return (-EIO);
-      DS[d].audio_state=audio_playing;
+      DriveStruct[d].audio_state=audio_playing;
       return (0);
 
     case CDROMPLAYMSF:
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMPLAYMSF entered.\n"));
-      if (DS[d].audio_state==audio_playing)
+      if (DriveStruct[d].audio_state==audio_playing)
        {
          i=xx_Pause_Resume(1);
          if (i<0) return (-EIO);
          i=xx_ReadSubQ();
          if (i<0) return (-EIO);
-         DS[d].pos_audio_start=DS[d].SubQ_run_tot;
-         i=xx_Seek(DS[d].pos_audio_start,1);
+         DriveStruct[d].pos_audio_start=DriveStruct[d].SubQ_run_tot;
+         i=xx_Seek(DriveStruct[d].pos_audio_start,1);
        }
       st=verify_area(VERIFY_READ, (void *) arg, sizeof(struct cdrom_msf));
       if (st) return (st);
       memcpy_fromfs(&msf, (void *) arg, sizeof(struct cdrom_msf));
       /* values come as msf-bin */
-      DS[d].pos_audio_start = (msf.cdmsf_min0<<16) |
+      DriveStruct[d].pos_audio_start = (msf.cdmsf_min0<<16) |
                         (msf.cdmsf_sec0<<8) |
                         msf.cdmsf_frame0;
-      DS[d].pos_audio_end = (msf.cdmsf_min1<<16) |
+      DriveStruct[d].pos_audio_end = (msf.cdmsf_min1<<16) |
                       (msf.cdmsf_sec1<<8) |
                       msf.cdmsf_frame1;
       DPRINTF((DBG_IOX,"SBPCD: ioctl: CDROMPLAYMSF %08X %08X\n",
-                              DS[d].pos_audio_start,DS[d].pos_audio_end));
-      i=xx_PlayAudioMSF(DS[d].pos_audio_start,DS[d].pos_audio_end);
+                              DriveStruct[d].pos_audio_start,DriveStruct[d].pos_audio_end));
+      i=xx_PlayAudioMSF(DriveStruct[d].pos_audio_start,DriveStruct[d].pos_audio_end);
       DPRINTF((DBG_IOC,"SBPCD: ioctl: xx_PlayAudioMSF returns %d\n",i));
 #if 0
       if (i<0) return (-EIO);
 #endif 0
-      DS[d].audio_state=audio_playing;
+      DriveStruct[d].audio_state=audio_playing;
       return (0);
 
     case CDROMPLAYTRKIND: /* Play a track.  This currently ignores index. */
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMPLAYTRKIND entered.\n"));
-      if (DS[d].audio_state==audio_playing)
+      if (DriveStruct[d].audio_state==audio_playing)
        {
          DPRINTF((DBG_IOX,"SBPCD: CDROMPLAYTRKIND: already audio_playing.\n"));
          return (0);
@@ -2262,23 +2262,23 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       memcpy_fromfs(&ti,(void *) arg,sizeof(struct cdrom_ti));
       DPRINTF((DBG_IOX,"SBPCD: ioctl: trk0: %d, ind0: %d, trk1:%d, ind1:%d\n",
             ti.cdti_trk0,ti.cdti_ind0,ti.cdti_trk1,ti.cdti_ind1));
-      if (ti.cdti_trk0<DS[d].n_first_track) return (-EINVAL);
-      if (ti.cdti_trk0>DS[d].n_last_track) return (-EINVAL);
+      if (ti.cdti_trk0<DriveStruct[d].n_first_track) return (-EINVAL);
+      if (ti.cdti_trk0>DriveStruct[d].n_last_track) return (-EINVAL);
       if (ti.cdti_trk1<ti.cdti_trk0) ti.cdti_trk1=ti.cdti_trk0;
-      if (ti.cdti_trk1>DS[d].n_last_track) ti.cdti_trk1=DS[d].n_last_track;
-      DS[d].pos_audio_start=DS[d].TocBuffer[ti.cdti_trk0].address;
-      DS[d].pos_audio_end=DS[d].TocBuffer[ti.cdti_trk1+1].address;
-      i=xx_PlayAudioMSF(DS[d].pos_audio_start,DS[d].pos_audio_end);
+      if (ti.cdti_trk1>DriveStruct[d].n_last_track) ti.cdti_trk1=DriveStruct[d].n_last_track;
+      DriveStruct[d].pos_audio_start=DriveStruct[d].TocBuffer[ti.cdti_trk0].address;
+      DriveStruct[d].pos_audio_end=DriveStruct[d].TocBuffer[ti.cdti_trk1+1].address;
+      i=xx_PlayAudioMSF(DriveStruct[d].pos_audio_start,DriveStruct[d].pos_audio_end);
 #if 0
       if (i<0) return (-EIO);
 #endif 0
-      DS[d].audio_state=audio_playing;
+      DriveStruct[d].audio_state=audio_playing;
       return (0);
            
     case CDROMREADTOCHDR:        /* Read the table of contents header */
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMREADTOCHDR entered.\n"));
-      tochdr.cdth_trk0=DS[d].n_first_track;
-      tochdr.cdth_trk1=DS[d].n_last_track;
+      tochdr.cdth_trk0=DriveStruct[d].n_first_track;
+      tochdr.cdth_trk1=DriveStruct[d].n_last_track;
       st=verify_area(VERIFY_WRITE, (void *) arg, sizeof(struct cdrom_tochdr));
       if (st) return (st);
       memcpy_tofs((void *) arg, &tochdr, sizeof(struct cdrom_tochdr));
@@ -2290,18 +2290,18 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       if (st) return (st);
       memcpy_fromfs(&tocentry, (void *) arg, sizeof(struct cdrom_tocentry));
       i=tocentry.cdte_track;
-      if (i==CDROM_LEADOUT) i=DS[d].n_last_track+1;
-      else if (i<DS[d].n_first_track||i>DS[d].n_last_track) return (-EINVAL);
-      tocentry.cdte_adr=DS[d].TocBuffer[i].ctl_adr&0x0F;
-      tocentry.cdte_ctrl=(DS[d].TocBuffer[i].ctl_adr>>4)&0x0F;
-      tocentry.cdte_datamode=DS[d].TocBuffer[i].format;
+      if (i==CDROM_LEADOUT) i=DriveStruct[d].n_last_track+1;
+      else if (i<DriveStruct[d].n_first_track||i>DriveStruct[d].n_last_track) return (-EINVAL);
+      tocentry.cdte_adr=DriveStruct[d].TocBuffer[i].ctl_adr&0x0F;
+      tocentry.cdte_ctrl=(DriveStruct[d].TocBuffer[i].ctl_adr>>4)&0x0F;
+      tocentry.cdte_datamode=DriveStruct[d].TocBuffer[i].format;
       if (tocentry.cdte_format==CDROM_MSF) /* MSF-bin required */
-       { tocentry.cdte_addr.msf.minute=(DS[d].TocBuffer[i].address>>16)&0x00FF;
-         tocentry.cdte_addr.msf.second=(DS[d].TocBuffer[i].address>>8)&0x00FF;
-         tocentry.cdte_addr.msf.frame=DS[d].TocBuffer[i].address&0x00FF;
+       { tocentry.cdte_addr.msf.minute=(DriveStruct[d].TocBuffer[i].address>>16)&0x00FF;
+         tocentry.cdte_addr.msf.second=(DriveStruct[d].TocBuffer[i].address>>8)&0x00FF;
+         tocentry.cdte_addr.msf.frame=DriveStruct[d].TocBuffer[i].address&0x00FF;
        }
       else if (tocentry.cdte_format==CDROM_LBA) /* blk required */
-       tocentry.cdte_addr.lba=msf2blk(DS[d].TocBuffer[i].address);
+       tocentry.cdte_addr.lba=msf2blk(DriveStruct[d].TocBuffer[i].address);
       else return (-EINVAL);
       st=verify_area(VERIFY_WRITE,(void *) arg, sizeof(struct cdrom_tocentry));
       if (st) return (st);
@@ -2312,30 +2312,30 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMSTOP entered.\n"));
       i=DriveReset();
 #if WORKMAN
-      DS[d].CD_changed=0xFF;
-      DS[d].diskstate_flags=0;
+      DriveStruct[d].CD_changed=0xFF;
+      DriveStruct[d].diskstate_flags=0;
 #endif WORKMAN
       DPRINTF((DBG_IOC,"SBPCD: ioctl: DriveReset returns %d\n",i));
-      DS[d].audio_state=0;
+      DriveStruct[d].audio_state=0;
       i=DiskInfo();
       return (0);
 
     case CDROMSTART:  /* Spin up the drive */
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMSTART entered.\n"));
       i=xx_SpinUp();
-      DS[d].audio_state=0;
+      DriveStruct[d].audio_state=0;
       return (0);
       
     case CDROMEJECT:
       DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMEJECT entered.\n"));
       if (!new_drive) return (0);
 #if WORKMAN
-      DS[d].CD_changed=0xFF;
-      DS[d].diskstate_flags=0;
+      DriveStruct[d].CD_changed=0xFF;
+      DriveStruct[d].diskstate_flags=0;
 #endif WORKMAN
       i=yy_SpinDown();
       if (i<0) return (-EIO);
-      DS[d].audio_state=0;
+      DriveStruct[d].audio_state=0;
       return (0);
       
     case CDROMVOLCTRL:   /* Volume control */
@@ -2343,10 +2343,10 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       st=verify_area(VERIFY_READ,(void *) arg,sizeof(volctrl));
       if (st) return (st);
       memcpy_fromfs(&volctrl,(char *) arg,sizeof(volctrl));
-      DS[d].vol_chan0=0;
-      DS[d].vol_ctrl0=volctrl.channel0;
-      DS[d].vol_chan1=1;
-      DS[d].vol_ctrl1=volctrl.channel1;
+      DriveStruct[d].vol_chan0=0;
+      DriveStruct[d].vol_ctrl0=volctrl.channel0;
+      DriveStruct[d].vol_chan1=1;
+      DriveStruct[d].vol_ctrl1=volctrl.channel1;
       i=xx_SetVolume();
       return (0);
 
@@ -2358,7 +2358,7 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
       st=verify_area(VERIFY_WRITE, (void *) arg, sizeof(struct cdrom_subchnl));
       if (st)  return (st);
       memcpy_fromfs(&SC, (void *) arg, sizeof(struct cdrom_subchnl));
-      switch (DS[d].audio_state)
+      switch (DriveStruct[d].audio_state)
        {
        case audio_playing:
          SC.cdsc_audiostatus=CDROM_AUDIO_PLAY;
@@ -2370,23 +2370,23 @@ static int sbpcd_ioctl(struct inode *inode,struct file *file,
          SC.cdsc_audiostatus=CDROM_AUDIO_NO_STATUS;
          break;
        }
-      SC.cdsc_adr=DS[d].SubQ_ctl_adr;
-      SC.cdsc_ctrl=DS[d].SubQ_ctl_adr>>4;
-      SC.cdsc_trk=bcd2bin(DS[d].SubQ_trk);
-      SC.cdsc_ind=bcd2bin(DS[d].SubQ_pnt_idx);
+      SC.cdsc_adr=DriveStruct[d].SubQ_ctl_adr;
+      SC.cdsc_ctrl=DriveStruct[d].SubQ_ctl_adr>>4;
+      SC.cdsc_trk=bcd2bin(DriveStruct[d].SubQ_trk);
+      SC.cdsc_ind=bcd2bin(DriveStruct[d].SubQ_pnt_idx);
       if (SC.cdsc_format==CDROM_LBA)
        {
-         SC.cdsc_absaddr.lba=msf2blk(DS[d].SubQ_run_tot);
-         SC.cdsc_reladdr.lba=msf2blk(DS[d].SubQ_run_trk);
+         SC.cdsc_absaddr.lba=msf2blk(DriveStruct[d].SubQ_run_tot);
+         SC.cdsc_reladdr.lba=msf2blk(DriveStruct[d].SubQ_run_trk);
        }
       else /* not only if (SC.cdsc_format==CDROM_MSF) */
        {
-         SC.cdsc_absaddr.msf.minute=(DS[d].SubQ_run_tot>>16)&0x00FF;
-         SC.cdsc_absaddr.msf.second=(DS[d].SubQ_run_tot>>8)&0x00FF;
-         SC.cdsc_absaddr.msf.frame=DS[d].SubQ_run_tot&0x00FF;
-         SC.cdsc_reladdr.msf.minute=(DS[d].SubQ_run_trk>>16)&0x00FF;
-         SC.cdsc_reladdr.msf.second=(DS[d].SubQ_run_trk>>8)&0x00FF;
-         SC.cdsc_reladdr.msf.frame=DS[d].SubQ_run_trk&0x00FF;
+         SC.cdsc_absaddr.msf.minute=(DriveStruct[d].SubQ_run_tot>>16)&0x00FF;
+         SC.cdsc_absaddr.msf.second=(DriveStruct[d].SubQ_run_tot>>8)&0x00FF;
+         SC.cdsc_absaddr.msf.frame=DriveStruct[d].SubQ_run_tot&0x00FF;
+         SC.cdsc_reladdr.msf.minute=(DriveStruct[d].SubQ_run_trk>>16)&0x00FF;
+         SC.cdsc_reladdr.msf.second=(DriveStruct[d].SubQ_run_trk>>8)&0x00FF;
+         SC.cdsc_reladdr.msf.frame=DriveStruct[d].SubQ_run_trk&0x00FF;
        }
       memcpy_tofs((void *) arg, &SC, sizeof(struct cdrom_subchnl));
       DPRINTF((DBG_IOS,"SBPCD: CDROMSUBCHNL: %1X %02X %08X %08X %02X %02X %06X %06X\n",
@@ -2419,11 +2419,11 @@ static void sbp_transfer(void)
   long offs;
   
   while ( (CURRENT->nr_sectors > 0) &&
-         (CURRENT->sector/4 >= DS[d].sbp_first_frame) &&
-         (CURRENT->sector/4 <= DS[d].sbp_last_frame) )
+         (CURRENT->sector/4 >= DriveStruct[d].sbp_first_frame) &&
+         (CURRENT->sector/4 <= DriveStruct[d].sbp_last_frame) )
     {
-      offs = (CURRENT->sector - DS[d].sbp_first_frame * 4) * 512;
-      memcpy(CURRENT->buffer, DS[d].sbp_buf + offs, 512);
+      offs = (CURRENT->sector - DriveStruct[d].sbp_first_frame * 4) * 512;
+      memcpy(CURRENT->buffer, DriveStruct[d].sbp_buf + offs, 512);
       CURRENT->nr_sectors--;
       CURRENT->sector++;
       CURRENT->buffer += 512;
@@ -2540,7 +2540,7 @@ request_loop:
   if (!st_spinning) xx_SpinUp();
 
 #ifdef XA_TEST1
-  if ((!new_drive) && (DS[d].xa_byte==0x20)) /* XA disk with old drive */
+  if ((!new_drive) && (DriveStruct[d].xa_byte==0x20)) /* XA disk with old drive */
       {
        xx_ModeSelect(CD_FRAMESIZE_XA);
        xx_ModeSense();
@@ -2585,45 +2585,45 @@ static void sbp_read_cmd(void)
   int i;
   int block;
 
-  DS[d].sbp_first_frame=DS[d].sbp_last_frame=-1;      /* purge buffer */
+  DriveStruct[d].sbp_first_frame=DriveStruct[d].sbp_last_frame=-1;      /* purge buffer */
   block=CURRENT->sector/4;
 
   if (new_drive)
     {
 #if MANY_SESSION
       DPRINTF((DBG_MUL,"SBPCD: read MSF %08X\n", blk2msf(block)));
-      if ( (DS[d].f_multisession) && (multisession_valid) )
+      if ( (DriveStruct[d].f_multisession) && (multisession_valid) )
        {
          DPRINTF((DBG_MUL,"SBPCD: MultiSession: use %08X for %08X (msf)\n",
-                        blk2msf(DS[d].lba_multi+block),
+                        blk2msf(DriveStruct[d].lba_multi+block),
                          blk2msf(block)));
-         block=DS[d].lba_multi+block;
+         block=DriveStruct[d].lba_multi+block;
        }
 #else
-      if ( (block==166) && (DS[d].f_multisession) && (multisession_valid) )
+      if ( (block==166) && (DriveStruct[d].f_multisession) && (multisession_valid) )
        {
          DPRINTF((DBG_MUL,"SBPCD: MultiSession: use %08X for %08X (msf)\n",
-                        blk2msf(DS[d].lba_multi+16),
+                        blk2msf(DriveStruct[d].lba_multi+16),
                          blk2msf(block)));
-         block=DS[d].lba_multi+16;
+         block=DriveStruct[d].lba_multi+16;
        }
 #endif MANY_SESSION
     }
 
-  if (block+SBP_BUFFER_FRAMES <= DS[d].CDsize_frm)
-    DS[d].sbp_read_frames = SBP_BUFFER_FRAMES;
+  if (block+SBP_BUFFER_FRAMES <= DriveStruct[d].CDsize_frm)
+    DriveStruct[d].sbp_read_frames = SBP_BUFFER_FRAMES;
   else
     {
-      DS[d].sbp_read_frames=DS[d].CDsize_frm-block;
+      DriveStruct[d].sbp_read_frames=DriveStruct[d].CDsize_frm-block;
                                       /* avoid reading past end of data */
-      if (DS[d].sbp_read_frames < 1)
+      if (DriveStruct[d].sbp_read_frames < 1)
        {
          DPRINTF((DBG_INF,"SBPCD: requested frame %d, CD size %d ???\n",
-                       block, DS[d].CDsize_frm));
-         DS[d].sbp_read_frames=1;
+                       block, DriveStruct[d].CDsize_frm));
+         DriveStruct[d].sbp_read_frames=1;
        }
     }
-  DS[d].sbp_current = 0;
+  DriveStruct[d].sbp_current = 0;
 
   flags_cmd_out = f_putcmd |
                   f_respo2 |
@@ -2633,7 +2633,7 @@ static void sbp_read_cmd(void)
   if (!new_drive)
     {
       flags_cmd_out |= f_lopsta | f_getsta | f_bit1;
-      if (DS[d].xa_byte==0x20)
+      if (DriveStruct[d].xa_byte==0x20)
        {
          cmd_type=READ_M2;
          drvcmd[0]=0x03;   /* "read XA frames" command for old drives */
@@ -2641,14 +2641,14 @@ static void sbp_read_cmd(void)
          drvcmd[2]=(block>>8)&0x000000ff;
          drvcmd[3]=block&0x000000ff;
          drvcmd[4]=0;
-         drvcmd[5]=DS[d].sbp_read_frames;
+         drvcmd[5]=DriveStruct[d].sbp_read_frames;
          drvcmd[6]=0;
        }
       else
        {
          drvcmd[0]=0x02;        /* "read frames" command for old drives */
          
-         if (DS[d].drv_type>=drv_201)
+         if (DriveStruct[d].drv_type>=drv_201)
            {
              lba2msf(block,&drvcmd[1]); /* msf-bcd format required */
              bin2bcdx(&drvcmd[1]);
@@ -2662,8 +2662,8 @@ static void sbp_read_cmd(void)
              drvcmd[3]=block&0x000000ff;
            }
          drvcmd[4]=0;
-         drvcmd[5]=DS[d].sbp_read_frames;
-         drvcmd[6]=(DS[d].drv_type<drv_201)?0:2; /* flag "lba or msf-bcd format" */
+         drvcmd[5]=DriveStruct[d].sbp_read_frames;
+         drvcmd[6]=(DriveStruct[d].drv_type<drv_201)?0:2; /* flag "lba or msf-bcd format" */
        }
     }
   else /* if new_drive */
@@ -2672,7 +2672,7 @@ static void sbp_read_cmd(void)
       lba2msf(block,&drvcmd[1]); /* msf-bin format required */
       drvcmd[4]=0;
       drvcmd[5]=0;
-      drvcmd[6]=DS[d].sbp_read_frames;
+      drvcmd[6]=DriveStruct[d].sbp_read_frames;
     }
 #if SBPCD_DIS_IRQ
   cli();
@@ -2702,7 +2702,7 @@ static int sbp_data(void)
   int xa_count;
   error_flag=0;
 
-  for (frame=DS[d].sbp_current;frame<DS[d].sbp_read_frames&&!error_flag; frame++)
+  for (frame=DriveStruct[d].sbp_current;frame<DriveStruct[d].sbp_read_frames&&!error_flag; frame++)
     {
 #if SBPCD_DIS_IRQ
       cli();
@@ -2736,7 +2736,7 @@ static int sbp_data(void)
 
       if (j&s_not_data_ready)
        {
-         if ((DS[d].ored_ctl_adr&0x40)==0)
+         if ((DriveStruct[d].ored_ctl_adr&0x40)==0)
            printk("SBPCD: CD contains no data tracks.\n");
          else printk("SBPCD: sbp_data: DATA_READY timeout.\n");
          error_flag++;
@@ -2749,14 +2749,14 @@ static int sbp_data(void)
 
       CLEAR_TIMER;
       error_flag=0;
-      p = DS[d].sbp_buf + frame *  CD_FRAMESIZE;
+      p = DriveStruct[d].sbp_buf + frame *  CD_FRAMESIZE;
 
       if (sbpro_type) OUT(CDo_sel_d_i,0x01);
       if (cmd_type==READ_M2) READ_DATA(CDi_data, xa_head_buf, CD_XA_HEAD);
       READ_DATA(CDi_data, p, CD_FRAMESIZE);
       if (cmd_type==READ_M2) READ_DATA(CDi_data, xa_tail_buf, CD_XA_TAIL);
       if (sbpro_type) OUT(CDo_sel_d_i,0x00);
-      DS[d].sbp_current++;
+      DriveStruct[d].sbp_current++;
       if (cmd_type==READ_M2)
        {
          DPRINTF((DBG_XA,"SBPCD: xa_head:"));
@@ -2823,7 +2823,7 @@ static int sbp_data(void)
       if (!new_drive) xx_ReadStatus();
       i=ResponseStatus();  /* builds status_byte, returns orig. status (old) or faked p_success_old (new) */
       if (i<0) { DPRINTF((DBG_INF,"SBPCD: xx_ReadStatus error after read: %02X\n",
-                              DS[d].status_byte));
+                              DriveStruct[d].status_byte));
                 return (0);
               }
     }
@@ -2835,8 +2835,8 @@ static int sbp_data(void)
       return (0);
     }
 
-  DS[d].sbp_first_frame = CURRENT -> sector / 4;
-  DS[d].sbp_last_frame = DS[d].sbp_first_frame + DS[d].sbp_read_frames - 1;
+  DriveStruct[d].sbp_first_frame = CURRENT -> sector / 4;
+  DriveStruct[d].sbp_last_frame = DriveStruct[d].sbp_first_frame + DriveStruct[d].sbp_read_frames - 1;
   sbp_transfer();
   return (1);
 }
@@ -2869,7 +2869,7 @@ int sbpcd_open(struct inode *ip, struct file *fp)
       DPRINTF((DBG_INF,"SBPCD: sbpcd_open: xx_ReadStatus timed out\n"));
       return (-EIO);                  /* drive doesn't respond */
     }
-  DPRINTF((DBG_STA,"SBPCD: sbpcd_open: status %02X\n", DS[d].status_byte));
+  DPRINTF((DBG_STA,"SBPCD: sbpcd_open: status %02X\n", DriveStruct[d].status_byte));
   if (!st_door_closed||!st_caddy_in)
     {
       printk("SBPCD: sbpcd_open: no disk in drive\n");
@@ -2880,13 +2880,13 @@ int sbpcd_open(struct inode *ip, struct file *fp)
  * try to keep an "open" counter here and lock the door if 0->1.
  */
   DPRINTF((DBG_LCK,"SBPCD: open_count: %d -> %d\n",
-          DS[d].open_count,DS[d].open_count+1));
-  if (++DS[d].open_count==1) yy_LockDoor(1);
+          DriveStruct[d].open_count,DriveStruct[d].open_count+1));
+  if (++DriveStruct[d].open_count==1) yy_LockDoor(1);
   
   if (!st_spinning) xx_SpinUp();
 
   i=DiskInfo();
-  if ((DS[d].ored_ctl_adr&0x40)==0)
+  if ((DriveStruct[d].ored_ctl_adr&0x40)==0)
     DPRINTF((DBG_INF,"SBPCD: CD contains no data tracks.\n"));
   return (0);
 }
@@ -2906,17 +2906,17 @@ static void sbpcd_release(struct inode * ip, struct file * file)
     }
   switch_drive(i);
 
-  DS[d].sbp_first_frame=DS[d].sbp_last_frame=-1;
+  DriveStruct[d].sbp_first_frame=DriveStruct[d].sbp_last_frame=-1;
   sync_dev(ip->i_rdev);                    /* nonsense if read only device? */
   invalidate_buffers(ip->i_rdev);
-  DS[d].diskstate_flags &= ~cd_size_bit;
+  DriveStruct[d].diskstate_flags &= ~cd_size_bit;
 
 /*
  * try to keep an "open" counter here and unlock the door if 1->0.
  */
   DPRINTF((DBG_LCK,"SBPCD: open_count: %d -> %d\n",
-          DS[d].open_count,DS[d].open_count-1));
-  if (--DS[d].open_count==0) yy_LockDoor(0);
+          DriveStruct[d].open_count,DriveStruct[d].open_count-1));
+  if (--DriveStruct[d].open_count==0) yy_LockDoor(0);
 }
 /*==========================================================================*/
 /*
@@ -3058,16 +3058,16 @@ u_long sbpcd_init(u_long mem_start, u_long mem_end)
 
   for (j=0;j<NR_SBPCD;j++)
     {
-      if (DS[j].drv_minor==-1) continue;
+      if (DriveStruct[j].drv_minor==-1) continue;
       switch_drive(j);
       xy_DriveReset();
       if (!st_spinning) xx_SpinUp();
-      DS[d].sbp_first_frame = -1;  /* First frame in buffer */
-      DS[d].sbp_last_frame = -1;   /* Last frame in buffer  */
-      DS[d].sbp_read_frames = 0;   /* Number of frames being read to buffer */
-      DS[d].sbp_current = 0;       /* Frame being currently read */
-      DS[d].CD_changed=1;
-      DS[d].frame_size=CD_FRAMESIZE;
+      DriveStruct[d].sbp_first_frame = -1;  /* First frame in buffer */
+      DriveStruct[d].sbp_last_frame = -1;   /* Last frame in buffer  */
+      DriveStruct[d].sbp_read_frames = 0;   /* Number of frames being read to buffer */
+      DriveStruct[d].sbp_current = 0;       /* Frame being currently read */
+      DriveStruct[d].CD_changed=1;
+      DriveStruct[d].frame_size=CD_FRAMESIZE;
 
       xx_ReadStatus();
       i=ResponseStatus();  /* returns orig. status or p_busy_new */
@@ -3084,7 +3084,7 @@ u_long sbpcd_init(u_long mem_start, u_long mem_end)
        }
       DPRINTF((DBG_INI,"SBPCD: init: first GetStatus: %d\n",i));
       sti(); /* to avoid possible "printk" bug */
-      if (DS[d].error_byte==aud_12)
+      if (DriveStruct[d].error_byte==aud_12)
        {
          do { i=GetStatus();
               DPRINTF((DBG_INI,"SBPCD: init: second GetStatus: %02X\n",i));
@@ -3095,7 +3095,7 @@ u_long sbpcd_init(u_long mem_start, u_long mem_end)
          while (!st_diskok);
        }
       i=SetSpeed();
-      if (i>=0) DS[d].CD_changed=1;
+      if (i>=0) DriveStruct[d].CD_changed=1;
     }
 
   if (sbpro_type)
@@ -3129,8 +3129,8 @@ u_long sbpcd_init(u_long mem_start, u_long mem_end)
  */ 
   for (j=0;j<NR_SBPCD;j++)
     {
-      if (DS[j].drv_minor==-1) continue;
-      DS[j].sbp_buf=(u_char *)mem_start;
+      if (DriveStruct[j].drv_minor==-1) continue;
+      DriveStruct[j].sbp_buf=(u_char *)mem_start;
       mem_start += SBP_BUFFER_FRAMES*CD_FRAMESIZE;
     }
   DPRINTF((DBG_INF,"SBPCD: init done.\n"));
@@ -3157,30 +3157,30 @@ int check_sbpcd_media_change(int full_dev, int unused_minor)
   
   xx_ReadStatus();                         /* command: give 1-byte status */
   st=ResponseStatus();
-  DPRINTF((DBG_CHK,"SBPCD: media_check: %02X\n",DS[d].status_byte));
+  DPRINTF((DBG_CHK,"SBPCD: media_check: %02X\n",DriveStruct[d].status_byte));
   if (st<0)
     {
       DPRINTF((DBG_INF,"SBPCD: media_check: ResponseStatus error.\n"));
       return (1); /* status not obtainable */
     }
-  if (DS[d].CD_changed==0xFF) DPRINTF((DBG_CHK,"SBPCD: media_check: \"changed\" assumed.\n"));
+  if (DriveStruct[d].CD_changed==0xFF) DPRINTF((DBG_CHK,"SBPCD: media_check: \"changed\" assumed.\n"));
   if (!st_spinning) DPRINTF((DBG_CHK,"SBPCD: media_check: motor off.\n"));
   if (!st_door_closed)
     {
       DPRINTF((DBG_CHK,"SBPCD: media_check: door open.\n"));
-      DS[d].CD_changed=0xFF;
+      DriveStruct[d].CD_changed=0xFF;
     }
   if (!st_caddy_in)
     {
       DPRINTF((DBG_CHK,"SBPCD: media_check: no disk in drive.\n"));
-      DS[d].CD_changed=0xFF;
+      DriveStruct[d].CD_changed=0xFF;
     }
   if (!st_diskok) DPRINTF((DBG_CHK,"SBPCD: media_check: !st_diskok.\n"));
   
 #if 0000
-  if (DS[d].CD_changed==0xFF)
+  if (DriveStruct[d].CD_changed==0xFF)
     {
-      DS[d].CD_changed=1;
+      DriveStruct[d].CD_changed=1;
       return (1); /* driver had a change detected before */
     }
 #endif 0000 /* seems to give additional errors at the moment */
index ff146d50ac67c6c78dfe0280a5e1663f7246b172..657b5e18efec540a7e613bdc1863796231c07b16 100644 (file)
@@ -482,6 +482,10 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
                        put_tty_queue(c, tty);
                        tty->canon_head = tty->read_head;
                        tty->canon_data++;
+                       if (tty->fasync)
+                               kill_fasync(tty->fasync, SIGIO);
+                       if (tty->read_wait)
+                               wake_up_interruptible(&tty->read_wait);
                        return;
                }
        }
@@ -560,8 +564,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, unsigned char *cp,
                        tty->driver.flush_chars(tty);
        }
 
-       if (tty->icanon ? tty->canon_data :
-           (tty->read_cnt >= tty->minimum_to_wake)) {
+       if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) {
                if (tty->fasync)
                        kill_fasync(tty->fasync, SIGIO);
                if (tty->read_wait)
index f0e6a1d9e7c336f3d396e74b2019c75b20f61850..3bc33c252fdce3777293913228b42ff68e2831ea 100644 (file)
@@ -1006,8 +1006,8 @@ static void shutdown(struct async_struct * info)
        cli();
        
        if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
-               info->MCR &= ~UART_MCR_DTR;
-               info->MCR_noint &= ~UART_MCR_DTR;
+               info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
+               info->MCR_noint &= ~(UART_MCR_DTR|UART_MCR_RTS);
        }
        serial_outp(info, UART_MCR, info->MCR_noint);
 
index 3476788bb9a3624f1350912d5b8e984a3aa469af..4d215c9e0614b2acc7dff961c4028feb66ebe4cf 100644 (file)
@@ -302,7 +302,7 @@ static char *format_names[] = {
  * Exception 16 (BOM) is added for beginning-of-media (catch BOM).
  */
 static struct exception_list_type {
-       short mask, code;
+       unsigned short mask, code;
        char *msg;
 } exception_list[] = {
        {0, 0,
@@ -1008,7 +1008,7 @@ static int ll_do_qic_cmd(int cmd, time_t timeout)
                stat = TE_OK;
        }
        if (stat != TE_OK) {
-               printk(TPQIC_NAME ": ll_do_qic_cmd(%x, %d) failed\n", cmd, timeout);
+               printk(TPQIC_NAME ": ll_do_qic_cmd(%x, %ld) failed\n", cmd, timeout);
                return -EIO;
        }
 
@@ -1044,7 +1044,7 @@ static int ll_do_qic_cmd(int cmd, time_t timeout)
        /* sense() will set eof/eom as required */
        if (stat==TE_EX) {
                if (tp_sense(TP_WRP|TP_BOM|TP_EOM|TP_FIL)!=TE_OK) {
-                       printk(TPQIC_NAME ": Exception persist in ll_do_qic_cmd[1](%x, %d)", cmd, timeout);
+                       printk(TPQIC_NAME ": Exception persist in ll_do_qic_cmd[1](%x, %ld)", cmd, timeout);
                        status_dead = YES;
                        return -ENXIO;
                        /* if rdstatus fails too, we're in trouble */
@@ -1065,7 +1065,7 @@ static int ll_do_qic_cmd(int cmd, time_t timeout)
                if (tp_sense((cmd==QCMD_SEEK_EOD ?              /*****************************/
                      TP_EOR|TP_NDT|TP_UDA|TP_BNL|TP_WRP|TP_BOM|TP_EOM|TP_FIL :
                      TP_WRP|TP_BOM|TP_EOM|TP_FIL))!=TE_OK) {
-                       printk(TPQIC_NAME ": Exception persist in ll_do_qic_cmd[2](%x, %d)\n", cmd, timeout);
+                       printk(TPQIC_NAME ": Exception persist in ll_do_qic_cmd[2](%x, %ld)\n", cmd, timeout);
                        if (cmd!=QCMD_RD_FM)
                                status_dead = YES;
                        return -ENXIO;
@@ -1816,7 +1816,7 @@ static int tape_qic02_read(struct inode * inode, struct file * filp, char * buf,
        int stat;
 
        if (TP_DIAGS(current_tape_dev))
-               printk(TPQIC_NAME ": request READ, minor=%x, buf=%p, count=%x, pos=%x, flags=%x\n",
+               printk(TPQIC_NAME ": request READ, minor=%x, buf=%p, count=%x, pos=%lx, flags=%x\n",
                        MINOR(dev), buf, count, filp->f_pos, flags);
 
        if (count % TAPE_BLKSIZE) {     /* Only allow mod 512 bytes at a time. */
@@ -1849,7 +1849,7 @@ static int tape_qic02_read(struct inode * inode, struct file * filp, char * buf,
 
                /* Must ensure that user program sees exactly one EOF token (==0) */
                if (return_read_eof==YES) {
-                       printk("read: return_read_eof==%d, reported_read_eof==%d, total_bytes_done==%d\n", return_read_eof, reported_read_eof, total_bytes_done);
+                       printk("read: return_read_eof==%d, reported_read_eof==%d, total_bytes_done==%ld\n", return_read_eof, reported_read_eof, total_bytes_done);
 
                        if (reported_read_eof==NO) {
                                /* have not yet returned EOF to user program */
@@ -1985,7 +1985,7 @@ static int tape_qic02_write(struct inode * inode, struct file * filp, char * buf
        unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
 
        if (TP_DIAGS(current_tape_dev))
-               printk(TPQIC_NAME ": request WRITE, minor=%x, buf=%p, count=%x, pos=%x, flags=%x\n",
+               printk(TPQIC_NAME ": request WRITE, minor=%x, buf=%p, count=%x, pos=%lx, flags=%x\n",
                        MINOR(dev), buf, count, filp->f_pos, flags);
 
        if (count % TAPE_BLKSIZE) {     /* only allow mod 512 bytes at a time */
@@ -2107,7 +2107,7 @@ static int tape_qic02_write(struct inode * inode, struct file * filp, char * buf
                }
        }
        tpqputs("write request for <0 bytes");
-       printk(TPQIC_NAME ": status_bytes_wr %x, buf %p, total_bytes_done %x, count %x\n", status_bytes_wr, buf, total_bytes_done, count);
+       printk(TPQIC_NAME ": status_bytes_wr %x, buf %p, total_bytes_done %lx, count %x\n", status_bytes_wr, buf, total_bytes_done, count);
        return -EINVAL;
 } /* tape_qic02_write */
 
@@ -2337,7 +2337,7 @@ static int tape_qic02_ioctl(struct inode * inode, struct file * filp,
 #endif
 
        if (TP_DIAGS(current_tape_dev))
-               printk(TPQIC_NAME ": ioctl(%4x, %4x, %4x)\n", dev_maj, iocmd, ioarg);
+               printk(TPQIC_NAME ": ioctl(%4x, %4x, %4lx)\n", dev_maj, iocmd, ioarg);
 
        if (!inode || !ioarg)
                return -EINVAL;
index 3ea22e5187a1c7f781db6a0fae0463211ce04723..3d5b4309bc10866538ffbde89ca8ded0fe4e3239 100644 (file)
@@ -180,18 +180,18 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
        tty->termios->c_line = ldisc;
        if (tty->ldisc.open) {
                retval = (tty->ldisc.open)(tty);
-               if (!retval)
-                       return 0;
+               if (retval >= 0)
+                       return retval;
                
                tty->ldisc = o_ldisc;
                tty->termios->c_line = tty->ldisc.num;
-               if (tty->ldisc.open && tty->ldisc.open(tty)) {
+               if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) {
                        tty->ldisc = ldiscs[N_TTY];
                        tty->termios->c_line = N_TTY;
                        if (tty->ldisc.open) {
                                int r = tty->ldisc.open(tty);
 
-                               if (r)
+                               if (r < 0)
                                        panic("Couldn't open N_TTY ldisc for "
                                              "%s --- error %d.",
                                              tty_name(tty), r);
@@ -344,9 +344,9 @@ void do_tty_hangup(struct tty_struct * tty, struct file_operations *fops)
                tty->termios->c_line = N_TTY;
                if (tty->ldisc.open) {
                        i = (tty->ldisc.open)(tty);
-                       if (i)
+                       if (i < 0)
                                printk("do_tty_hangup: N_TTY open: error %d\n",
-                                      i);
+                                      -i);
                }
        }
        
@@ -815,7 +815,7 @@ repeat:
                (*driver->refcount)++;
                if (tty->ldisc.open) {
                        retval = (tty->ldisc.open)(tty);
-                       if (retval)
+                       if (retval < 0)
                                goto end_init;
                }
                tty = NULL;
@@ -836,7 +836,7 @@ repeat:
                        (*driver->other->refcount)++;
                        if (o_tty->ldisc.open) {
                                retval = (o_tty->ldisc.open)(o_tty);
-                               if (retval)
+                               if (retval < 0)
                                        goto end_init;
                        }
                        o_tty = NULL;
index 8efee3cfc198f0921c68bdc1b2a34e66ccfdb4f4..fe37f9cf8b77d0a943d9f0f98cf9c1d78af980e1 100644 (file)
@@ -41,6 +41,11 @@ static char *version =
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
+#ifdef MODULE
+#include <linux/module.h>
+#include "../../tools/version.h"
+#endif
+
 #ifndef HAVE_AUTOIRQ
 /* From auto_irq.c, should be in a *.h file. */
 extern void autoirq_setup(int waittime);
@@ -223,6 +228,9 @@ el_open(struct device *dev)
   outb(AX_RX, AX_CMD); /* Aux control, irq and receive enabled */
   if (el_debug > 2)
      printk("finished el_open().\n");
+#ifdef MODULE
+  MOD_INC_USE_COUNT;
+#endif       
   return (0);
 }
 
@@ -463,6 +471,9 @@ el1_close(struct device *dev)
     outb(AX_RESET, AX_CMD);    /* Reset the chip */
     irq2dev_map[dev->irq] = 0;
 
+#ifdef MODULE
+    MOD_DEC_USE_COUNT;
+#endif    
     return 0;
 }
 
@@ -499,3 +510,31 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
  *  kept-new-versions: 5
  * End:
  */
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_3c501 = {
+       "" /*"3c501"*/, 
+               0, 0, 0, 0,
+               0x280, 7,
+               0, 0, 0, NULL, el1_probe };
+       
+int
+init_module(void)
+{
+       if (register_netdev(&dev_3c501) != 0)
+               return -EIO;
+       return 0;
+}
+
+void
+cleanup_module(void)
+{
+       if (MOD_IN_USE)
+               printk("3c501: device busy, remove delayed\n");
+       else
+       {
+               unregister_netdev(&dev_3c501);
+       }
+}
+#endif /* MODULE */
index 60be2f58f5dc5eb27e0c542260cd19e838ea5398..ffef7fff9cf39f4423364b8ae094f3b35baac744 100644 (file)
@@ -1,3 +1,7 @@
 MODULES = \
        3c509.o \
-       de600.o
+       de600.o \
+       3c501.o \
+       plip.o
+
+
index 76761abf21b407bab71a4bf2869b47d01a3fc3ca..44bb05180f9747fb8e60624cbf1022ee18cfdf65 100644 (file)
@@ -74,6 +74,14 @@ slip.o:      slip.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 endif
 
+ifdef CONFIG_DE650
+NETDRV_OBJS := $(NETDRV_OBJS) net.a(de650.o)
+CONFIG_8390 = CONFIG_8390
+endif
+ifdef CONFIG_3C589
+NETDRV_OBJS := $(NETDRV_OBJS) net.a(3c589.o)
+endif
+
 ifdef CONFIG_DE600
 NETDRV_OBJS := $(NETDRV_OBJS) net.a(de600.o)
 endif
index 694c85ab80661c81f55b1cf3511e0e997cc6c876..290ac256b3c50cf7eae1dfe3f8ba41fb855d6c19 100644 (file)
@@ -26,6 +26,7 @@
  */
 #include <linux/config.h>
 #include <linux/netdevice.h>
+#include <linux/errno.h>
 
 #define LOOPBACK                       /* always present, right?       */
 
@@ -123,6 +124,39 @@ ethif_probe(struct device *dev)
     return 0;
 }
 
+#ifdef CONFIG_PCMCIA_NET
+extern int dl_open(struct device *dev);
+extern int tc589_open(struct device *dev);
+extern int ibmccae_open(struct device *dev);
+static int pc_eth_open(struct device *dev);
+
+static int pc_eth_probe(struct device *dev)
+  {
+  dev->open = &pc_eth_open;
+  dev->set_config = &ether_config;
+  dev->tbusy = 1;
+  return 0;
+  }
+
+static int pc_eth_open(struct device *dev)
+  {
+  if (1
+#ifdef CONFIG_DE650
+      && dl_open(dev)
+#endif
+#ifdef CONFIG_3C589
+      && tc589_open(dev)
+#endif
+#ifdef CONFIG_IBMCCAE
+      && ibmccae_open(dev)
+#endif
+      && 1)
+    return -ENODEV;
+  else
+    return 0;
+  }
+#endif /* CONFIG_PCMCIA_NET */
+
 
 /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
 #ifdef CONFIG_ATP              /* AT-LAN-TEC (RealTek) pocket adaptor. */
@@ -132,6 +166,17 @@ static struct device atp_dev = {
 #   define NEXT_DEV    (&atp_dev)
 #endif
 
+#ifdef CONFIG_PCMCIA_NET
+static struct device pc_eth1_dev = {
+    "pc_eth1", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, pc_eth_probe,
+    };
+static struct device pc_eth0_dev = {
+    "pc_eth0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &pc_eth1_dev, pc_eth_probe,
+    };
+#   undef NEXT_DEV
+#   define NEXT_DEV    (&pc_eth0_dev)
+#endif /* CONFIG_PCMCIA_NET */
+
 /* The first device defaults to I/O base '0', which means autoprobe. */
 #ifndef ETH0_ADDR
 # define ETH0_ADDR 0
index 0c75a1ab8f6aad04eedc7c0de897e726e95c4618..295ef7c027a7d12887f65f66aea8d3159d46425b 100644 (file)
@@ -165,6 +165,23 @@ void ether_setup(struct device *dev)
        dev->pa_alen    = sizeof(unsigned long);
 }
 
+int ether_config(struct device *dev, struct ifmap *map)
+{
+       if (map->mem_start != (u_long)(-1))
+               dev->mem_start = map->mem_start;
+       if (map->mem_end != (u_long)(-1))
+               dev->mem_end = map->mem_end;
+       if (map->base_addr != (u_short)(-1))
+               dev->base_addr = map->base_addr;
+       if (map->irq != (u_char)(-1))
+               dev->irq = map->irq;
+       if (map->dma != (u_char)(-1))
+               dev->dma = map->dma;
+       if (map->port != (u_char)(-1))
+               dev->if_port = map->port;
+       return 0;
+}
+
 int register_netdev(struct device *dev)
 {
        struct device *d = dev_base;
index 8a6dc92c7d72a9dfcfcbb965d5a8f78805e7a481..b89a8a1b8c11b6a3d154bdbca91175bd3bdcafce 100644 (file)
@@ -17,7 +17,9 @@
  *     Tested this against ncsa-telnet 2.3 and pcip_pkt using plip.com (which
  *     contains "version       equ     0" and ";History:562,1" in the firts 2
  *    source-lines                                             28-Mar-94
- *     
+ *
+ *     Modularised it (Alan Cox). Will upgrade to Niibe's PLIP once its settled
+ *     down better.
  *     
  *
  *  This is parallel port packet pusher.  It's actually more general
  *  Info:
  *             I <Alan> got 15K/second NFS throughput (about 20-25K second IP). I also got some ethernet cards
  *     so don't ask me for help. This code needs a real major rewrite. Any volunteers ?
+ *
+ ***** So we can all compare loads of different PLIP drivers for a bit I've modularised this beastie too.
+ ***** In addition a seperate bidirectional plip module can be done.
  */
 
 static char *version =
-    "NET3 PLIP.010 (from plip.c:v0.15 for 0.99pl12+, 8/11/93)\n";
+    "NET3 "
+#ifdef MODULE
+    "MODULAR "    
+#endif    
+    "PLIP.010 (from plip.c:v0.15 for 0.99pl12+, 8/11/93)\n";
 
 #include <linux/config.h>
 
@@ -95,6 +104,11 @@ make one yourself.  The wiring is:
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
+#ifdef MODULE
+#include <linux/module.h>
+#include "../../tools/version.h"
+#endif
+
 #ifdef PRINTK
 #undef PRINTK
 #endif
@@ -219,8 +233,8 @@ plip_init(struct device *dev)
    This routine gets exclusive access to the parallel port by allocating
    its IRQ line.
    */
-static int
-plip_open(struct device *dev)
+   
+static int plip_open(struct device *dev)
 {
     if (dev->irq == 0)
        dev->irq = 7;
@@ -237,6 +251,9 @@ plip_open(struct device *dev)
     dev->tbusy = 0;
     dev->interrupt = 0;
     dev->start = 1;
+#ifdef MODULE
+    MOD_INC_USE_COUNT;
+#endif        
     return 0;
 }
 
@@ -251,6 +268,9 @@ plip_close(struct device *dev)
     irq2dev_map[dev->irq] = NULL;
     sti();
     outb(0x00, dev->base_addr);                /* Release the interrupt. */
+#ifdef MODULE
+    MOD_DEC_USE_COUNT;
+#endif        
     return 0;
 }
 
@@ -746,3 +766,76 @@ plip_get_stats(struct device *dev)
  *  kept-new-versions: 5
  * End:
  */
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+
+static struct device dev_plip0 = 
+{
+       "plip0" /*"plip"*/,
+       0, 0, 0, 0,             /* memory */
+       0x3BC, 5,               /* base, irq */
+       0, 0, 0, NULL, plip_init 
+};
+
+static struct device dev_plip1 = 
+{
+       "plip1" /*"plip"*/,
+       0, 0, 0, 0,             /* memory */
+       0x378, 7,               /* base, irq */
+       0, 0, 0, NULL, plip_init 
+};
+
+static struct device dev_plip2 = 
+{
+       "plip2" /*"plip"*/,
+       0, 0, 0, 0,             /* memory */
+       0x278, 2,               /* base, irq */
+       0, 0, 0, NULL, plip_init 
+};
+
+int
+init_module(void)
+{
+       int err;
+
+       if ( ((err=register_netdev(&dev_plip0)) == 0) &&
+            ((err=register_netdev(&dev_plip1)) == 0) &&
+            ((err=register_netdev(&dev_plip2)) == 0)
+          )
+       {
+               if(err==-EEXIST)
+                       printk("plip devices already present. Module not loaded.\n");
+               return err;
+       }
+       return 0;
+}
+
+void
+cleanup_module(void)
+{
+       if (MOD_IN_USE)
+               printk("plip: device busy, remove delayed\n");
+       else
+       {
+               unregister_netdev(&dev_plip0);
+               if(dev_plip0.priv)
+               {
+                       kfree_s(dev_plip0.priv,sizeof(struct netstats));
+                       dev_plip0.priv=NULL;
+               }
+               unregister_netdev(&dev_plip1);
+               if(dev_plip1.priv)
+               {
+                       kfree_s(dev_plip1.priv,sizeof(struct netstats));
+                       dev_plip0.priv=NULL;
+               }
+               unregister_netdev(&dev_plip2);
+               if(dev_plip2.priv)
+               {
+                       kfree_s(dev_plip2.priv,sizeof(struct netstats));
+                       dev_plip2.priv=NULL;
+               }
+       }
+}
+#endif /* MODULE */
index eef50eac617c83e344945eb01065fb2bb512690e..8f87fa08266d3a4b2c953a16f8c26ea8509053e0 100644 (file)
@@ -377,9 +377,9 @@ ppp_changedmtu (struct ppp *ppp, int new_mtu, int new_mru)
   PRINTKN (2,(KERN_INFO "ppp: channel %s mtu = %d, mru = %d\n",
              dev->name, new_mtu, new_mru));
        
-  new_xbuff = (unsigned char *) kmalloc(mtu + 4, GFP_KERNEL);
-  new_rbuff = (unsigned char *) kmalloc(mru + 4, GFP_KERNEL);
-  new_cbuff = (unsigned char *) kmalloc(mru + 4, GFP_KERNEL);
+  new_xbuff = (unsigned char *) kmalloc(mtu + 4, GFP_ATOMIC);
+  new_rbuff = (unsigned char *) kmalloc(mru + 4, GFP_ATOMIC);
+  new_cbuff = (unsigned char *) kmalloc(mru + 4, GFP_ATOMIC);
 /*
  *  If the buffers failed to allocate then complain.
  */
@@ -558,11 +558,7 @@ ppp_open(struct tty_struct *tty)
 
   PRINTKN (2,(KERN_INFO "ppp: channel %s open\n", ppp->dev->name));
 
-#ifdef NEW_TTY_DRIVERS
-  return (0);
-#else
   return (ppp->line);
-#endif
 }
 
 /* called when ppp interface goes "up".  here this just means we start
index cda33a035e017f4c10204fc068e484be75b941ad..4d6bfea03b015b638193e3510cccf56d459aaf6b 100644 (file)
@@ -17,6 +17,8 @@
  *           Renamed "route_get_info()" to "rt_get_info()" for consistency.
  * Alan Cox (gw4pts@gw4pts.ampr.org) 4/94
  *           Dusted off the code and added IPX. Fixed the 4K limit.
+ * Erik Schoenfelder (schoenfr@ibr.cs.tu-bs.de)
+ *           /proc/net/snmp.
  *
  *  proc net directory handling functions
  */
@@ -47,6 +49,7 @@ extern int arp_get_info(char *, char **, off_t, int);
 extern int rarp_get_info(char *, char **, off_t, int);
 extern int dev_get_info(char *, char **, off_t, int);
 extern int rt_get_info(char *, char **, off_t, int);
+extern int snmp_get_info(char *, char **, off_t, int);
 #endif /* CONFIG_INET */
 #ifdef CONFIG_IPX
 extern int ipx_get_info(char *, char **, off_t, int);
@@ -107,22 +110,23 @@ static struct proc_dir_entry net_dir[] = {
        { 131,3,"dev" },
        { 132,3,"raw" },
        { 133,3,"tcp" },
-       { 134,3,"udp" }
+       { 134,3,"udp" },
+       { 135,4,"snmp" }
 #ifdef CONFIG_INET_RARP
-       ,{ 135,4,"rarp"}
+       ,{ 136,4,"rarp"}
 #endif
 #endif /* CONFIG_INET */
 #ifdef CONFIG_IPX
-       ,{ 136,9,"ipx_route" },
-       { 137,3,"ipx" }
+       ,{ 137,9,"ipx_route" },
+       { 138,3,"ipx" }
 #endif /* CONFIG_IPX */
 #ifdef CONFIG_AX25
-       ,{ 138,10,"ax25_route" },
-       { 139,4,"ax25" }
+       ,{ 139,10,"ax25_route" },
+       { 140,4,"ax25" }
 #ifdef CONFIG_NETROM
-       ,{ 140,8,"nr_nodes" },
-       { 141,8,"nr_neigh" },
-       { 142,2,"nr" }
+       ,{ 141,8,"nr_nodes" },
+       { 142,8,"nr_neigh" },
+       { 143,2,"nr" }
 #endif /* CONFIG_NETROM */
 #endif /* CONFIG_AX25 */
 };
@@ -235,35 +239,38 @@ static int proc_readnet(struct inode * inode, struct file * file,
                        case 134:
                                length = udp_get_info(page,&start,file->f_pos,thistime);
                                break;
-#ifdef CONFIG_INET_RARP                                
                        case 135:
+                               length = snmp_get_info(page, &start, file->f_pos,thistime);
+                               break;
+#ifdef CONFIG_INET_RARP                                
+                       case 136:
                                length = rarp_get_info(page,&start,file->f_pos,thistime);
                                break;
 #endif /* CONFIG_INET_RARP */                          
 #endif /* CONFIG_INET */
 #ifdef CONFIG_IPX
-                       case 136:
+                       case 137:
                                length = ipx_rt_get_info(page,&start,file->f_pos,thistime);
                                break;
-                       case 137:
+                       case 138:
                                length = ipx_get_info(page,&start,file->f_pos,thistime);
                                break;
 #endif /* CONFIG_IPX */
 #ifdef CONFIG_AX25
-                       case 138:
+                       case 139:
                                length = ax25_rt_get_info(page,&start,file->f_pos,thistime);
                                break;
-                       case 139:
+                       case 140:
                                length = ax25_get_info(page,&start,file->f_pos,thistime);
                                break;
 #ifdef CONFIG_NETROM
-                       case 140:
+                       case 141:
                                length = nr_nodes_get_info(page,&start,file->f_pos,thistime);
                                break;
-                       case 141:
+                       case 142:
                                length = nr_neigh_get_info(page,&start,file->f_pos,thistime);
                                break;
-                       case 142:
+                       case 143:
                                length = nr_get_info(page,&start,file->f_pos,thistime);
                                break;
 #endif /* CONFIG_NETROM */
index 4afb9e9d531f52d1d0ad003931fdf5f6009309ea..4b93762f5721bd054ae986f18a9ebe726f784fba 100644 (file)
@@ -662,5 +662,6 @@ void mount_root(void)
                        return;
                }
        }
-       panic("VFS: Unable to mount root");
+       panic("VFS: Unable to mount root fs on %02x:%02x",
+               MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
 }
index 721c73dfdd515bb31c4e8e84447a51eacf20789d..650b75ee138b0e44de67368d0cd8ebc64af666e2 100644 (file)
@@ -193,9 +193,10 @@ extern int         dev_ioctl(unsigned int cmd, void *);
 
 extern void            dev_init(void);
 
-/* This function lives elsewhere (drivers/net/net_init.c but is related) */
+/* These functions live elsewhere (drivers/net/net_init.c, but related) */
 
 extern void            ether_setup(struct device *dev);
+extern int             ether_config(struct device *dev, struct ifmap *map);
 /* Support for loadable net-drivers */
 extern int             register_netdev(struct device *dev);
 extern void            unregister_netdev(struct device *dev);
index 0a2923573055a98c29f1be9e89b15a65257f5eb0..48efbed62068225b770fb1d11a04ad04159168b6 100644 (file)
 /*
  * disk states (bits of diskstate_flags):
  */
-#define upc_valid (DS[d].diskstate_flags&upc_bit)
-#define volume_valid (DS[d].diskstate_flags&volume_bit)
-#define toc_valid (DS[d].diskstate_flags&toc_bit)
-#define multisession_valid (DS[d].diskstate_flags&multisession_bit)
-#define cd_size_valid (DS[d].diskstate_flags&cd_size_bit)
-#define subq_valid (DS[d].diskstate_flags&subq_bit)
-#define frame_size_valid (DS[d].diskstate_flags&frame_size_bit)
+#define upc_valid (DriveStruct[d].diskstate_flags&upc_bit)
+#define volume_valid (DriveStruct[d].diskstate_flags&volume_bit)
+#define toc_valid (DriveStruct[d].diskstate_flags&toc_bit)
+#define multisession_valid (DriveStruct[d].diskstate_flags&multisession_bit)
+#define cd_size_valid (DriveStruct[d].diskstate_flags&cd_size_bit)
+#define subq_valid (DriveStruct[d].diskstate_flags&subq_bit)
+#define frame_size_valid (DriveStruct[d].diskstate_flags&frame_size_bit)
 
 
 /*
 /*
  * used drive states:
  */
-#define st_door_closed (DS[d].status_byte&p_door_closed)
-#define st_caddy_in (DS[d].status_byte&p_caddy_in)
-#define st_spinning (DS[d].status_byte&p_spinning)
-#define st_check (DS[d].status_byte&p_check)
-#define st_busy (DS[d].status_byte&p_busy_new)
-#define st_door_locked (DS[d].status_byte&p_door_locked)
-#define st_diskok (DS[d].status_byte&p_disk_ok)
+#define st_door_closed (DriveStruct[d].status_byte&p_door_closed)
+#define st_caddy_in (DriveStruct[d].status_byte&p_caddy_in)
+#define st_spinning (DriveStruct[d].status_byte&p_spinning)
+#define st_check (DriveStruct[d].status_byte&p_check)
+#define st_busy (DriveStruct[d].status_byte&p_busy_new)
+#define st_door_locked (DriveStruct[d].status_byte&p_door_locked)
+#define st_diskok (DriveStruct[d].status_byte&p_disk_ok)
 
 /*
  * bits of the CDi_status register:
 /*
  * drv_099 and drv_100 are the "new" drives
  */
-#define new_drive (DS[d].drv_type&0x10)
+#define new_drive (DriveStruct[d].drv_type&0x10)
 
 /*
  * audio states:
index 1dd03e17ed07fd69e93024b8a77c8652f0805997..1b5bd3af8cf9b298c1832a0dfc105c3a87776d8f 100644 (file)
@@ -68,7 +68,11 @@ struct sk_buff {
                                used,
                                free,
                                arp;
-  unsigned char                        tries,lock,localroute;
+  unsigned char                        tries,lock,localroute,pkt_type;
+#define PACKET_HOST            0               /* To us */
+#define PACKET_BROADCAST       1
+#define PACKET_MULTICAST       2
+#define PACKET_OTHERHOST       3               /* Unmatched promiscuous */
   unsigned short               users;          /* User count - see datagram.c (and soon seqpacket.c/stream.c) */
 #ifdef CONFIG_SLAVE_BALANCING
   unsigned short               in_dev_queue;
index 38641363c6e96f2d0ba4e1d6a7ede1c861b4f5b7..f0fbab682963c74327291da87fb58bdba05ecab3 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_TERMIOS_H
 #define _LINUX_TERMIOS_H
 
+#include <linux/types.h>
+
 /* 0x54 is just a magic number to make these relatively uniqe ('T') */
 
 #define TCGETS         0x5401
index d299ff7706d9721d536a7131854fd15392d2e0cc..89740b008d00ac29b2c259fd3cab36f22a94b305 100644 (file)
@@ -5,6 +5,7 @@
  * 'tty.h' defines some structures used by tty_io.c and some defines.
  */
 
+#include <linux/fs.h>
 #include <linux/termios.h>
 #include <linux/tqueue.h>
 #include <linux/tty_driver.h>
index 72fba1b2fadb3aff5972876d3bb9b588758399d4..cb95160432a041698df0202403c47440c074007b 100644 (file)
@@ -87,6 +87,8 @@
  * 
  */
 
+#include <linux/fs.h>
+
 struct tty_driver {
        int     magic;          /* magic number for this structure */
        char    *name;
index 9fd14e6bfafd5931f28c6a5946350f1c445fec10..732f5a115a6df8fea3f67d0d17486ac4fcf52b41 100644 (file)
@@ -5,6 +5,9 @@
  * Definitions for the tty line discipline
  */
 
+#include <linux/fs.h>
+#include <linux/wait.h>
+
 struct tty_ldisc {
        int     magic;
        int     num;
index 4a175d01f8628d52c6e28e0c6874c72f78aa5618..d8e7ca0ea1bd3ca35fc0e5e49ab1ba3af9485b70 100644 (file)
@@ -1 +1 @@
-3c509.o de600.o
+3c509.o de600.o 3c501.o plip.o
index f777dee64da038219edc57ea0b317c3fa37f3b9a..67f6d732312fc92ae52bd7d82479baa937296f12 100644 (file)
@@ -1,5 +1,18 @@
 This is snapshot 014
 
+Fixes added for 1.1.15
+o      Modular PLIP and 3c501 drivers. Now you -can- have multiple 3c501's
+       (sort of).
+o      Integrated new AX.25 - this will be ready for the big time in a few
+       releases.
+
+Fixes added for 1.1.14
+
+o      Compiles properly on the whole 8)
+o      Yet more Unix /proc protection.
+o      Modular PLIP and 3c501 drivers. Now you -can- have multiple 3c501's
+       (sort of).
+
 This fixes the following from the 1.1.12 release (see the relevant files
 for the credits to authors).
 
index 96496389a5baac7f340d2fa5072fad0280f620b4..c439862108075177cd690e1ee38466b589bef313 100644 (file)
@@ -292,7 +292,10 @@ int dev_close(struct device *dev)
                 */
 #ifdef CONFIG_INET              
                ip_rt_flush(dev);
-#endif         
+#endif 
+#ifdef CONFIG_IPX
+               ipxrtr_device_down(dev);
+#endif 
                /*
                 *      Blank the IP addresses
                 */
index f3fe763ad54aab27d7e42a8ea533819ed8b52f93..ad4c428896cadb3fb011f1d452149a6519cee526 100644 (file)
@@ -167,7 +167,21 @@ unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
 {
        struct ethhdr *eth = (struct ethhdr *) skb->data;
        char *rawp;
-
+       
+       if(*eth->h_dest&1)
+       {
+               if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
+                       skb->pkt_type=PACKET_BROADCAST;
+               else
+                       skb->pkt_type=PACKET_MULTICAST;
+       }
+       
+       if(dev->flags&IFF_PROMISC)
+       {
+               if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN))
+                       skb->pkt_type=PACKET_OTHERHOST;
+       }
+       
        if (ntohs(eth->h_proto) >= 1536)
                return eth->h_proto;
                
index 09540eff2517dbe997a57ff1acf35e45f444a488..2743352df9ffe4fd8793f2f1ec88634f393c7de2 100644 (file)
@@ -177,6 +177,7 @@ static int ip_send(struct sk_buff *skb, unsigned long daddr, int len, struct dev
        return mac;
 }
 
+int ip_id_count = 0;
 
 /*
  * This routine builds the appropriate hardware/IP headers for
@@ -192,7 +193,6 @@ int ip_build_header(struct sk_buff *skb, unsigned long saddr, unsigned long dadd
        struct rtable *rt;
        unsigned char *buff;
        unsigned long raddr;
-       static int count = 0;
        int tmp;
        unsigned long src;
 
@@ -295,8 +295,7 @@ int ip_build_header(struct sk_buff *skb, unsigned long saddr, unsigned long dadd
        iph->saddr    = saddr;
        iph->protocol = type;
        iph->ihl      = 5;
-       iph->id       = htons(count++);
-
+  
        /* Setup the IP options. */
 #ifdef Not_Yet_Avail
        build_options(iph, opt);
@@ -1250,25 +1249,6 @@ static void ip_forward(struct sk_buff *skb, struct device *dev, int is_frag)
        unsigned char *ptr;     /* Data pointer */
        unsigned long raddr;    /* Router IP address */
 
-       /*
-        * Only forward packets that were fired at us when we are in promiscuous
-        * mode. In standard mode we rely on the driver to filter for us.
-        *
-        * This is a mess. When the drivers class packets on the upcall this
-        * will tidy up!
-        */
-   
-       if(dev->flags&IFF_PROMISC)
-       {
-               if(memcmp(skb->data,dev->dev_addr,dev->addr_len))
-                       return;
-       }
-       
-       if(!memcmp(skb->data,dev->broadcast, dev->addr_len))
-               return;
-       
-
-  
        /*
         *      According to the RFC, we must first decrease the TTL field. If
         *      that reaches zero, we must reply an ICMP control message telling
@@ -1516,7 +1496,16 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
 
        if ((brd = ip_chk_addr(iph->daddr)) == 0) 
        {
+               /*
+                *      Don't forward multicast or broadcast frames.
+                */
        
+               if(skb->pkt_type!=PACKET_HOST)
+               {
+                       kfree_skb(skb,FREE_WRITE);
+                       return 0;
+               }
+               
                /*
                 *      The packet is for another target. Forward the frame
                 */
@@ -1683,6 +1672,7 @@ void ip_queue_xmit(struct sock *sk, struct device *dev,
        iph = (struct iphdr *)ptr;
        skb->ip_hdr = iph;
        iph->tot_len = ntohs(skb->len-dev->hard_header_len);
+       iph->id      = htons(ip_id_count++);
 
        /*
         *      Do we need to fragment. Again this is inefficient. 
@@ -1813,27 +1803,34 @@ void ip_do_retransmit(struct sock *sk, int all)
        {
                dev = skb->dev;
                IS_SKB(skb);
-#if 0
-       /********** THIS IS NOW DONE BY THE DEVICE LAYER **********/    
-               /*
-                *      The rebuild_header function sees if the ARP is done.
-                *      If not it sends a new ARP request, and if so it builds
-                *      the header. It isn't really needed here, and with the
-                *      new ARP pretty much will not happen.
+               skb->when = jiffies;
+
+               /* 
+                * In general it's OK just to use the old packet.  However we
+                * need to use the current ack and window fields.  Urg and 
+                * urg_ptr could possibly stand to be updated as well, but we 
+                * don't keep the necessary data.  That shouldn't be a problem,
+                * if the other end is doing the right thing.  Since we're 
+                * changing the packet, we have to issue a new IP identifier.
                 */
-                
-               if (!skb->arp) 
-               {
-                       if (dev->rebuild_header(skb->data, dev, skb->raddr, NULL)) 
-                       {
-                               if (!all) 
-                                       break;
-                               skb = skb->link3;
-                               continue;
-                       }
+
+               /* this check may be unnecessary - retransmit only for TCP */
+               if (sk->protocol == IPPROTO_TCP) {
+                 struct tcphdr *th;
+                 struct iphdr *iph;
+                 int size;
+
+                 iph = (struct iphdr *)(skb->data + dev->hard_header_len);
+                 th = (struct tcphdr *)(((char *)iph) + (iph->ihl << 2));
+                 size = skb->len - (((unsigned char *) th) - skb->data);
+
+                 iph->id = htons(ip_id_count++);
+                 ip_send_check(iph);
+
+                 th->ack_seq = ntohl(sk->acked_seq);
+                 th->window = ntohs(tcp_select_window(sk));
+                 tcp_send_check(th, sk->saddr, sk->daddr, size, sk);
                }
-#endif
-               skb->when = jiffies;
 
                /* 
                 *      If the interface is (still) up and running, kick it. 
index 21658fb92cd7dd3cc7997da3b376cc786cf274ed..4375599c920d353106db194a8dfdd32d59e14201 100644 (file)
@@ -24,7 +24,9 @@
  *     Revision 0.24:  Supports new /proc with no 4K limit
  *     Revision 0.25:  Add ephemeral sockets, passive local network 
  *                     identification, support for local net 0 and
- *                     multiple datalinks
+ *                     multiple datalinks <Greg Page>
+ *     Revision 0.26:  Device drop kills IPX routes via it. (needed for modules)
+ *
  *                     
  *
  */
@@ -350,50 +352,54 @@ static int ipxrtr_create(struct ipx_route_def *r)
 
 static int ipxrtr_delete_localnet(ipx_route *d)
 {
-       ipx_route *r=ipx_localnet_list;
-       if(r==d)
-       {
-               ipx_localnet_list=r->next;
-               return 0;
-       }
-       while(r->next!=NULL)
-       {
-               if(r->nextlocal==d)
-               {
-                       r->nextlocal=d->nextlocal;
+       ipx_route **r = &ipx_localnet_list;
+       ipx_route *tmp;
+
+       while ((tmp = *r) != NULL) {
+               if (tmp == d) {
+                       *r = tmp->next;
                        return 0;
                }
-               r=r->nextlocal;
+               r = &tmp->nextlocal;
        }
        return -ENOENT;
 }
 
 static int ipxrtr_delete(long net)
 {
-       ipx_route *r=ipx_router_list;
-       if(r->net==net)
-       {
-               ipx_router_list=r->next;
-               kfree_s(r,sizeof(ipx_route));
-               return 0;
-       }
-       while(r->next!=NULL)
-       {
-               if(r->next->net==net)
-               {
-                       ipx_route *d=r->next;
-                       r->next=d->next;
-                       if (d->router_net == 0) {
-                               ipxrtr_delete_localnet(d);
+       ipx_route **r = &ipx_router_list;
+       ipx_route *tmp;
+
+       while ((tmp = *r) != NULL) {
+               if (tmp->net == net) {
+                       *r = tmp->next;
+                       if (tmp->router_net == 0) {
+                               ipxrtr_delete_localnet(tmp);
                        }
-                       kfree_s(d,sizeof(ipx_route));
+                       kfree_s(tmp, sizeof(ipx_route));
                        return 0;
                }
-               r=r->next;
+               r = &tmp->next;
        }
        return -ENOENT;
 }
 
+void ipxrtr_device_down(struct device *dev)
+{
+       ipx_route **r = &ipx_router_list;
+       ipx_route *tmp;
+
+       while ((tmp = *r) != NULL) {
+               if (tmp->dev == dev) {
+                       *r = tmp->next;
+                       if(tmp->router_net == 0)
+                               ipxrtr_delete_localnet(tmp);
+                       kfree_s(tmp, sizeof(ipx_route));
+               }
+               r = &tmp->next;
+       }
+}
+
 static int ipxrtr_ioctl(unsigned int cmd, void *arg)
 {
        int err;
index bb3294e07f2f66b3631c5e413cf59c9382cb1a8c..7a4cf6a0e568964db3662ea075efbdde47cbf853 100644 (file)
@@ -64,6 +64,7 @@ typedef struct sock ipx_socket;
 
 #include "ipxcall.h"
 extern int ipx_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt);
+extern void ipxrtr_device_down(struct device *dev);
 
 
 
index 1b49a67f462914338c5b325996a53c2ad72275d3..9b1df8cbdf6a63291fe535e199f0d241467687a6 100644 (file)
  * Authors:    Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *             Gerald J. Heim, <heim@peanuts.informatik.uni-tuebingen.de>
  *             Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
+ *             Erik Schoenfelder, <schoenfr@ibr.cs.tu-bs.de>
  *
  * Fixes:
  *             Alan Cox        :       UDP sockets show the rxqueue/txqueue
  *                                     using hint flag for the netinfo.
  *     Pauline Middelink       :       Pidentd support
  *             Alan Cox        :       Make /proc safer.
- *
- * To Do:
- *             Put the creating userid in the proc/net/... files. This will
- *             allow us to write an RFC931 daemon for Linux
+ *     Erik Schoenfelder       :       /proc/net/snmp
  *
  *             This program is free software; you can redistribute it and/or
  *             modify it under the terms of the GNU General Public License
@@ -39,6 +37,7 @@
 #include <linux/inet.h>
 #include <linux/netdevice.h>
 #include "ip.h"
+#include "icmp.h"
 #include "protocol.h"
 #include "tcp.h"
 #include "udp.h"
@@ -141,3 +140,73 @@ int raw_get_info(char *buffer, char **start, off_t offset, int length)
 {
   return get__netinfo(&raw_prot, buffer,1, start, offset, length);
 }
+
+
+/* 
+ *     Called from the PROCfs module. This outputs /proc/net/snmp.
+ */
+int snmp_get_info(char *buffer, char **start, off_t offset, int length)
+{
+  extern struct tcp_mib tcp_statistics;
+  extern struct udp_mib udp_statistics;
+  int len;
+
+  len = sprintf (buffer,
+       "Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates\n"
+       "Ip: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+           ip_statistics.IpForwarding, ip_statistics.IpDefaultTTL, 
+           ip_statistics.IpInReceives, ip_statistics.IpInHdrErrors, 
+           ip_statistics.IpInAddrErrors, ip_statistics.IpForwDatagrams, 
+           ip_statistics.IpInUnknownProtos, ip_statistics.IpInDiscards, 
+           ip_statistics.IpInDelivers, ip_statistics.IpOutRequests, 
+           ip_statistics.IpOutDiscards, ip_statistics.IpOutNoRoutes, 
+           ip_statistics.IpReasmTimeout, ip_statistics.IpReasmReqds, 
+           ip_statistics.IpReasmOKs, ip_statistics.IpReasmFails, 
+           ip_statistics.IpFragOKs, ip_statistics.IpFragFails, 
+           ip_statistics.IpFragCreates);
+       
+  len += sprintf (buffer + len,
+       "Icmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps\n"
+       "Icmp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+           icmp_statistics.IcmpInMsgs, icmp_statistics.IcmpInErrors,
+           icmp_statistics.IcmpInDestUnreachs, icmp_statistics.IcmpInTimeExcds,
+           icmp_statistics.IcmpInParmProbs, icmp_statistics.IcmpInSrcQuenchs,
+           icmp_statistics.IcmpInRedirects, icmp_statistics.IcmpInEchos,
+           icmp_statistics.IcmpInEchoReps, icmp_statistics.IcmpInTimestamps,
+           icmp_statistics.IcmpInTimestampReps, icmp_statistics.IcmpInAddrMasks,
+           icmp_statistics.IcmpInAddrMaskReps, icmp_statistics.IcmpOutMsgs,
+           icmp_statistics.IcmpOutErrors, icmp_statistics.IcmpOutDestUnreachs,
+           icmp_statistics.IcmpOutTimeExcds, icmp_statistics.IcmpOutParmProbs,
+           icmp_statistics.IcmpOutSrcQuenchs, icmp_statistics.IcmpOutRedirects,
+           icmp_statistics.IcmpOutEchos, icmp_statistics.IcmpOutEchoReps,
+           icmp_statistics.IcmpOutTimestamps, icmp_statistics.IcmpOutTimestampReps,
+           icmp_statistics.IcmpOutAddrMasks, icmp_statistics.IcmpOutAddrMaskReps);
+
+   len += sprintf (buffer + len,
+       "Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs\n"
+       "Tcp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+           tcp_statistics.TcpRtoAlgorithm, tcp_statistics.TcpRtoMin,
+           tcp_statistics.TcpRtoMax, tcp_statistics.TcpMaxConn,
+           tcp_statistics.TcpActiveOpens, tcp_statistics.TcpPassiveOpens,
+           tcp_statistics.TcpAttemptFails, tcp_statistics.TcpEstabResets,
+           tcp_statistics.TcpCurrEstab, tcp_statistics.TcpInSegs,
+           tcp_statistics.TcpOutSegs, tcp_statistics.TcpRetransSegs);
+       
+         len += sprintf (buffer + len,
+       "Udp: InDatagrams NoPorts InErrors OutDatagrams\nUdp: %lu %lu %lu %lu\n",
+           udp_statistics.UdpInDatagrams, udp_statistics.UdpNoPorts,
+           udp_statistics.UdpInErrors, udp_statistics.UdpOutDatagrams);
+       
+  if (offset >= len)
+    {
+             *start = buffer;
+             return 0;
+    }
+  *start = buffer + offset;
+  len -= offset;
+  if (len > length)
+    len = length;
+  return len;
+}
+
index eb540f4dcbf2134fb6a7c6ed7d804cb5ff362c68..41ea605a0b41e3e7a9fdc1c3158a406efa592b7a 100644 (file)
@@ -464,6 +464,7 @@ void kfree_skb(struct sk_buff *skb, int rw)
 
        skb->free = 2;  /* Invalid so we pick up forgetful users */
        skb->lock = 0;
+       skb->pkt_type = PACKET_HOST;    /* Default type */
        skb->truesize = size;
        skb->mem_len = size;
        skb->mem_addr = skb;
index 42e20a7e334f0f27ce5519e69cec36989093ff91..6dbecffe85f2785f6307566214071ccd1a1dde66 100644 (file)
@@ -148,6 +148,8 @@ struct sock {
   char                         ax25_retxqi;
   char                         ax25_rrtimer;
   char                         ax25_timer;
+  unsigned char                        ax25_n2;
+  unsigned short               ax25_t1,ax25_t3;
   ax25_digi                    *ax25_digipeat;
 #endif  
 /* IP 'private area' or will be eventually */
index 56d0a27b5ea70e9437aeb166c26704520d68c686..db1e3ba29d6f68a2cb8e4baae627ded2142f5519 100644 (file)
@@ -172,7 +172,7 @@ min(unsigned int a, unsigned int b)
    Better heuristics welcome
 */
    
-static int tcp_select_window(struct sock *sk)
+int tcp_select_window(struct sock *sk)
 {
        int new_window = sk->prot->rspace(sk);
        
@@ -572,13 +572,14 @@ static void tcp_send_skb(struct sock *sk, struct sk_buff *skb)
        }
 
        tcp_statistics.TcpOutSegs++;  
-       /* We need to complete and send the packet. */
-       tcp_send_check(th, sk->saddr, sk->daddr, size, sk);
 
        skb->h.seq = ntohl(th->seq) + size - 4*th->doff;
        if (after(skb->h.seq, sk->window_seq) ||
            (sk->retransmits && sk->timeout == TIME_WRITE) ||
             sk->packets_out >= sk->cong_window) {
+               /* checksum will be supplied by tcp_write_xmit.  So
+                * we shouldn't need to set it at all.  I'm being paraoid */
+               th->check = 0;
                if (skb->next != NULL) {
                        printk("tcp_send_partial: next != NULL\n");
                        skb_unlink(skb);
@@ -589,6 +590,11 @@ static void tcp_send_skb(struct sock *sk, struct sk_buff *skb)
                    sk->ack_backlog == 0)
                  reset_timer(sk, TIME_PROBE0, sk->rto);
        } else {
+               th->ack_seq = ntohl(sk->acked_seq);
+               th->window = ntohs(tcp_select_window(sk));
+
+               tcp_send_check(th, sk->saddr, sk->daddr, size, sk);
+
                sk->sent_seq = sk->write_seq;
                sk->prot->queue_xmit(sk, skb->dev, skb, 0);
        }
@@ -2237,6 +2243,26 @@ tcp_write_xmit(struct sock *sk)
                        kfree_skb(skb, FREE_WRITE);
                        if (!sk->dead) sk->write_space(sk);
                } else {
+                       struct tcphdr *th;
+                       struct iphdr *iph;
+                       int size;
+/*
+ * put in the ack seq and window at this point rather than earlier,
+ * in order to keep them monotonic.  We really want to avoid taking
+ * back window allocations.  That's legal, but RFC1122 says it's frowned on.
+ * Ack and window will in general have changed since this packet was put
+ * on the write queue.
+ */
+                       iph = (struct iphdr *)(skb->data +
+                                              skb->dev->hard_header_len);
+                       th = (struct tcphdr *)(((char *)iph) +(iph->ihl << 2));
+                       size = skb->len - (((unsigned char *) th) - skb->data);
+                       
+                       th->ack_seq = ntohl(sk->acked_seq);
+                       th->window = ntohs(tcp_select_window(sk));
+
+                       tcp_send_check(th, sk->saddr, sk->daddr, size, sk);
+
                        sk->sent_seq = skb->h.seq;
                        sk->prot->queue_xmit(sk, skb->dev, skb, skb->free);
                }
@@ -3197,7 +3223,7 @@ static int tcp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len)
                sk->mtu = rt->rt_mtu;
        else 
        {
-#ifdef SUBNETSARELOCAL
+#ifdef CONFIG_INET_SNARL
                if ((sk->saddr ^ sk->daddr) & default_mask(sk->saddr))
 #else
                if ((sk->saddr ^ sk->daddr) & dev->pa_mask)
@@ -3319,6 +3345,12 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
   
   tcp_statistics.TcpInSegs++;
   
+  if(skb->pkt_type!=PACKET_HOST)
+  {
+       kfree_skb(skb,FREE_READ);
+       return(0);
+  }
+  
   th = skb->h.th;
 
   /* Find the socket. */
index 227fb5f2f74cfb4c0d09fe9fff63a992adab6c08..a6f30737d916c97b64e2700ccb2c5feee206b5d3 100644 (file)
@@ -123,6 +123,9 @@ extern int  tcp_rcv(struct sk_buff *skb, struct device *dev,
 
 extern int     tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 
+extern int tcp_select_window(struct sock *sk);
+extern void tcp_send_check(struct tcphdr *th, unsigned long saddr, 
+               unsigned long daddr, int len, struct sock *sk);
 extern void tcp_send_probe0(struct sock *sk);
 extern void tcp_enqueue_partial(struct sk_buff *, struct sock *);
 extern struct sk_buff * tcp_dequeue_partial(struct sock *);
index 7c230cb0b067ecbde3d4bb01fbb9523f08f7ba19..848fef6aef672c54dbcbef66fdc9aff80237a0d2 100644 (file)
@@ -237,15 +237,7 @@ DEBG1("3 ");
         z = 1 << j;             /* table entries for j-bit table */
 
         /* allocate and link in new table */
-        if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
-            (struct huft *)NULL)
-        {
-DEBG1("31 ");
-         error("malloc failed\n");
-          if (h)
-            huft_free(u[0]);
-          return 3;             /* not enough memory */
-        }
+        q = (struct huft *)malloc((z + 1)*sizeof(struct huft));
 DEBG1("4 ");
         hufts += z + 1;         /* track memory usage */
         *t = q + 1;             /* link to list for huft_free() */
index 3b6835b4a9e57d7fb06c4c23a3a847546ba0100a..a810e71368a7c3406e9ae7a833e5c4b1612f7c12 100644 (file)
@@ -4,7 +4,7 @@
  * This is a collection of several routines from gzip-1.0.3 
  * adapted for Linux.
  *
- * malloc by Hannu Savolainen 1993
+ * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  * puts by Nick Holloway 1993
  */
 
@@ -78,6 +78,8 @@ local int get_method(int);
 char *vidmem = (char *)0xb8000;
 int lines, cols;
 
+static void puts(const char *);
+
 void *malloc(int size)
 {
        void *p;
@@ -85,16 +87,29 @@ void *malloc(int size)
        if (size <0) error("Malloc error\n");
        if (free_mem_ptr <= 0) error("Memory error\n");
 
+   while(1) {
        free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
 
        p = (void *)free_mem_ptr;
-
        free_mem_ptr += size;
 
-       if (free_mem_ptr > 0x90000) error("\nOut of memory\n");
-
-       if (p == NULL) error("malloc = NULL\n");
+       /*
+        * The part of the compresed kernel which has already been expanded
+        * is no longer needed. Therefore we can reuse it for malloc.
+        * With bigger kernels, this is necessary.
+        */
+          
+       if (free_mem_ptr < (long)&end) {
+               if (free_mem_ptr > (long)&input_data[input_ptr])
+                       error("\nOut of memory\n");
+
+               return p;
+       }
+       if (free_mem_ptr < 0x90000)
        return p;
+       puts("memory is tight...");
+       free_mem_ptr = (long)input_data;
+       }
 }
 
 void free(void *where)
@@ -110,7 +125,7 @@ static void scroll()
                vidmem[i] = ' ';
 }
 
-static void puts(char *s)
+static void puts(const char *s)
 {
        int x,y;
        char c;
@@ -309,7 +324,7 @@ void decompress_kernel()
 
        if (EXT_MEM_K < 1024) error("<2M of mem\n");
 
-       output_data = (char *)1048576;  /* Points to 1M */
+       output_data = (char *)0x100000; /* Points to 1M */
        output_ptr = 0;
 
        exit_code = 0;
@@ -361,16 +376,10 @@ local int get_method(in)
        work = unzip;
        method = (int)get_byte();
        flags  = (uch)get_byte();
-       if ((flags & ENCRYPTED) != 0) {
+       if ((flags & ENCRYPTED) != 0)
            error("Input is encrypted\n");
-           exit_code = ERROR;
-           return -1;
-       }
-       if ((flags & CONTINUATION) != 0) {
+       if ((flags & CONTINUATION) != 0)
               error("Multi part input\n");
-           exit_code = ERROR;
-           if (force <= 1) return -1;
-       }
        if ((flags & RESERVED) != 0) {
            error("Input has invalid flags\n");
            exit_code = ERROR;
@@ -384,13 +393,6 @@ local int get_method(in)
        (void)get_byte();  /* Ignore extra flags for the moment */
        (void)get_byte();  /* Ignore OS type for the moment */
 
-       if ((flags & CONTINUATION) != 0) {
-           unsigned part = (unsigned)get_byte();
-           part |= ((unsigned)get_byte())<<8;
-           if (verbose) {
-               error("Input is not part number 1\n");
-           }
-       }
        if ((flags & EXTRA_FIELD) != 0) {
            unsigned len = (unsigned)get_byte();
            len |= ((unsigned)get_byte())<<8;
@@ -410,28 +412,7 @@ local int get_method(in)
        if ((flags & COMMENT) != 0) {
            while (get_byte() != 0) /* null */ ;
        }
-
-    } else if (memcmp(magic, PKZIP_MAGIC, 2) == 0 && inptr == 2
-           && memcmp(inbuf, PKZIP_MAGIC, 4) == 0) {
-       /* To simplify the code, we support a zip file when alone only.
-         * We are thus guaranteed that the entire local header fits in inbuf.
-         */
-        inptr = 0;
-       work = unzip;
-       if (check_zipfile(in) == -1) return -1;
-       /* check_zipfile may get ofname from the local header */
-       last_member = 1;
-
-    } else if (memcmp(magic, PACK_MAGIC, 2) == 0) {
-       error("packed input");
-    } else if (memcmp(magic, LZW_MAGIC, 2) == 0) {
-       error("compressed input");
-       last_member = 1;
-    }
-    if (method == -1) {
-       error("Corrupted input\n");
-       if (exit_code != ERROR) exit_code = part_nb == 1 ? ERROR : WARNING;
-       return part_nb == 1 ? -1 : -2;
-    }
+    } else
+       error("unknown compression method");
     return method;
 }