Commit f57a4143 authored by Jeremy Linton's avatar Jeremy Linton Committed by Steven Rostedt (VMware)

trace: rename enum_map functions

Rename the core trace enum routines to use eval, to
reflect their use by more than just enum to value mapping.

Link: http://lkml.kernel.org/r/20170531215653.3240-8-jeremy.linton@arm.comSigned-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 5f60b351
...@@ -145,7 +145,7 @@ static DEFINE_MUTEX(trace_eval_mutex); ...@@ -145,7 +145,7 @@ static DEFINE_MUTEX(trace_eval_mutex);
* one at the beginning, and one at the end. The beginning item contains * one at the beginning, and one at the end. The beginning item contains
* the count of the saved maps (head.length), and the module they * the count of the saved maps (head.length), and the module they
* belong to if not built in (head.mod). The ending item contains a * belong to if not built in (head.mod). The ending item contains a
* pointer to the next array of saved enum_map items. * pointer to the next array of saved enum_eval/enum_map items.
*/ */
union trace_eval_map_item { union trace_eval_map_item {
struct trace_eval_map map; struct trace_eval_map map;
...@@ -1141,9 +1141,9 @@ unsigned long nsecs_to_usecs(unsigned long nsecs) ...@@ -1141,9 +1141,9 @@ unsigned long nsecs_to_usecs(unsigned long nsecs)
/* /*
* TRACE_FLAGS is defined as a tuple matching bit masks with strings. * TRACE_FLAGS is defined as a tuple matching bit masks with strings.
* It uses C(a, b) where 'a' is the enum name and 'b' is the string that * It uses C(a, b) where 'a' is the eval (enum) name and 'b' is the string that
* matches it. By defining "C(a, b) b", TRACE_FLAGS becomes a list * matches it. By defining "C(a, b) b", TRACE_FLAGS becomes a list
* of strings in the order that the enums were defined. * of strings in the order that the evals (enum) were defined.
*/ */
#undef C #undef C
#define C(a, b) b #define C(a, b) b
...@@ -4746,7 +4746,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { ...@@ -4746,7 +4746,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = {
#ifdef CONFIG_TRACE_ENUM_MAP_FILE #ifdef CONFIG_TRACE_ENUM_MAP_FILE
static union trace_eval_map_item * static union trace_eval_map_item *
update_enum_map(union trace_eval_map_item *ptr) update_eval_map(union trace_eval_map_item *ptr)
{ {
if (!ptr->map.eval_string) { if (!ptr->map.eval_string) {
if (ptr->tail.next) { if (ptr->tail.next) {
...@@ -4759,7 +4759,7 @@ update_enum_map(union trace_eval_map_item *ptr) ...@@ -4759,7 +4759,7 @@ update_enum_map(union trace_eval_map_item *ptr)
return ptr; return ptr;
} }
static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) static void *eval_map_next(struct seq_file *m, void *v, loff_t *pos)
{ {
union trace_eval_map_item *ptr = v; union trace_eval_map_item *ptr = v;
...@@ -4767,7 +4767,7 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) ...@@ -4767,7 +4767,7 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos)
* Paranoid! If ptr points to end, we don't want to increment past it. * Paranoid! If ptr points to end, we don't want to increment past it.
* This really should never happen. * This really should never happen.
*/ */
ptr = update_enum_map(ptr); ptr = update_eval_map(ptr);
if (WARN_ON_ONCE(!ptr)) if (WARN_ON_ONCE(!ptr))
return NULL; return NULL;
...@@ -4775,12 +4775,12 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) ...@@ -4775,12 +4775,12 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos)
(*pos)++; (*pos)++;
ptr = update_enum_map(ptr); ptr = update_eval_map(ptr);
return ptr; return ptr;
} }
static void *enum_map_start(struct seq_file *m, loff_t *pos) static void *eval_map_start(struct seq_file *m, loff_t *pos)
{ {
union trace_eval_map_item *v; union trace_eval_map_item *v;
loff_t l = 0; loff_t l = 0;
...@@ -4792,18 +4792,18 @@ static void *enum_map_start(struct seq_file *m, loff_t *pos) ...@@ -4792,18 +4792,18 @@ static void *enum_map_start(struct seq_file *m, loff_t *pos)
v++; v++;
while (v && l < *pos) { while (v && l < *pos) {
v = enum_map_next(m, v, &l); v = eval_map_next(m, v, &l);
} }
return v; return v;
} }
static void enum_map_stop(struct seq_file *m, void *v) static void eval_map_stop(struct seq_file *m, void *v)
{ {
mutex_unlock(&trace_eval_mutex); mutex_unlock(&trace_eval_mutex);
} }
static int enum_map_show(struct seq_file *m, void *v) static int eval_map_show(struct seq_file *m, void *v)
{ {
union trace_eval_map_item *ptr = v; union trace_eval_map_item *ptr = v;
...@@ -4814,23 +4814,23 @@ static int enum_map_show(struct seq_file *m, void *v) ...@@ -4814,23 +4814,23 @@ static int enum_map_show(struct seq_file *m, void *v)
return 0; return 0;
} }
static const struct seq_operations tracing_enum_map_seq_ops = { static const struct seq_operations tracing_eval_map_seq_ops = {
.start = enum_map_start, .start = eval_map_start,
.next = enum_map_next, .next = eval_map_next,
.stop = enum_map_stop, .stop = eval_map_stop,
.show = enum_map_show, .show = eval_map_show,
}; };
static int tracing_enum_map_open(struct inode *inode, struct file *filp) static int tracing_eval_map_open(struct inode *inode, struct file *filp)
{ {
if (tracing_disabled) if (tracing_disabled)
return -ENODEV; return -ENODEV;
return seq_open(filp, &tracing_enum_map_seq_ops); return seq_open(filp, &tracing_eval_map_seq_ops);
} }
static const struct file_operations tracing_enum_map_fops = { static const struct file_operations tracing_eval_map_fops = {
.open = tracing_enum_map_open, .open = tracing_eval_map_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release, .release = seq_release,
...@@ -4844,7 +4844,7 @@ trace_eval_jmp_to_tail(union trace_eval_map_item *ptr) ...@@ -4844,7 +4844,7 @@ trace_eval_jmp_to_tail(union trace_eval_map_item *ptr)
} }
static void static void
trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start,
int len) int len)
{ {
struct trace_eval_map **stop; struct trace_eval_map **stop;
...@@ -4861,7 +4861,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, ...@@ -4861,7 +4861,7 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start,
*/ */
map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL); map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL);
if (!map_array) { if (!map_array) {
pr_warn("Unable to allocate trace enum mapping\n"); pr_warn("Unable to allocate trace eval mapping\n");
return; return;
} }
...@@ -4893,19 +4893,19 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, ...@@ -4893,19 +4893,19 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start,
mutex_unlock(&trace_eval_mutex); mutex_unlock(&trace_eval_mutex);
} }
static void trace_create_enum_file(struct dentry *d_tracer) static void trace_create_eval_file(struct dentry *d_tracer)
{ {
trace_create_file("enum_map", 0444, d_tracer, trace_create_file("enum_map", 0444, d_tracer,
NULL, &tracing_enum_map_fops); NULL, &tracing_eval_map_fops);
} }
#else /* CONFIG_TRACE_ENUM_MAP_FILE */ #else /* CONFIG_TRACE_ENUM_MAP_FILE */
static inline void trace_create_enum_file(struct dentry *d_tracer) { } static inline void trace_create_eval_file(struct dentry *d_tracer) { }
static inline void trace_insert_enum_map_file(struct module *mod, static inline void trace_insert_eval_map_file(struct module *mod,
struct trace_eval_map **start, int len) { } struct trace_eval_map **start, int len) { }
#endif /* !CONFIG_TRACE_ENUM_MAP_FILE */ #endif /* !CONFIG_TRACE_ENUM_MAP_FILE */
static void trace_insert_enum_map(struct module *mod, static void trace_insert_eval_map(struct module *mod,
struct trace_eval_map **start, int len) struct trace_eval_map **start, int len)
{ {
struct trace_eval_map **map; struct trace_eval_map **map;
...@@ -4915,9 +4915,9 @@ static void trace_insert_enum_map(struct module *mod, ...@@ -4915,9 +4915,9 @@ static void trace_insert_enum_map(struct module *mod,
map = start; map = start;
trace_event_enum_update(map, len); trace_event_eval_update(map, len);
trace_insert_enum_map_file(mod, start, len); trace_insert_eval_map_file(mod, start, len);
} }
static ssize_t static ssize_t
...@@ -7740,11 +7740,11 @@ static void __init trace_eval_init(void) ...@@ -7740,11 +7740,11 @@ static void __init trace_eval_init(void)
int len; int len;
len = __stop_ftrace_eval_maps - __start_ftrace_eval_maps; len = __stop_ftrace_eval_maps - __start_ftrace_eval_maps;
trace_insert_enum_map(NULL, __start_ftrace_eval_maps, len); trace_insert_eval_map(NULL, __start_ftrace_eval_maps, len);
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
static void trace_module_add_enums(struct module *mod) static void trace_module_add_evals(struct module *mod)
{ {
if (!mod->num_trace_evals) if (!mod->num_trace_evals)
return; return;
...@@ -7756,11 +7756,11 @@ static void trace_module_add_enums(struct module *mod) ...@@ -7756,11 +7756,11 @@ static void trace_module_add_enums(struct module *mod)
if (trace_module_has_bad_taint(mod)) if (trace_module_has_bad_taint(mod))
return; return;
trace_insert_enum_map(mod, mod->trace_evals, mod->num_trace_evals); trace_insert_eval_map(mod, mod->trace_evals, mod->num_trace_evals);
} }
#ifdef CONFIG_TRACE_ENUM_MAP_FILE #ifdef CONFIG_TRACE_ENUM_MAP_FILE
static void trace_module_remove_enums(struct module *mod) static void trace_module_remove_evals(struct module *mod)
{ {
union trace_eval_map_item *map; union trace_eval_map_item *map;
union trace_eval_map_item **last = &trace_eval_maps; union trace_eval_map_item **last = &trace_eval_maps;
...@@ -7788,7 +7788,7 @@ static void trace_module_remove_enums(struct module *mod) ...@@ -7788,7 +7788,7 @@ static void trace_module_remove_enums(struct module *mod)
mutex_unlock(&trace_eval_mutex); mutex_unlock(&trace_eval_mutex);
} }
#else #else
static inline void trace_module_remove_enums(struct module *mod) { } static inline void trace_module_remove_evals(struct module *mod) { }
#endif /* CONFIG_TRACE_ENUM_MAP_FILE */ #endif /* CONFIG_TRACE_ENUM_MAP_FILE */
static int trace_module_notify(struct notifier_block *self, static int trace_module_notify(struct notifier_block *self,
...@@ -7798,10 +7798,10 @@ static int trace_module_notify(struct notifier_block *self, ...@@ -7798,10 +7798,10 @@ static int trace_module_notify(struct notifier_block *self,
switch (val) { switch (val) {
case MODULE_STATE_COMING: case MODULE_STATE_COMING:
trace_module_add_enums(mod); trace_module_add_evals(mod);
break; break;
case MODULE_STATE_GOING: case MODULE_STATE_GOING:
trace_module_remove_enums(mod); trace_module_remove_evals(mod);
break; break;
} }
...@@ -7841,7 +7841,7 @@ static __init int tracer_init_tracefs(void) ...@@ -7841,7 +7841,7 @@ static __init int tracer_init_tracefs(void)
trace_eval_init(); trace_eval_init();
trace_create_enum_file(d_tracer); trace_create_eval_file(d_tracer);
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
register_module_notifier(&trace_module_nb); register_module_notifier(&trace_module_nb);
......
...@@ -1773,10 +1773,10 @@ static inline const char *get_syscall_name(int syscall) ...@@ -1773,10 +1773,10 @@ static inline const char *get_syscall_name(int syscall)
#ifdef CONFIG_EVENT_TRACING #ifdef CONFIG_EVENT_TRACING
void trace_event_init(void); void trace_event_init(void);
void trace_event_enum_update(struct trace_eval_map **map, int len); void trace_event_eval_update(struct trace_eval_map **map, int len);
#else #else
static inline void __init trace_event_init(void) { } static inline void __init trace_event_init(void) { }
static inline void trace_event_enum_update(struct trace_eval_map **map, int len) { } static inline void trace_event_eval_update(struct trace_eval_map **map, int len) { }
#endif #endif
extern struct trace_iterator *tracepoint_print_iter; extern struct trace_iterator *tracepoint_print_iter;
......
...@@ -2165,7 +2165,7 @@ static void update_event_printk(struct trace_event_call *call, ...@@ -2165,7 +2165,7 @@ static void update_event_printk(struct trace_event_call *call,
} }
} }
void trace_event_enum_update(struct trace_eval_map **map, int len) void trace_event_eval_update(struct trace_eval_map **map, int len)
{ {
struct trace_event_call *call, *p; struct trace_event_call *call, *p;
const char *last_system = NULL; const char *last_system = NULL;
......
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