diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-10 05:29:29 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:33 -0400 |
commit | cf7732e4cc14b56d593ff53352673e1fd5e3ba52 (patch) | |
tree | 3479e278b72f9d535a58066bc2a26238806252ce /net/ipv4/ipmr.c | |
parent | 39699037a5c94d7cd1363dfe48a50c78c643fd9a (diff) |
[NET]: Make core networking code use seq_open_private
This concerns the ipv4 and ipv6 code mostly, but also the netlink
and unix sockets.
The netlink code is an example of how to use the __seq_open_private()
call - it saves the net namespace on this private.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b8b4b497fb57..37bb497d92af 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1714,26 +1714,8 @@ static const struct seq_operations ipmr_vif_seq_ops = { | |||
1714 | 1714 | ||
1715 | static int ipmr_vif_open(struct inode *inode, struct file *file) | 1715 | static int ipmr_vif_open(struct inode *inode, struct file *file) |
1716 | { | 1716 | { |
1717 | struct seq_file *seq; | 1717 | return seq_open_private(file, &ipmr_vif_seq_ops, |
1718 | int rc = -ENOMEM; | 1718 | sizeof(struct ipmr_vif_iter)); |
1719 | struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); | ||
1720 | |||
1721 | if (!s) | ||
1722 | goto out; | ||
1723 | |||
1724 | rc = seq_open(file, &ipmr_vif_seq_ops); | ||
1725 | if (rc) | ||
1726 | goto out_kfree; | ||
1727 | |||
1728 | s->ct = 0; | ||
1729 | seq = file->private_data; | ||
1730 | seq->private = s; | ||
1731 | out: | ||
1732 | return rc; | ||
1733 | out_kfree: | ||
1734 | kfree(s); | ||
1735 | goto out; | ||
1736 | |||
1737 | } | 1719 | } |
1738 | 1720 | ||
1739 | static const struct file_operations ipmr_vif_fops = { | 1721 | static const struct file_operations ipmr_vif_fops = { |
@@ -1877,25 +1859,8 @@ static const struct seq_operations ipmr_mfc_seq_ops = { | |||
1877 | 1859 | ||
1878 | static int ipmr_mfc_open(struct inode *inode, struct file *file) | 1860 | static int ipmr_mfc_open(struct inode *inode, struct file *file) |
1879 | { | 1861 | { |
1880 | struct seq_file *seq; | 1862 | return seq_open_private(file, &ipmr_mfc_seq_ops, |
1881 | int rc = -ENOMEM; | 1863 | sizeof(struct ipmr_mfc_iter)); |
1882 | struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); | ||
1883 | |||
1884 | if (!s) | ||
1885 | goto out; | ||
1886 | |||
1887 | rc = seq_open(file, &ipmr_mfc_seq_ops); | ||
1888 | if (rc) | ||
1889 | goto out_kfree; | ||
1890 | |||
1891 | seq = file->private_data; | ||
1892 | seq->private = s; | ||
1893 | out: | ||
1894 | return rc; | ||
1895 | out_kfree: | ||
1896 | kfree(s); | ||
1897 | goto out; | ||
1898 | |||
1899 | } | 1864 | } |
1900 | 1865 | ||
1901 | static const struct file_operations ipmr_mfc_fops = { | 1866 | static const struct file_operations ipmr_mfc_fops = { |