diff options
author | Denis V. Lunev <den@openvz.org> | 2008-03-28 21:25:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-28 21:25:06 -0400 |
commit | a2be75c182cd16bc104919e33451ffda8b6f65b4 (patch) | |
tree | 89876bf35f9df6df52cf0365491171ee0fa38937 /net/ipv4/udp.c | |
parent | dda61925f84d89e2f2a4597d6298a05a2bc05c20 (diff) |
[UDP]: Cleanup /proc/udp[6] creation/removal.
Replace seq_open with seq_open_net and remove udp_seq_release
completely. seq_release_net will do this job just fine.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index bae94b3eaa43..e716d2d55e1e 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1576,46 +1576,18 @@ static void udp_seq_stop(struct seq_file *seq, void *v) | |||
1576 | static int udp_seq_open(struct inode *inode, struct file *file) | 1576 | static int udp_seq_open(struct inode *inode, struct file *file) |
1577 | { | 1577 | { |
1578 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; | 1578 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; |
1579 | struct seq_file *seq; | 1579 | struct udp_iter_state *s; |
1580 | struct net *net; | 1580 | int err; |
1581 | int rc = -ENOMEM; | ||
1582 | struct udp_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
1583 | |||
1584 | if (!s) | ||
1585 | goto out; | ||
1586 | 1581 | ||
1587 | rc = -ENXIO; | 1582 | err = seq_open_net(inode, file, &afinfo->seq_ops, |
1588 | net = get_proc_net(inode); | 1583 | sizeof(struct udp_iter_state)); |
1589 | if (!net) | 1584 | if (err < 0) |
1590 | goto out_kfree; | 1585 | return err; |
1591 | 1586 | ||
1587 | s = ((struct seq_file *)file->private_data)->private; | ||
1592 | s->family = afinfo->family; | 1588 | s->family = afinfo->family; |
1593 | s->hashtable = afinfo->hashtable; | 1589 | s->hashtable = afinfo->hashtable; |
1594 | s->p.net = net; | 1590 | return err; |
1595 | |||
1596 | rc = seq_open(file, &afinfo->seq_ops); | ||
1597 | if (rc) | ||
1598 | goto out_put_net; | ||
1599 | |||
1600 | seq = file->private_data; | ||
1601 | seq->private = s; | ||
1602 | out: | ||
1603 | return rc; | ||
1604 | out_put_net: | ||
1605 | put_net(net); | ||
1606 | out_kfree: | ||
1607 | kfree(s); | ||
1608 | goto out; | ||
1609 | } | ||
1610 | |||
1611 | static int udp_seq_release(struct inode *inode, struct file *file) | ||
1612 | { | ||
1613 | struct seq_file *seq = file->private_data; | ||
1614 | struct udp_iter_state *s = seq->private; | ||
1615 | |||
1616 | put_net(s->p.net); | ||
1617 | seq_release_private(inode, file); | ||
1618 | return 0; | ||
1619 | } | 1591 | } |
1620 | 1592 | ||
1621 | /* ------------------------------------------------------------------------ */ | 1593 | /* ------------------------------------------------------------------------ */ |
@@ -1628,7 +1600,7 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) | |||
1628 | afinfo->seq_fops->open = udp_seq_open; | 1600 | afinfo->seq_fops->open = udp_seq_open; |
1629 | afinfo->seq_fops->read = seq_read; | 1601 | afinfo->seq_fops->read = seq_read; |
1630 | afinfo->seq_fops->llseek = seq_lseek; | 1602 | afinfo->seq_fops->llseek = seq_lseek; |
1631 | afinfo->seq_fops->release = udp_seq_release; | 1603 | afinfo->seq_fops->release = seq_release_net; |
1632 | 1604 | ||
1633 | afinfo->seq_ops.start = udp_seq_start; | 1605 | afinfo->seq_ops.start = udp_seq_start; |
1634 | afinfo->seq_ops.next = udp_seq_next; | 1606 | afinfo->seq_ops.next = udp_seq_next; |