Commit 86599dbe authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt

tracing: Add helper functions to simplify event_command.parse() callback handling

The event_command.parse() callback is responsible for parsing and
registering triggers.  The existing command implementions for this
callback duplicate a lot of the same code, so to clean up and
consolidate those implementations, introduce a handful of helper
functions for implementors to use.

This also makes it easier for new commands to be implemented and
allows them to focus more on the customizations they provide rather
than obscuring and complicating it with boilerplate code.

Link: https://lkml.kernel.org/r/c1ff71f594d45177706571132bd3119491097221.1641823001.git.zanussi@kernel.orgSigned-off-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 2378a2d6
......@@ -1610,6 +1610,30 @@ get_named_trigger_data(struct event_trigger_data *data);
extern int register_event_command(struct event_command *cmd);
extern int unregister_event_command(struct event_command *cmd);
extern int register_trigger_hist_enable_disable_cmds(void);
extern bool event_trigger_check_remove(const char *glob);
extern bool event_trigger_empty_param(const char *param);
extern int event_trigger_separate_filter(char *param_and_filter, char **param,
char **filter, bool param_required);
extern struct event_trigger_data *
event_trigger_alloc(struct event_command *cmd_ops,
char *cmd,
char *param,
void *private_data);
extern int event_trigger_parse_num(char *trigger,
struct event_trigger_data *trigger_data);
extern int event_trigger_set_filter(struct event_command *cmd_ops,
struct trace_event_file *file,
char *param,
struct event_trigger_data *trigger_data);
extern void event_trigger_reset_filter(struct event_command *cmd_ops,
struct event_trigger_data *trigger_data);
extern int event_trigger_register(struct event_command *cmd_ops,
struct trace_event_file *file,
char *glob,
char *cmd,
char *trigger,
struct event_trigger_data *trigger_data,
int *n_registered);
/**
* struct event_trigger_ops - callbacks for trace event triggers
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment