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
ee735cbb
Commit
ee735cbb
authored
Oct 06, 2003
by
Vinay K. Nallamothu
Committed by
David S. Miller
Oct 06, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[X25]: Use mod_timer(), add missing sock locking to x25_accept().
parent
e5b736bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
48 deletions
+30
-48
net/x25/af_x25.c
net/x25/af_x25.c
+9
-6
net/x25/x25_link.c
net/x25/x25_link.c
+6
-10
net/x25/x25_timer.c
net/x25/x25_timer.c
+15
-32
No files found.
net/x25/af_x25.c
View file @
ee735cbb
...
...
@@ -345,10 +345,8 @@ void x25_destroy_socket(struct sock *sk)
if
(
atomic_read
(
&
sk
->
sk_wmem_alloc
)
||
atomic_read
(
&
sk
->
sk_rmem_alloc
))
{
/* Defer: outstanding buffers */
init_timer
(
&
sk
->
sk_timer
);
sk
->
sk_timer
.
expires
=
jiffies
+
10
*
HZ
;
sk
->
sk_timer
.
function
=
x25_destroy_timer
;
sk
->
sk_timer
.
data
=
(
unsigned
long
)
sk
;
add_timer
(
&
sk
->
sk_timer
);
}
else
{
/* drop last reference so sock_put will free */
...
...
@@ -463,6 +461,8 @@ static struct sock *x25_alloc_socket(void)
goto
out
;
}
void
x25_init_timers
(
struct
sock
*
sk
);
static
int
x25_create
(
struct
socket
*
sock
,
int
protocol
)
{
struct
sock
*
sk
;
...
...
@@ -481,7 +481,7 @@ static int x25_create(struct socket *sock, int protocol)
sock_init_data
(
sock
,
sk
);
sk_set_owner
(
sk
,
THIS_MODULE
);
init_timer
(
&
x25
->
timer
);
x25_init_timers
(
sk
);
sock
->
ops
=
&
x25_proto_ops
;
sk
->
sk_protocol
=
protocol
;
...
...
@@ -537,7 +537,7 @@ static struct sock *x25_make_new(struct sock *osk)
x25
->
facilities
=
ox25
->
facilities
;
x25
->
qbitincl
=
ox25
->
qbitincl
;
init_timer
(
&
x25
->
timer
);
x25_init_timers
(
sk
);
out:
return
sk
;
}
...
...
@@ -760,13 +760,14 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
if
(
sk
->
sk_type
!=
SOCK_SEQPACKET
)
goto
out
;
lock_sock
(
sk
);
rc
=
x25_wait_for_data
(
sk
,
sk
->
sk_rcvtimeo
);
if
(
rc
)
goto
out
;
goto
out
2
;
skb
=
skb_dequeue
(
&
sk
->
sk_receive_queue
);
rc
=
-
EINVAL
;
if
(
!
skb
->
sk
)
goto
out
;
goto
out
2
;
newsk
=
skb
->
sk
;
newsk
->
sk_pair
=
NULL
;
newsk
->
sk_socket
=
newsock
;
...
...
@@ -779,6 +780,8 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
newsock
->
sk
=
newsk
;
newsock
->
state
=
SS_CONNECTED
;
rc
=
0
;
out2:
release_sock
(
sk
);
out:
return
rc
;
}
...
...
net/x25/x25_link.c
View file @
ee735cbb
...
...
@@ -51,15 +51,9 @@ static void x25_t20timer_expiry(unsigned long);
/*
* Linux set/reset timer routines
*/
static
void
x25_start_t20timer
(
struct
x25_neigh
*
nb
)
static
inline
void
x25_start_t20timer
(
struct
x25_neigh
*
nb
)
{
del_timer
(
&
nb
->
t20timer
);
nb
->
t20timer
.
data
=
(
unsigned
long
)
nb
;
nb
->
t20timer
.
function
=
&
x25_t20timer_expiry
;
nb
->
t20timer
.
expires
=
jiffies
+
nb
->
t20
;
add_timer
(
&
nb
->
t20timer
);
mod_timer
(
&
nb
->
t20timer
,
jiffies
+
nb
->
t20
);
}
static
void
x25_t20timer_expiry
(
unsigned
long
param
)
...
...
@@ -71,12 +65,12 @@ static void x25_t20timer_expiry(unsigned long param)
x25_start_t20timer
(
nb
);
}
static
void
x25_stop_t20timer
(
struct
x25_neigh
*
nb
)
static
inline
void
x25_stop_t20timer
(
struct
x25_neigh
*
nb
)
{
del_timer
(
&
nb
->
t20timer
);
}
static
int
x25_t20timer_pending
(
struct
x25_neigh
*
nb
)
static
in
line
in
t
x25_t20timer_pending
(
struct
x25_neigh
*
nb
)
{
return
timer_pending
(
&
nb
->
t20timer
);
}
...
...
@@ -291,6 +285,8 @@ void x25_link_device_up(struct net_device *dev)
skb_queue_head_init
(
&
nb
->
queue
);
init_timer
(
&
nb
->
t20timer
);
nb
->
t20timer
.
data
=
(
unsigned
long
)
nb
;
nb
->
t20timer
.
function
=
&
x25_t20timer_expiry
;
dev_hold
(
dev
);
nb
->
dev
=
dev
;
...
...
net/x25/x25_timer.c
View file @
ee735cbb
...
...
@@ -43,15 +43,22 @@
static
void
x25_heartbeat_expiry
(
unsigned
long
);
static
void
x25_timer_expiry
(
unsigned
long
);
void
x25_
start_heartbeat
(
struct
sock
*
sk
)
void
x25_
init_timers
(
struct
sock
*
sk
)
{
del_timer
(
&
sk
->
sk_timer
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
init_timer
(
&
x25
->
timer
);
x25
->
timer
.
data
=
(
unsigned
long
)
sk
;
x25
->
timer
.
function
=
&
x25_timer_expiry
;
/* initialized by sock_init_data */
sk
->
sk_timer
.
data
=
(
unsigned
long
)
sk
;
sk
->
sk_timer
.
function
=
&
x25_heartbeat_expiry
;
sk
->
sk_timer
.
expires
=
jiffies
+
5
*
HZ
;
}
add_timer
(
&
sk
->
sk_timer
);
void
x25_start_heartbeat
(
struct
sock
*
sk
)
{
mod_timer
(
&
sk
->
sk_timer
,
jiffies
+
5
*
HZ
);
}
void
x25_stop_heartbeat
(
struct
sock
*
sk
)
...
...
@@ -63,52 +70,28 @@ void x25_start_t2timer(struct sock *sk)
{
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
x25
->
timer
.
data
=
(
unsigned
long
)
sk
;
x25
->
timer
.
function
=
&
x25_timer_expiry
;
x25
->
timer
.
expires
=
jiffies
+
x25
->
t2
;
add_timer
(
&
x25
->
timer
);
mod_timer
(
&
x25
->
timer
,
jiffies
+
x25
->
t2
);
}
void
x25_start_t21timer
(
struct
sock
*
sk
)
{
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
x25
->
timer
.
data
=
(
unsigned
long
)
sk
;
x25
->
timer
.
function
=
&
x25_timer_expiry
;
x25
->
timer
.
expires
=
jiffies
+
x25
->
t21
;
add_timer
(
&
x25
->
timer
);
mod_timer
(
&
x25
->
timer
,
jiffies
+
x25
->
t21
);
}
void
x25_start_t22timer
(
struct
sock
*
sk
)
{
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
x25
->
timer
.
data
=
(
unsigned
long
)
sk
;
x25
->
timer
.
function
=
&
x25_timer_expiry
;
x25
->
timer
.
expires
=
jiffies
+
x25
->
t22
;
add_timer
(
&
x25
->
timer
);
mod_timer
(
&
x25
->
timer
,
jiffies
+
x25
->
t22
);
}
void
x25_start_t23timer
(
struct
sock
*
sk
)
{
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
x25
->
timer
.
data
=
(
unsigned
long
)
sk
;
x25
->
timer
.
function
=
&
x25_timer_expiry
;
x25
->
timer
.
expires
=
jiffies
+
x25
->
t23
;
add_timer
(
&
x25
->
timer
);
mod_timer
(
&
x25
->
timer
,
jiffies
+
x25
->
t23
);
}
void
x25_stop_timer
(
struct
sock
*
sk
)
...
...
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