aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-11-20 01:31:54 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:28 -0500
commite372c41401993b45c721c4d92730e7e0a79f7c1b (patch)
tree8f062f506c0578fc83b7d05c8751a7ccac96e50e /net/core/dev.c
parent097e66c578459f79e3a2128c54e9df5194e1419a (diff)
[NET]: Consolidate net namespace related proc files creation.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 0879f52115e..d0e23d8310f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2364,7 +2364,7 @@ static int dev_ifconf(struct net *net, char __user *arg)
2364 */ 2364 */
2365void *dev_seq_start(struct seq_file *seq, loff_t *pos) 2365void *dev_seq_start(struct seq_file *seq, loff_t *pos)
2366{ 2366{
2367 struct net *net = seq->private; 2367 struct net *net = seq_file_net(seq);
2368 loff_t off; 2368 loff_t off;
2369 struct net_device *dev; 2369 struct net_device *dev;
2370 2370
@@ -2382,7 +2382,7 @@ void *dev_seq_start(struct seq_file *seq, loff_t *pos)
2382 2382
2383void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) 2383void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2384{ 2384{
2385 struct net *net = seq->private; 2385 struct net *net = seq_file_net(seq);
2386 ++*pos; 2386 ++*pos;
2387 return v == SEQ_START_TOKEN ? 2387 return v == SEQ_START_TOKEN ?
2388 first_net_device(net) : next_net_device((struct net_device *)v); 2388 first_net_device(net) : next_net_device((struct net_device *)v);
@@ -2481,26 +2481,8 @@ static const struct seq_operations dev_seq_ops = {
2481 2481
2482static int dev_seq_open(struct inode *inode, struct file *file) 2482static int dev_seq_open(struct inode *inode, struct file *file)
2483{ 2483{
2484 struct seq_file *seq; 2484 return seq_open_net(inode, file, &dev_seq_ops,
2485 int res; 2485 sizeof(struct seq_net_private));
2486 res = seq_open(file, &dev_seq_ops);
2487 if (!res) {
2488 seq = file->private_data;
2489 seq->private = get_proc_net(inode);
2490 if (!seq->private) {
2491 seq_release(inode, file);
2492 res = -ENXIO;
2493 }
2494 }
2495 return res;
2496}
2497
2498static int dev_seq_release(struct inode *inode, struct file *file)
2499{
2500 struct seq_file *seq = file->private_data;
2501 struct net *net = seq->private;
2502 put_net(net);
2503 return seq_release(inode, file);
2504} 2486}
2505 2487
2506static const struct file_operations dev_seq_fops = { 2488static const struct file_operations dev_seq_fops = {
@@ -2508,7 +2490,7 @@ static const struct file_operations dev_seq_fops = {
2508 .open = dev_seq_open, 2490 .open = dev_seq_open,
2509 .read = seq_read, 2491 .read = seq_read,
2510 .llseek = seq_lseek, 2492 .llseek = seq_lseek,
2511 .release = dev_seq_release, 2493 .release = seq_release_net,
2512}; 2494};
2513 2495
2514static const struct seq_operations softnet_seq_ops = { 2496static const struct seq_operations softnet_seq_ops = {