aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-31 22:43:43 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-31 22:43:43 -0400
commitdfb12eb70fc926562488515a9596c88b8eadc545 (patch)
tree29190db313262e71b79d8a90d12168b4d42fe86b /net
parentfd4e7b50455330403ed5b1060055f9d411ecdc57 (diff)
[IPV6][NETNS]: Display per-net info in sockstat6 file.
Do with the sockstat6 file what we've already done for the sockstat. Same good side effect - ipv6 reassembling stats are now shown per-net. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/proc.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 562366015e54..ca8b82f96fe5 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -35,16 +35,18 @@ static struct proc_dir_entry *proc_net_devsnmp6;
35 35
36static int sockstat6_seq_show(struct seq_file *seq, void *v) 36static int sockstat6_seq_show(struct seq_file *seq, void *v)
37{ 37{
38 struct net *net = seq->private;
39
38 seq_printf(seq, "TCP6: inuse %d\n", 40 seq_printf(seq, "TCP6: inuse %d\n",
39 sock_prot_inuse_get(&init_net, &tcpv6_prot)); 41 sock_prot_inuse_get(net, &tcpv6_prot));
40 seq_printf(seq, "UDP6: inuse %d\n", 42 seq_printf(seq, "UDP6: inuse %d\n",
41 sock_prot_inuse_get(&init_net, &udpv6_prot)); 43 sock_prot_inuse_get(net, &udpv6_prot));
42 seq_printf(seq, "UDPLITE6: inuse %d\n", 44 seq_printf(seq, "UDPLITE6: inuse %d\n",
43 sock_prot_inuse_get(&init_net, &udplitev6_prot)); 45 sock_prot_inuse_get(net, &udplitev6_prot));
44 seq_printf(seq, "RAW6: inuse %d\n", 46 seq_printf(seq, "RAW6: inuse %d\n",
45 sock_prot_inuse_get(&init_net, &rawv6_prot)); 47 sock_prot_inuse_get(net, &rawv6_prot));
46 seq_printf(seq, "FRAG6: inuse %d memory %d\n", 48 seq_printf(seq, "FRAG6: inuse %d memory %d\n",
47 ip6_frag_nqueues(&init_net), ip6_frag_mem(&init_net)); 49 ip6_frag_nqueues(net), ip6_frag_mem(net));
48 return 0; 50 return 0;
49} 51}
50 52
@@ -183,7 +185,32 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
183 185
184static int sockstat6_seq_open(struct inode *inode, struct file *file) 186static int sockstat6_seq_open(struct inode *inode, struct file *file)
185{ 187{
186 return single_open(file, sockstat6_seq_show, NULL); 188 int err;
189 struct net *net;
190
191 err = -ENXIO;
192 net = get_proc_net(inode);
193 if (net == NULL)
194 goto err_net;
195
196 err = single_open(file, sockstat6_seq_show, net);
197 if (err < 0)
198 goto err_open;
199
200 return 0;
201
202err_open:
203 put_net(net);
204err_net:
205 return err;
206}
207
208static int sockstat6_seq_release(struct inode *inode, struct file *file)
209{
210 struct net *net = ((struct seq_file *)file->private_data)->private;
211
212 put_net(net);
213 return single_release(inode, file);
187} 214}
188 215
189static const struct file_operations sockstat6_seq_fops = { 216static const struct file_operations sockstat6_seq_fops = {
@@ -191,7 +218,7 @@ static const struct file_operations sockstat6_seq_fops = {
191 .open = sockstat6_seq_open, 218 .open = sockstat6_seq_open,
192 .read = seq_read, 219 .read = seq_read,
193 .llseek = seq_lseek, 220 .llseek = seq_lseek,
194 .release = single_release, 221 .release = sockstat6_seq_release,
195}; 222};
196 223
197static int snmp6_seq_open(struct inode *inode, struct file *file) 224static int snmp6_seq_open(struct inode *inode, struct file *file)