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/unix | |
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/unix')
-rw-r--r-- | net/unix/af_unix.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 10e73122c34c..2b57eaf66abc 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2086,25 +2086,7 @@ static const struct seq_operations unix_seq_ops = { | |||
2086 | 2086 | ||
2087 | static int unix_seq_open(struct inode *inode, struct file *file) | 2087 | static int unix_seq_open(struct inode *inode, struct file *file) |
2088 | { | 2088 | { |
2089 | struct seq_file *seq; | 2089 | return seq_open_private(file, &unix_seq_ops, sizeof(int)); |
2090 | int rc = -ENOMEM; | ||
2091 | int *iter = kmalloc(sizeof(int), GFP_KERNEL); | ||
2092 | |||
2093 | if (!iter) | ||
2094 | goto out; | ||
2095 | |||
2096 | rc = seq_open(file, &unix_seq_ops); | ||
2097 | if (rc) | ||
2098 | goto out_kfree; | ||
2099 | |||
2100 | seq = file->private_data; | ||
2101 | seq->private = iter; | ||
2102 | *iter = 0; | ||
2103 | out: | ||
2104 | return rc; | ||
2105 | out_kfree: | ||
2106 | kfree(iter); | ||
2107 | goto out; | ||
2108 | } | 2090 | } |
2109 | 2091 | ||
2110 | static const struct file_operations unix_seq_fops = { | 2092 | static const struct file_operations unix_seq_fops = { |