Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90480
b: refs/heads/master
c: dfb12eb
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Apr 1, 2008
1 parent 74fe0c0 commit 6d20fc6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fd4e7b50455330403ed5b1060055f9d411ecdc57
refs/heads/master: dfb12eb70fc926562488515a9596c88b8eadc545
41 changes: 34 additions & 7 deletions trunk/net/ipv6/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ static struct proc_dir_entry *proc_net_devsnmp6;

static int sockstat6_seq_show(struct seq_file *seq, void *v)
{
struct net *net = seq->private;

seq_printf(seq, "TCP6: inuse %d\n",
sock_prot_inuse_get(&init_net, &tcpv6_prot));
sock_prot_inuse_get(net, &tcpv6_prot));
seq_printf(seq, "UDP6: inuse %d\n",
sock_prot_inuse_get(&init_net, &udpv6_prot));
sock_prot_inuse_get(net, &udpv6_prot));
seq_printf(seq, "UDPLITE6: inuse %d\n",
sock_prot_inuse_get(&init_net, &udplitev6_prot));
sock_prot_inuse_get(net, &udplitev6_prot));
seq_printf(seq, "RAW6: inuse %d\n",
sock_prot_inuse_get(&init_net, &rawv6_prot));
sock_prot_inuse_get(net, &rawv6_prot));
seq_printf(seq, "FRAG6: inuse %d memory %d\n",
ip6_frag_nqueues(&init_net), ip6_frag_mem(&init_net));
ip6_frag_nqueues(net), ip6_frag_mem(net));
return 0;
}

Expand Down Expand Up @@ -183,15 +185,40 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)

static int sockstat6_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, sockstat6_seq_show, NULL);
int err;
struct net *net;

err = -ENXIO;
net = get_proc_net(inode);
if (net == NULL)
goto err_net;

err = single_open(file, sockstat6_seq_show, net);
if (err < 0)
goto err_open;

return 0;

err_open:
put_net(net);
err_net:
return err;
}

static int sockstat6_seq_release(struct inode *inode, struct file *file)
{
struct net *net = ((struct seq_file *)file->private_data)->private;

put_net(net);
return single_release(inode, file);
}

static const struct file_operations sockstat6_seq_fops = {
.owner = THIS_MODULE,
.open = sockstat6_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.release = sockstat6_seq_release,
};

static int snmp6_seq_open(struct inode *inode, struct file *file)
Expand Down

0 comments on commit 6d20fc6

Please sign in to comment.