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
45f0e972
Commit
45f0e972
authored
Oct 06, 2002
by
Arnaldo Carvalho de Melo
Committed by
Arnaldo Carvalho de Melo
Oct 06, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o X25: use seq_file for proc stuff
Also some CodingStyle cleanups.
parent
5c0fbae1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
320 additions
and
167 deletions
+320
-167
include/net/x25.h
include/net/x25.h
+9
-2
net/x25/Makefile
net/x25/Makefile
+1
-1
net/x25/af_x25.c
net/x25/af_x25.c
+45
-101
net/x25/x25_proc.c
net/x25/x25_proc.c
+263
-0
net/x25/x25_route.c
net/x25/x25_route.c
+2
-63
No files found.
include/net/x25.h
View file @
45f0e972
...
...
@@ -220,9 +220,8 @@ extern void x25_enquiry_response(struct sock *);
/* x25_route.c */
extern
struct
x25_route
*
x25_get_route
(
struct
x25_address
*
addr
);
extern
struct
net_device
*
x25_dev_get
(
char
*
);
extern
void
x25_route_device_down
(
struct
net_device
*
);
extern
void
x25_route_device_down
(
struct
net_device
*
dev
);
extern
int
x25_route_ioctl
(
unsigned
int
,
void
*
);
extern
int
x25_routes_get_info
(
char
*
,
char
**
,
off_t
,
int
);
extern
void
x25_route_free
(
void
);
static
__inline__
void
x25_route_hold
(
struct
x25_route
*
rt
)
...
...
@@ -263,4 +262,12 @@ struct x25_skb_cb {
unsigned
flags
;
};
#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb))
extern
struct
sock
*
x25_list
;
extern
rwlock_t
x25_list_lock
;
extern
struct
list_head
x25_route_list
;
extern
rwlock_t
x25_route_list_lock
;
extern
int
x25_proc_init
(
void
);
extern
void
x25_proc_exit
(
void
);
#endif
net/x25/Makefile
View file @
45f0e972
...
...
@@ -6,7 +6,7 @@ obj-$(CONFIG_X25) += x25.o
x25-y
:=
af_x25.o x25_dev.o x25_facilities.o x25_in.o
\
x25_link.o x25_out.o x25_route.o x25_subr.o
\
x25_timer.o
x25_timer.o
x25_proc.o
x25-$(CONFIG_SYSCTL)
+=
sysctl_net_x25.o
x25-objs
:=
$
(
x25-y
)
...
...
net/x25/af_x25.c
View file @
45f0e972
...
...
@@ -27,6 +27,8 @@
* 2000-10-02 Henner Eisen Made x25_kick() single threaded per socket.
* 2000-10-27 Henner Eisen MSG_DONTWAIT for fragment allocation.
* 2000-11-14 Henner Eisen Closing datalink from NETDEV_GOING_DOWN
* 2002-10-06 Arnaldo C. Melo Get rid of cli/sti, move proc stuff to
* x25_proc.c, using seq_file
*/
#include <linux/config.h>
...
...
@@ -55,7 +57,6 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <net/x25.h>
...
...
@@ -65,8 +66,8 @@ int sysctl_x25_reset_request_timeout = X25_DEFAULT_T22;
int
sysctl_x25_clear_request_timeout
=
X25_DEFAULT_T23
;
int
sysctl_x25_ack_holdback_timeout
=
X25_DEFAULT_T2
;
st
atic
st
ruct
sock
*
x25_list
;
static
rwlock_t
x25_list_lock
=
RW_LOCK_UNLOCKED
;
struct
sock
*
x25_list
;
rwlock_t
x25_list_lock
=
RW_LOCK_UNLOCKED
;
static
struct
proto_ops
x25_proto_ops
;
...
...
@@ -246,8 +247,10 @@ static struct sock *x25_find_listener(struct x25_address *addr)
read_lock_bh
(
&
x25_list_lock
);
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
if
((
!
strcmp
(
addr
->
x25_addr
,
x25_sk
(
s
)
->
source_addr
.
x25_addr
)
||
!
strcmp
(
addr
->
x25_addr
,
null_x25_address
.
x25_addr
))
&&
if
((
!
strcmp
(
addr
->
x25_addr
,
x25_sk
(
s
)
->
source_addr
.
x25_addr
)
||
!
strcmp
(
addr
->
x25_addr
,
null_x25_address
.
x25_addr
))
&&
s
->
state
==
TCP_LISTEN
)
break
;
...
...
@@ -318,12 +321,13 @@ static void x25_destroy_timer(unsigned long data)
}
/*
* This is called from user mode and the timers. Thus it protects itself against
* interrupt users but doesn't worry about being called during work.
* Once it is removed from the queue no interrupt or bottom half will
* touch it and we are (fairly 8-) ) safe.
* This is called from user mode and the timers. Thus it protects itself
* against interrupt users but doesn't worry about being called during
* work. Once it is removed from the queue no interrupt or bottom half
* will touch it and we are (fairly 8-) ) safe.
* Not static as it's used by the timer
*/
void
x25_destroy_socket
(
struct
sock
*
sk
)
/* Not static as it's used by the timer */
void
x25_destroy_socket
(
struct
sock
*
sk
)
{
struct
sk_buff
*
skb
;
...
...
@@ -337,7 +341,10 @@ void x25_destroy_socket(struct sock *sk) /* Not static as it's used by the timer
while
((
skb
=
skb_dequeue
(
&
sk
->
receive_queue
))
!=
NULL
)
{
if
(
skb
->
sk
!=
sk
)
{
/* A pending connection */
skb
->
sk
->
dead
=
1
;
/* Queue the unaccepted socket for death */
/*
* Queue the unaccepted socket for death
*/
skb
->
sk
->
dead
=
1
;
x25_start_heartbeat
(
skb
->
sk
);
x25_sk
(
skb
->
sk
)
->
state
=
X25_STATE_0
;
}
...
...
@@ -631,7 +638,8 @@ static int x25_wait_for_connection_establishment(struct sock *sk)
return
rc
;
}
static
int
x25_connect
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
int
addr_len
,
int
flags
)
static
int
x25_connect
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
int
addr_len
,
int
flags
)
{
struct
sock
*
sk
=
sock
->
sk
;
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
...
...
@@ -785,7 +793,8 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
return
rc
;
}
static
int
x25_getname
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
int
*
uaddr_len
,
int
peer
)
static
int
x25_getname
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
int
*
uaddr_len
,
int
peer
)
{
struct
sockaddr_x25
*
sx25
=
(
struct
sockaddr_x25
*
)
uaddr
;
struct
sock
*
sk
=
sock
->
sk
;
...
...
@@ -804,7 +813,8 @@ static int x25_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_l
return
0
;
}
int
x25_rx_call_request
(
struct
sk_buff
*
skb
,
struct
x25_neigh
*
nb
,
unsigned
int
lci
)
int
x25_rx_call_request
(
struct
sk_buff
*
skb
,
struct
x25_neigh
*
nb
,
unsigned
int
lci
)
{
struct
sock
*
sk
;
struct
sock
*
make
;
...
...
@@ -906,7 +916,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, unsigned int
goto
out
;
}
static
int
x25_sendmsg
(
struct
socket
*
sock
,
struct
msghdr
*
msg
,
int
len
,
struct
scm_cookie
*
scm
)
static
int
x25_sendmsg
(
struct
socket
*
sock
,
struct
msghdr
*
msg
,
int
len
,
struct
scm_cookie
*
scm
)
{
struct
sock
*
sk
=
sock
->
sk
;
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
...
...
@@ -1118,7 +1129,8 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size,
msg
->
msg_flags
|=
MSG_OOB
;
}
else
{
/* Now we can treat all alike */
skb
=
skb_recv_datagram
(
sk
,
flags
&
~
MSG_DONTWAIT
,
flags
&
MSG_DONTWAIT
,
&
rc
);
skb
=
skb_recv_datagram
(
sk
,
flags
&
~
MSG_DONTWAIT
,
flags
&
MSG_DONTWAIT
,
&
rc
);
if
(
!
skb
)
goto
out
;
...
...
@@ -1236,14 +1248,16 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
break
;
case
SIOCX25GFACILITIES
:
{
struct
x25_facilities
fac
=
x25
->
facilities
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
fac
,
sizeof
(
fac
))
?
-
EFAULT
:
0
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
fac
,
sizeof
(
fac
))
?
-
EFAULT
:
0
;
break
;
}
case
SIOCX25SFACILITIES
:
{
struct
x25_facilities
facilities
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
facilities
,
(
void
*
)
arg
,
sizeof
(
facilities
)))
if
(
copy_from_user
(
&
facilities
,
(
void
*
)
arg
,
sizeof
(
facilities
)))
break
;
rc
=
-
EINVAL
;
if
(
sk
->
state
!=
TCP_LISTEN
&&
sk
->
state
!=
TCP_CLOSE
)
...
...
@@ -1269,7 +1283,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case
SIOCX25GCALLUSERDATA
:
{
struct
x25_calluserdata
cud
=
x25
->
calluserdata
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
cud
,
sizeof
(
cud
))
?
-
EFAULT
:
0
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
cud
,
sizeof
(
cud
))
?
-
EFAULT
:
0
;
break
;
}
...
...
@@ -1277,7 +1292,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
struct
x25_calluserdata
calluserdata
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
calluserdata
,
(
void
*
)
arg
,
sizeof
(
calluserdata
)))
if
(
copy_from_user
(
&
calluserdata
,
(
void
*
)
arg
,
sizeof
(
calluserdata
)))
break
;
rc
=
-
EINVAL
;
if
(
calluserdata
.
cudlength
>
X25_MAX_CUD_LEN
)
...
...
@@ -1290,7 +1306,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case
SIOCX25GCAUSEDIAG
:
{
struct
x25_causediag
causediag
;
causediag
=
x25
->
causediag
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
causediag
,
sizeof
(
causediag
))
?
-
EFAULT
:
0
;
rc
=
copy_to_user
((
void
*
)
arg
,
&
causediag
,
sizeof
(
causediag
))
?
-
EFAULT
:
0
;
break
;
}
...
...
@@ -1302,70 +1319,6 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return
rc
;
}
static
int
x25_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
{
struct
sock
*
s
;
struct
net_device
*
dev
;
const
char
*
devname
;
off_t
pos
=
0
;
off_t
begin
=
0
;
int
len
=
sprintf
(
buffer
,
"dest_addr src_addr dev lci st vs vr "
"va t t2 t21 t22 t23 Snd-Q Rcv-Q inode
\n
"
);
read_lock_bh
(
&
x25_list_lock
);
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
{
struct
x25_opt
*
x25
=
x25_sk
(
s
);
if
(
!
x25
->
neighbour
||
(
dev
=
x25
->
neighbour
->
dev
)
==
NULL
)
devname
=
"???"
;
else
devname
=
x25
->
neighbour
->
dev
->
name
;
len
+=
sprintf
(
buffer
+
len
,
"%-10s %-10s %-5s %3.3X %d %d "
"%d %d %3lu %3lu %3lu %3lu %3lu "
"%5d %5d %ld
\n
"
,
!
x25
->
dest_addr
.
x25_addr
[
0
]
?
"*"
:
x25
->
dest_addr
.
x25_addr
,
!
x25
->
source_addr
.
x25_addr
[
0
]
?
"*"
:
x25
->
source_addr
.
x25_addr
,
devname
,
x25
->
lci
&
0x0FFF
,
x25
->
state
,
x25
->
vs
,
x25
->
vr
,
x25
->
va
,
x25_display_timer
(
s
)
/
HZ
,
x25
->
t2
/
HZ
,
x25
->
t21
/
HZ
,
x25
->
t22
/
HZ
,
x25
->
t23
/
HZ
,
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
rmem_alloc
),
s
->
socket
?
SOCK_INODE
(
s
->
socket
)
->
i_ino
:
0L
);
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
break
;
}
read_unlock_bh
(
&
x25_list_lock
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
return
len
;
}
struct
net_proto_family
x25_family_ops
=
{
.
family
=
AF_X25
,
.
create
=
x25_create
,
...
...
@@ -1395,7 +1348,6 @@ static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = {
#include <linux/smp_lock.h>
SOCKOPS_WRAP
(
x25_proto
,
AF_X25
);
static
struct
packet_type
x25_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_X25
),
.
func
=
x25_lapb_receive_frame
,
...
...
@@ -1435,9 +1387,7 @@ static int __init x25_init(void)
x25_register_sysctl
();
#endif
proc_net_create
(
"x25"
,
0
,
x25_get_info
);
proc_net_create
(
"x25_routes"
,
0
,
x25_routes_get_info
);
x25_proc_init
();
#ifdef MODULE
/*
* Register any pre existing devices.
...
...
@@ -1457,18 +1407,9 @@ static int __init x25_init(void)
}
module_init
(
x25_init
);
MODULE_AUTHOR
(
"Jonathan Naylor <g4klx@g4klx.demon.co.uk>"
);
MODULE_DESCRIPTION
(
"The X.25 Packet Layer network layer protocol"
);
MODULE_LICENSE
(
"GPL"
);
static
void
__exit
x25_exit
(
void
)
{
proc_net_remove
(
"x25"
);
proc_net_remove
(
"x25_routes"
);
x25_proc_exit
();
x25_link_free
();
x25_route_free
();
...
...
@@ -1484,3 +1425,6 @@ static void __exit x25_exit(void)
}
module_exit
(
x25_exit
);
MODULE_AUTHOR
(
"Jonathan Naylor <g4klx@g4klx.demon.co.uk>"
);
MODULE_DESCRIPTION
(
"The X.25 Packet Layer network layer protocol"
);
MODULE_LICENSE
(
"GPL"
);
net/x25/x25_proc.c
0 → 100644
View file @
45f0e972
/*
* X.25 Packet Layer release 002
*
* This is ALPHA test software. This code may break your machine,
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
* This code REQUIRES 2.4 with seq_file support
*
* This module:
* This module is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* History
* 2002/10/06 Arnaldo Carvalho de Melo seq_file support
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/sock.h>
#include <net/x25.h>
#ifdef CONFIG_PROC_FS
static
__inline__
struct
x25_route
*
x25_get_route_idx
(
loff_t
pos
)
{
struct
list_head
*
route_entry
;
struct
x25_route
*
rt
=
NULL
;
list_for_each
(
route_entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
route_entry
,
struct
x25_route
,
node
);
if
(
--
pos
)
break
;
}
return
rt
;
}
static
void
*
x25_seq_route_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
loff_t
l
=
*
pos
;
read_lock_bh
(
&
x25_route_list_lock
);
return
l
?
x25_get_route_idx
(
--
l
)
:
(
void
*
)
1
;
}
static
void
*
x25_seq_route_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
struct
x25_route
*
rt
;
++*
pos
;
if
(
v
==
(
void
*
)
1
)
{
rt
=
NULL
;
if
(
!
list_empty
(
&
x25_route_list
))
rt
=
list_entry
(
x25_route_list
.
next
,
struct
x25_route
,
node
);
goto
out
;
}
rt
=
v
;
if
(
rt
->
node
.
next
!=
&
x25_route_list
)
rt
=
list_entry
(
rt
->
node
.
next
,
struct
x25_route
,
node
);
else
rt
=
NULL
;
out:
return
rt
;
}
static
void
x25_seq_route_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock_bh
(
&
x25_route_list_lock
);
}
static
int
x25_seq_route_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
struct
x25_route
*
rt
;
if
(
v
==
(
void
*
)
1
)
{
seq_puts
(
seq
,
"Address Digits Device
\n
"
);
goto
out
;
}
rt
=
v
;
seq_printf
(
seq
,
"%-15s %-6d %-5s
\n
"
,
rt
->
address
.
x25_addr
,
rt
->
sigdigits
,
rt
->
dev
?
rt
->
dev
->
name
:
"???"
);
out:
return
0
;
}
static
__inline__
struct
sock
*
x25_get_socket_idx
(
loff_t
pos
)
{
struct
sock
*
s
;
for
(
s
=
x25_list
;
pos
&&
s
;
s
=
s
->
next
)
--
pos
;
return
s
;
}
static
void
*
x25_seq_socket_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
loff_t
l
=
*
pos
;
read_lock_bh
(
&
x25_list_lock
);
return
l
?
x25_get_socket_idx
(
--
l
)
:
(
void
*
)
1
;
}
static
void
*
x25_seq_socket_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
struct
sock
*
s
;
++*
pos
;
if
(
v
==
(
void
*
)
1
)
{
s
=
NULL
;
if
(
x25_list
)
s
=
x25_list
;
goto
out
;
}
s
=
v
;
s
=
s
->
next
;
out:
return
s
;
}
static
void
x25_seq_socket_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock_bh
(
&
x25_list_lock
);
}
static
int
x25_seq_socket_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
struct
sock
*
s
;
struct
x25_opt
*
x25
;
struct
net_device
*
dev
;
const
char
*
devname
;
if
(
v
==
(
void
*
)
1
)
{
seq_printf
(
seq
,
"dest_addr src_addr dev lci st vs vr "
"va t t2 t21 t22 t23 Snd-Q Rcv-Q inode
\n
"
);
goto
out
;
}
s
=
v
;
x25
=
x25_sk
(
s
);
if
(
!
x25
->
neighbour
||
(
dev
=
x25
->
neighbour
->
dev
)
==
NULL
)
devname
=
"???"
;
else
devname
=
x25
->
neighbour
->
dev
->
name
;
seq_printf
(
seq
,
"%-10s %-10s %-5s %3.3X %d %d %d %d %3lu %3lu "
"%3lu %3lu %3lu %5d %5d %ld
\n
"
,
!
x25
->
dest_addr
.
x25_addr
[
0
]
?
"*"
:
x25
->
dest_addr
.
x25_addr
,
!
x25
->
source_addr
.
x25_addr
[
0
]
?
"*"
:
x25
->
source_addr
.
x25_addr
,
devname
,
x25
->
lci
&
0x0FFF
,
x25
->
state
,
x25
->
vs
,
x25
->
vr
,
x25
->
va
,
x25_display_timer
(
s
)
/
HZ
,
x25
->
t2
/
HZ
,
x25
->
t21
/
HZ
,
x25
->
t22
/
HZ
,
x25
->
t23
/
HZ
,
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
rmem_alloc
),
s
->
socket
?
SOCK_INODE
(
s
->
socket
)
->
i_ino
:
0L
);
out:
return
0
;
}
struct
seq_operations
x25_seq_route_ops
=
{
.
start
=
x25_seq_route_start
,
.
next
=
x25_seq_route_next
,
.
stop
=
x25_seq_route_stop
,
.
show
=
x25_seq_route_show
,
};
struct
seq_operations
x25_seq_socket_ops
=
{
.
start
=
x25_seq_socket_start
,
.
next
=
x25_seq_socket_next
,
.
stop
=
x25_seq_socket_stop
,
.
show
=
x25_seq_socket_show
,
};
static
int
x25_seq_socket_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
x25_seq_socket_ops
);
}
static
int
x25_seq_route_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
x25_seq_route_ops
);
}
static
struct
file_operations
x25_seq_socket_fops
=
{
.
open
=
x25_seq_socket_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
static
struct
file_operations
x25_seq_route_fops
=
{
.
open
=
x25_seq_route_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
static
int
x25_proc_perms
(
struct
inode
*
inode
,
int
op
)
{
return
0
;
}
static
struct
inode_operations
x25_seq_inode
=
{
.
permission
=
x25_proc_perms
,
};
static
struct
proc_dir_entry
*
x25_proc_dir
;
int
__init
x25_proc_init
(
void
)
{
struct
proc_dir_entry
*
p
;
int
rc
=
-
ENOMEM
;
x25_proc_dir
=
proc_mkdir
(
"x25"
,
proc_net
);
if
(
!
x25_proc_dir
)
goto
out
;
p
=
create_proc_entry
(
"route"
,
0
,
x25_proc_dir
);
if
(
!
p
)
goto
out_route
;
p
->
proc_fops
=
&
x25_seq_route_fops
;
p
->
proc_iops
=
&
x25_seq_inode
;
p
=
create_proc_entry
(
"socket"
,
0
,
x25_proc_dir
);
if
(
!
p
)
goto
out_socket
;
p
->
proc_fops
=
&
x25_seq_socket_fops
;
p
->
proc_iops
=
&
x25_seq_inode
;
rc
=
0
;
out:
return
rc
;
out_socket:
remove_proc_entry
(
"route"
,
x25_proc_dir
);
out_route:
remove_proc_entry
(
"x25"
,
proc_net
);
goto
out
;
}
void
__exit
x25_proc_exit
(
void
)
{
remove_proc_entry
(
"route"
,
x25_proc_dir
);
remove_proc_entry
(
"socket"
,
x25_proc_dir
);
remove_proc_entry
(
"x25"
,
proc_net
);
}
#else
/* CONFIG_PROC_FS */
int
__init
x25_proc_init
(
void
)
{
return
0
;
}
void
__exit
x25_proc_exit
(
void
)
{
}
#endif
/* CONFIG_PROC_FS */
net/x25/x25_route.c
View file @
45f0e972
...
...
@@ -18,34 +18,12 @@
*/
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <net/arp.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/fcntl.h>
#include <linux/termios.h>
/* For TIOCINQ/OUTQ */
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/init.h>
#include <net/x25.h>
st
atic
st
ruct
list_head
x25_route_list
=
LIST_HEAD_INIT
(
x25_route_list
);
static
rwlock_t
x25_route_list_lock
=
RW_LOCK_UNLOCKED
;
struct
list_head
x25_route_list
=
LIST_HEAD_INIT
(
x25_route_list
);
rwlock_t
x25_route_list_lock
=
RW_LOCK_UNLOCKED
;
/*
* Add a new route.
...
...
@@ -226,45 +204,6 @@ int x25_route_ioctl(unsigned int cmd, void *arg)
return
rc
;
}
int
x25_routes_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
{
struct
x25_route
*
rt
;
struct
list_head
*
entry
;
off_t
pos
=
0
;
off_t
begin
=
0
;
int
len
=
sprintf
(
buffer
,
"address digits device
\n
"
);
read_lock_bh
(
&
x25_route_list_lock
);
list_for_each
(
entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
len
+=
sprintf
(
buffer
+
len
,
"%-15s %-6d %-5s
\n
"
,
rt
->
address
.
x25_addr
,
rt
->
sigdigits
,
rt
->
dev
?
rt
->
dev
->
name
:
"???"
);
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
break
;
}
read_unlock_bh
(
&
x25_route_list_lock
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
return
len
;
}
/*
* Release all memory associated with X.25 routing structures.
*/
...
...
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