diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-18 07:07:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 07:07:21 -0400 |
commit | de05c557b24c7dffc6d392e3db120cf11c9f6ae7 (patch) | |
tree | d1d6fe1323657afd7d416c6af8a62d6a9e1e1e66 /net/ipv6 | |
parent | 60bdde95807e982a824be9cfdd35055cc721a88a (diff) |
proc: consolidate per-net single_open callers
There are already 7 of them - time to kill some duplicate code.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/proc.c | 19 | ||||
-rw-r--r-- | net/ipv6/route.c | 26 |
2 files changed, 3 insertions, 42 deletions
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 | ||
184 | static int sockstat6_seq_open(struct inode *inode, struct file *file) | 184 | static 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 | |||
200 | err_open: | ||
201 | put_net(net); | ||
202 | err_net: | ||
203 | return err; | ||
204 | } | 187 | } |
205 | 188 | ||
206 | static int sockstat6_seq_release(struct inode *inode, struct file *file) | 189 | static 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 | ||
2417 | static int ipv6_route_open(struct inode *inode, struct file *file) | 2417 | static 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 | ||
2433 | static int ipv6_route_release(struct inode *inode, struct file *file) | 2422 | static 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 | ||
2464 | static int rt6_stats_seq_open(struct inode *inode, struct file *file) | 2453 | static 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 | ||
2480 | static int rt6_stats_seq_release(struct inode *inode, struct file *file) | 2458 | static int rt6_stats_seq_release(struct inode *inode, struct file *file) |