diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 21:00:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 21:00:14 -0500 |
commit | c68cd1a01ba56995d85a4a62b195b2b3f6415c64 (patch) | |
tree | 69351005622aced7acf9085fa5c54134419286ba /net/xfrm/xfrm_proc.c | |
parent | 59c9940ed0ef026673cac52f2eaed77af7d486da (diff) |
netns xfrm: /proc/net/xfrm_stat in netns
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_proc.c')
-rw-r--r-- | net/xfrm/xfrm_proc.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c index 27a2ab92d874..284eaef1dbf2 100644 --- a/net/xfrm/xfrm_proc.c +++ b/net/xfrm/xfrm_proc.c | |||
@@ -59,17 +59,18 @@ fold_field(void *mib[], int offt) | |||
59 | 59 | ||
60 | static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) | 60 | static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) |
61 | { | 61 | { |
62 | struct net *net = seq->private; | ||
62 | int i; | 63 | int i; |
63 | for (i=0; xfrm_mib_list[i].name; i++) | 64 | for (i=0; xfrm_mib_list[i].name; i++) |
64 | seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, | 65 | seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, |
65 | fold_field((void **)init_net.mib.xfrm_statistics, | 66 | fold_field((void **)net->mib.xfrm_statistics, |
66 | xfrm_mib_list[i].entry)); | 67 | xfrm_mib_list[i].entry)); |
67 | return 0; | 68 | return 0; |
68 | } | 69 | } |
69 | 70 | ||
70 | static int xfrm_statistics_seq_open(struct inode *inode, struct file *file) | 71 | static int xfrm_statistics_seq_open(struct inode *inode, struct file *file) |
71 | { | 72 | { |
72 | return single_open(file, xfrm_statistics_seq_show, NULL); | 73 | return single_open_net(inode, file, xfrm_statistics_seq_show); |
73 | } | 74 | } |
74 | 75 | ||
75 | static struct file_operations xfrm_statistics_seq_fops = { | 76 | static struct file_operations xfrm_statistics_seq_fops = { |
@@ -77,21 +78,18 @@ static struct file_operations xfrm_statistics_seq_fops = { | |||
77 | .open = xfrm_statistics_seq_open, | 78 | .open = xfrm_statistics_seq_open, |
78 | .read = seq_read, | 79 | .read = seq_read, |
79 | .llseek = seq_lseek, | 80 | .llseek = seq_lseek, |
80 | .release = single_release, | 81 | .release = single_release_net, |
81 | }; | 82 | }; |
82 | 83 | ||
83 | int __init xfrm_proc_init(void) | 84 | int __net_init xfrm_proc_init(struct net *net) |
84 | { | 85 | { |
85 | int rc = 0; | 86 | if (!proc_net_fops_create(net, "xfrm_stat", S_IRUGO, |
86 | |||
87 | if (!proc_net_fops_create(&init_net, "xfrm_stat", S_IRUGO, | ||
88 | &xfrm_statistics_seq_fops)) | 87 | &xfrm_statistics_seq_fops)) |
89 | goto stat_fail; | 88 | return -ENOMEM; |
90 | 89 | return 0; | |
91 | out: | 90 | } |
92 | return rc; | ||
93 | 91 | ||
94 | stat_fail: | 92 | void xfrm_proc_fini(struct net *net) |
95 | rc = -ENOMEM; | 93 | { |
96 | goto out; | 94 | proc_net_remove(net, "xfrm_stat"); |
97 | } | 95 | } |