Skip to content

Commit 850a80c

Browse files
Lai JiangshanIngo Molnar
authored andcommitted
ftrace: use seq_read
Impact: cleanup VFS layer has tested the file mode, we do not need test it. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <srostedt@redhat.com> LKML-Reference: <49BA2BAB.6010608@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent fa9d13c commit 850a80c

1 file changed

Lines changed: 3 additions & 23 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,16 +1120,6 @@ ftrace_notrace_open(struct inode *inode, struct file *file)
11201120
return ftrace_regex_open(inode, file, 0);
11211121
}
11221122

1123-
static ssize_t
1124-
ftrace_regex_read(struct file *file, char __user *ubuf,
1125-
size_t cnt, loff_t *ppos)
1126-
{
1127-
if (file->f_mode & FMODE_READ)
1128-
return seq_read(file, ubuf, cnt, ppos);
1129-
else
1130-
return -EPERM;
1131-
}
1132-
11331123
static loff_t
11341124
ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
11351125
{
@@ -1882,15 +1872,15 @@ static const struct file_operations ftrace_failures_fops = {
18821872

18831873
static const struct file_operations ftrace_filter_fops = {
18841874
.open = ftrace_filter_open,
1885-
.read = ftrace_regex_read,
1875+
.read = seq_read,
18861876
.write = ftrace_filter_write,
18871877
.llseek = ftrace_regex_lseek,
18881878
.release = ftrace_filter_release,
18891879
};
18901880

18911881
static const struct file_operations ftrace_notrace_fops = {
18921882
.open = ftrace_notrace_open,
1893-
.read = ftrace_regex_read,
1883+
.read = seq_read,
18941884
.write = ftrace_notrace_write,
18951885
.llseek = ftrace_regex_lseek,
18961886
.release = ftrace_notrace_release,
@@ -1992,16 +1982,6 @@ ftrace_graph_open(struct inode *inode, struct file *file)
19921982
return ret;
19931983
}
19941984

1995-
static ssize_t
1996-
ftrace_graph_read(struct file *file, char __user *ubuf,
1997-
size_t cnt, loff_t *ppos)
1998-
{
1999-
if (file->f_mode & FMODE_READ)
2000-
return seq_read(file, ubuf, cnt, ppos);
2001-
else
2002-
return -EPERM;
2003-
}
2004-
20051985
static int
20061986
ftrace_set_func(unsigned long *array, int *idx, char *buffer)
20071987
{
@@ -2132,7 +2112,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
21322112

21332113
static const struct file_operations ftrace_graph_fops = {
21342114
.open = ftrace_graph_open,
2135-
.read = ftrace_graph_read,
2115+
.read = seq_read,
21362116
.write = ftrace_graph_write,
21372117
};
21382118
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */

0 commit comments

Comments
 (0)