diff options
author | Yordan Karadzhov (VMware) <y.karadz@gmail.com> | 2021-04-09 21:04:22 +0300 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2021-04-09 14:42:21 -0400 |
commit | a219b7ab9b655a42b397514f4b43b16c233af81b (patch) | |
tree | cdb8fa33dc650e1549735c2502bdd45f30d6e1fd /include | |
parent | aceb539d889bca022f51c3187a62baeff0a17f43 (diff) | |
download | libtracefs-a219b7ab9b655a42b397514f4b43b16c233af81b.tar.gz |
libtracefs: Option's bit masks to be owned by the instance
If the instance owns two mask objects, we no longer need to
dynamically allocate memory in tracefs_options_get_supported() and
tracefs_options_get_enabled(). This will simplify the code on the
caller side, since the user is no longer responsible for freeing
those masks.
Link: https://lore.kernel.org/linux-trace-devel/20210409180423.72497-5-y.karadz@gmail.com
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
[ Modified tracefs_instance structure to remove holes ]
[ Added spaces in conditional statements x ? y : z; ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/tracefs-local.h | 24 | ||||
-rw-r--r-- | include/tracefs.h | 2 |
2 files changed, 17 insertions, 9 deletions
diff --git a/include/tracefs-local.h b/include/tracefs-local.h index 37f99cd..84e4b10 100644 --- a/include/tracefs-local.h +++ b/include/tracefs-local.h @@ -20,14 +20,16 @@ struct tracefs_options_mask { }; struct tracefs_instance { - char *trace_dir; - char *name; - pthread_mutex_t lock; - int flags; - int ftrace_filter_fd; - int ftrace_notrace_fd; - int ftrace_marker_fd; - int ftrace_marker_raw_fd; + struct tracefs_options_mask supported_opts; + struct tracefs_options_mask enabled_opts; + char *trace_dir; + char *name; + pthread_mutex_t lock; + int flags; + int ftrace_filter_fd; + int ftrace_notrace_fd; + int ftrace_marker_fd; + int ftrace_marker_raw_fd; }; extern pthread_mutex_t toplevel_lock; @@ -56,4 +58,10 @@ char *trace_find_tracing_dir(void); #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/ #endif +struct tracefs_options_mask * +supported_opts_mask(struct tracefs_instance *instance); + +struct tracefs_options_mask * +enabled_opts_mask(struct tracefs_instance *instance); + #endif /* _TRACE_FS_LOCAL_H */ diff --git a/include/tracefs.h b/include/tracefs.h index c791933..f310708 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -143,7 +143,7 @@ enum tracefs_option_id { #define TRACEFS_OPTION_MAX (TRACEFS_OPTION_VERBOSE + 1) struct tracefs_options_mask; -bool tracefs_option_is_set(struct tracefs_options_mask *options, +bool tracefs_option_is_set(const struct tracefs_options_mask *options, enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); bool tracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_id id); |