diff -u --recursive --new-file v1.1.15/linux/Makefile linux/Makefile --- v1.1.15/linux/Makefile Fri May 27 10:49:05 1994 +++ linux/Makefile Thu May 26 10:46:48 1994 @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 15 +SUBLEVEL = 16 all: Version zImage diff -u --recursive --new-file v1.1.15/linux/drivers/block/sbpcd.c linux/drivers/block/sbpcd.c --- v1.1.15/linux/drivers/block/sbpcd.c Tue May 24 08:47:06 1994 +++ linux/drivers/block/sbpcd.c Thu May 26 08:58:45 1994 @@ -327,7 +327,7 @@ /* * 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 @@ int in_SpinUp; -} DS[4]; +} DriveStruct[4]; /* * drive space ends here (needed separate for each unit) @@ -557,7 +557,7 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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_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 @@ 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 @@ } response_count=0; i=cmd_out(); - DS[d].in_SpinUp = 0; + DriveStruct[d].in_SpinUp = 0; return (i); } /*==========================================================================*/ @@ -937,15 +937,15 @@ 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 @@ } 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 @@ else { value0=(volume0>volume1)?volume0:volume1; - 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 @@ 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 @@ 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 @@ { 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 @@ 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 @@ { 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 @@ 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 @@ { 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 @@ 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 @@ } DPRINTF((DBG_XA,"\n")); - DS[d].diskstate_flags |= frame_size_bit; + DriveStruct[d].diskstate_flags |= frame_size_bit; return (0); } /*==========================================================================*/ @@ -1254,35 +1254,35 @@ { 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 @@ 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 @@ 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_211) + if (DriveStruct[d].drv_type>=drv_211) { if ((switches&0x20)!=0) chan0=1; if ((switches&0x10)!=0) chan1=0; @@ -1360,15 +1360,15 @@ } } } - 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 @@ { 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 @@ 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 @@ { int i; - DS[d].diskstate_flags &= ~toc_bit; + DriveStruct[d].diskstate_flags &= ~toc_bit; clr_cmdbuf(); if (new_drive) { @@ -1419,14 +1419,14 @@ 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 @@ 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 @@ 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 @@ 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>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 @@ ndrives=0; for (j=0;j=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 @@ { 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 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 @@ 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 @@ 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 @@ 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 @@ i=check_allowed3(func,subfunc); if (i<0) { - DS[d].CD_changed=1; + DriveStruct[d].CD_changed=1; return (-15); } } @@ -2069,9 +2069,9 @@ { #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 @@ { 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 @@ } 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 @@ { #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 @@ { 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 @@ /* 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 @@ /* 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 @@ 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_trk0DS[d].n_last_track) return (-EINVAL); + if (ti.cdti_trk0DriveStruct[d].n_last_track) return (-EINVAL); if (ti.cdti_trk1DS[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 @@ 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 (iDS[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 (iDriveStruct[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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ drvcmd[3]=block&0x000000ff; } drvcmd[4]=0; - drvcmd[5]=DS[d].sbp_read_frames; - drvcmd[6]=(DS[d].drv_type 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 @@ 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 @@ * 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 @@ } 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 @@ for (j=0;j=0) DS[d].CD_changed=1; + if (i>=0) DriveStruct[d].CD_changed=1; } if (sbpro_type) @@ -3129,8 +3129,8 @@ */ for (j=0;jcanon_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 @@ 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) diff -u --recursive --new-file v1.1.15/linux/drivers/char/serial.c linux/drivers/char/serial.c --- v1.1.15/linux/drivers/char/serial.c Tue May 24 00:34:48 1994 +++ linux/drivers/char/serial.c Fri May 27 10:46:54 1994 @@ -1006,8 +1006,8 @@ 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); diff -u --recursive --new-file v1.1.15/linux/drivers/char/tpqic02.c linux/drivers/char/tpqic02.c --- v1.1.15/linux/drivers/char/tpqic02.c Mon Feb 14 22:13:26 1994 +++ linux/drivers/char/tpqic02.c Thu May 26 09:16:18 1994 @@ -302,7 +302,7 @@ * 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 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ } } 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 @@ #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; diff -u --recursive --new-file v1.1.15/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c --- v1.1.15/linux/drivers/char/tty_io.c Tue May 24 00:34:49 1994 +++ linux/drivers/char/tty_io.c Fri May 27 10:46:55 1994 @@ -180,18 +180,18 @@ 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 @@ 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 @@ (*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 @@ (*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; diff -u --recursive --new-file v1.1.15/linux/drivers/net/3c501.c linux/drivers/net/3c501.c --- v1.1.15/linux/drivers/net/3c501.c Tue May 24 00:34:50 1994 +++ linux/drivers/net/3c501.c Fri May 27 10:46:37 1994 @@ -41,6 +41,11 @@ #include #include +#ifdef MODULE +#include +#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 @@ 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 @@ 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 @@ * 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 */ diff -u --recursive --new-file v1.1.15/linux/drivers/net/MODULES linux/drivers/net/MODULES --- v1.1.15/linux/drivers/net/MODULES Tue May 24 00:34:50 1994 +++ linux/drivers/net/MODULES Fri May 27 10:46:37 1994 @@ -1,3 +1,7 @@ MODULES = \ 3c509.o \ - de600.o + de600.o \ + 3c501.o \ + plip.o + + diff -u --recursive --new-file v1.1.15/linux/drivers/net/Makefile linux/drivers/net/Makefile --- v1.1.15/linux/drivers/net/Makefile Tue May 24 00:34:50 1994 +++ linux/drivers/net/Makefile Fri May 27 10:46:45 1994 @@ -74,6 +74,14 @@ $(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 diff -u --recursive --new-file v1.1.15/linux/drivers/net/Space.c linux/drivers/net/Space.c --- v1.1.15/linux/drivers/net/Space.c Tue May 24 00:34:50 1994 +++ linux/drivers/net/Space.c Fri May 27 10:46:45 1994 @@ -26,6 +26,7 @@ */ #include #include +#include #define LOOPBACK /* always present, right? */ @@ -123,6 +124,39 @@ 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 = ðer_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. */ @@ -131,6 +165,17 @@ # undef NEXT_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 Only in v1.1.15/linux/drivers/net: d_link.c diff -u --recursive --new-file v1.1.15/linux/drivers/net/net_init.c linux/drivers/net/net_init.c --- v1.1.15/linux/drivers/net/net_init.c Tue May 24 00:34:51 1994 +++ linux/drivers/net/net_init.c Fri May 27 10:46:45 1994 @@ -165,6 +165,23 @@ 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; diff -u --recursive --new-file v1.1.15/linux/drivers/net/plip.c linux/drivers/net/plip.c --- v1.1.15/linux/drivers/net/plip.c Tue May 24 00:34:52 1994 +++ linux/drivers/net/plip.c Fri May 27 10:46:37 1994 @@ -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 @@ -40,10 +42,17 @@ * Info: * I 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 @@ -95,6 +104,11 @@ #include #include +#ifdef MODULE +#include +#include "../../tools/version.h" +#endif + #ifdef PRINTK #undef PRINTK #endif @@ -219,8 +233,8 @@ 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 @@ dev->tbusy = 0; dev->interrupt = 0; dev->start = 1; +#ifdef MODULE + MOD_INC_USE_COUNT; +#endif return 0; } @@ -251,6 +268,9 @@ 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 @@ * 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 */ diff -u --recursive --new-file v1.1.15/linux/drivers/net/ppp.c linux/drivers/net/ppp.c --- v1.1.15/linux/drivers/net/ppp.c Tue May 24 00:34:52 1994 +++ linux/drivers/net/ppp.c Fri May 27 10:46:55 1994 @@ -377,9 +377,9 @@ 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 @@ 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 diff -u --recursive --new-file v1.1.15/linux/fs/proc/net.c linux/fs/proc/net.c --- v1.1.15/linux/fs/proc/net.c Tue May 24 08:47:07 1994 +++ linux/fs/proc/net.c Fri May 27 10:46:54 1994 @@ -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 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 @@ { 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 @@ 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 */ diff -u --recursive --new-file v1.1.15/linux/fs/super.c linux/fs/super.c --- v1.1.15/linux/fs/super.c Sat May 7 14:54:11 1994 +++ linux/fs/super.c Fri May 27 10:19:33 1994 @@ -662,5 +662,6 @@ return; } } - panic("VFS: Unable to mount root"); + panic("VFS: Unable to mount root fs on %02x:%02x", + MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); } diff -u --recursive --new-file v1.1.15/linux/include/linux/netdevice.h linux/include/linux/netdevice.h --- v1.1.15/linux/include/linux/netdevice.h Tue May 24 00:34:56 1994 +++ linux/include/linux/netdevice.h Fri May 27 10:46:46 1994 @@ -193,9 +193,10 @@ 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); diff -u --recursive --new-file v1.1.15/linux/include/linux/sbpcd.h linux/include/linux/sbpcd.h --- v1.1.15/linux/include/linux/sbpcd.h Wed Apr 27 09:46:09 1994 +++ linux/include/linux/sbpcd.h Thu May 26 09:07:41 1994 @@ -107,13 +107,13 @@ /* * 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) /* @@ -137,13 +137,13 @@ /* * 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: @@ -175,7 +175,7 @@ /* * 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: diff -u --recursive --new-file v1.1.15/linux/include/linux/skbuff.h linux/include/linux/skbuff.h --- v1.1.15/linux/include/linux/skbuff.h Tue May 24 00:34:57 1994 +++ linux/include/linux/skbuff.h Fri May 27 10:46:38 1994 @@ -68,7 +68,11 @@ 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; diff -u --recursive --new-file v1.1.15/linux/include/linux/termios.h linux/include/linux/termios.h --- v1.1.15/linux/include/linux/termios.h Tue Mar 1 19:00:15 1994 +++ linux/include/linux/termios.h Fri May 27 10:47:05 1994 @@ -1,6 +1,8 @@ #ifndef _LINUX_TERMIOS_H #define _LINUX_TERMIOS_H +#include + /* 0x54 is just a magic number to make these relatively uniqe ('T') */ #define TCGETS 0x5401 diff -u --recursive --new-file v1.1.15/linux/include/linux/tty.h linux/include/linux/tty.h --- v1.1.15/linux/include/linux/tty.h Tue May 24 00:34:57 1994 +++ linux/include/linux/tty.h Fri May 27 10:47:12 1994 @@ -5,6 +5,7 @@ * 'tty.h' defines some structures used by tty_io.c and some defines. */ +#include #include #include #include diff -u --recursive --new-file v1.1.15/linux/include/linux/tty_driver.h linux/include/linux/tty_driver.h --- v1.1.15/linux/include/linux/tty_driver.h Tue May 24 00:34:57 1994 +++ linux/include/linux/tty_driver.h Fri May 27 10:47:22 1994 @@ -87,6 +87,8 @@ * */ +#include + struct tty_driver { int magic; /* magic number for this structure */ char *name; diff -u --recursive --new-file v1.1.15/linux/include/linux/tty_ldisc.h linux/include/linux/tty_ldisc.h --- v1.1.15/linux/include/linux/tty_ldisc.h Tue May 24 00:34:58 1994 +++ linux/include/linux/tty_ldisc.h Fri May 27 10:47:29 1994 @@ -5,6 +5,9 @@ * Definitions for the tty line discipline */ +#include +#include + struct tty_ldisc { int magic; int num; diff -u --recursive --new-file v1.1.15/linux/modules/NET_MODULES linux/modules/NET_MODULES --- v1.1.15/linux/modules/NET_MODULES Tue May 24 00:34:58 1994 +++ linux/modules/NET_MODULES Fri May 27 11:59:10 1994 @@ -1 +1 @@ -3c509.o de600.o +3c509.o de600.o 3c501.o plip.o diff -u --recursive --new-file v1.1.15/linux/net/inet/README linux/net/inet/README --- v1.1.15/linux/net/inet/README Tue May 24 00:34:59 1994 +++ linux/net/inet/README Fri May 27 10:46:38 1994 @@ -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). diff -u --recursive --new-file v1.1.15/linux/net/inet/dev.c linux/net/inet/dev.c --- v1.1.15/linux/net/inet/dev.c Tue May 24 00:35:00 1994 +++ linux/net/inet/dev.c Fri May 27 10:46:38 1994 @@ -292,7 +292,10 @@ */ #ifdef CONFIG_INET ip_rt_flush(dev); -#endif +#endif +#ifdef CONFIG_IPX + ipxrtr_device_down(dev); +#endif /* * Blank the IP addresses */ diff -u --recursive --new-file v1.1.15/linux/net/inet/eth.c linux/net/inet/eth.c --- v1.1.15/linux/net/inet/eth.c Tue May 24 00:35:01 1994 +++ linux/net/inet/eth.c Fri May 27 10:46:38 1994 @@ -167,7 +167,21 @@ { 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; diff -u --recursive --new-file v1.1.15/linux/net/inet/ip.c linux/net/inet/ip.c --- v1.1.15/linux/net/inet/ip.c Fri May 27 10:49:16 1994 +++ linux/net/inet/ip.c Fri May 27 11:01:09 1994 @@ -177,6 +177,7 @@ return mac; } +int ip_id_count = 0; /* * This routine builds the appropriate hardware/IP headers for @@ -192,7 +193,6 @@ struct rtable *rt; unsigned char *buff; unsigned long raddr; - static int count = 0; int tmp; unsigned long src; @@ -295,8 +295,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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. diff -u --recursive --new-file v1.1.15/linux/net/inet/ipx.c linux/net/inet/ipx.c --- v1.1.15/linux/net/inet/ipx.c Tue May 24 00:35:02 1994 +++ linux/net/inet/ipx.c Fri May 27 11:59:01 1994 @@ -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 + * Revision 0.26: Device drop kills IPX routes via it. (needed for modules) + * * * */ @@ -350,48 +352,52 @@ 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) diff -u --recursive --new-file v1.1.15/linux/net/inet/ipx.h linux/net/inet/ipx.h --- v1.1.15/linux/net/inet/ipx.h Tue May 24 00:35:02 1994 +++ linux/net/inet/ipx.h Fri May 27 10:46:44 1994 @@ -64,6 +64,7 @@ #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); diff -u --recursive --new-file v1.1.15/linux/net/inet/proc.c linux/net/inet/proc.c --- v1.1.15/linux/net/inet/proc.c Tue Apr 19 10:54:01 1994 +++ linux/net/inet/proc.c Fri May 27 10:46:54 1994 @@ -12,17 +12,15 @@ * Authors: Fred N. van Kempen, * Gerald J. Heim, * Fred Baumgarten, + * Erik Schoenfelder, * * Fixes: * Alan Cox : UDP sockets show the rxqueue/txqueue * using hint flag for the netinfo. * Pauline Middelink : Pidentd support * Alan Cox : Make /proc safer. + * Erik Schoenfelder : /proc/net/snmp * - * To Do: - * Put the creating userid in the proc/net/... files. This will - * allow us to write an RFC931 daemon for Linux - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -39,6 +37,7 @@ #include #include #include "ip.h" +#include "icmp.h" #include "protocol.h" #include "tcp.h" #include "udp.h" @@ -141,3 +140,73 @@ { 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; +} + diff -u --recursive --new-file v1.1.15/linux/net/inet/skbuff.c linux/net/inet/skbuff.c --- v1.1.15/linux/net/inet/skbuff.c Tue May 24 00:35:03 1994 +++ linux/net/inet/skbuff.c Fri May 27 10:46:44 1994 @@ -464,6 +464,7 @@ 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; diff -u --recursive --new-file v1.1.15/linux/net/inet/sock.h linux/net/inet/sock.h --- v1.1.15/linux/net/inet/sock.h Tue Apr 19 22:20:36 1994 +++ linux/net/inet/sock.h Fri May 27 10:46:45 1994 @@ -148,6 +148,8 @@ 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 */ diff -u --recursive --new-file v1.1.15/linux/net/inet/tcp.c linux/net/inet/tcp.c --- v1.1.15/linux/net/inet/tcp.c Tue May 24 00:35:05 1994 +++ linux/net/inet/tcp.c Fri May 27 10:46:45 1994 @@ -172,7 +172,7 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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) @@ -3318,6 +3344,12 @@ } tcp_statistics.TcpInSegs++; + + if(skb->pkt_type!=PACKET_HOST) + { + kfree_skb(skb,FREE_READ); + return(0); + } th = skb->h.th; diff -u --recursive --new-file v1.1.15/linux/net/inet/tcp.h linux/net/inet/tcp.h --- v1.1.15/linux/net/inet/tcp.h Tue May 24 00:35:05 1994 +++ linux/net/inet/tcp.h Thu May 26 11:17:09 1994 @@ -123,6 +123,9 @@ 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 *); diff -u --recursive --new-file v1.1.15/linux/zBoot/inflate.c linux/zBoot/inflate.c --- v1.1.15/linux/zBoot/inflate.c Wed Dec 1 14:44:15 1993 +++ linux/zBoot/inflate.c Fri May 27 10:47:29 1994 @@ -237,15 +237,7 @@ 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() */ diff -u --recursive --new-file v1.1.15/linux/zBoot/misc.c linux/zBoot/misc.c --- v1.1.15/linux/zBoot/misc.c Wed Dec 1 14:44:15 1993 +++ linux/zBoot/misc.c Fri May 27 10:47:29 1994 @@ -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 @@ char *vidmem = (char *)0xb8000; int lines, cols; +static void puts(const char *); + void *malloc(int size) { void *p; @@ -85,16 +87,29 @@ 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"); + /* + * 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"); - if (p == NULL) error("malloc = NULL\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 @@ vidmem[i] = ' '; } -static void puts(char *s) +static void puts(const char *s) { int x,y; char c; @@ -309,7 +324,7 @@ 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 @@ 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 @@ (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 @@ 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; }