mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-01 00:58:39 +02:00 
			
		
		
		
	tracing: Don't pass file_operations array to event_create_dir()
Now that event_create_dir() and __trace_add_new_event() always use the same file_operations we can kill these arguments and simplify the code. Link: http://lkml.kernel.org/r/20130731173135.GA31040@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									779c5e3791
								
							
						
					
					
						commit
						620a30e97f
					
				
					 1 changed files with 12 additions and 34 deletions
				
			
		|  | @ -1489,12 +1489,7 @@ event_subsystem_dir(struct trace_array *tr, const char *name, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int | static int | ||||||
| event_create_dir(struct dentry *parent, | event_create_dir(struct dentry *parent, struct ftrace_event_file *file) | ||||||
| 		 struct ftrace_event_file *file, |  | ||||||
| 		 const struct file_operations *id, |  | ||||||
| 		 const struct file_operations *enable, |  | ||||||
| 		 const struct file_operations *filter, |  | ||||||
| 		 const struct file_operations *format) |  | ||||||
| { | { | ||||||
| 	struct ftrace_event_call *call = file->event_call; | 	struct ftrace_event_call *call = file->event_call; | ||||||
| 	struct trace_array *tr = file->tr; | 	struct trace_array *tr = file->tr; | ||||||
|  | @ -1522,12 +1517,13 @@ event_create_dir(struct dentry *parent, | ||||||
| 
 | 
 | ||||||
| 	if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) | 	if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) | ||||||
| 		trace_create_file("enable", 0644, file->dir, file, | 		trace_create_file("enable", 0644, file->dir, file, | ||||||
| 				  enable); | 				  &ftrace_enable_fops); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_PERF_EVENTS | #ifdef CONFIG_PERF_EVENTS | ||||||
| 	if (call->event.type && call->class->reg) | 	if (call->event.type && call->class->reg) | ||||||
| 		trace_create_file("id", 0444, file->dir, | 		trace_create_file("id", 0444, file->dir, | ||||||
| 				  (void *)(long)call->event.type, id); | 				  (void *)(long)call->event.type, | ||||||
|  | 				  &ftrace_event_id_fops); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  | @ -1544,10 +1540,10 @@ event_create_dir(struct dentry *parent, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	trace_create_file("filter", 0644, file->dir, call, | 	trace_create_file("filter", 0644, file->dir, call, | ||||||
| 			  filter); | 			  &ftrace_event_filter_fops); | ||||||
| 
 | 
 | ||||||
| 	trace_create_file("format", 0444, file->dir, call, | 	trace_create_file("format", 0444, file->dir, call, | ||||||
| 			  format); | 			  &ftrace_event_format_fops); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -1648,12 +1644,7 @@ trace_create_new_event(struct ftrace_event_call *call, | ||||||
| 
 | 
 | ||||||
| /* Add an event to a trace directory */ | /* Add an event to a trace directory */ | ||||||
| static int | static int | ||||||
| __trace_add_new_event(struct ftrace_event_call *call, | __trace_add_new_event(struct ftrace_event_call *call, struct trace_array *tr) | ||||||
| 		      struct trace_array *tr, |  | ||||||
| 		      const struct file_operations *id, |  | ||||||
| 		      const struct file_operations *enable, |  | ||||||
| 		      const struct file_operations *filter, |  | ||||||
| 		      const struct file_operations *format) |  | ||||||
| { | { | ||||||
| 	struct ftrace_event_file *file; | 	struct ftrace_event_file *file; | ||||||
| 
 | 
 | ||||||
|  | @ -1661,7 +1652,7 @@ __trace_add_new_event(struct ftrace_event_call *call, | ||||||
| 	if (!file) | 	if (!file) | ||||||
| 		return -ENOMEM; | 		return -ENOMEM; | ||||||
| 
 | 
 | ||||||
| 	return event_create_dir(tr->event_dir, file, id, enable, filter, format); | 	return event_create_dir(tr->event_dir, file); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -1845,11 +1836,7 @@ __trace_add_event_dirs(struct trace_array *tr) | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| 	list_for_each_entry(call, &ftrace_events, list) { | 	list_for_each_entry(call, &ftrace_events, list) { | ||||||
| 		ret = __trace_add_new_event(call, tr, | 		ret = __trace_add_new_event(call, tr); | ||||||
| 					    &ftrace_event_id_fops, |  | ||||||
| 					    &ftrace_enable_fops, |  | ||||||
| 					    &ftrace_event_filter_fops, |  | ||||||
| 					    &ftrace_event_format_fops); |  | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			pr_warning("Could not create directory for event %s\n", | 			pr_warning("Could not create directory for event %s\n", | ||||||
| 				   call->name); | 				   call->name); | ||||||
|  | @ -2157,11 +2144,7 @@ __trace_early_add_event_dirs(struct trace_array *tr) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	list_for_each_entry(file, &tr->events, list) { | 	list_for_each_entry(file, &tr->events, list) { | ||||||
| 		ret = event_create_dir(tr->event_dir, file, | 		ret = event_create_dir(tr->event_dir, file); | ||||||
| 				       &ftrace_event_id_fops, |  | ||||||
| 				       &ftrace_enable_fops, |  | ||||||
| 				       &ftrace_event_filter_fops, |  | ||||||
| 				       &ftrace_event_format_fops); |  | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			pr_warning("Could not create directory for event %s\n", | 			pr_warning("Could not create directory for event %s\n", | ||||||
| 				   file->event_call->name); | 				   file->event_call->name); | ||||||
|  | @ -2206,13 +2189,8 @@ static void __add_event_to_tracers(struct ftrace_event_call *call) | ||||||
| { | { | ||||||
| 	struct trace_array *tr; | 	struct trace_array *tr; | ||||||
| 
 | 
 | ||||||
| 	list_for_each_entry(tr, &ftrace_trace_arrays, list) { | 	list_for_each_entry(tr, &ftrace_trace_arrays, list) | ||||||
| 		__trace_add_new_event(call, tr, | 		__trace_add_new_event(call, tr); | ||||||
| 				      &ftrace_event_id_fops, |  | ||||||
| 				      &ftrace_enable_fops, |  | ||||||
| 				      &ftrace_event_filter_fops, |  | ||||||
| 				      &ftrace_event_format_fops); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct notifier_block trace_module_nb = { | static struct notifier_block trace_module_nb = { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Oleg Nesterov
						Oleg Nesterov