diff options
author | Jovi Zhang <bookjovi@gmail.com> | 2011-01-12 20:00:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:16 -0500 |
commit | c6a340584607f653e10549c76dd427d4780c8f2c (patch) | |
tree | 20e82a1dd34f4b2f7477bf02b398759ba026d772 /fs/proc | |
parent | 6d1b6e4eff89475785f60fa00f65da780f869f36 (diff) |
proc: use single_open() correctly
single_open()'s third argument is for copying into seq_file->private. Use
that, rather than open-coding it.
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index bf6ba967cffb..93f1cdd5d3d7 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -745,14 +745,7 @@ static int proc_single_show(struct seq_file *m, void *v) | |||
745 | 745 | ||
746 | static int proc_single_open(struct inode *inode, struct file *filp) | 746 | static int proc_single_open(struct inode *inode, struct file *filp) |
747 | { | 747 | { |
748 | int ret; | 748 | return single_open(filp, proc_single_show, inode); |
749 | ret = single_open(filp, proc_single_show, NULL); | ||
750 | if (!ret) { | ||
751 | struct seq_file *m = filp->private_data; | ||
752 | |||
753 | m->private = inode; | ||
754 | } | ||
755 | return ret; | ||
756 | } | 749 | } |
757 | 750 | ||
758 | static const struct file_operations proc_single_file_operations = { | 751 | static const struct file_operations proc_single_file_operations = { |
@@ -1380,15 +1373,7 @@ sched_write(struct file *file, const char __user *buf, | |||
1380 | 1373 | ||
1381 | static int sched_open(struct inode *inode, struct file *filp) | 1374 | static int sched_open(struct inode *inode, struct file *filp) |
1382 | { | 1375 | { |
1383 | int ret; | 1376 | return single_open(filp, sched_show, inode); |
1384 | |||
1385 | ret = single_open(filp, sched_show, NULL); | ||
1386 | if (!ret) { | ||
1387 | struct seq_file *m = filp->private_data; | ||
1388 | |||
1389 | m->private = inode; | ||
1390 | } | ||
1391 | return ret; | ||
1392 | } | 1377 | } |
1393 | 1378 | ||
1394 | static const struct file_operations proc_pid_sched_operations = { | 1379 | static const struct file_operations proc_pid_sched_operations = { |
@@ -1524,15 +1509,7 @@ static int comm_show(struct seq_file *m, void *v) | |||
1524 | 1509 | ||
1525 | static int comm_open(struct inode *inode, struct file *filp) | 1510 | static int comm_open(struct inode *inode, struct file *filp) |
1526 | { | 1511 | { |
1527 | int ret; | 1512 | return single_open(filp, comm_show, inode); |
1528 | |||
1529 | ret = single_open(filp, comm_show, NULL); | ||
1530 | if (!ret) { | ||
1531 | struct seq_file *m = filp->private_data; | ||
1532 | |||
1533 | m->private = inode; | ||
1534 | } | ||
1535 | return ret; | ||
1536 | } | 1513 | } |
1537 | 1514 | ||
1538 | static const struct file_operations proc_pid_set_comm_operations = { | 1515 | static const struct file_operations proc_pid_set_comm_operations = { |