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

trace: rename trace_enum_map to trace_eval_map

Each enum is loaded into the trace_enum_map, as we
are now using this for more than enums rename it.

Link: http://lkml.kernel.org/r/20170531215653.3240-3-jeremy.linton@arm.comSigned-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 02fd7f68
...@@ -442,7 +442,7 @@ struct module { ...@@ -442,7 +442,7 @@ struct module {
#ifdef CONFIG_EVENT_TRACING #ifdef CONFIG_EVENT_TRACING
struct trace_event_call **trace_events; struct trace_event_call **trace_events;
unsigned int num_trace_events; unsigned int num_trace_events;
struct trace_enum_map **trace_enums; struct trace_eval_map **trace_enums;
unsigned int num_trace_enums; unsigned int num_trace_enums;
#endif #endif
#ifdef CONFIG_FTRACE_MCOUNT_RECORD #ifdef CONFIG_FTRACE_MCOUNT_RECORD
......
...@@ -25,10 +25,10 @@ struct module; ...@@ -25,10 +25,10 @@ struct module;
struct tracepoint; struct tracepoint;
struct notifier_block; struct notifier_block;
struct trace_enum_map { struct trace_eval_map {
const char *system; const char *system;
const char *enum_string; const char *eval_string;
unsigned long enum_value; unsigned long eval_value;
}; };
#define TRACEPOINT_DEFAULT_PRIO 10 #define TRACEPOINT_DEFAULT_PRIO 10
......
...@@ -35,14 +35,14 @@ TRACE_MAKE_SYSTEM_STR(); ...@@ -35,14 +35,14 @@ TRACE_MAKE_SYSTEM_STR();
#undef TRACE_DEFINE_ENUM #undef TRACE_DEFINE_ENUM
#define TRACE_DEFINE_ENUM(a) \ #define TRACE_DEFINE_ENUM(a) \
static struct trace_enum_map __used __initdata \ static struct trace_eval_map __used __initdata \
__##TRACE_SYSTEM##_##a = \ __##TRACE_SYSTEM##_##a = \
{ \ { \
.system = TRACE_SYSTEM_STRING, \ .system = TRACE_SYSTEM_STRING, \
.enum_string = #a, \ .eval_string = #a, \
.enum_value = a \ .eval_value = a \
}; \ }; \
static struct trace_enum_map __used \ static struct trace_eval_map __used \
__attribute__((section("_ftrace_eval_map"))) \ __attribute__((section("_ftrace_eval_map"))) \
*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
......
...@@ -132,7 +132,7 @@ union trace_enum_map_item; ...@@ -132,7 +132,7 @@ union trace_enum_map_item;
struct trace_enum_map_tail { struct trace_enum_map_tail {
/* /*
* "end" is first and points to NULL as it must be different * "end" is first and points to NULL as it must be different
* than "mod" or "enum_string" * than "mod" or "eval_string"
*/ */
union trace_enum_map_item *next; union trace_enum_map_item *next;
const char *end; /* points to NULL */ const char *end; /* points to NULL */
...@@ -148,7 +148,7 @@ static DEFINE_MUTEX(trace_enum_mutex); ...@@ -148,7 +148,7 @@ static DEFINE_MUTEX(trace_enum_mutex);
* pointer to the next array of saved enum_map items. * pointer to the next array of saved enum_map items.
*/ */
union trace_enum_map_item { union trace_enum_map_item {
struct trace_enum_map map; struct trace_eval_map map;
struct trace_enum_map_head head; struct trace_enum_map_head head;
struct trace_enum_map_tail tail; struct trace_enum_map_tail tail;
}; };
...@@ -4748,7 +4748,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { ...@@ -4748,7 +4748,7 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = {
static union trace_enum_map_item * static union trace_enum_map_item *
update_enum_map(union trace_enum_map_item *ptr) update_enum_map(union trace_enum_map_item *ptr)
{ {
if (!ptr->map.enum_string) { if (!ptr->map.eval_string) {
if (ptr->tail.next) { if (ptr->tail.next) {
ptr = ptr->tail.next; ptr = ptr->tail.next;
/* Set ptr to the next real item (skip head) */ /* Set ptr to the next real item (skip head) */
...@@ -4808,7 +4808,7 @@ static int enum_map_show(struct seq_file *m, void *v) ...@@ -4808,7 +4808,7 @@ static int enum_map_show(struct seq_file *m, void *v)
union trace_enum_map_item *ptr = v; union trace_enum_map_item *ptr = v;
seq_printf(m, "%s %ld (%s)\n", seq_printf(m, "%s %ld (%s)\n",
ptr->map.enum_string, ptr->map.enum_value, ptr->map.eval_string, ptr->map.eval_value,
ptr->map.system); ptr->map.system);
return 0; return 0;
...@@ -4844,11 +4844,11 @@ trace_enum_jmp_to_tail(union trace_enum_map_item *ptr) ...@@ -4844,11 +4844,11 @@ trace_enum_jmp_to_tail(union trace_enum_map_item *ptr)
} }
static void static void
trace_insert_enum_map_file(struct module *mod, struct trace_enum_map **start, trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start,
int len) int len)
{ {
struct trace_enum_map **stop; struct trace_eval_map **stop;
struct trace_enum_map **map; struct trace_eval_map **map;
union trace_enum_map_item *map_array; union trace_enum_map_item *map_array;
union trace_enum_map_item *ptr; union trace_enum_map_item *ptr;
...@@ -4902,13 +4902,13 @@ static void trace_create_enum_file(struct dentry *d_tracer) ...@@ -4902,13 +4902,13 @@ static void trace_create_enum_file(struct dentry *d_tracer)
#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_enum_file(struct dentry *d_tracer) { }
static inline void trace_insert_enum_map_file(struct module *mod, static inline void trace_insert_enum_map_file(struct module *mod,
struct trace_enum_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_enum_map(struct module *mod,
struct trace_enum_map **start, int len) struct trace_eval_map **start, int len)
{ {
struct trace_enum_map **map; struct trace_eval_map **map;
if (len <= 0) if (len <= 0)
return; return;
...@@ -7732,8 +7732,8 @@ struct dentry *tracing_init_dentry(void) ...@@ -7732,8 +7732,8 @@ struct dentry *tracing_init_dentry(void)
return NULL; return NULL;
} }
extern struct trace_enum_map *__start_ftrace_eval_maps[]; extern struct trace_eval_map *__start_ftrace_eval_maps[];
extern struct trace_enum_map *__stop_ftrace_eval_maps[]; extern struct trace_eval_map *__stop_ftrace_eval_maps[];
static void __init trace_enum_init(void) static void __init trace_enum_init(void)
{ {
......
...@@ -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_enum_map **map, int len); void trace_event_enum_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_enum_map **map, int len) { } static inline void trace_event_enum_update(struct trace_eval_map **map, int len) { }
#endif #endif
extern struct trace_iterator *tracepoint_print_iter; extern struct trace_iterator *tracepoint_print_iter;
......
...@@ -2067,18 +2067,18 @@ __register_event(struct trace_event_call *call, struct module *mod) ...@@ -2067,18 +2067,18 @@ __register_event(struct trace_event_call *call, struct module *mod)
return 0; return 0;
} }
static char *enum_replace(char *ptr, struct trace_enum_map *map, int len) static char *enum_replace(char *ptr, struct trace_eval_map *map, int len)
{ {
int rlen; int rlen;
int elen; int elen;
/* Find the length of the enum value as a string */ /* Find the length of the enum value as a string */
elen = snprintf(ptr, 0, "%ld", map->enum_value); elen = snprintf(ptr, 0, "%ld", map->eval_value);
/* Make sure there's enough room to replace the string with the value */ /* Make sure there's enough room to replace the string with the value */
if (len < elen) if (len < elen)
return NULL; return NULL;
snprintf(ptr, elen + 1, "%ld", map->enum_value); snprintf(ptr, elen + 1, "%ld", map->eval_value);
/* Get the rest of the string of ptr */ /* Get the rest of the string of ptr */
rlen = strlen(ptr + len); rlen = strlen(ptr + len);
...@@ -2090,11 +2090,11 @@ static char *enum_replace(char *ptr, struct trace_enum_map *map, int len) ...@@ -2090,11 +2090,11 @@ static char *enum_replace(char *ptr, struct trace_enum_map *map, int len)
} }
static void update_event_printk(struct trace_event_call *call, static void update_event_printk(struct trace_event_call *call,
struct trace_enum_map *map) struct trace_eval_map *map)
{ {
char *ptr; char *ptr;
int quote = 0; int quote = 0;
int len = strlen(map->enum_string); int len = strlen(map->eval_string);
for (ptr = call->print_fmt; *ptr; ptr++) { for (ptr = call->print_fmt; *ptr; ptr++) {
if (*ptr == '\\') { if (*ptr == '\\') {
...@@ -2125,7 +2125,7 @@ static void update_event_printk(struct trace_event_call *call, ...@@ -2125,7 +2125,7 @@ static void update_event_printk(struct trace_event_call *call,
continue; continue;
} }
if (isalpha(*ptr) || *ptr == '_') { if (isalpha(*ptr) || *ptr == '_') {
if (strncmp(map->enum_string, ptr, len) == 0 && if (strncmp(map->eval_string, ptr, len) == 0 &&
!isalnum(ptr[len]) && ptr[len] != '_') { !isalnum(ptr[len]) && ptr[len] != '_') {
ptr = enum_replace(ptr, map, len); ptr = enum_replace(ptr, map, len);
/* Hmm, enum string smaller than value */ /* Hmm, enum string smaller than value */
...@@ -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_enum_map **map, int len) void trace_event_enum_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