diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-14 01:12:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-14 01:12:41 -0400 |
commit | 52d6f3f11bdb8c26fead701c9dbad08acd28063d (patch) | |
tree | a053cd0fa67fce68676ce174b2b50786cdf3470f /net/ipv4/tcp_ipv4.c | |
parent | 9427c4b36b8fe652df1d7c89eae678948e1f4b32 (diff) |
[TCP]: Cleanup /proc/tcp[6] creation/removal.
Replace seq_open with seq_open_net and remove tcp_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/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index c50dd1793643..840346b390d7 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2211,46 +2211,19 @@ static void tcp_seq_stop(struct seq_file *seq, void *v) | |||
2211 | static int tcp_seq_open(struct inode *inode, struct file *file) | 2211 | static int tcp_seq_open(struct inode *inode, struct file *file) |
2212 | { | 2212 | { |
2213 | struct tcp_seq_afinfo *afinfo = PDE(inode)->data; | 2213 | struct tcp_seq_afinfo *afinfo = PDE(inode)->data; |
2214 | struct seq_file *seq; | ||
2215 | struct tcp_iter_state *s; | 2214 | struct tcp_iter_state *s; |
2216 | struct net *net; | 2215 | int err; |
2217 | int rc; | ||
2218 | 2216 | ||
2219 | if (unlikely(afinfo == NULL)) | 2217 | if (unlikely(afinfo == NULL)) |
2220 | return -EINVAL; | 2218 | return -EINVAL; |
2221 | 2219 | ||
2222 | s = kzalloc(sizeof(*s), GFP_KERNEL); | 2220 | err = seq_open_net(inode, file, &afinfo->seq_ops, |
2223 | if (!s) | 2221 | sizeof(struct tcp_iter_state)); |
2224 | return -ENOMEM; | 2222 | if (err < 0) |
2225 | 2223 | return err; | |
2226 | rc = -ENXIO; | ||
2227 | net = get_proc_net(inode); | ||
2228 | if (!net) | ||
2229 | goto out_kfree; | ||
2230 | 2224 | ||
2225 | s = ((struct seq_file *)file->private_data)->private; | ||
2231 | s->family = afinfo->family; | 2226 | s->family = afinfo->family; |
2232 | s->p.net = net; | ||
2233 | |||
2234 | rc = seq_open(file, &afinfo->seq_ops); | ||
2235 | if (rc) | ||
2236 | goto out_put_net; | ||
2237 | seq = file->private_data; | ||
2238 | seq->private = s; | ||
2239 | out: | ||
2240 | return rc; | ||
2241 | out_put_net: | ||
2242 | put_net(net); | ||
2243 | out_kfree: | ||
2244 | kfree(s); | ||
2245 | goto out; | ||
2246 | } | ||
2247 | |||
2248 | static int tcp_seq_release(struct inode *inode, struct file *file) | ||
2249 | { | ||
2250 | struct seq_file *seq = file->private_data; | ||
2251 | |||
2252 | put_net(seq_file_net(seq)); | ||
2253 | seq_release_private(inode, file); | ||
2254 | return 0; | 2227 | return 0; |
2255 | } | 2228 | } |
2256 | 2229 | ||
@@ -2263,7 +2236,7 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) | |||
2263 | afinfo->seq_fops->open = tcp_seq_open; | 2236 | afinfo->seq_fops->open = tcp_seq_open; |
2264 | afinfo->seq_fops->read = seq_read; | 2237 | afinfo->seq_fops->read = seq_read; |
2265 | afinfo->seq_fops->llseek = seq_lseek; | 2238 | afinfo->seq_fops->llseek = seq_lseek; |
2266 | afinfo->seq_fops->release = tcp_seq_release; | 2239 | afinfo->seq_fops->release = seq_release_net; |
2267 | 2240 | ||
2268 | afinfo->seq_ops.start = tcp_seq_start; | 2241 | afinfo->seq_ops.start = tcp_seq_start; |
2269 | afinfo->seq_ops.next = tcp_seq_next; | 2242 | afinfo->seq_ops.next = tcp_seq_next; |