aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/fib_trie.c13
-rw-r--r--net/ipv4/proc.c57
-rw-r--r--net/ipv6/proc.c19
-rw-r--r--net/ipv6/route.c26
4 files changed, 7 insertions, 108 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f155a66d6ebf..6009df238ed9 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2251,18 +2251,7 @@ static int fib_triestat_seq_show(struct seq_file *seq, void *v)
2251 2251
2252static int fib_triestat_seq_open(struct inode *inode, struct file *file) 2252static int fib_triestat_seq_open(struct inode *inode, struct file *file)
2253{ 2253{
2254 int err; 2254 return single_open_net(inode, file, fib_triestat_seq_show);
2255 struct net *net;
2256
2257 net = get_proc_net(inode);
2258 if (net == NULL)
2259 return -ENXIO;
2260 err = single_open(file, fib_triestat_seq_show, net);
2261 if (err < 0) {
2262 put_net(net);
2263 return err;
2264 }
2265 return 0;
2266} 2255}
2267 2256
2268static int fib_triestat_seq_release(struct inode *ino, struct file *f) 2257static int fib_triestat_seq_release(struct inode *ino, struct file *f)
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 554390431a4e..daf5d3c80cef 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -71,24 +71,7 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
71 71
72static int sockstat_seq_open(struct inode *inode, struct file *file) 72static int sockstat_seq_open(struct inode *inode, struct file *file)
73{ 73{
74 int err; 74 return single_open_net(inode, file, sockstat_seq_show);
75 struct net *net;
76
77 err = -ENXIO;
78 net = get_proc_net(inode);
79 if (net == NULL)
80 goto err_net;
81
82 err = single_open(file, sockstat_seq_show, net);
83 if (err < 0)
84 goto err_open;
85
86 return 0;
87
88err_open:
89 put_net(net);
90err_net:
91 return err;
92} 75}
93 76
94static int sockstat_seq_release(struct inode *inode, struct file *file) 77static int sockstat_seq_release(struct inode *inode, struct file *file)
@@ -397,24 +380,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
397 380
398static int snmp_seq_open(struct inode *inode, struct file *file) 381static int snmp_seq_open(struct inode *inode, struct file *file)
399{ 382{
400 int err; 383 return single_open_net(inode, file, snmp_seq_show);
401 struct net *net;
402
403 err = -ENXIO;
404 net = get_proc_net(inode);
405 if (net == NULL)
406 goto err_net;
407
408 err = single_open(file, snmp_seq_show, net);
409 if (err < 0)
410 goto err_open;
411
412 return 0;
413
414err_open:
415 put_net(net);
416err_net:
417 return err;
418} 384}
419 385
420static int snmp_seq_release(struct inode *inode, struct file *file) 386static int snmp_seq_release(struct inode *inode, struct file *file)
@@ -469,24 +435,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v)
469 435
470static int netstat_seq_open(struct inode *inode, struct file *file) 436static int netstat_seq_open(struct inode *inode, struct file *file)
471{ 437{
472 int err; 438 return single_open_net(inode, file, netstat_seq_show);
473 struct net *net;
474
475 err = -ENXIO;
476 net = get_proc_net(inode);
477 if (net == NULL)
478 goto err_net;
479
480 err = single_open(file, netstat_seq_show, net);
481 if (err < 0)
482 goto err_open;
483
484 return 0;
485
486err_open:
487 put_net(net);
488err_net:
489 return err;
490} 439}
491 440
492static int netstat_seq_release(struct inode *inode, struct file *file) 441static int netstat_seq_release(struct inode *inode, struct file *file)
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index cbc7e514d3ec..29c5a79444c2 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -183,24 +183,7 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
183 183
184static int sockstat6_seq_open(struct inode *inode, struct file *file) 184static int sockstat6_seq_open(struct inode *inode, struct file *file)
185{ 185{
186 int err; 186 return single_open_net(inode, file, sockstat6_seq_show);
187 struct net *net;
188
189 err = -ENXIO;
190 net = get_proc_net(inode);
191 if (net == NULL)
192 goto err_net;
193
194 err = single_open(file, sockstat6_seq_show, net);
195 if (err < 0)
196 goto err_open;
197
198 return 0;
199
200err_open:
201 put_net(net);
202err_net:
203 return err;
204} 187}
205 188
206static int sockstat6_seq_release(struct inode *inode, struct file *file) 189static int sockstat6_seq_release(struct inode *inode, struct file *file)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5d6c166dfbb6..fb7ff8f0c6db 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2416,18 +2416,7 @@ static int ipv6_route_show(struct seq_file *m, void *v)
2416 2416
2417static int ipv6_route_open(struct inode *inode, struct file *file) 2417static int ipv6_route_open(struct inode *inode, struct file *file)
2418{ 2418{
2419 int err; 2419 return single_open_net(inode, file, ipv6_route_show);
2420 struct net *net = get_proc_net(inode);
2421 if (!net)
2422 return -ENXIO;
2423
2424 err = single_open(file, ipv6_route_show, net);
2425 if (err < 0) {
2426 put_net(net);
2427 return err;
2428 }
2429
2430 return 0;
2431} 2420}
2432 2421
2433static int ipv6_route_release(struct inode *inode, struct file *file) 2422static int ipv6_route_release(struct inode *inode, struct file *file)
@@ -2463,18 +2452,7 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v)
2463 2452
2464static int rt6_stats_seq_open(struct inode *inode, struct file *file) 2453static int rt6_stats_seq_open(struct inode *inode, struct file *file)
2465{ 2454{
2466 int err; 2455 return single_open_net(inode, file, rt6_stats_seq_show);
2467 struct net *net = get_proc_net(inode);
2468 if (!net)
2469 return -ENXIO;
2470
2471 err = single_open(file, rt6_stats_seq_show, net);
2472 if (err < 0) {
2473 put_net(net);
2474 return err;
2475 }
2476
2477 return 0;
2478} 2456}
2479 2457
2480static int rt6_stats_seq_release(struct inode *inode, struct file *file) 2458static int rt6_stats_seq_release(struct inode *inode, struct file *file)