aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-18 07:07:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-18 07:07:44 -0400
commitb6fcbdb4f283f7ba67cec3cda6be23da8e959031 (patch)
tree45d72a4a5d0cce9ab2c98321f4d7d122bf982a55 /net/ipv4
parentde05c557b24c7dffc6d392e3db120cf11c9f6ae7 (diff)
proc: consolidate per-net single-release callers
They are symmetrical to single_open ones :) Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_trie.c9
-rw-r--r--net/ipv4/proc.c30
2 files changed, 4 insertions, 35 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 6009df238ed9..5cb72786a8af 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2254,19 +2254,12 @@ static int fib_triestat_seq_open(struct inode *inode, struct file *file)
2254 return single_open_net(inode, file, fib_triestat_seq_show); 2254 return single_open_net(inode, file, fib_triestat_seq_show);
2255} 2255}
2256 2256
2257static int fib_triestat_seq_release(struct inode *ino, struct file *f)
2258{
2259 struct seq_file *seq = f->private_data;
2260 put_net(seq->private);
2261 return single_release(ino, f);
2262}
2263
2264static const struct file_operations fib_triestat_fops = { 2257static const struct file_operations fib_triestat_fops = {
2265 .owner = THIS_MODULE, 2258 .owner = THIS_MODULE,
2266 .open = fib_triestat_seq_open, 2259 .open = fib_triestat_seq_open,
2267 .read = seq_read, 2260 .read = seq_read,
2268 .llseek = seq_lseek, 2261 .llseek = seq_lseek,
2269 .release = fib_triestat_seq_release, 2262 .release = single_release_net,
2270}; 2263};
2271 2264
2272static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) 2265static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos)
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index daf5d3c80cef..834356ea99df 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -74,20 +74,12 @@ static int sockstat_seq_open(struct inode *inode, struct file *file)
74 return single_open_net(inode, file, sockstat_seq_show); 74 return single_open_net(inode, file, sockstat_seq_show);
75} 75}
76 76
77static int sockstat_seq_release(struct inode *inode, struct file *file)
78{
79 struct net *net = ((struct seq_file *)file->private_data)->private;
80
81 put_net(net);
82 return single_release(inode, file);
83}
84
85static const struct file_operations sockstat_seq_fops = { 77static const struct file_operations sockstat_seq_fops = {
86 .owner = THIS_MODULE, 78 .owner = THIS_MODULE,
87 .open = sockstat_seq_open, 79 .open = sockstat_seq_open,
88 .read = seq_read, 80 .read = seq_read,
89 .llseek = seq_lseek, 81 .llseek = seq_lseek,
90 .release = sockstat_seq_release, 82 .release = single_release_net,
91}; 83};
92 84
93/* snmp items */ 85/* snmp items */
@@ -383,20 +375,12 @@ static int snmp_seq_open(struct inode *inode, struct file *file)
383 return single_open_net(inode, file, snmp_seq_show); 375 return single_open_net(inode, file, snmp_seq_show);
384} 376}
385 377
386static int snmp_seq_release(struct inode *inode, struct file *file)
387{
388 struct net *net = ((struct seq_file *)file->private_data)->private;
389
390 put_net(net);
391 return single_release(inode, file);
392}
393
394static const struct file_operations snmp_seq_fops = { 378static const struct file_operations snmp_seq_fops = {
395 .owner = THIS_MODULE, 379 .owner = THIS_MODULE,
396 .open = snmp_seq_open, 380 .open = snmp_seq_open,
397 .read = seq_read, 381 .read = seq_read,
398 .llseek = seq_lseek, 382 .llseek = seq_lseek,
399 .release = snmp_seq_release, 383 .release = single_release_net,
400}; 384};
401 385
402 386
@@ -438,20 +422,12 @@ static int netstat_seq_open(struct inode *inode, struct file *file)
438 return single_open_net(inode, file, netstat_seq_show); 422 return single_open_net(inode, file, netstat_seq_show);
439} 423}
440 424
441static int netstat_seq_release(struct inode *inode, struct file *file)
442{
443 struct net *net = ((struct seq_file *)file->private_data)->private;
444
445 put_net(net);
446 return single_release(inode, file);
447}
448
449static const struct file_operations netstat_seq_fops = { 425static const struct file_operations netstat_seq_fops = {
450 .owner = THIS_MODULE, 426 .owner = THIS_MODULE,
451 .open = netstat_seq_open, 427 .open = netstat_seq_open,
452 .read = seq_read, 428 .read = seq_read,
453 .llseek = seq_lseek, 429 .llseek = seq_lseek,
454 .release = netstat_seq_release, 430 .release = single_release_net,
455}; 431};
456 432
457static __net_init int ip_proc_init_net(struct net *net) 433static __net_init int ip_proc_init_net(struct net *net)