aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace.h3
-rw-r--r--kernel/trace/ftrace.c36
-rw-r--r--kernel/trace/trace_stack.c2
3 files changed, 21 insertions, 20 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 167abf907802..52da2a250795 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -396,7 +396,6 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
396 size_t cnt, loff_t *ppos); 396 size_t cnt, loff_t *ppos);
397ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 397ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
398 size_t cnt, loff_t *ppos); 398 size_t cnt, loff_t *ppos);
399loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
400int ftrace_regex_release(struct inode *inode, struct file *file); 399int ftrace_regex_release(struct inode *inode, struct file *file);
401 400
402void __init 401void __init
@@ -569,6 +568,8 @@ static inline int
569ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 568ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
570#endif /* CONFIG_DYNAMIC_FTRACE */ 569#endif /* CONFIG_DYNAMIC_FTRACE */
571 570
571loff_t ftrace_filter_lseek(struct file *file, loff_t offset, int whence);
572
572/* totally disable ftrace - can not re-enable after this */ 573/* totally disable ftrace - can not re-enable after this */
573void ftrace_kill(void); 574void ftrace_kill(void);
574 575
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 926ebfb74936..2461ede45a8d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1052,6 +1052,19 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
1052 1052
1053static struct pid * const ftrace_swapper_pid = &init_struct_pid; 1053static struct pid * const ftrace_swapper_pid = &init_struct_pid;
1054 1054
1055loff_t
1056ftrace_filter_lseek(struct file *file, loff_t offset, int whence)
1057{
1058 loff_t ret;
1059
1060 if (file->f_mode & FMODE_READ)
1061 ret = seq_lseek(file, offset, whence);
1062 else
1063 file->f_pos = ret = 1;
1064
1065 return ret;
1066}
1067
1055#ifdef CONFIG_DYNAMIC_FTRACE 1068#ifdef CONFIG_DYNAMIC_FTRACE
1056 1069
1057#ifndef CONFIG_FTRACE_MCOUNT_RECORD 1070#ifndef CONFIG_FTRACE_MCOUNT_RECORD
@@ -2612,7 +2625,7 @@ static void ftrace_filter_reset(struct ftrace_hash *hash)
2612 * routine, you can use ftrace_filter_write() for the write 2625 * routine, you can use ftrace_filter_write() for the write
2613 * routine if @flag has FTRACE_ITER_FILTER set, or 2626 * routine if @flag has FTRACE_ITER_FILTER set, or
2614 * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. 2627 * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set.
2615 * ftrace_regex_lseek() should be used as the lseek routine, and 2628 * ftrace_filter_lseek() should be used as the lseek routine, and
2616 * release must call ftrace_regex_release(). 2629 * release must call ftrace_regex_release().
2617 */ 2630 */
2618int 2631int
@@ -2696,19 +2709,6 @@ ftrace_notrace_open(struct inode *inode, struct file *file)
2696 inode, file); 2709 inode, file);
2697} 2710}
2698 2711
2699loff_t
2700ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
2701{
2702 loff_t ret;
2703
2704 if (file->f_mode & FMODE_READ)
2705 ret = seq_lseek(file, offset, whence);
2706 else
2707 file->f_pos = ret = 1;
2708
2709 return ret;
2710}
2711
2712static int ftrace_match(char *str, char *regex, int len, int type) 2712static int ftrace_match(char *str, char *regex, int len, int type)
2713{ 2713{
2714 int matched = 0; 2714 int matched = 0;
@@ -3570,7 +3570,7 @@ static const struct file_operations ftrace_filter_fops = {
3570 .open = ftrace_filter_open, 3570 .open = ftrace_filter_open,
3571 .read = seq_read, 3571 .read = seq_read,
3572 .write = ftrace_filter_write, 3572 .write = ftrace_filter_write,
3573 .llseek = ftrace_regex_lseek, 3573 .llseek = ftrace_filter_lseek,
3574 .release = ftrace_regex_release, 3574 .release = ftrace_regex_release,
3575}; 3575};
3576 3576
@@ -3578,7 +3578,7 @@ static const struct file_operations ftrace_notrace_fops = {
3578 .open = ftrace_notrace_open, 3578 .open = ftrace_notrace_open,
3579 .read = seq_read, 3579 .read = seq_read,
3580 .write = ftrace_notrace_write, 3580 .write = ftrace_notrace_write,
3581 .llseek = ftrace_regex_lseek, 3581 .llseek = ftrace_filter_lseek,
3582 .release = ftrace_regex_release, 3582 .release = ftrace_regex_release,
3583}; 3583};
3584 3584
@@ -3783,8 +3783,8 @@ static const struct file_operations ftrace_graph_fops = {
3783 .open = ftrace_graph_open, 3783 .open = ftrace_graph_open,
3784 .read = seq_read, 3784 .read = seq_read,
3785 .write = ftrace_graph_write, 3785 .write = ftrace_graph_write,
3786 .llseek = ftrace_filter_lseek,
3786 .release = ftrace_graph_release, 3787 .release = ftrace_graph_release,
3787 .llseek = seq_lseek,
3788}; 3788};
3789#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 3789#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
3790 3790
@@ -4439,7 +4439,7 @@ static const struct file_operations ftrace_pid_fops = {
4439 .open = ftrace_pid_open, 4439 .open = ftrace_pid_open,
4440 .write = ftrace_pid_write, 4440 .write = ftrace_pid_write,
4441 .read = seq_read, 4441 .read = seq_read,
4442 .llseek = seq_lseek, 4442 .llseek = ftrace_filter_lseek,
4443 .release = ftrace_pid_release, 4443 .release = ftrace_pid_release,
4444}; 4444};
4445 4445
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 42ca822fc701..83a8b5b7bd35 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -322,7 +322,7 @@ static const struct file_operations stack_trace_filter_fops = {
322 .open = stack_trace_filter_open, 322 .open = stack_trace_filter_open,
323 .read = seq_read, 323 .read = seq_read,
324 .write = ftrace_filter_write, 324 .write = ftrace_filter_write,
325 .llseek = ftrace_regex_lseek, 325 .llseek = ftrace_filter_lseek,
326 .release = ftrace_regex_release, 326 .release = ftrace_regex_release,
327}; 327};
328 328