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
0acb47cd
Commit
0acb47cd
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 0.99.15h
parent
2fbc2376
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1651 additions
and
189 deletions
+1651
-189
Makefile
Makefile
+3
-1
config.in
config.in
+1
-1
drivers/char/console.c
drivers/char/console.c
+11
-5
drivers/net/8390.c
drivers/net/8390.c
+4
-6
drivers/net/CONFIG
drivers/net/CONFIG
+4
-0
drivers/net/Makefile
drivers/net/Makefile
+2
-0
drivers/net/depca.c
drivers/net/depca.c
+1364
-0
drivers/net/depca.h
drivers/net/depca.h
+128
-0
fs/ext2/balloc.c
fs/ext2/balloc.c
+16
-3
fs/ext2/truncate.c
fs/ext2/truncate.c
+11
-2
include/linux/sched.h
include/linux/sched.h
+2
-0
kernel/itimer.c
kernel/itimer.c
+9
-0
kernel/sched.c
kernel/sched.c
+2
-2
net/inet/dev.c
net/inet/dev.c
+0
-1
net/inet/tcp.c
net/inet/tcp.c
+94
-168
No files found.
Makefile
View file @
0acb47cd
VERSION
=
0.99
PATCHLEVEL
=
15
ALPHA
=
g
ALPHA
=
h
all
:
Version zImage
...
...
@@ -188,7 +188,9 @@ zdisk: zImage
zlilo
:
$(CONFIGURE) zImage
if
[
-f
/vmlinuz
]
;
then
mv
/vmlinuz /vmlinuz.old
;
fi
if
[
-f
/zSystem.map
]
;
then
mv
/zSystem.map /zSystem.old
;
fi
cat
zImage
>
/vmlinuz
cp
zSystem.map /
if
[
-x
/sbin/lilo
]
;
then
/sbin/lilo
;
else
/etc/lilo/install
;
fi
tools/zSystem
:
boot/head.o init/main.o tools/version.o linuxsubdirs
...
...
config.in
View file @
0acb47cd
...
...
@@ -76,7 +76,7 @@ bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE n
bool 'AT1700 support' CONFIG_AT1700 n
#bool 'Zenith Z-Note support' CONFIG_ZNET n
#bool 'EtherExpress support' CONFIG_EEXPRESS n
#
bool 'DEPCA support' CONFIG_DEPCA n
bool 'DEPCA support' CONFIG_DEPCA n
#bool 'NI52** support' CONFIG_NI52 n
#bool 'NI65** support' CONFIG_NI65 n
#bool 'Ansel Communications EISA 3200 support' CONFIG_AC3200 n
...
...
drivers/char/console.c
View file @
0acb47cd
...
...
@@ -382,12 +382,18 @@ static void set_origin(int currcons)
__set_origin
(
__real_origin
);
}
static
inline
void
hide_cursor
(
int
currcons
)
/*
* Put the cursor just beyond the end of the display adaptor memory.
*/
static
inline
void
hide_cursor
(
void
)
{
/* This is inefficient, we could just put the cursor at 0xffff,
but perhaps the delays due to the inefficiency are useful for
some hardware... */
outb_p
(
14
,
video_port_reg
);
outb_p
(
0xff
&
((
scr_end
-
video_mem_base
)
>>
9
),
video_port_val
);
outb_p
(
0xff
&
((
video_mem_term
-
video_mem_base
)
>>
9
),
video_port_val
);
outb_p
(
15
,
video_port_reg
);
outb_p
(
0xff
&
((
scr_end
-
video_mem_base
)
>>
1
),
video_port_val
);
outb_p
(
0xff
&
((
video_mem_term
-
video_mem_base
)
>>
1
),
video_port_val
);
}
static
inline
void
set_cursor
(
int
currcons
)
...
...
@@ -405,7 +411,7 @@ static inline void set_cursor(int currcons)
outb_p
(
15
,
video_port_reg
);
outb_p
(
0xff
&
((
pos
-
video_mem_base
)
>>
1
),
video_port_val
);
}
else
hide_cursor
(
currcons
);
hide_cursor
();
restore_flags
(
flags
);
}
...
...
@@ -1546,7 +1552,7 @@ void blank_screen(void)
return
;
timer_table
[
BLANK_TIMER
].
fn
=
unblank_screen
;
get_scrmem
(
fg_console
);
hide_cursor
(
fg_console
);
hide_cursor
();
console_blanked
=
1
;
memsetw
((
void
*
)
video_mem_base
,
0x0020
,
video_mem_term
-
video_mem_base
);
}
...
...
drivers/net/8390.c
View file @
0acb47cd
...
...
@@ -122,12 +122,6 @@ int ei_open(struct device *dev)
irq2dev_map
[
dev
->
irq
]
=
dev
;
NS8390_init
(
dev
,
1
);
ei_local
->
tx1
=
ei_local
->
tx2
=
0
;
/* The old local flags... */
ei_local
->
txing
=
0
;
/* ... are now global. */
dev
->
tbusy
=
0
;
dev
->
interrupt
=
0
;
dev
->
start
=
1
;
ei_local
->
irqlock
=
0
;
return
0
;
...
...
@@ -684,6 +678,10 @@ void NS8390_init(struct device *dev, int startp)
outb_p
(
ei_local
->
rx_start_page
,
e8390_base
+
EN1_CURPAG
);
outb_p
(
E8390_NODMA
+
E8390_PAGE0
+
E8390_STOP
,
e8390_base
);
sti
();
dev
->
tbusy
=
0
;
dev
->
interrupt
=
0
;
ei_local
->
tx1
=
ei_local
->
tx2
=
0
;
ei_local
->
txing
=
0
;
if
(
startp
)
{
outb_p
(
0xff
,
e8390_base
+
EN0_ISR
);
outb_p
(
ENISR_ALL
,
e8390_base
+
EN0_IMR
);
...
...
drivers/net/CONFIG
View file @
0acb47cd
...
...
@@ -30,6 +30,9 @@
# D_LINK_IO The D-Link I/O address (0x378 == typical)
# D_LINK_IRQ The D-Link IRQ number to use (IRQ7 == typical)
# D_LINK_DEBUG Enable or disable D-Link debugging
# DEPCA The DIGITAL series of AT Ethernet Cards (DE100, DE200)
# DEPCA_IRQ Set the desired IRQ (=0, for autoprobe)
# DEPCA_DEBUG Set the desired debug level
#
# The following options exist, but cannot be set in this file.
...
...
@@ -50,6 +53,7 @@ EL2_OPTS = #-DEL2_AUI
NE_OPTS =
HP_OPTS =
PLIP_OPTS =
DEPCA_OPTS = -DDEPCA_IRQ=0 -DDEPCA_DEBUG=1
# The following are the only parameters that must be set in this file.
DL_OPTS = -DD_LINK_IO=0x378 -DD_LINK_IRQ=7 -UD_LINK_DEBUG
drivers/net/Makefile
View file @
0acb47cd
...
...
@@ -105,6 +105,8 @@ NETDRV_OBJS := $(NETDRV_OBJS) net.a(znet.o)
endif
ifdef
CONFIG_DEPCA
NETDRV_OBJS
:=
$(NETDRV_OBJS)
net.a
(
depca.o
)
depca.o
:
depca.c CONFIG
$(CC)
$(CPPFLAGS)
$(CFLAGS)
$(DEPCA_OPTS)
-c
$<
endif
ifdef
CONFIG_ATP
NETDRV_OBJS
:=
$(NETDRV_OBJS)
net.a
(
atp.o
)
...
...
drivers/net/depca.c
0 → 100644
View file @
0acb47cd
This diff is collapsed.
Click to expand it.
drivers/net/depca.h
0 → 100644
View file @
0acb47cd
/*
Written 1994 by David C. Davies.
Copyright 1994 David C. Davies. This software may be used and distributed
according to the terms of the GNU Public License, incorporated herein by
reference.
*/
/*
** I/O addresses. Note that the 2k buffer option is not supported in
** this driver.
*/
#define DEPCA_NICSR ioaddr+0x00
/* Network interface CSR */
#define DEPCA_RBI ioaddr+0x02
/* RAM buffer index (2k buffer mode) */
#define DEPCA_DATA ioaddr+0x04
/* LANCE registers' data port */
#define DEPCA_ADDR ioaddr+0x06
/* LANCE registers' address port */
#define DEPCA_PROM ioaddr+0x0c
/* Ethernet address ROM data port */
#define DEPCA_RBSA ioaddr+0x0e
/* RAM buffer starting address (2k buff.) */
/*
** These are LANCE registers addressable through DEPCA_ADDR
*/
#define CSR0 0
#define CSR1 1
#define CSR2 2
#define CSR3 3
/*
** NETWORK INTERFACE CSR (NI_CSR) bit definitions
*/
#define TO 0x0100
/* Time Out for remote boot */
#define SHE 0x0080
/* SHadow memory Enable */
#define BS 0x0040
/* Bank Select */
#define BUF 0x0020
/* BUFfer size (1->32k, 0->64k) */
#define RBE 0x0010
/* Remote Boot Enable (1->net boot) */
#define AAC 0x0008
/* for DEPCA family compatability */
#define IM 0x0004
/* Interrupt Mask (1->mask) */
#define IEN 0x0002
/* Interrupt tristate ENable (1->enable) */
#define LED 0x0001
/* LED control */
/*
** Control and Status Register 0 (CSR0) bit definitions
*/
#define ERR 0x8000
/* Error summary */
#define BABL 0x4000
/* Babble transmitter timeout error */
#define CERR 0x2000
/* Collision Error */
#define MISS 0x1000
/* Missed packet */
#define MERR 0x0800
/* Memory Error */
#define RINT 0x0400
/* Receiver Interrupt */
#define TINT 0x0200
/* Transmit Interrupt */
#define IDON 0x0100
/* Initialization Done */
#define INTR 0x0080
/* Interrupt Flag */
#define INEA 0x0040
/* Interrupt Enable */
#define RXON 0x0020
/* Receiver on */
#define TXON 0x0010
/* Transmitter on */
#define TDMD 0x0008
/* Transmit Demand */
#define STOP 0x0004
/* Stop */
#define STRT 0x0002
/* Start */
#define INIT 0x0001
/* Initialize */
/*
** CONTROL AND STATUS REGISTER 3 (CSR3)
*/
#define BSWP 0x0004
/* Byte SWaP */
#define ACON 0x0002
/* ALE control */
#define BCON 0x0001
/* Byte CONtrol */
/*
** Initialization Block Mode Register
*/
#define PROM 0x8000
/* Promiscuous Mode */
#define EMBA 0x0080
/* Enable Modified Back-off Algorithm */
#define INTL 0x0040
/* Internal Loopback */
#define DRTY 0x0020
/* Disable Retry */
#define COLL 0x0010
/* Force Collision */
#define DTCR 0x0008
/* Disable Transmit CRC */
#define LOOP 0x0004
/* Loopback */
#define DTX 0x0002
/* Disable the Transmitter */
#define DRX 0x0001
/* Disable the Receiver */
/*
** Receive Message Descriptor 1 (RMD1) bit definitions.
*/
#define R_OWN 0x80000000
/* Owner bit 0 = host, 1 = lance */
#define R_ERR 0x4000
/* Error Summary */
#define R_FRAM 0x2000
/* Framing Error */
#define R_OFLO 0x1000
/* Overflow Error */
#define R_CRC 0x0800
/* CRC Error */
#define R_BUFF 0x0400
/* Buffer Error */
#define R_STP 0x0200
/* Start of Packet */
#define R_ENP 0x0100
/* End of Packet */
/*
** Transmit Message Descriptor 1 (TMD1) bit definitions.
*/
#define T_OWN 0x80000000
/* Owner bit 0 = host, 1 = lance */
#define T_ERR 0x4000
/* Error Summary */
#define T_ADD_FCS 0x2000
/* More the 1 retry needed to Xmit */
#define T_MORE 0x1000
/* >1 retry to transmit packet */
#define T_ONE 0x0800
/* 1 try needed to transmit the packet */
#define T_DEF 0x0400
/* Deferred */
#define T_STP 0x02000000
/* Start of Packet */
#define T_ENP 0x01000000
/* End of Packet */
/*
** Transmit Message Descriptor 3 (TMD3) bit definitions.
*/
#define TMD3_BUFF 0x8000
/* BUFFer error */
#define TMD3_UFLO 0x4000
/* UnderFLOw error */
#define TMD3_RES 0x2000
/* REServed */
#define TMD3_LCOL 0x1000
/* Late COLlision */
#define TMD3_LCAR 0x0800
/* Loss of CARrier */
#define TMD3_RTRY 0x0400
/* ReTRY error */
/*
** Miscellaneous
*/
#define MASK_INTERRUPTS 1
#define UNMASK_INTERRUPTS 0
fs/ext2/balloc.c
View file @
0acb47cd
...
...
@@ -605,6 +605,7 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
struct
buffer_head
*
bh
;
struct
ext2_super_block
*
es
;
unsigned
long
desc_count
,
bitmap_count
,
x
;
unsigned
long
desc_blocks
;
int
bitmap_nr
;
struct
ext2_group_desc
*
gdp
;
int
i
,
j
;
...
...
@@ -614,12 +615,24 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
desc_count
=
0
;
bitmap_count
=
0
;
gdp
=
NULL
;
desc_blocks
=
(
sb
->
u
.
ext2_sb
.
s_groups_count
+
EXT2_DESC_PER_BLOCK
(
sb
)
-
1
)
/
EXT2_DESC_PER_BLOCK
(
sb
);
for
(
i
=
0
;
i
<
sb
->
u
.
ext2_sb
.
s_groups_count
;
i
++
)
{
gdp
=
get_group_desc
(
sb
,
i
,
NULL
);
desc_count
+=
gdp
->
bg_free_blocks_count
;
bitmap_nr
=
load_block_bitmap
(
sb
,
i
);
bh
=
sb
->
u
.
ext2_sb
.
s_block_bitmap
[
bitmap_nr
];
if
(
!
test_bit
(
0
,
bh
->
b_data
))
ext2_error
(
sb
,
"ext2_check_blocks_bitmap"
,
"Superblock in group %d is marked free"
,
i
);
for
(
j
=
0
;
j
<
desc_blocks
;
j
++
)
if
(
!
test_bit
(
j
+
1
,
bh
->
b_data
))
ext2_error
(
sb
,
"ext2_check_blocks_bitmap"
,
"Descriptor block #%d in group "
"%d is marked free"
,
j
,
i
);
if
(
!
block_in_use
(
gdp
->
bg_block_bitmap
,
sb
,
bh
->
b_data
))
ext2_error
(
sb
,
"ext2_check_blocks_bitmap"
,
"Block bitmap for group %d is marked free"
,
...
...
@@ -632,9 +645,9 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
for
(
j
=
0
;
j
<
sb
->
u
.
ext2_sb
.
s_itb_per_group
;
j
++
)
if
(
!
block_in_use
(
gdp
->
bg_inode_table
+
j
,
sb
,
bh
->
b_data
))
ext2_error
(
sb
,
"ext2_check_blocks_bitmap"
,
"Block #%d of the inode table in group %d
"
"
is marked free"
,
j
,
i
);
ext2_error
(
sb
,
"ext2_check_blocks_bitmap"
,
"Block #%d of the inode table in
"
"group %d
is marked free"
,
j
,
i
);
x
=
ext2_count_free
(
bh
,
sb
->
s_blocksize
);
if
(
gdp
->
bg_free_blocks_count
!=
x
)
...
...
fs/ext2/truncate.c
View file @
0acb47cd
...
...
@@ -12,6 +12,11 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/*
* Real random numbers for secure rm added 94/02/18
* Idea from Pierre del Perugia <delperug@gla.ecoledoc.ibp.fr>
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/ext2_fs.h>
...
...
@@ -28,6 +33,10 @@
:"a" (value), "c" (size / 4), "D" ((long) (addr)) \
:"cx", "di")
static
int
ext2_secrm_seed
=
152
;
/* Random generator base */
#define RANDOM_INT (ext2_secrm_seed = ext2_secrm_seed * 69069l +1)
/*
* Truncate has the most races in the whole filesystem: coding it is
* a pain in the a**. Especially as I don't do any locking...
...
...
@@ -80,7 +89,7 @@ static int trunc_direct (struct inode * inode)
inode
->
i_dirt
=
1
;
if
(
inode
->
u
.
ext2_i
.
i_flags
&
EXT2_SECRM_FL
)
{
clear_block
(
bh
->
b_data
,
inode
->
i_sb
->
s_blocksize
,
CURRENT_TIME
);
RANDOM_INT
);
bh
->
b_dirt
=
1
;
}
brelse
(
bh
);
...
...
@@ -156,7 +165,7 @@ static int trunc_indirect (struct inode * inode, int offset, unsigned long * p)
ind_bh
->
b_dirt
=
1
;
if
(
inode
->
u
.
ext2_i
.
i_flags
&
EXT2_SECRM_FL
)
{
clear_block
(
bh
->
b_data
,
inode
->
i_sb
->
s_blocksize
,
CURRENT_TIME
);
RANDOM_INT
);
bh
->
b_dirt
=
1
;
}
brelse
(
bh
);
...
...
include/linux/sched.h
View file @
0acb47cd
...
...
@@ -302,6 +302,8 @@ extern struct task_struct *task[NR_TASKS];
extern
struct
task_struct
*
last_task_used_math
;
extern
struct
task_struct
*
current
;
extern
unsigned
long
volatile
jiffies
;
extern
unsigned
long
itimer_ticks
;
extern
unsigned
long
itimer_next
;
extern
struct
timeval
xtime
;
extern
int
need_resched
;
...
...
kernel/itimer.c
View file @
0acb47cd
...
...
@@ -81,14 +81,23 @@ int _setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
return
k
;
switch
(
which
)
{
case
ITIMER_REAL
:
if
(
j
)
{
j
+=
1
+
itimer_ticks
;
if
(
j
<
itimer_next
)
itimer_next
=
j
;
}
current
->
it_real_value
=
j
;
current
->
it_real_incr
=
i
;
break
;
case
ITIMER_VIRTUAL
:
if
(
j
)
j
++
;
current
->
it_virt_value
=
j
;
current
->
it_virt_incr
=
i
;
break
;
case
ITIMER_PROF
:
if
(
j
)
j
++
;
current
->
it_prof_value
=
j
;
current
->
it_prof_incr
=
i
;
break
;
...
...
kernel/sched.c
View file @
0acb47cd
...
...
@@ -192,8 +192,8 @@ asmlinkage void math_emulate(long arg)
#endif
/* CONFIG_MATH_EMULATION */
static
unsigned
long
itimer_ticks
=
0
;
static
unsigned
long
itimer_next
=
~
0
;
unsigned
long
itimer_ticks
=
0
;
unsigned
long
itimer_next
=
~
0
;
static
unsigned
long
lost_ticks
=
0
;
/*
...
...
net/inet/dev.c
View file @
0acb47cd
...
...
@@ -966,7 +966,6 @@ dev_ioctl(unsigned int cmd, void *arg)
{
struct
iflink
iflink
;
struct
ddi_device
*
dev
;
int
ret
;
switch
(
cmd
)
{
case
IP_SET_DEV
:
...
...
net/inet/tcp.c
View file @
0acb47cd
...
...
@@ -60,7 +60,9 @@
* Charles Hedrick : TCP fixes
* Toomas Tamm : TCP window fixes
* Alan Cox : Small URG fix to rlogin ^C ack fight
* Linus : Rewrote URG handling completely
* Charles Hedrick : Window fix
* Linus : Rewrote tcp_read() and URG handling
* completely
*
*
* To Fix:
...
...
@@ -1293,175 +1295,111 @@ tcp_read_urg(struct sock * sk, int nonblock,
/* This routine copies from a sock struct into the user buffer. */
static
int
tcp_read
(
struct
sock
*
sk
,
unsigned
char
*
to
,
int
len
,
int
nonblock
,
unsigned
flags
)
static
int
tcp_read
(
struct
sock
*
sk
,
unsigned
char
*
to
,
int
len
,
int
nonblock
,
unsigned
flags
)
{
int
copied
=
0
;
/* will be used to say how much has been copied. */
struct
sk_buff
*
skb
;
unsigned
long
peek_seq
;
unsigned
long
offset
;
unsigned
long
*
seq
;
int
err
;
struct
wait_queue
wait
=
{
current
,
NULL
};
int
copied
=
0
;
unsigned
long
peek_seq
;
unsigned
long
*
seq
;
unsigned
long
used
;
int
err
;
if
(
len
==
0
)
return
0
;
if
(
len
==
0
)
return
0
;
if
(
len
<
0
)
return
-
EINVAL
;
if
(
len
<
0
)
return
-
EINVAL
;
err
=
verify_area
(
VERIFY_WRITE
,
to
,
len
);
if
(
err
)
return
err
;
err
=
verify_area
(
VERIFY_WRITE
,
to
,
len
);
if
(
err
)
return
err
;
/* This error should be checked. */
if
(
sk
->
state
==
TCP_LISTEN
)
return
-
ENOTCONN
;
/* This error should be checked. */
if
(
sk
->
state
==
TCP_LISTEN
)
return
-
ENOTCONN
;
/* Urgent data needs to be handled specially. */
if
(
flags
&
MSG_OOB
)
return
tcp_read_urg
(
sk
,
nonblock
,
to
,
len
,
flags
);
/* Urgent data needs to be handled specially. */
if
(
flags
&
MSG_OOB
)
return
tcp_read_urg
(
sk
,
nonblock
,
to
,
len
,
flags
);
/* So no-one else will use this socket. */
sk
->
inuse
=
1
;
skb
=
skb_peek
(
&
sk
->
rqueue
);
peek_seq
=
sk
->
copied_seq
;
seq
=
&
sk
->
copied_seq
;
if
(
flags
&
MSG_PEEK
)
seq
=
&
peek_seq
;
peek_seq
=
sk
->
copied_seq
;
seq
=
&
sk
->
copied_seq
;
if
(
flags
&
MSG_PEEK
)
seq
=
&
peek_seq
;
add_wait_queue
(
sk
->
sleep
,
&
wait
);
sk
->
inuse
=
1
;
while
(
len
>
0
)
{
struct
sk_buff
*
skb
;
unsigned
long
offset
;
/*
* are we at urgent data? Stop if we have read anything.
*/
if
(
copied
&&
sk
->
urg_data
&&
sk
->
urg_seq
==
1
+*
seq
)
break
;
DPRINTF
((
DBG_TCP
,
"tcp_read(sk=%X, to=%X, len=%d, nonblock=%d, flags=%X)
\n
"
,
sk
,
to
,
len
,
nonblock
,
flags
));
current
->
state
=
TASK_INTERRUPTIBLE
;
while
(
len
>
0
)
{
/* skb->used just checks to see if we've gone all the way around. */
/* While no data, or first data indicates some is missing, or data is used */
while
(
skb
==
NULL
||
skb
->
used
||
before
(
1
+*
seq
,
skb
->
h
.
th
->
seq
))
{
DPRINTF
((
DBG_TCP
,
"skb = %X:
\n
"
,
skb
));
cleanup_rbuf
(
sk
);
if
(
sk
->
err
)
{
int
tmp
;
skb
=
sk
->
rqueue
;
do
{
if
(
!
skb
)
break
;
if
(
before
(
1
+*
seq
,
skb
->
h
.
th
->
seq
))
break
;
offset
=
1
+
*
seq
-
skb
->
h
.
th
->
seq
;
if
(
skb
->
h
.
th
->
syn
)
offset
--
;
if
(
offset
<
skb
->
len
)
goto
found_ok_skb
;
if
(
!
(
flags
&
MSG_PEEK
))
skb
->
used
=
1
;
skb
=
(
struct
sk_buff
*
)
skb
->
next
;
}
while
(
skb
!=
sk
->
rqueue
);
release_sock
(
sk
);
if
(
copied
)
{
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
}
tmp
=
-
sk
->
err
;
if
(
copied
)
break
;
if
(
sk
->
err
)
{
copied
=
-
sk
->
err
;
sk
->
err
=
0
;
return
(
tmp
)
;
break
;
}
if
(
sk
->
state
==
TCP_CLOSE
)
{
release_sock
(
sk
);
if
(
copied
)
{
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
}
if
(
sk
->
state
==
TCP_CLOSE
)
{
if
(
!
sk
->
done
)
{
sk
->
done
=
1
;
return
(
0
)
;
break
;
}
return
(
-
ENOTCONN
);
copied
=
-
ENOTCONN
;
break
;
}
if
(
sk
->
shutdown
&
RCV_SHUTDOWN
)
{
release_sock
(
sk
);
if
(
copied
==
0
)
sk
->
done
=
1
;
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
if
(
sk
->
shutdown
&
RCV_SHUTDOWN
)
{
sk
->
done
=
1
;
break
;
}
if
(
nonblock
||
copied
)
{
release_sock
(
sk
);
if
(
sk
->
debug
)
printk
(
"read: EAGAIN
\n
"
);
if
(
copied
)
{
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
}
return
(
-
EAGAIN
);
if
(
nonblock
)
{
copied
=
-
EAGAIN
;
break
;
}
if
((
flags
&
MSG_PEEK
)
&&
copied
!=
0
)
{
release_sock
(
sk
);
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
}
DPRINTF
((
DBG_TCP
,
"tcp_read about to sleep. state = %d
\n
"
,
sk
->
state
));
cleanup_rbuf
(
sk
);
release_sock
(
sk
);
/*
* Now we may have some data waiting or we could
* have changed state.
*/
cli
();
if
(
sk
->
shutdown
&
RCV_SHUTDOWN
||
sk
->
err
!=
0
)
{
sk
->
inuse
=
1
;
sti
();
continue
;
}
skb
=
skb_peek
(
&
sk
->
rqueue
);
if
(
skb
==
NULL
||
before
(
1
+*
seq
,
skb
->
h
.
th
->
seq
))
{
if
(
sk
->
debug
)
printk
(
"Read wait sleep
\n
"
);
interruptible_sleep_on
(
sk
->
sleep
);
if
(
sk
->
debug
)
printk
(
"Read wait wakes
\n
"
);
if
(
current
->
signal
&
~
current
->
blocked
)
{
sti
();
if
(
copied
)
{
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
(
copied
);
}
return
(
-
ERESTARTSYS
);
}
}
schedule
();
sk
->
inuse
=
1
;
sti
();
DPRINTF
((
DBG_TCP
,
"tcp_read woke up.
\n
"
));
skb
=
skb_peek
(
&
sk
->
rqueue
);
/* That may have been null if we were beaten, if so we loop again */
}
/*
* are we at urgent data? Stop if we have read anything.
*/
if
(
copied
&&
sk
->
urg_data
&&
sk
->
urg_seq
==
1
+*
seq
)
{
release_sock
(
sk
);
return
copied
;
}
/*
* Copy anything from the current block that needs
* to go into the user buffer.
*/
offset
=
*
seq
-
skb
->
h
.
th
->
seq
+
1
;
if
(
skb
->
h
.
th
->
syn
)
offset
--
;
if
(
current
->
signal
&
~
current
->
blocked
)
{
copied
=
-
ERESTARTSYS
;
break
;
}
continue
;
if
(
offset
<
skb
->
len
)
/* Some of the packet is useful */
{
found_ok_skb:
/* Ok so how much can we use ? */
u
nsigned
long
u
sed
=
skb
->
len
-
offset
;
used
=
skb
->
len
-
offset
;
if
(
len
<
used
)
used
=
len
;
/* do we have urgent data here? */
...
...
@@ -1469,50 +1407,38 @@ tcp_read(struct sock *sk, unsigned char *to,
unsigned
long
urg_offset
=
sk
->
urg_seq
-
(
1
+
*
seq
);
if
(
urg_offset
<
used
)
{
if
(
!
urg_offset
)
{
if
(
!
(
flags
&
MSG_PEEK
))
sk
->
urg_data
=
0
;
if
(
!
sk
->
urginline
)
{
++*
seq
;
offset
++
;
used
--
;
}
}
else
used
=
offset
;
used
=
urg_
offset
;
}
}
/* Copy it */
memcpy_tofs
(
to
,((
unsigned
char
*
)
skb
->
h
.
th
)
+
skb
->
h
.
th
->
doff
*
4
+
offset
,
used
);
skb
->
h
.
th
->
doff
*
4
+
offset
,
used
);
copied
+=
used
;
len
-=
used
;
to
+=
used
;
*
seq
+=
used
;
/*
* Mark this data used if we are really reading it, and we
* have used all the data.
*/
if
(
!
(
flags
&
MSG_PEEK
)
&&
(
used
+
offset
>=
skb
->
len
))
skb
->
used
=
1
;
}
else
{
/* already used this data, must be a retransmit */
if
(
!
(
flags
&
MSG_PEEK
))
if
(
after
(
sk
->
copied_seq
+
1
,
sk
->
urg_seq
))
sk
->
urg_data
=
0
;
if
(
!
(
flags
&
MSG_PEEK
)
&&
(
used
+
offset
>=
skb
->
len
))
skb
->
used
=
1
;
}
/* Move along a packet */
skb
=
(
struct
sk_buff
*
)
skb
->
next
;
}
/* Clean up data we have read: This will do ACK frames */
cleanup_rbuf
(
sk
);
release_sock
(
sk
);
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
if
(
copied
==
0
&&
nonblock
)
return
(
-
EAGAIN
);
return
(
copied
);
remove_wait_queue
(
sk
->
sleep
,
&
wait
);
current
->
state
=
TASK_RUNNING
;
/* Clean up data we have read: This will do ACK frames */
cleanup_rbuf
(
sk
);
release_sock
(
sk
);
DPRINTF
((
DBG_TCP
,
"tcp_read: returning %d
\n
"
,
copied
));
return
copied
;
}
/*
* Send a FIN without closing the connection.
* Not called at interrupt time.
...
...
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