Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c2700b1f
Commit
c2700b1f
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 1.1.16
parent
7eb2fd0c
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
831 additions
and
491 deletions
+831
-491
Makefile
Makefile
+1
-1
drivers/block/sbpcd.c
drivers/block/sbpcd.c
+286
-286
drivers/char/n_tty.c
drivers/char/n_tty.c
+5
-2
drivers/char/serial.c
drivers/char/serial.c
+2
-2
drivers/char/tpqic02.c
drivers/char/tpqic02.c
+9
-9
drivers/char/tty_io.c
drivers/char/tty_io.c
+8
-8
drivers/net/3c501.c
drivers/net/3c501.c
+39
-0
drivers/net/MODULES
drivers/net/MODULES
+5
-1
drivers/net/Makefile
drivers/net/Makefile
+8
-0
drivers/net/Space.c
drivers/net/Space.c
+45
-0
drivers/net/net_init.c
drivers/net/net_init.c
+17
-0
drivers/net/plip.c
drivers/net/plip.c
+97
-4
drivers/net/ppp.c
drivers/net/ppp.c
+3
-7
fs/proc/net.c
fs/proc/net.c
+24
-17
fs/super.c
fs/super.c
+2
-1
include/linux/netdevice.h
include/linux/netdevice.h
+2
-1
include/linux/sbpcd.h
include/linux/sbpcd.h
+15
-15
include/linux/skbuff.h
include/linux/skbuff.h
+5
-1
include/linux/termios.h
include/linux/termios.h
+2
-0
include/linux/tty.h
include/linux/tty.h
+1
-0
include/linux/tty_driver.h
include/linux/tty_driver.h
+2
-0
include/linux/tty_ldisc.h
include/linux/tty_ldisc.h
+3
-0
modules/NET_MODULES
modules/NET_MODULES
+1
-1
net/inet/README
net/inet/README
+13
-0
net/inet/dev.c
net/inet/dev.c
+4
-1
net/inet/eth.c
net/inet/eth.c
+15
-1
net/inet/ip.c
net/inet/ip.c
+38
-41
net/inet/ipx.c
net/inet/ipx.c
+36
-30
net/inet/ipx.h
net/inet/ipx.h
+1
-0
net/inet/proc.c
net/inet/proc.c
+73
-4
net/inet/skbuff.c
net/inet/skbuff.c
+1
-0
net/inet/sock.h
net/inet/sock.h
+2
-0
net/inet/tcp.c
net/inet/tcp.c
+36
-4
net/inet/tcp.h
net/inet/tcp.h
+3
-0
zBoot/inflate.c
zBoot/inflate.c
+1
-9
zBoot/misc.c
zBoot/misc.c
+26
-45
No files found.
Makefile
View file @
c2700b1f
VERSION
=
1
PATCHLEVEL
=
1
SUBLEVEL
=
1
5
SUBLEVEL
=
1
6
all
:
Version zImage
...
...
drivers/block/sbpcd.c
View file @
c2700b1f
...
...
@@ -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
;
/* D
S
index: drive number */
static
int
d
=
0
;
/* D
riveStruct
index: drive number */
static
struct
{
char
drv_minor
;
/* minor number or -1 */
...
...
@@ -405,7 +405,7 @@ static struct {
int
in_SpinUp
;
}
D
S
[
4
];
}
D
riveStruct
[
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
);
D
S
[
d
].
CD_changed
=
0xFF
;
D
riveStruct
[
d
].
CD_changed
=
0xFF
;
if
(
sta
==
0x11
)
return
(
-
15
);
return
(
-
2
);
}
...
...
@@ -669,14 +669,14 @@ static int EvaluateStatus(int st)
{
if
(
!
new_drive
)
{
D
S
[
d
].
status_byte
=
0
;
if
(
st
&
p_caddin_old
)
D
S
[
d
].
status_byte
|=
p_door_closed
|
p_caddy_in
;
if
(
st
&
p_spinning
)
D
S
[
d
].
status_byte
|=
p_spinning
;
if
(
st
&
p_check
)
D
S
[
d
].
status_byte
|=
p_check
;
if
(
st
&
p_busy_old
)
D
S
[
d
].
status_byte
|=
p_busy_new
;
if
(
st
&
p_disk_ok
)
D
S
[
d
].
status_byte
|=
p_disk_ok
;
D
riveStruct
[
d
].
status_byte
=
0
;
if
(
st
&
p_caddin_old
)
D
riveStruct
[
d
].
status_byte
|=
p_door_closed
|
p_caddy_in
;
if
(
st
&
p_spinning
)
D
riveStruct
[
d
].
status_byte
|=
p_spinning
;
if
(
st
&
p_check
)
D
riveStruct
[
d
].
status_byte
|=
p_check
;
if
(
st
&
p_busy_old
)
D
riveStruct
[
d
].
status_byte
|=
p_busy_new
;
if
(
st
&
p_disk_ok
)
D
riveStruct
[
d
].
status_byte
|=
p_disk_ok
;
}
else
{
D
S
[
d
].
status_byte
=
st
;
else
{
D
riveStruct
[
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
();
D
S
[
d
].
error_byte
=
0
;
D
riveStruct
[
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
;
D
S
[
d
].
error_byte
=
infobuf
[
i
];
DPRINTF
((
DBG_ERR
,
"SBPCD: xx_ReadError: infobuf[%d] is %d (%02X)
\n
"
,
i
,
D
S
[
d
].
error_byte
,
DS
[
d
].
error_byte
));
D
riveStruct
[
d
].
error_byte
=
infobuf
[
i
];
DPRINTF
((
DBG_ERR
,
"SBPCD: xx_ReadError: infobuf[%d] is %d (%02X)
\n
"
,
i
,
D
riveStruct
[
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
(
D
S
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to CDi_stat_loop.
\n
"
));
if
(
D
riveStruct
[
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
(
D
S
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to xx_ReadStatus.
\n
"
));
if
(
D
riveStruct
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to xx_ReadStatus.
\n
"
));
xx_ReadStatus
();
LOC_229:
if
(
flags_cmd_out
&
f_ResponseStatus
)
{
if
(
D
S
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to ResponseStatus.
\n
"
));
if
(
D
riveStruct
[
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 @@ int cmd_out(void)
LOC_232:
if
(
!
(
flags_cmd_out
&
f_obey_p_check
))
return
(
0
);
if
(
!
st_check
)
return
(
0
);
if
(
D
S
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to xx_ReadError.
\n
"
));
if
(
D
riveStruct
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to xx_ReadError.
\n
"
));
i
=
xx_ReadError
();
if
(
D
S
[
d
].
in_SpinUp
!=
0
)
DPRINTF
((
DBG_SPI
,
"SBPCD: to cmd_out OK.
\n
"
));
if
(
D
riveStruct
[
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
"
));
D
S
[
d
].
in_SpinUp
=
1
;
D
riveStruct
[
d
].
in_SpinUp
=
1
;
clr_cmdbuf
();
if
(
!
new_drive
)
{
...
...
@@ -897,7 +897,7 @@ static int xx_SpinUp(void)
}
response_count
=
0
;
i
=
cmd_out
();
D
S
[
d
].
in_SpinUp
=
0
;
D
riveStruct
[
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
;
D
S
[
d
].
diskstate_flags
&=
~
volume_bit
;
D
riveStruct
[
d
].
diskstate_flags
&=
~
volume_bit
;
clr_cmdbuf
();
channel0
=
D
S
[
d
].
vol_chan0
;
volume0
=
D
S
[
d
].
vol_ctrl0
;
channel1
=
control1
=
D
S
[
d
].
vol_chan1
;
volume1
=
value1
=
D
S
[
d
].
vol_ctrl1
;
channel0
=
D
riveStruct
[
d
].
vol_chan0
;
volume0
=
D
riveStruct
[
d
].
vol_ctrl0
;
channel1
=
control1
=
D
riveStruct
[
d
].
vol_chan1
;
volume1
=
value1
=
D
riveStruct
[
d
].
vol_ctrl1
;
control0
=
value0
=
0
;
if
(((
D
S
[
d
].
drv_options
&
sax_a
)
!=
0
)
&&
(
DS
[
d
].
drv_type
>=
drv_211
))
if
(((
D
riveStruct
[
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
(
D
S
[
d
].
drv_type
>=
drv_300
)
if
(
D
riveStruct
[
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
(
D
S
[
d
].
drv_type
<
drv_211
)
if
(
D
riveStruct
[
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
(
D
S
[
d
].
drv_type
<
drv_201
)
volume0
=
volume1
=
value0
;
else
if
(
D
riveStruct
[
d
].
drv_type
<
drv_201
)
volume0
=
volume1
=
value0
;
if
(
D
S
[
d
].
drv_type
>=
drv_201
)
if
(
D
riveStruct
[
d
].
drv_type
>=
drv_201
)
{
if
(
volume0
==
0
)
control0
|=
0x80
;
if
(
volume1
==
0
)
control0
|=
0x40
;
}
if
(
D
S
[
d
].
drv_type
>=
drv_211
)
if
(
D
riveStruct
[
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
);
D
S
[
d
].
diskstate_flags
|=
volume_bit
;
D
riveStruct
[
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
(
D
S
[
d
].
error_byte
!=
aud_12
)
return
-
1
;
if
(
D
riveStruct
[
d
].
error_byte
!=
aud_12
)
return
-
1
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1095,12 +1095,12 @@ static int SetSpeed(void)
{
int
i
,
speed
;
if
(
!
(
D
S
[
d
].
drv_options
&
(
speed_auto
|
speed_300
|
speed_150
)))
return
(
0
);
if
(
!
(
D
riveStruct
[
d
].
drv_options
&
(
speed_auto
|
speed_300
|
speed_150
)))
return
(
0
);
speed
=
speed_auto
;
if
(
!
(
D
S
[
d
].
drv_options
&
speed_auto
))
if
(
!
(
D
riveStruct
[
d
].
drv_options
&
speed_auto
))
{
speed
|=
speed_300
;
if
(
!
(
D
S
[
d
].
drv_options
&
speed_300
))
speed
=
0
;
if
(
!
(
D
riveStruct
[
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
);
D
S
[
d
].
CD_changed
=
1
;
D
riveStruct
[
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
;
D
S
[
d
].
diskstate_flags
&=
~
subq_bit
;
D
riveStruct
[
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
))
{
D
S
[
d
].
SubQ_ctl_adr
=
DS
[
d
].
SubQ_trk
=
DS
[
d
].
SubQ_pnt_idx
=
DS
[
d
].
SubQ_whatisthis
=
0
;
D
S
[
d
].
SubQ_run_tot
=
DS
[
d
].
SubQ_run_trk
=
0
;
D
riveStruct
[
d
].
SubQ_ctl_adr
=
DriveStruct
[
d
].
SubQ_trk
=
DriveStruct
[
d
].
SubQ_pnt_idx
=
DriveStruct
[
d
].
SubQ_whatisthis
=
0
;
D
riveStruct
[
d
].
SubQ_run_tot
=
DriveStruct
[
d
].
SubQ_run_trk
=
0
;
return
(
0
);
}
}
D
S
[
d
].
SubQ_ctl_adr
=
swap_nibbles
(
infobuf
[
1
]);
D
S
[
d
].
SubQ_trk
=
byt2bcd
(
infobuf
[
2
]);
D
S
[
d
].
SubQ_pnt_idx
=
byt2bcd
(
infobuf
[
3
]);
D
riveStruct
[
d
].
SubQ_ctl_adr
=
swap_nibbles
(
infobuf
[
1
]);
D
riveStruct
[
d
].
SubQ_trk
=
byt2bcd
(
infobuf
[
2
]);
D
riveStruct
[
d
].
SubQ_pnt_idx
=
byt2bcd
(
infobuf
[
3
]);
i
=
4
;
if
(
!
new_drive
)
i
=
5
;
D
S
[
d
].
SubQ_run_tot
=
make32
(
make16
(
0
,
infobuf
[
i
]),
make16
(
infobuf
[
i
+
1
],
infobuf
[
i
+
2
]));
/* msf-bin */
D
riveStruct
[
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
;
D
S
[
d
].
SubQ_run_trk
=
make32
(
make16
(
0
,
infobuf
[
i
]),
make16
(
infobuf
[
i
+
1
],
infobuf
[
i
+
2
]));
/* msf-bin */
D
S
[
d
].
SubQ_whatisthis
=
infobuf
[
i
+
3
];
D
S
[
d
].
diskstate_flags
|=
subq_bit
;
D
riveStruct
[
d
].
SubQ_run_trk
=
make32
(
make16
(
0
,
infobuf
[
i
]),
make16
(
infobuf
[
i
+
1
],
infobuf
[
i
+
2
]));
/* msf-bin */
D
riveStruct
[
d
].
SubQ_whatisthis
=
infobuf
[
i
+
3
];
D
riveStruct
[
d
].
diskstate_flags
|=
subq_bit
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1216,7 +1216,7 @@ static int xx_ModeSense(void)
{
int
i
;
D
S
[
d
].
diskstate_flags
&=
~
frame_size_bit
;
D
riveStruct
[
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
)
D
S
[
d
].
sense_byte
=
infobuf
[
i
++
];
D
S
[
d
].
frame_size
=
make16
(
infobuf
[
i
],
infobuf
[
i
+
1
]);
if
(
new_drive
)
D
riveStruct
[
d
].
sense_byte
=
infobuf
[
i
++
];
D
riveStruct
[
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
"
));
D
S
[
d
].
diskstate_flags
|=
frame_size_bit
;
D
riveStruct
[
d
].
diskstate_flags
|=
frame_size_bit
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1254,35 +1254,35 @@ static int xx_ModeSelect(int framesize)
{
int
i
;
D
S
[
d
].
diskstate_flags
&=
~
frame_size_bit
;
D
riveStruct
[
d
].
diskstate_flags
&=
~
frame_size_bit
;
clr_cmdbuf
();
D
S
[
d
].
frame_size
=
framesize
;
D
riveStruct
[
d
].
frame_size
=
framesize
;
DPRINTF
((
DBG_XA
,
"SBPCD: xx_ModeSelect: %02X %04X
\n
"
,
D
S
[
d
].
sense_byte
,
DS
[
d
].
frame_size
));
D
riveStruct
[
d
].
sense_byte
,
DriveStruct
[
d
].
frame_size
));
if
(
new_drive
)
{
drvcmd
[
0
]
=
0x09
;
drvcmd
[
1
]
=
0x00
;
drvcmd
[
2
]
=
D
S
[
d
].
sense_byte
;
drvcmd
[
3
]
=
(
D
S
[
d
].
frame_size
>>
8
)
&
0xFF
;
drvcmd
[
4
]
=
D
S
[
d
].
frame_size
&
0xFF
;
drvcmd
[
2
]
=
D
riveStruct
[
d
].
sense_byte
;
drvcmd
[
3
]
=
(
D
riveStruct
[
d
].
frame_size
>>
8
)
&
0xFF
;
drvcmd
[
4
]
=
D
riveStruct
[
d
].
frame_size
&
0xFF
;
flags_cmd_out
=
f_putcmd
|
f_ResponseStatus
|
f_obey_p_check
;
}
else
{
drvcmd
[
0
]
=
0x84
;
drvcmd
[
1
]
=
0x00
;
drvcmd
[
2
]
=
(
D
S
[
d
].
frame_size
>>
8
)
&
0xFF
;
drvcmd
[
3
]
=
D
S
[
d
].
frame_size
&
0xFF
;
drvcmd
[
2
]
=
(
D
riveStruct
[
d
].
frame_size
>>
8
)
&
0xFF
;
drvcmd
[
3
]
=
D
riveStruct
[
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
);
D
S
[
d
].
diskstate_flags
|=
frame_size_bit
;
D
riveStruct
[
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;
D
S
[d].diskstate_flags &= ~volume_bit;
D
riveStruct
[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 (D
S
[d].drv_type>=drv_201)
if (D
riveStruct
[d].drv_type>=drv_201)
{
if (D
S
[d].drv_type<drv_300)
if (D
riveStruct
[d].drv_type<drv_300)
{
switches=infobuf[0];
if ((switches&0x80)!=0) vol0=0;
if ((switches&0x40)!=0) vol1=0;
if (D
S
[d].drv_type>=drv_211)
if (D
riveStruct
[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)
}
}
}
D
S
[d].vol_chan0=chan0;
D
S
[d].vol_ctrl0=vol0;
D
S
[d].vol_chan1=chan1;
D
S
[d].vol_ctrl1=vol1;
D
S
[d].vol_chan2=2;
D
S
[d].vol_ctrl2=0xFF;
D
S
[d].vol_chan3=3;
D
S
[d].vol_ctrl3=0xFF;
D
S
[d].diskstate_flags |= volume_bit;
D
riveStruct
[d].vol_chan0=chan0;
D
riveStruct
[d].vol_ctrl0=vol0;
D
riveStruct
[d].vol_chan1=chan1;
D
riveStruct
[d].vol_ctrl1=vol1;
D
riveStruct
[d].vol_chan2=2;
D
riveStruct
[d].vol_ctrl2=0xFF;
D
riveStruct
[d].vol_chan3=3;
D
riveStruct
[d].vol_ctrl3=0xFF;
D
riveStruct
[d].diskstate_flags |= volume_bit;
return (0);
}
#endif
...
...
@@ -1377,7 +1377,7 @@ static int xx_ReadCapacity(void)
{
int
i
;
D
S
[
d
].
diskstate_flags
&=
~
cd_size_bit
;
D
riveStruct
[
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
);
D
S
[
d
].
CDsize_blk
=
make32
(
make16
(
0
,
infobuf
[
0
]),
make16
(
infobuf
[
1
],
infobuf
[
2
]));
if
(
new_drive
)
D
S
[
d
].
CDsize_blk
=
msf2blk
(
DS
[
d
].
CDsize_blk
);
D
S
[
d
].
CDsize_frm
=
(
DS
[
d
].
CDsize_blk
*
make16
(
infobuf
[
3
],
infobuf
[
4
]))
/
CD_FRAMESIZE
;
D
S
[
d
].
CDsize_blk
+=
151
;
D
S
[
d
].
diskstate_flags
|=
cd_size_bit
;
D
riveStruct
[
d
].
CDsize_blk
=
make32
(
make16
(
0
,
infobuf
[
0
]),
make16
(
infobuf
[
1
],
infobuf
[
2
]));
if
(
new_drive
)
D
riveStruct
[
d
].
CDsize_blk
=
msf2blk
(
DriveStruct
[
d
].
CDsize_blk
);
D
riveStruct
[
d
].
CDsize_frm
=
(
DriveStruct
[
d
].
CDsize_blk
*
make16
(
infobuf
[
3
],
infobuf
[
4
]))
/
CD_FRAMESIZE
;
D
riveStruct
[
d
].
CDsize_blk
+=
151
;
D
riveStruct
[
d
].
diskstate_flags
|=
cd_size_bit
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1404,7 +1404,7 @@ static int xx_ReadTocDescr(void)
{
int
i
;
D
S
[
d
].
diskstate_flags
&=
~
toc_bit
;
D
riveStruct
[
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
);
D
S
[
d
].
xa_byte
=
infobuf
[
0
];
D
S
[
d
].
n_first_track
=
infobuf
[
1
];
D
S
[
d
].
n_last_track
=
infobuf
[
2
];
D
S
[
d
].
size_msf
=
make32
(
make16
(
0
,
infobuf
[
3
]),
make16
(
infobuf
[
4
],
infobuf
[
5
]));
D
S
[
d
].
size_blk
=
msf2blk
(
DS
[
d
].
size_msf
);
D
S
[
d
].
diskstate_flags
|=
toc_bit
;
D
riveStruct
[
d
].
xa_byte
=
infobuf
[
0
];
D
riveStruct
[
d
].
n_first_track
=
infobuf
[
1
];
D
riveStruct
[
d
].
n_last_track
=
infobuf
[
2
];
D
riveStruct
[
d
].
size_msf
=
make32
(
make16
(
0
,
infobuf
[
3
]),
make16
(
infobuf
[
4
],
infobuf
[
5
]));
D
riveStruct
[
d
].
size_blk
=
msf2blk
(
DriveStruct
[
d
].
size_msf
);
D
riveStruct
[
d
].
diskstate_flags
|=
toc_bit
;
DPRINTF
((
DBG_TOC
,
"SBPCD: TocDesc: %02X %02X %02X %08X
\n
"
,
D
S
[
d
].
xa_byte
,
DS
[
d
].
n_first_track
,
DS
[
d
].
n_last_track
,
DS
[
d
].
size_msf
));
D
riveStruct
[
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
);
D
S
[
d
].
TocEnt_nixbyte
=
infobuf
[
0
];
D
S
[
d
].
TocEnt_ctl_adr
=
swap_nibbles
(
infobuf
[
1
]);
D
S
[
d
].
TocEnt_number
=
infobuf
[
2
];
D
S
[
d
].
TocEnt_format
=
infobuf
[
3
];
D
riveStruct
[
d
].
TocEnt_nixbyte
=
infobuf
[
0
];
D
riveStruct
[
d
].
TocEnt_ctl_adr
=
swap_nibbles
(
infobuf
[
1
]);
D
riveStruct
[
d
].
TocEnt_number
=
infobuf
[
2
];
D
riveStruct
[
d
].
TocEnt_format
=
infobuf
[
3
];
if
(
new_drive
)
i
=
4
;
else
i
=
5
;
D
S
[
d
].
TocEnt_address
=
make32
(
make16
(
0
,
infobuf
[
i
]),
make16
(
infobuf
[
i
+
1
],
infobuf
[
i
+
2
]));
D
riveStruct
[
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
"
,
D
S
[
d
].
TocEnt_nixbyte
,
DS
[
d
].
TocEnt_ctl_adr
,
DS
[
d
].
TocEnt_number
,
D
S
[
d
].
TocEnt_format
,
DS
[
d
].
TocEnt_address
));
D
riveStruct
[
d
].
TocEnt_nixbyte
,
DriveStruct
[
d
].
TocEnt_ctl_adr
,
DriveStruct
[
d
].
TocEnt_number
,
D
riveStruct
[
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
)
D
S
[
d
].
UPC_buf
[
i
]
=
swap_nibbles
(
*
p
++
);
if
(
new_drive
)
D
riveStruct
[
d
].
UPC_buf
[
i
]
=
swap_nibbles
(
*
p
++
);
else
{
D
S
[
d
].
UPC_buf
[
i
]
=
((
*
p
++
)
<<
4
)
&
0xFF
;
D
S
[
d
].
UPC_buf
[
i
]
|=
*
p
++
;
D
riveStruct
[
d
].
UPC_buf
[
i
]
=
((
*
p
++
)
<<
4
)
&
0xFF
;
D
riveStruct
[
d
].
UPC_buf
[
i
]
|=
*
p
++
;
}
}
D
S
[
d
].
UPC_buf
[
6
]
&=
0xF0
;
D
riveStruct
[
d
].
UPC_buf
[
6
]
&=
0xF0
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1501,7 +1501,7 @@ static int xx_ReadUPC(void)
int
block
,
checksum
;
#endif TEST_UPC
D
S
[
d
].
diskstate_flags
&=
~
upc_bit
;
D
riveStruct
[
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
D
S
[
d
].
UPC_ctl_adr
=
0
;
D
riveStruct
[
d
].
UPC_ctl_adr
=
0
;
if
(
new_drive
)
i
=
0
;
else
i
=
2
;
if
((
infobuf
[
i
]
&
0x80
)
!=
0
)
{
convert_UPC
(
&
infobuf
[
i
]);
D
S
[
d
].
UPC_ctl_adr
=
(
DS
[
d
].
TocEnt_ctl_adr
&
0xF0
)
|
0x02
;
D
riveStruct
[
d
].
UPC_ctl_adr
=
(
DriveStruct
[
d
].
TocEnt_ctl_adr
&
0xF0
)
|
0x02
;
}
DPRINTF
((
DBG_UPC
,
"SBPCD: UPC code: "
));
DPRINTF
((
DBG_UPC
,
"(%02X) "
,
D
S
[
d
].
UPC_ctl_adr
));
DPRINTF
((
DBG_UPC
,
"(%02X) "
,
D
riveStruct
[
d
].
UPC_ctl_adr
));
for
(
i
=
0
;
i
<
7
;
i
++
)
{
DPRINTF
((
DBG_UPC
,
"%02X "
,
D
S
[
d
].
UPC_buf
[
i
]));
DPRINTF
((
DBG_UPC
,
"%02X "
,
D
riveStruct
[
d
].
UPC_buf
[
i
]));
}
DPRINTF
((
DBG_UPC
,
"
\n
"
));
D
S
[
d
].
diskstate_flags
|=
upc_bit
;
D
riveStruct
[
d
].
diskstate_flags
|=
upc_bit
;
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1578,8 +1578,8 @@ static int yy_CheckMultiSession(void)
{
int
i
;
D
S
[
d
].
diskstate_flags
&=
~
multisession_bit
;
D
S
[
d
].
f_multisession
=
0
;
D
riveStruct
[
d
].
diskstate_flags
&=
~
multisession_bit
;
D
riveStruct
[
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
]));
D
S
[
d
].
f_multisession
=
1
;
D
S
[
d
].
lba_multi
=
msf2blk
(
make32
(
make16
(
0
,
infobuf
[
1
]),
D
riveStruct
[
d
].
f_multisession
=
1
;
D
riveStruct
[
d
].
lba_multi
=
msf2blk
(
make32
(
make16
(
0
,
infobuf
[
1
]),
make16
(
infobuf
[
2
],
infobuf
[
3
])));
}
}
D
S
[
d
].
diskstate_flags
|=
multisession_bit
;
D
riveStruct
[
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 (D
S
[d].audio_state!=audio_playing) return (-2);
if (D
riveStruct
[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
;
D
S
[
d
].
frame_size
=
CD_FRAMESIZE_SUB
;
D
riveStruct
[
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
)
{
D
S
[
d
].
drive_model
[
0
]
=
infobuf
[
i
++
];
D
S
[
d
].
drive_model
[
1
]
=
infobuf
[
i
++
];
D
S
[
d
].
drive_model
[
2
]
=
'-'
;
D
S
[
d
].
drive_model
[
3
]
=
'x'
;
D
S
[
d
].
drv_type
=
drv_new
;
D
riveStruct
[
d
].
drive_model
[
0
]
=
infobuf
[
i
++
];
D
riveStruct
[
d
].
drive_model
[
1
]
=
infobuf
[
i
++
];
D
riveStruct
[
d
].
drive_model
[
2
]
=
'-'
;
D
riveStruct
[
d
].
drive_model
[
3
]
=
'x'
;
D
riveStruct
[
d
].
drv_type
=
drv_new
;
}
else
{
for
(
i
=
0
;
i
<
8
;
i
++
)
if
(
infobuf
[
i
]
!=
drive_vendor
[
i
])
break
;
if
(
i
!=
8
)
return
(
-
1
);
D
S
[
d
].
drive_model
[
0
]
=
'2'
;
D
S
[
d
].
drive_model
[
1
]
=
'x'
;
D
S
[
d
].
drive_model
[
2
]
=
'-'
;
D
S
[
d
].
drive_model
[
3
]
=
'x'
;
D
S
[
d
].
drv_type
=
drv_old
;
}
for
(
j
=
0
;
j
<
4
;
j
++
)
D
S
[
d
].
firmware_version
[
j
]
=
infobuf
[
i
+
j
];
j
=
(
D
S
[
d
].
firmware_version
[
0
]
&
0x0F
)
*
100
+
(
D
S
[
d
].
firmware_version
[
2
]
&
0x0F
)
*
10
+
(
D
S
[
d
].
firmware_version
[
3
]
&
0x0F
);
D
riveStruct
[
d
].
drive_model
[
0
]
=
'2'
;
D
riveStruct
[
d
].
drive_model
[
1
]
=
'x'
;
D
riveStruct
[
d
].
drive_model
[
2
]
=
'-'
;
D
riveStruct
[
d
].
drive_model
[
3
]
=
'x'
;
D
riveStruct
[
d
].
drv_type
=
drv_old
;
}
for
(
j
=
0
;
j
<
4
;
j
++
)
D
riveStruct
[
d
].
firmware_version
[
j
]
=
infobuf
[
i
+
j
];
j
=
(
D
riveStruct
[
d
].
firmware_version
[
0
]
&
0x0F
)
*
100
+
(
D
riveStruct
[
d
].
firmware_version
[
2
]
&
0x0F
)
*
10
+
(
D
riveStruct
[
d
].
firmware_version
[
3
]
&
0x0F
);
if
(
new_drive
)
{
if
(
j
<
100
)
D
S
[
d
].
drv_type
=
drv_099
;
else
D
S
[
d
].
drv_type
=
drv_100
;
if
(
j
<
100
)
D
riveStruct
[
d
].
drv_type
=
drv_099
;
else
D
riveStruct
[
d
].
drv_type
=
drv_100
;
}
else
if
(
j
<
200
)
D
S
[
d
].
drv_type
=
drv_199
;
else
if
(
j
<
201
)
D
S
[
d
].
drv_type
=
drv_200
;
else
if
(
j
<
210
)
D
S
[
d
].
drv_type
=
drv_201
;
else
if
(
j
<
211
)
D
S
[
d
].
drv_type
=
drv_210
;
else
if
(
j
<
300
)
D
S
[
d
].
drv_type
=
drv_211
;
else
D
S
[
d
].
drv_type
=
drv_300
;
else
if
(
j
<
200
)
D
riveStruct
[
d
].
drv_type
=
drv_199
;
else
if
(
j
<
201
)
D
riveStruct
[
d
].
drv_type
=
drv_200
;
else
if
(
j
<
210
)
D
riveStruct
[
d
].
drv_type
=
drv_201
;
else
if
(
j
<
211
)
D
riveStruct
[
d
].
drv_type
=
drv_210
;
else
if
(
j
<
300
)
D
riveStruct
[
d
].
drv_type
=
drv_211
;
else
D
riveStruct
[
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
"
,
D
S
[
d
].
drv_minor
));
DPRINTF
((
DBG_DID
,
"SBPCD: switch_drive: drive %d activated.
\n
"
,
D
riveStruct
[
d
].
drv_minor
));
return
(
0
);
}
/*==========================================================================*/
...
...
@@ -1757,7 +1757,7 @@ static int check_drives(void)
ndrives
=
0
;
for
(
j
=
0
;
j
<
NR_SBPCD
;
j
++
)
{
D
S
[
j
].
drv_minor
=
j
;
D
riveStruct
[
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
++
;
D
S
[
d
].
drv_options
=
drv_pattern
[
j
];
if
(
!
new_drive
)
D
S
[
d
].
drv_options
&=~
(
speed_auto
|
speed_300
|
speed_150
);
D
riveStruct
[
d
].
drv_options
=
drv_pattern
[
j
];
if
(
!
new_drive
)
D
riveStruct
[
d
].
drv_options
&=~
(
speed_auto
|
speed_300
|
speed_150
);
printk
(
"%sDrive %d: %s%.4s (%.4s)
\n
"
,
printk_header
,
D
S
[
d
].
drv_minor
,
D
riveStruct
[
d
].
drv_minor
,
drive_family
,
D
S
[
d
].
drive_model
,
D
S
[
d
].
firmware_version
);
D
riveStruct
[
d
].
drive_model
,
D
riveStruct
[
d
].
firmware_version
);
printk_header
=
" - "
;
}
else
D
S
[
d
].
drv_minor
=-
1
;
else
D
riveStruct
[
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
(
D
S
[
d
].
pos_audio_end
)
-
1
;
i
=
msf2blk
(
D
riveStruct
[
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
;
D
S
[
d
].
diskstate_flags
&=
~
toc_bit
;
D
S
[
d
].
ored_ctl_adr
=
0
;
for
(
j
=
D
S
[
d
].
n_first_track
;
j
<=
DS
[
d
].
n_last_track
;
j
++
)
D
riveStruct
[
d
].
diskstate_flags
&=
~
toc_bit
;
D
riveStruct
[
d
].
ored_ctl_adr
=
0
;
for
(
j
=
D
riveStruct
[
d
].
n_first_track
;
j
<=
DriveStruct
[
d
].
n_last_track
;
j
++
)
{
i
=
xx_ReadTocEntry
(
j
);
if
(
i
<
0
)
return
(
i
);
D
S
[
d
].
TocBuffer
[
j
].
nixbyte
=
DS
[
d
].
TocEnt_nixbyte
;
D
S
[
d
].
TocBuffer
[
j
].
ctl_adr
=
DS
[
d
].
TocEnt_ctl_adr
;
D
S
[
d
].
TocBuffer
[
j
].
number
=
DS
[
d
].
TocEnt_number
;
D
S
[
d
].
TocBuffer
[
j
].
format
=
DS
[
d
].
TocEnt_format
;
D
S
[
d
].
TocBuffer
[
j
].
address
=
DS
[
d
].
TocEnt_address
;
D
S
[
d
].
ored_ctl_adr
|=
DS
[
d
].
TocEnt_ctl_adr
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
nixbyte
=
DriveStruct
[
d
].
TocEnt_nixbyte
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
ctl_adr
=
DriveStruct
[
d
].
TocEnt_ctl_adr
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
number
=
DriveStruct
[
d
].
TocEnt_number
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
format
=
DriveStruct
[
d
].
TocEnt_format
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
address
=
DriveStruct
[
d
].
TocEnt_address
;
D
riveStruct
[
d
].
ored_ctl_adr
|=
DriveStruct
[
d
].
TocEnt_ctl_adr
;
}
/* fake entry for LeadOut Track */
D
S
[
d
].
TocBuffer
[
j
].
nixbyte
=
0
;
D
S
[
d
].
TocBuffer
[
j
].
ctl_adr
=
0
;
D
S
[
d
].
TocBuffer
[
j
].
number
=
0
;
D
S
[
d
].
TocBuffer
[
j
].
format
=
0
;
D
S
[
d
].
TocBuffer
[
j
].
address
=
DS
[
d
].
size_msf
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
nixbyte
=
0
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
ctl_adr
=
0
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
number
=
0
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
format
=
0
;
D
riveStruct
[
d
].
TocBuffer
[
j
].
address
=
DriveStruct
[
d
].
size_msf
;
D
S
[
d
].
diskstate_flags
|=
toc_bit
;
D
riveStruct
[
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
(
D
S
[
d
].
n_first_track
);
i
=
xx_ReadTocEntry
(
D
riveStruct
[
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
)
&&
(
D
S
[
d
].
xa_byte
==
0x20
))
/* XA disk with old drive */
if
((
!
new_drive
)
&&
(
D
riveStruct
[
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
(
D
S
[
d
].
CD_changed
==
0xFF
)
if
(
D
riveStruct
[
d
].
CD_changed
==
0xFF
)
{
#if MANY_SESSION
#else
D
S
[
d
].
diskstate_flags
=
0
;
D
riveStruct
[
d
].
diskstate_flags
=
0
;
#endif MANY_SESSION
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
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
)
{
D
S
[
d
].
CD_changed
=
1
;
D
riveStruct
[
d
].
CD_changed
=
1
;
return
(
-
15
);
}
}
...
...
@@ -2069,9 +2069,9 @@ static int prepare(u_char func, u_char subfunc)
{
#if MANY_SESSION
#else
D
S
[
d
].
diskstate_flags
=
0
;
D
riveStruct
[
d
].
diskstate_flags
=
0
;
#endif MANY_SESSION
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
!=
audio_pausing
)
if
(
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
==
audio_playing
)
seek_pos_audio_end
();
D
S
[
d
].
audio_state
=
0
;
if
(
D
riveStruct
[
d
].
audio_state
==
audio_playing
)
seek_pos_audio_end
();
D
riveStruct
[
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
D
S
[
d
].
diskstate_flags
=
0
;
D
riveStruct
[
d
].
diskstate_flags
=
0
;
#endif MANY_SESSION
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
==
audio_playing
)
return
(
-
EINVAL
);
if
(
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
)
switch
(
D
riveStruct
[
d
].
audio_state
)
{
case
audio_playing
:
i
=
xx_Pause_Resume
(
1
);
if
(
i
<
0
)
return
(
-
EIO
);
D
S
[
d
].
audio_state
=
audio_pausing
;
D
riveStruct
[
d
].
audio_state
=
audio_pausing
;
i
=
xx_ReadSubQ
();
if
(
i
<
0
)
return
(
-
EIO
);
D
S
[
d
].
pos_audio_start
=
DS
[
d
].
SubQ_run_tot
;
D
riveStruct
[
d
].
pos_audio_start
=
DriveStruct
[
d
].
SubQ_run_tot
;
return
(
0
);
case
audio_pausing
:
i
=
xx_Seek
(
D
S
[
d
].
pos_audio_start
,
1
);
i
=
xx_Seek
(
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
!=
audio_pausing
)
return
-
EINVAL
;
if
(
D
riveStruct
[
d
].
audio_state
!=
audio_pausing
)
return
-
EINVAL
;
i
=
xx_Pause_Resume
(
3
);
if
(
i
<
0
)
return
(
-
EIO
);
D
S
[
d
].
audio_state
=
audio_playing
;
D
riveStruct
[
d
].
audio_state
=
audio_playing
;
return
(
0
);
case
CDROMPLAYMSF
:
DPRINTF
((
DBG_IOC
,
"SBPCD: ioctl: CDROMPLAYMSF entered.
\n
"
));
if
(
D
S
[
d
].
audio_state
==
audio_playing
)
if
(
D
riveStruct
[
d
].
audio_state
==
audio_playing
)
{
i
=
xx_Pause_Resume
(
1
);
if
(
i
<
0
)
return
(
-
EIO
);
i
=
xx_ReadSubQ
();
if
(
i
<
0
)
return
(
-
EIO
);
D
S
[
d
].
pos_audio_start
=
DS
[
d
].
SubQ_run_tot
;
i
=
xx_Seek
(
D
S
[
d
].
pos_audio_start
,
1
);
D
riveStruct
[
d
].
pos_audio_start
=
DriveStruct
[
d
].
SubQ_run_tot
;
i
=
xx_Seek
(
D
riveStruct
[
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 */
D
S
[
d
].
pos_audio_start
=
(
msf
.
cdmsf_min0
<<
16
)
|
D
riveStruct
[
d
].
pos_audio_start
=
(
msf
.
cdmsf_min0
<<
16
)
|
(
msf
.
cdmsf_sec0
<<
8
)
|
msf
.
cdmsf_frame0
;
D
S
[
d
].
pos_audio_end
=
(
msf
.
cdmsf_min1
<<
16
)
|
D
riveStruct
[
d
].
pos_audio_end
=
(
msf
.
cdmsf_min1
<<
16
)
|
(
msf
.
cdmsf_sec1
<<
8
)
|
msf
.
cdmsf_frame1
;
DPRINTF
((
DBG_IOX
,
"SBPCD: ioctl: CDROMPLAYMSF %08X %08X
\n
"
,
D
S
[
d
].
pos_audio_start
,
DS
[
d
].
pos_audio_end
));
i
=
xx_PlayAudioMSF
(
D
S
[
d
].
pos_audio_start
,
DS
[
d
].
pos_audio_end
);
D
riveStruct
[
d
].
pos_audio_start
,
DriveStruct
[
d
].
pos_audio_end
));
i
=
xx_PlayAudioMSF
(
D
riveStruct
[
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
D
S
[
d
].
audio_state
=
audio_playing
;
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
==
audio_playing
)
if
(
D
riveStruct
[
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
<
D
S
[
d
].
n_first_track
)
return
(
-
EINVAL
);
if
(
ti
.
cdti_trk0
>
D
S
[
d
].
n_last_track
)
return
(
-
EINVAL
);
if
(
ti
.
cdti_trk0
<
D
riveStruct
[
d
].
n_first_track
)
return
(
-
EINVAL
);
if
(
ti
.
cdti_trk0
>
D
riveStruct
[
d
].
n_last_track
)
return
(
-
EINVAL
);
if
(
ti
.
cdti_trk1
<
ti
.
cdti_trk0
)
ti
.
cdti_trk1
=
ti
.
cdti_trk0
;
if
(
ti
.
cdti_trk1
>
D
S
[
d
].
n_last_track
)
ti
.
cdti_trk1
=
DS
[
d
].
n_last_track
;
D
S
[
d
].
pos_audio_start
=
DS
[
d
].
TocBuffer
[
ti
.
cdti_trk0
].
address
;
D
S
[
d
].
pos_audio_end
=
DS
[
d
].
TocBuffer
[
ti
.
cdti_trk1
+
1
].
address
;
i
=
xx_PlayAudioMSF
(
D
S
[
d
].
pos_audio_start
,
DS
[
d
].
pos_audio_end
);
if
(
ti
.
cdti_trk1
>
D
riveStruct
[
d
].
n_last_track
)
ti
.
cdti_trk1
=
DriveStruct
[
d
].
n_last_track
;
D
riveStruct
[
d
].
pos_audio_start
=
DriveStruct
[
d
].
TocBuffer
[
ti
.
cdti_trk0
].
address
;
D
riveStruct
[
d
].
pos_audio_end
=
DriveStruct
[
d
].
TocBuffer
[
ti
.
cdti_trk1
+
1
].
address
;
i
=
xx_PlayAudioMSF
(
D
riveStruct
[
d
].
pos_audio_start
,
DriveStruct
[
d
].
pos_audio_end
);
#if 0
if (i<0) return (-EIO);
#endif 0
D
S
[
d
].
audio_state
=
audio_playing
;
D
riveStruct
[
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
=
D
S
[
d
].
n_first_track
;
tochdr
.
cdth_trk1
=
D
S
[
d
].
n_last_track
;
tochdr
.
cdth_trk0
=
D
riveStruct
[
d
].
n_first_track
;
tochdr
.
cdth_trk1
=
D
riveStruct
[
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
=
D
S
[
d
].
n_last_track
+
1
;
else
if
(
i
<
D
S
[
d
].
n_first_track
||
i
>
DS
[
d
].
n_last_track
)
return
(
-
EINVAL
);
tocentry
.
cdte_adr
=
D
S
[
d
].
TocBuffer
[
i
].
ctl_adr
&
0x0F
;
tocentry
.
cdte_ctrl
=
(
D
S
[
d
].
TocBuffer
[
i
].
ctl_adr
>>
4
)
&
0x0F
;
tocentry
.
cdte_datamode
=
D
S
[
d
].
TocBuffer
[
i
].
format
;
if
(
i
==
CDROM_LEADOUT
)
i
=
D
riveStruct
[
d
].
n_last_track
+
1
;
else
if
(
i
<
D
riveStruct
[
d
].
n_first_track
||
i
>
DriveStruct
[
d
].
n_last_track
)
return
(
-
EINVAL
);
tocentry
.
cdte_adr
=
D
riveStruct
[
d
].
TocBuffer
[
i
].
ctl_adr
&
0x0F
;
tocentry
.
cdte_ctrl
=
(
D
riveStruct
[
d
].
TocBuffer
[
i
].
ctl_adr
>>
4
)
&
0x0F
;
tocentry
.
cdte_datamode
=
D
riveStruct
[
d
].
TocBuffer
[
i
].
format
;
if
(
tocentry
.
cdte_format
==
CDROM_MSF
)
/* MSF-bin required */
{
tocentry
.
cdte_addr
.
msf
.
minute
=
(
D
S
[
d
].
TocBuffer
[
i
].
address
>>
16
)
&
0x00FF
;
tocentry
.
cdte_addr
.
msf
.
second
=
(
D
S
[
d
].
TocBuffer
[
i
].
address
>>
8
)
&
0x00FF
;
tocentry
.
cdte_addr
.
msf
.
frame
=
D
S
[
d
].
TocBuffer
[
i
].
address
&
0x00FF
;
{
tocentry
.
cdte_addr
.
msf
.
minute
=
(
D
riveStruct
[
d
].
TocBuffer
[
i
].
address
>>
16
)
&
0x00FF
;
tocentry
.
cdte_addr
.
msf
.
second
=
(
D
riveStruct
[
d
].
TocBuffer
[
i
].
address
>>
8
)
&
0x00FF
;
tocentry
.
cdte_addr
.
msf
.
frame
=
D
riveStruct
[
d
].
TocBuffer
[
i
].
address
&
0x00FF
;
}
else
if
(
tocentry
.
cdte_format
==
CDROM_LBA
)
/* blk required */
tocentry
.
cdte_addr
.
lba
=
msf2blk
(
D
S
[
d
].
TocBuffer
[
i
].
address
);
tocentry
.
cdte_addr
.
lba
=
msf2blk
(
D
riveStruct
[
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
D
S
[
d
].
CD_changed
=
0xFF
;
D
S
[
d
].
diskstate_flags
=
0
;
D
riveStruct
[
d
].
CD_changed
=
0xFF
;
D
riveStruct
[
d
].
diskstate_flags
=
0
;
#endif WORKMAN
DPRINTF
((
DBG_IOC
,
"SBPCD: ioctl: DriveReset returns %d
\n
"
,
i
));
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
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
();
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
d
].
audio_state
=
0
;
return
(
0
);
case
CDROMEJECT
:
DPRINTF
((
DBG_IOC
,
"SBPCD: ioctl: CDROMEJECT entered.
\n
"
));
if
(
!
new_drive
)
return
(
0
);
#if WORKMAN
D
S
[
d
].
CD_changed
=
0xFF
;
D
S
[
d
].
diskstate_flags
=
0
;
D
riveStruct
[
d
].
CD_changed
=
0xFF
;
D
riveStruct
[
d
].
diskstate_flags
=
0
;
#endif WORKMAN
i
=
yy_SpinDown
();
if
(
i
<
0
)
return
(
-
EIO
);
D
S
[
d
].
audio_state
=
0
;
D
riveStruct
[
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
));
D
S
[
d
].
vol_chan0
=
0
;
D
S
[
d
].
vol_ctrl0
=
volctrl
.
channel0
;
D
S
[
d
].
vol_chan1
=
1
;
D
S
[
d
].
vol_ctrl1
=
volctrl
.
channel1
;
D
riveStruct
[
d
].
vol_chan0
=
0
;
D
riveStruct
[
d
].
vol_ctrl0
=
volctrl
.
channel0
;
D
riveStruct
[
d
].
vol_chan1
=
1
;
D
riveStruct
[
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
(
D
S
[
d
].
audio_state
)
switch
(
D
riveStruct
[
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
=
D
S
[
d
].
SubQ_ctl_adr
;
SC
.
cdsc_ctrl
=
D
S
[
d
].
SubQ_ctl_adr
>>
4
;
SC
.
cdsc_trk
=
bcd2bin
(
D
S
[
d
].
SubQ_trk
);
SC
.
cdsc_ind
=
bcd2bin
(
D
S
[
d
].
SubQ_pnt_idx
);
SC
.
cdsc_adr
=
D
riveStruct
[
d
].
SubQ_ctl_adr
;
SC
.
cdsc_ctrl
=
D
riveStruct
[
d
].
SubQ_ctl_adr
>>
4
;
SC
.
cdsc_trk
=
bcd2bin
(
D
riveStruct
[
d
].
SubQ_trk
);
SC
.
cdsc_ind
=
bcd2bin
(
D
riveStruct
[
d
].
SubQ_pnt_idx
);
if
(
SC
.
cdsc_format
==
CDROM_LBA
)
{
SC
.
cdsc_absaddr
.
lba
=
msf2blk
(
D
S
[
d
].
SubQ_run_tot
);
SC
.
cdsc_reladdr
.
lba
=
msf2blk
(
D
S
[
d
].
SubQ_run_trk
);
SC
.
cdsc_absaddr
.
lba
=
msf2blk
(
D
riveStruct
[
d
].
SubQ_run_tot
);
SC
.
cdsc_reladdr
.
lba
=
msf2blk
(
D
riveStruct
[
d
].
SubQ_run_trk
);
}
else
/* not only if (SC.cdsc_format==CDROM_MSF) */
{
SC
.
cdsc_absaddr
.
msf
.
minute
=
(
D
S
[
d
].
SubQ_run_tot
>>
16
)
&
0x00FF
;
SC
.
cdsc_absaddr
.
msf
.
second
=
(
D
S
[
d
].
SubQ_run_tot
>>
8
)
&
0x00FF
;
SC
.
cdsc_absaddr
.
msf
.
frame
=
D
S
[
d
].
SubQ_run_tot
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
minute
=
(
D
S
[
d
].
SubQ_run_trk
>>
16
)
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
second
=
(
D
S
[
d
].
SubQ_run_trk
>>
8
)
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
frame
=
D
S
[
d
].
SubQ_run_trk
&
0x00FF
;
SC
.
cdsc_absaddr
.
msf
.
minute
=
(
D
riveStruct
[
d
].
SubQ_run_tot
>>
16
)
&
0x00FF
;
SC
.
cdsc_absaddr
.
msf
.
second
=
(
D
riveStruct
[
d
].
SubQ_run_tot
>>
8
)
&
0x00FF
;
SC
.
cdsc_absaddr
.
msf
.
frame
=
D
riveStruct
[
d
].
SubQ_run_tot
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
minute
=
(
D
riveStruct
[
d
].
SubQ_run_trk
>>
16
)
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
second
=
(
D
riveStruct
[
d
].
SubQ_run_trk
>>
8
)
&
0x00FF
;
SC
.
cdsc_reladdr
.
msf
.
frame
=
D
riveStruct
[
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
>=
D
S
[
d
].
sbp_first_frame
)
&&
(
CURRENT
->
sector
/
4
<=
D
S
[
d
].
sbp_last_frame
)
)
(
CURRENT
->
sector
/
4
>=
D
riveStruct
[
d
].
sbp_first_frame
)
&&
(
CURRENT
->
sector
/
4
<=
D
riveStruct
[
d
].
sbp_last_frame
)
)
{
offs
=
(
CURRENT
->
sector
-
D
S
[
d
].
sbp_first_frame
*
4
)
*
512
;
memcpy
(
CURRENT
->
buffer
,
D
S
[
d
].
sbp_buf
+
offs
,
512
);
offs
=
(
CURRENT
->
sector
-
D
riveStruct
[
d
].
sbp_first_frame
*
4
)
*
512
;
memcpy
(
CURRENT
->
buffer
,
D
riveStruct
[
d
].
sbp_buf
+
offs
,
512
);
CURRENT
->
nr_sectors
--
;
CURRENT
->
sector
++
;
CURRENT
->
buffer
+=
512
;
...
...
@@ -2540,7 +2540,7 @@ static void do_sbpcd_request(void)
if
(
!
st_spinning
)
xx_SpinUp
();
#ifdef XA_TEST1
if
((
!
new_drive
)
&&
(
D
S
[
d
].
xa_byte
==
0x20
))
/* XA disk with old drive */
if
((
!
new_drive
)
&&
(
D
riveStruct
[
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
;
D
S
[
d
].
sbp_first_frame
=
DS
[
d
].
sbp_last_frame
=-
1
;
/* purge buffer */
D
riveStruct
[
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
(
(
D
S
[
d
].
f_multisession
)
&&
(
multisession_valid
)
)
if
(
(
D
riveStruct
[
d
].
f_multisession
)
&&
(
multisession_valid
)
)
{
DPRINTF
((
DBG_MUL
,
"SBPCD: MultiSession: use %08X for %08X (msf)
\n
"
,
blk2msf
(
D
S
[
d
].
lba_multi
+
block
),
blk2msf
(
D
riveStruct
[
d
].
lba_multi
+
block
),
blk2msf
(
block
)));
block
=
D
S
[
d
].
lba_multi
+
block
;
block
=
D
riveStruct
[
d
].
lba_multi
+
block
;
}
#else
if
(
(
block
==
166
)
&&
(
D
S
[
d
].
f_multisession
)
&&
(
multisession_valid
)
)
if
(
(
block
==
166
)
&&
(
D
riveStruct
[
d
].
f_multisession
)
&&
(
multisession_valid
)
)
{
DPRINTF
((
DBG_MUL
,
"SBPCD: MultiSession: use %08X for %08X (msf)
\n
"
,
blk2msf
(
D
S
[
d
].
lba_multi
+
16
),
blk2msf
(
D
riveStruct
[
d
].
lba_multi
+
16
),
blk2msf
(
block
)));
block
=
D
S
[
d
].
lba_multi
+
16
;
block
=
D
riveStruct
[
d
].
lba_multi
+
16
;
}
#endif MANY_SESSION
}
if
(
block
+
SBP_BUFFER_FRAMES
<=
D
S
[
d
].
CDsize_frm
)
D
S
[
d
].
sbp_read_frames
=
SBP_BUFFER_FRAMES
;
if
(
block
+
SBP_BUFFER_FRAMES
<=
D
riveStruct
[
d
].
CDsize_frm
)
D
riveStruct
[
d
].
sbp_read_frames
=
SBP_BUFFER_FRAMES
;
else
{
D
S
[
d
].
sbp_read_frames
=
DS
[
d
].
CDsize_frm
-
block
;
D
riveStruct
[
d
].
sbp_read_frames
=
DriveStruct
[
d
].
CDsize_frm
-
block
;
/* avoid reading past end of data */
if
(
D
S
[
d
].
sbp_read_frames
<
1
)
if
(
D
riveStruct
[
d
].
sbp_read_frames
<
1
)
{
DPRINTF
((
DBG_INF
,
"SBPCD: requested frame %d, CD size %d ???
\n
"
,
block
,
D
S
[
d
].
CDsize_frm
));
D
S
[
d
].
sbp_read_frames
=
1
;
block
,
D
riveStruct
[
d
].
CDsize_frm
));
D
riveStruct
[
d
].
sbp_read_frames
=
1
;
}
}
D
S
[
d
].
sbp_current
=
0
;
D
riveStruct
[
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
(
D
S
[
d
].
xa_byte
==
0x20
)
if
(
D
riveStruct
[
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
]
=
D
S
[
d
].
sbp_read_frames
;
drvcmd
[
5
]
=
D
riveStruct
[
d
].
sbp_read_frames
;
drvcmd
[
6
]
=
0
;
}
else
{
drvcmd
[
0
]
=
0x02
;
/* "read frames" command for old drives */
if
(
D
S
[
d
].
drv_type
>=
drv_201
)
if
(
D
riveStruct
[
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
]
=
D
S
[
d
].
sbp_read_frames
;
drvcmd
[
6
]
=
(
D
S
[
d
].
drv_type
<
drv_201
)
?
0
:
2
;
/* flag "lba or msf-bcd format" */
drvcmd
[
5
]
=
D
riveStruct
[
d
].
sbp_read_frames
;
drvcmd
[
6
]
=
(
D
riveStruct
[
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
]
=
D
S
[
d
].
sbp_read_frames
;
drvcmd
[
6
]
=
D
riveStruct
[
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
=
D
S
[
d
].
sbp_current
;
frame
<
DS
[
d
].
sbp_read_frames
&&!
error_flag
;
frame
++
)
for
(
frame
=
D
riveStruct
[
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
((
D
S
[
d
].
ored_ctl_adr
&
0x40
)
==
0
)
if
((
D
riveStruct
[
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
=
D
S
[
d
].
sbp_buf
+
frame
*
CD_FRAMESIZE
;
p
=
D
riveStruct
[
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
);
D
S
[
d
].
sbp_current
++
;
D
riveStruct
[
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
"
,
D
S
[
d
].
status_byte
));
D
riveStruct
[
d
].
status_byte
));
return
(
0
);
}
}
...
...
@@ -2835,8 +2835,8 @@ static int sbp_data(void)
return
(
0
);
}
D
S
[
d
].
sbp_first_frame
=
CURRENT
->
sector
/
4
;
D
S
[
d
].
sbp_last_frame
=
DS
[
d
].
sbp_first_frame
+
DS
[
d
].
sbp_read_frames
-
1
;
D
riveStruct
[
d
].
sbp_first_frame
=
CURRENT
->
sector
/
4
;
D
riveStruct
[
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
"
,
D
S
[
d
].
status_byte
));
DPRINTF
((
DBG_STA
,
"SBPCD: sbpcd_open: status %02X
\n
"
,
D
riveStruct
[
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
"
,
D
S
[
d
].
open_count
,
DS
[
d
].
open_count
+
1
));
if
(
++
D
S
[
d
].
open_count
==
1
)
yy_LockDoor
(
1
);
D
riveStruct
[
d
].
open_count
,
DriveStruct
[
d
].
open_count
+
1
));
if
(
++
D
riveStruct
[
d
].
open_count
==
1
)
yy_LockDoor
(
1
);
if
(
!
st_spinning
)
xx_SpinUp
();
i
=
DiskInfo
();
if
((
D
S
[
d
].
ored_ctl_adr
&
0x40
)
==
0
)
if
((
D
riveStruct
[
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
);
D
S
[
d
].
sbp_first_frame
=
DS
[
d
].
sbp_last_frame
=-
1
;
D
riveStruct
[
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
);
D
S
[
d
].
diskstate_flags
&=
~
cd_size_bit
;
D
riveStruct
[
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
"
,
D
S
[
d
].
open_count
,
DS
[
d
].
open_count
-
1
));
if
(
--
D
S
[
d
].
open_count
==
0
)
yy_LockDoor
(
0
);
D
riveStruct
[
d
].
open_count
,
DriveStruct
[
d
].
open_count
-
1
));
if
(
--
D
riveStruct
[
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
(
D
S
[
j
].
drv_minor
==-
1
)
continue
;
if
(
D
riveStruct
[
j
].
drv_minor
==-
1
)
continue
;
switch_drive
(
j
);
xy_DriveReset
();
if
(
!
st_spinning
)
xx_SpinUp
();
D
S
[
d
].
sbp_first_frame
=
-
1
;
/* First frame in buffer */
D
S
[
d
].
sbp_last_frame
=
-
1
;
/* Last frame in buffer */
D
S
[
d
].
sbp_read_frames
=
0
;
/* Number of frames being read to buffer */
D
S
[
d
].
sbp_current
=
0
;
/* Frame being currently read */
D
S
[
d
].
CD_changed
=
1
;
D
S
[
d
].
frame_size
=
CD_FRAMESIZE
;
D
riveStruct
[
d
].
sbp_first_frame
=
-
1
;
/* First frame in buffer */
D
riveStruct
[
d
].
sbp_last_frame
=
-
1
;
/* Last frame in buffer */
D
riveStruct
[
d
].
sbp_read_frames
=
0
;
/* Number of frames being read to buffer */
D
riveStruct
[
d
].
sbp_current
=
0
;
/* Frame being currently read */
D
riveStruct
[
d
].
CD_changed
=
1
;
D
riveStruct
[
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
(
D
S
[
d
].
error_byte
==
aud_12
)
if
(
D
riveStruct
[
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
)
D
S
[
d
].
CD_changed
=
1
;
if
(
i
>=
0
)
D
riveStruct
[
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
(
D
S
[
j
].
drv_minor
==-
1
)
continue
;
D
S
[
j
].
sbp_buf
=
(
u_char
*
)
mem_start
;
if
(
D
riveStruct
[
j
].
drv_minor
==-
1
)
continue
;
D
riveStruct
[
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
"
,
D
S
[
d
].
status_byte
));
DPRINTF
((
DBG_CHK
,
"SBPCD: media_check: %02X
\n
"
,
D
riveStruct
[
d
].
status_byte
));
if
(
st
<
0
)
{
DPRINTF
((
DBG_INF
,
"SBPCD: media_check: ResponseStatus error.
\n
"
));
return
(
1
);
/* status not obtainable */
}
if
(
D
S
[
d
].
CD_changed
==
0xFF
)
DPRINTF
((
DBG_CHK
,
"SBPCD: media_check:
\"
changed
\"
assumed.
\n
"
));
if
(
D
riveStruct
[
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
"
));
D
S
[
d
].
CD_changed
=
0xFF
;
D
riveStruct
[
d
].
CD_changed
=
0xFF
;
}
if
(
!
st_caddy_in
)
{
DPRINTF
((
DBG_CHK
,
"SBPCD: media_check: no disk in drive.
\n
"
));
D
S
[
d
].
CD_changed
=
0xFF
;
D
riveStruct
[
d
].
CD_changed
=
0xFF
;
}
if
(
!
st_diskok
)
DPRINTF
((
DBG_CHK
,
"SBPCD: media_check: !st_diskok.
\n
"
));
#if 0000
if (D
S
[d].CD_changed==0xFF)
if (D
riveStruct
[d].CD_changed==0xFF)
{
D
S
[d].CD_changed=1;
D
riveStruct
[d].CD_changed=1;
return (1); /* driver had a change detected before */
}
#endif 0000 /* seems to give additional errors at the moment */
...
...
drivers/char/n_tty.c
View file @
c2700b1f
...
...
@@ -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
)
...
...
drivers/char/serial.c
View file @
c2700b1f
...
...
@@ -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
);
...
...
drivers/char/tpqic02.c
View file @
c2700b1f
...
...
@@ -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, %
l
d) 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, %
l
d)"
,
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, %
l
d)
\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=%
l
x, 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==%
l
d
\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=%
l
x, 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 %
l
x, 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, %4
l
x)
\n
"
,
dev_maj
,
iocmd
,
ioarg
);
if
(
!
inode
||
!
ioarg
)
return
-
EINVAL
;
...
...
drivers/char/tty_io.c
View file @
c2700b1f
...
...
@@ -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 @@ static int init_dev(dev_t device, struct tty_struct **ret_tty)
(
*
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 @@ static int init_dev(dev_t device, struct tty_struct **ret_tty)
(
*
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
;
...
...
drivers/net/3c501.c
View file @
c2700b1f
...
...
@@ -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 */
drivers/net/MODULES
View file @
c2700b1f
MODULES = \
3c509.o \
de600.o
de600.o \
3c501.o \
plip.o
drivers/net/Makefile
View file @
c2700b1f
...
...
@@ -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
...
...
drivers/net/Space.c
View file @
c2700b1f
...
...
@@ -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
...
...
drivers/net/net_init.c
View file @
c2700b1f
...
...
@@ -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
;
...
...
drivers/net/plip.c
View file @
c2700b1f
...
...
@@ -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 <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 */
drivers/net/ppp.c
View file @
c2700b1f
...
...
@@ -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
...
...
fs/proc/net.c
View file @
c2700b1f
...
...
@@ -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
,{
13
5
,
4
,
"rarp"
}
,{
13
6
,
4
,
"rarp"
}
#endif
#endif
/* CONFIG_INET */
#ifdef CONFIG_IPX
,{
13
6
,
9
,
"ipx_route"
},
{
13
7
,
3
,
"ipx"
}
,{
13
7
,
9
,
"ipx_route"
},
{
13
8
,
3
,
"ipx"
}
#endif
/* CONFIG_IPX */
#ifdef CONFIG_AX25
,{
13
8
,
10
,
"ax25_route"
},
{
1
39
,
4
,
"ax25"
}
,{
13
9
,
10
,
"ax25_route"
},
{
1
40
,
4
,
"ax25"
}
#ifdef CONFIG_NETROM
,{
14
0
,
8
,
"nr_nodes"
},
{
14
1
,
8
,
"nr_neigh"
},
{
14
2
,
2
,
"nr"
}
,{
14
1
,
8
,
"nr_nodes"
},
{
14
2
,
8
,
"nr_neigh"
},
{
14
3
,
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
13
6
:
case
13
7
:
length
=
ipx_rt_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
case
13
7
:
case
13
8
:
length
=
ipx_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
#endif
/* CONFIG_IPX */
#ifdef CONFIG_AX25
case
13
8
:
case
13
9
:
length
=
ax25_rt_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
case
1
39
:
case
1
40
:
length
=
ax25_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
#ifdef CONFIG_NETROM
case
14
0
:
case
14
1
:
length
=
nr_nodes_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
case
14
1
:
case
14
2
:
length
=
nr_neigh_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
case
14
2
:
case
14
3
:
length
=
nr_get_info
(
page
,
&
start
,
file
->
f_pos
,
thistime
);
break
;
#endif
/* CONFIG_NETROM */
...
...
fs/super.c
View file @
c2700b1f
...
...
@@ -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
));
}
include/linux/netdevice.h
View file @
c2700b1f
...
...
@@ -193,9 +193,10 @@ extern int dev_ioctl(unsigned int cmd, void *);
extern
void
dev_init
(
void
);
/* Th
is function lives elsewhere (drivers/net/net_init.c but is
related) */
/* Th
ese 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
);
...
...
include/linux/sbpcd.h
View file @
c2700b1f
...
...
@@ -107,13 +107,13 @@
/*
* disk states (bits of diskstate_flags):
*/
#define upc_valid (D
S
[d].diskstate_flags&upc_bit)
#define volume_valid (D
S
[d].diskstate_flags&volume_bit)
#define toc_valid (D
S
[d].diskstate_flags&toc_bit)
#define multisession_valid (D
S
[d].diskstate_flags&multisession_bit)
#define cd_size_valid (D
S
[d].diskstate_flags&cd_size_bit)
#define subq_valid (D
S
[d].diskstate_flags&subq_bit)
#define frame_size_valid (D
S
[d].diskstate_flags&frame_size_bit)
#define upc_valid (D
riveStruct
[d].diskstate_flags&upc_bit)
#define volume_valid (D
riveStruct
[d].diskstate_flags&volume_bit)
#define toc_valid (D
riveStruct
[d].diskstate_flags&toc_bit)
#define multisession_valid (D
riveStruct
[d].diskstate_flags&multisession_bit)
#define cd_size_valid (D
riveStruct
[d].diskstate_flags&cd_size_bit)
#define subq_valid (D
riveStruct
[d].diskstate_flags&subq_bit)
#define frame_size_valid (D
riveStruct
[d].diskstate_flags&frame_size_bit)
/*
...
...
@@ -137,13 +137,13 @@
/*
* used drive states:
*/
#define st_door_closed (D
S
[d].status_byte&p_door_closed)
#define st_caddy_in (D
S
[d].status_byte&p_caddy_in)
#define st_spinning (D
S
[d].status_byte&p_spinning)
#define st_check (D
S
[d].status_byte&p_check)
#define st_busy (D
S
[d].status_byte&p_busy_new)
#define st_door_locked (D
S
[d].status_byte&p_door_locked)
#define st_diskok (D
S
[d].status_byte&p_disk_ok)
#define st_door_closed (D
riveStruct
[d].status_byte&p_door_closed)
#define st_caddy_in (D
riveStruct
[d].status_byte&p_caddy_in)
#define st_spinning (D
riveStruct
[d].status_byte&p_spinning)
#define st_check (D
riveStruct
[d].status_byte&p_check)
#define st_busy (D
riveStruct
[d].status_byte&p_busy_new)
#define st_door_locked (D
riveStruct
[d].status_byte&p_door_locked)
#define st_diskok (D
riveStruct
[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 (D
S
[d].drv_type&0x10)
#define new_drive (D
riveStruct
[d].drv_type&0x10)
/*
* audio states:
...
...
include/linux/skbuff.h
View file @
c2700b1f
...
...
@@ -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
;
...
...
include/linux/termios.h
View file @
c2700b1f
#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
...
...
include/linux/tty.h
View file @
c2700b1f
...
...
@@ -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>
...
...
include/linux/tty_driver.h
View file @
c2700b1f
...
...
@@ -87,6 +87,8 @@
*
*/
#include <linux/fs.h>
struct
tty_driver
{
int
magic
;
/* magic number for this structure */
char
*
name
;
...
...
include/linux/tty_ldisc.h
View file @
c2700b1f
...
...
@@ -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
;
...
...
modules/NET_MODULES
View file @
c2700b1f
3c509.o de600.o
3c509.o de600.o
3c501.o plip.o
net/inet/README
View file @
c2700b1f
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).
...
...
net/inet/dev.c
View file @
c2700b1f
...
...
@@ -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
*/
...
...
net/inet/eth.c
View file @
c2700b1f
...
...
@@ -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
;
...
...
net/inet/ip.c
View file @
c2700b1f
...
...
@@ -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.
...
...
net/inet/ipx.c
View file @
c2700b1f
...
...
@@ -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
;
...
...
net/inet/ipx.h
View file @
c2700b1f
...
...
@@ -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
);
...
...
net/inet/proc.c
View file @
c2700b1f
...
...
@@ -12,16 +12,14 @@
* 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
\n
Udp: %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
;
}
net/inet/skbuff.c
View file @
c2700b1f
...
...
@@ -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
;
...
...
net/inet/sock.h
View file @
c2700b1f
...
...
@@ -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 */
...
...
net/inet/tcp.c
View file @
c2700b1f
...
...
@@ -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
SUBNETSARELOCA
L
#ifdef
CONFIG_INET_SNAR
L
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. */
...
...
net/inet/tcp.h
View file @
c2700b1f
...
...
@@ -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
*
);
...
...
zBoot/inflate.c
View file @
c2700b1f
...
...
@@ -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() */
...
...
zBoot/misc.c
View file @
c2700b1f
...
...
@@ -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
(
"
\n
Out 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
(
"
\n
Out 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
(
c
onst
c
har
*
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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment