提交 c6a34058 编写于 作者: J Jovi Zhang 提交者: Linus Torvalds

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: NJovi Zhang <bookjovi@gmail.com>
Acked-by: NDavid Rientjes <rientjes@google.com>
Acked-by: NAlexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6d1b6e4e
...@@ -745,14 +745,7 @@ static int proc_single_show(struct seq_file *m, void *v) ...@@ -745,14 +745,7 @@ static int proc_single_show(struct seq_file *m, void *v)
static int proc_single_open(struct inode *inode, struct file *filp) static int proc_single_open(struct inode *inode, struct file *filp)
{ {
int ret; return single_open(filp, proc_single_show, inode);
ret = single_open(filp, proc_single_show, NULL);
if (!ret) {
struct seq_file *m = filp->private_data;
m->private = inode;
}
return ret;
} }
static const struct file_operations proc_single_file_operations = { static const struct file_operations proc_single_file_operations = {
...@@ -1380,15 +1373,7 @@ sched_write(struct file *file, const char __user *buf, ...@@ -1380,15 +1373,7 @@ sched_write(struct file *file, const char __user *buf,
static int sched_open(struct inode *inode, struct file *filp) static int sched_open(struct inode *inode, struct file *filp)
{ {
int ret; return single_open(filp, sched_show, inode);
ret = single_open(filp, sched_show, NULL);
if (!ret) {
struct seq_file *m = filp->private_data;
m->private = inode;
}
return ret;
} }
static const struct file_operations proc_pid_sched_operations = { static const struct file_operations proc_pid_sched_operations = {
...@@ -1524,15 +1509,7 @@ static int comm_show(struct seq_file *m, void *v) ...@@ -1524,15 +1509,7 @@ static int comm_show(struct seq_file *m, void *v)
static int comm_open(struct inode *inode, struct file *filp) static int comm_open(struct inode *inode, struct file *filp)
{ {
int ret; return single_open(filp, comm_show, inode);
ret = single_open(filp, comm_show, NULL);
if (!ret) {
struct seq_file *m = filp->private_data;
m->private = inode;
}
return ret;
} }
static const struct file_operations proc_pid_set_comm_operations = { static const struct file_operations proc_pid_set_comm_operations = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册