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
5d45f59f
Commit
5d45f59f
authored
Sep 11, 2003
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Use proc_net_fops_create() and proc_net_remove() in net/ipv4.
parent
a763d83a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
62 deletions
+33
-62
net/ipv4/arp.c
net/ipv4/arp.c
+3
-8
net/ipv4/fib_hash.c
net/ipv4/fib_hash.c
+4
-10
net/ipv4/igmp.c
net/ipv4/igmp.c
+2
-9
net/ipv4/proc.c
net/ipv4/proc.c
+5
-12
net/ipv4/raw.c
net/ipv4/raw.c
+4
-10
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c
+11
-8
net/ipv4/udp.c
net/ipv4/udp.c
+4
-5
No files found.
net/ipv4/arp.c
View file @
5d45f59f
...
@@ -1416,14 +1416,9 @@ static struct file_operations arp_seq_fops = {
...
@@ -1416,14 +1416,9 @@ static struct file_operations arp_seq_fops = {
static
int
__init
arp_proc_init
(
void
)
static
int
__init
arp_proc_init
(
void
)
{
{
int
rc
=
0
;
if
(
!
proc_net_fops_create
(
"arp"
,
S_IRUGO
,
&
arp_seq_fops
))
struct
proc_dir_entry
*
p
=
create_proc_entry
(
"arp"
,
S_IRUGO
,
proc_net
);
return
-
ENOMEM
;
return
0
;
if
(
p
)
p
->
proc_fops
=
&
arp_seq_fops
;
else
rc
=
-
ENOMEM
;
return
rc
;
}
}
#else
/* CONFIG_PROC_FS */
#else
/* CONFIG_PROC_FS */
...
...
net/ipv4/fib_hash.c
View file @
5d45f59f
...
@@ -1096,19 +1096,13 @@ static struct file_operations fib_seq_fops = {
...
@@ -1096,19 +1096,13 @@ static struct file_operations fib_seq_fops = {
int
__init
fib_proc_init
(
void
)
int
__init
fib_proc_init
(
void
)
{
{
struct
proc_dir_entry
*
p
;
if
(
!
proc_net_fops_create
(
"route"
,
S_IRUGO
,
&
fib_seq_fops
))
int
rc
=
0
;
return
-
ENOMEM
;
return
0
;
p
=
create_proc_entry
(
"route"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
fib_seq_fops
;
else
rc
=
-
ENOMEM
;
return
rc
;
}
}
void
__init
fib_proc_exit
(
void
)
void
__init
fib_proc_exit
(
void
)
{
{
remove_proc_entry
(
"route"
,
proc_net
);
proc_net_remove
(
"route"
);
}
}
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
net/ipv4/igmp.c
View file @
5d45f59f
...
@@ -2430,15 +2430,8 @@ static struct file_operations igmp_mcf_seq_fops = {
...
@@ -2430,15 +2430,8 @@ static struct file_operations igmp_mcf_seq_fops = {
int
__init
igmp_mc_proc_init
(
void
)
int
__init
igmp_mc_proc_init
(
void
)
{
{
struct
proc_dir_entry
*
p
;
proc_net_fops_create
(
"igmp"
,
S_IRUGO
,
&
igmp_mc_seq_fops
);
proc_net_fops_create
(
"mcfilter"
,
S_IRUGO
,
&
igmp_mcf_seq_fops
);
p
=
create_proc_entry
(
"igmp"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
igmp_mc_seq_fops
;
p
=
create_proc_entry
(
"mcfilter"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
igmp_mcf_seq_fops
;
return
0
;
return
0
;
}
}
#endif
#endif
...
...
net/ipv4/proc.c
View file @
5d45f59f
...
@@ -238,28 +238,21 @@ static struct file_operations netstat_seq_fops = {
...
@@ -238,28 +238,21 @@ static struct file_operations netstat_seq_fops = {
int
__init
ip_misc_proc_init
(
void
)
int
__init
ip_misc_proc_init
(
void
)
{
{
int
rc
=
0
;
int
rc
=
0
;
struct
proc_dir_entry
*
p
;
p
=
create_proc_entry
(
"netstat"
,
S_IRUGO
,
proc_net
);
if
(
!
proc_net_fops_create
(
"netstat"
,
S_IRUGO
,
&
netstat_seq_fops
))
if
(
!
p
)
goto
out_netstat
;
goto
out_netstat
;
p
->
proc_fops
=
&
netstat_seq_fops
;
p
=
create_proc_entry
(
"snmp"
,
S_IRUGO
,
proc_net
);
if
(
!
proc_net_fops_create
(
"snmp"
,
S_IRUGO
,
&
snmp_seq_fops
))
if
(
!
p
)
goto
out_snmp
;
goto
out_snmp
;
p
->
proc_fops
=
&
snmp_seq_fops
;
p
=
create_proc_entry
(
"sockstat"
,
S_IRUGO
,
proc_net
);
if
(
!
proc_net_fops_create
(
"sockstat"
,
S_IRUGO
,
&
sockstat_seq_fops
))
if
(
!
p
)
goto
out_sockstat
;
goto
out_sockstat
;
p
->
proc_fops
=
&
sockstat_seq_fops
;
out:
out:
return
rc
;
return
rc
;
out_sockstat:
out_sockstat:
remove_proc_entry
(
"snmp"
,
proc_net
);
proc_net_remove
(
"snmp"
);
out_snmp:
out_snmp:
remove_proc_entry
(
"netstat"
,
proc_net
);
proc_net_remove
(
"netstat"
);
out_netstat:
out_netstat:
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
goto
out
;
goto
out
;
...
...
net/ipv4/raw.c
View file @
5d45f59f
...
@@ -831,19 +831,13 @@ static struct file_operations raw_seq_fops = {
...
@@ -831,19 +831,13 @@ static struct file_operations raw_seq_fops = {
int
__init
raw_proc_init
(
void
)
int
__init
raw_proc_init
(
void
)
{
{
struct
proc_dir_entry
*
p
;
if
(
!
proc_net_fops_create
(
"raw"
,
S_IRUGO
,
&
raw_seq_fops
))
int
rc
=
0
;
return
-
ENOMEM
;
return
0
;
p
=
create_proc_entry
(
"raw"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
raw_seq_fops
;
else
rc
=
-
ENOMEM
;
return
rc
;
}
}
void
__init
raw_proc_exit
(
void
)
void
__init
raw_proc_exit
(
void
)
{
{
remove_proc_entry
(
"raw"
,
proc_net
);
proc_net_remove
(
"raw"
);
}
}
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
net/ipv4/tcp_ipv4.c
View file @
5d45f59f
...
@@ -2413,11 +2413,15 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
...
@@ -2413,11 +2413,15 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
{
{
struct
tcp_seq_afinfo
*
afinfo
=
PDE
(
inode
)
->
data
;
struct
tcp_seq_afinfo
*
afinfo
=
PDE
(
inode
)
->
data
;
struct
seq_file
*
seq
;
struct
seq_file
*
seq
;
int
rc
=
-
ENOMEM
;
struct
tcp_iter_state
*
s
;
struct
tcp_iter_state
*
s
=
kmalloc
(
sizeof
(
*
s
),
GFP_KERNEL
)
;
int
rc
;
if
(
unlikely
(
afinfo
==
NULL
))
return
-
EINVAL
;
s
=
kmalloc
(
sizeof
(
*
s
),
GFP_KERNEL
);
if
(
!
s
)
if
(
!
s
)
goto
out
;
return
-
ENOMEM
;
memset
(
s
,
0
,
sizeof
(
*
s
));
memset
(
s
,
0
,
sizeof
(
*
s
));
s
->
family
=
afinfo
->
family
;
s
->
family
=
afinfo
->
family
;
s
->
seq_ops
.
start
=
tcp_seq_start
;
s
->
seq_ops
.
start
=
tcp_seq_start
;
...
@@ -2450,11 +2454,10 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
...
@@ -2450,11 +2454,10 @@ int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
afinfo
->
seq_fops
->
llseek
=
seq_lseek
;
afinfo
->
seq_fops
->
llseek
=
seq_lseek
;
afinfo
->
seq_fops
->
release
=
seq_release_private
;
afinfo
->
seq_fops
->
release
=
seq_release_private
;
p
=
create_proc_entry
(
afinfo
->
name
,
S_IRUGO
,
proc_net
);
p
=
proc_net_fops_create
(
afinfo
->
name
,
S_IRUGO
,
afinfo
->
seq_fops
);
if
(
p
)
{
if
(
p
)
p
->
data
=
afinfo
;
p
->
data
=
afinfo
;
p
->
proc_fops
=
afinfo
->
seq_fops
;
else
}
else
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
return
rc
;
return
rc
;
}
}
...
@@ -2463,7 +2466,7 @@ void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
...
@@ -2463,7 +2466,7 @@ void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
{
{
if
(
!
afinfo
)
if
(
!
afinfo
)
return
;
return
;
remove_proc_entry
(
afinfo
->
name
,
proc_net
);
proc_net_remove
(
afinfo
->
name
);
memset
(
afinfo
->
seq_fops
,
0
,
sizeof
(
*
afinfo
->
seq_fops
));
memset
(
afinfo
->
seq_fops
,
0
,
sizeof
(
*
afinfo
->
seq_fops
));
}
}
...
...
net/ipv4/udp.c
View file @
5d45f59f
...
@@ -1460,11 +1460,10 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
...
@@ -1460,11 +1460,10 @@ int udp_proc_register(struct udp_seq_afinfo *afinfo)
afinfo
->
seq_fops
->
llseek
=
seq_lseek
;
afinfo
->
seq_fops
->
llseek
=
seq_lseek
;
afinfo
->
seq_fops
->
release
=
seq_release_private
;
afinfo
->
seq_fops
->
release
=
seq_release_private
;
p
=
create_proc_entry
(
afinfo
->
name
,
S_IRUGO
,
proc_net
);
p
=
proc_net_fops_create
(
afinfo
->
name
,
S_IRUGO
,
afinfo
->
seq_fops
);
if
(
p
)
{
if
(
p
)
p
->
data
=
afinfo
;
p
->
data
=
afinfo
;
p
->
proc_fops
=
afinfo
->
seq_fops
;
else
}
else
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
return
rc
;
return
rc
;
}
}
...
@@ -1473,7 +1472,7 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo)
...
@@ -1473,7 +1472,7 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo)
{
{
if
(
!
afinfo
)
if
(
!
afinfo
)
return
;
return
;
remove_proc_entry
(
afinfo
->
name
,
proc_net
);
proc_net_remove
(
afinfo
->
name
);
memset
(
afinfo
->
seq_fops
,
0
,
sizeof
(
*
afinfo
->
seq_fops
));
memset
(
afinfo
->
seq_fops
,
0
,
sizeof
(
*
afinfo
->
seq_fops
));
}
}
...
...
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