Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Add generic event-name based remove event method

Add a generic method to remove event from dynamic event
list. This is same as other system under ftrace. You
just need to pass the event name with '!', e.g.

# echo p:new_grp/new_event _do_fork > dynamic_events

This creates an event, and

# echo '!p:new_grp/new_event _do_fork' > dynamic_events

Or,

# echo '!p:new_grp/new_event' > dynamic_events

will remove new_grp/new_event event.

Note that this doesn't check the event prefix (e.g. "p:")
strictly, because the "group/event" name must be unique.

Link: http://lkml.kernel.org/r/154140869774.17322.8887303560398645347.stgit@devbox

Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Masami Hiramatsu and committed by
Steven Rostedt (VMware)
1ce25e9f 7e1413ed

+11 -4
+11 -4
kernel/trace/trace_dynevent.c
··· 37 37 char *system = NULL, *event, *p; 38 38 int ret = -ENOENT; 39 39 40 - if (argv[0][1] != ':') 41 - return -EINVAL; 40 + if (argv[0][0] == '-') { 41 + if (argv[0][1] != ':') 42 + return -EINVAL; 43 + event = &argv[0][2]; 44 + } else { 45 + event = strchr(argv[0], ':'); 46 + if (!event) 47 + return -EINVAL; 48 + event++; 49 + } 42 50 43 - event = &argv[0][2]; 44 51 p = strchr(event, '/'); 45 52 if (p) { 46 53 system = event; ··· 76 69 struct dyn_event_operations *ops; 77 70 int ret; 78 71 79 - if (argv[0][0] == '-') 72 + if (argv[0][0] == '-' || argv[0][0] == '!') 80 73 return dyn_event_release(argc, argv, NULL); 81 74 82 75 mutex_lock(&dyn_event_ops_mutex);