diff options
author | Jeremy Linton <jeremy.linton@arm.com> | 2017-05-31 17:56:45 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-06-13 17:09:50 -0400 |
commit | 23bf8cb8dc86c0368d2471ebb4622e7edd38190b (patch) | |
tree | 1256f790cf269c5318114afbd13824d6ca1b7a10 | |
parent | 99be647c5841d570a23b5dfa65bfecada8b6e6b5 (diff) |
trace: rename trace enum data structures in trace.c
The enum map entries can be exported to userspace
via a sys enum_map file. Rename those functions
and structures to reflect the fact that we are using
them for more than enums.
Link: http://lkml.kernel.org/r/20170531215653.3240-5-jeremy.linton@arm.com
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/trace.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 061abd8ba101..13c81f4f2bd7 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -122,38 +122,38 @@ int __disable_trace_on_warning; | |||
122 | 122 | ||
123 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE | 123 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE |
124 | /* Map of enums to their values, for "enum_map" file */ | 124 | /* Map of enums to their values, for "enum_map" file */ |
125 | struct trace_enum_map_head { | 125 | struct trace_eval_map_head { |
126 | struct module *mod; | 126 | struct module *mod; |
127 | unsigned long length; | 127 | unsigned long length; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | union trace_enum_map_item; | 130 | union trace_eval_map_item; |
131 | 131 | ||
132 | struct trace_enum_map_tail { | 132 | struct trace_eval_map_tail { |
133 | /* | 133 | /* |
134 | * "end" is first and points to NULL as it must be different | 134 | * "end" is first and points to NULL as it must be different |
135 | * than "mod" or "eval_string" | 135 | * than "mod" or "eval_string" |
136 | */ | 136 | */ |
137 | union trace_enum_map_item *next; | 137 | union trace_eval_map_item *next; |
138 | const char *end; /* points to NULL */ | 138 | const char *end; /* points to NULL */ |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static DEFINE_MUTEX(trace_enum_mutex); | 141 | static DEFINE_MUTEX(trace_enum_mutex); |
142 | 142 | ||
143 | /* | 143 | /* |
144 | * The trace_enum_maps are saved in an array with two extra elements, | 144 | * The trace_eval_maps are saved in an array with two extra elements, |
145 | * one at the beginning, and one at the end. The beginning item contains | 145 | * one at the beginning, and one at the end. The beginning item contains |
146 | * the count of the saved maps (head.length), and the module they | 146 | * the count of the saved maps (head.length), and the module they |
147 | * belong to if not built in (head.mod). The ending item contains a | 147 | * belong to if not built in (head.mod). The ending item contains a |
148 | * pointer to the next array of saved enum_map items. | 148 | * pointer to the next array of saved enum_map items. |
149 | */ | 149 | */ |
150 | union trace_enum_map_item { | 150 | union trace_eval_map_item { |
151 | struct trace_eval_map map; | 151 | struct trace_eval_map map; |
152 | struct trace_enum_map_head head; | 152 | struct trace_eval_map_head head; |
153 | struct trace_enum_map_tail tail; | 153 | struct trace_eval_map_tail tail; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static union trace_enum_map_item *trace_enum_maps; | 156 | static union trace_eval_map_item *trace_eval_maps; |
157 | #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ | 157 | #endif /* CONFIG_TRACE_ENUM_MAP_FILE */ |
158 | 158 | ||
159 | static int tracing_set_tracer(struct trace_array *tr, const char *buf); | 159 | static int tracing_set_tracer(struct trace_array *tr, const char *buf); |
@@ -4745,8 +4745,8 @@ static const struct file_operations tracing_saved_cmdlines_size_fops = { | |||
4745 | }; | 4745 | }; |
4746 | 4746 | ||
4747 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE | 4747 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE |
4748 | static union trace_enum_map_item * | 4748 | static union trace_eval_map_item * |
4749 | update_enum_map(union trace_enum_map_item *ptr) | 4749 | update_enum_map(union trace_eval_map_item *ptr) |
4750 | { | 4750 | { |
4751 | if (!ptr->map.eval_string) { | 4751 | if (!ptr->map.eval_string) { |
4752 | if (ptr->tail.next) { | 4752 | if (ptr->tail.next) { |
@@ -4761,7 +4761,7 @@ update_enum_map(union trace_enum_map_item *ptr) | |||
4761 | 4761 | ||
4762 | static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) | 4762 | static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) |
4763 | { | 4763 | { |
4764 | union trace_enum_map_item *ptr = v; | 4764 | union trace_eval_map_item *ptr = v; |
4765 | 4765 | ||
4766 | /* | 4766 | /* |
4767 | * Paranoid! If ptr points to end, we don't want to increment past it. | 4767 | * Paranoid! If ptr points to end, we don't want to increment past it. |
@@ -4782,12 +4782,12 @@ static void *enum_map_next(struct seq_file *m, void *v, loff_t *pos) | |||
4782 | 4782 | ||
4783 | static void *enum_map_start(struct seq_file *m, loff_t *pos) | 4783 | static void *enum_map_start(struct seq_file *m, loff_t *pos) |
4784 | { | 4784 | { |
4785 | union trace_enum_map_item *v; | 4785 | union trace_eval_map_item *v; |
4786 | loff_t l = 0; | 4786 | loff_t l = 0; |
4787 | 4787 | ||
4788 | mutex_lock(&trace_enum_mutex); | 4788 | mutex_lock(&trace_enum_mutex); |
4789 | 4789 | ||
4790 | v = trace_enum_maps; | 4790 | v = trace_eval_maps; |
4791 | if (v) | 4791 | if (v) |
4792 | v++; | 4792 | v++; |
4793 | 4793 | ||
@@ -4805,7 +4805,7 @@ static void enum_map_stop(struct seq_file *m, void *v) | |||
4805 | 4805 | ||
4806 | static int enum_map_show(struct seq_file *m, void *v) | 4806 | static int enum_map_show(struct seq_file *m, void *v) |
4807 | { | 4807 | { |
4808 | union trace_enum_map_item *ptr = v; | 4808 | union trace_eval_map_item *ptr = v; |
4809 | 4809 | ||
4810 | seq_printf(m, "%s %ld (%s)\n", | 4810 | seq_printf(m, "%s %ld (%s)\n", |
4811 | ptr->map.eval_string, ptr->map.eval_value, | 4811 | ptr->map.eval_string, ptr->map.eval_value, |
@@ -4836,8 +4836,8 @@ static const struct file_operations tracing_enum_map_fops = { | |||
4836 | .release = seq_release, | 4836 | .release = seq_release, |
4837 | }; | 4837 | }; |
4838 | 4838 | ||
4839 | static inline union trace_enum_map_item * | 4839 | static inline union trace_eval_map_item * |
4840 | trace_enum_jmp_to_tail(union trace_enum_map_item *ptr) | 4840 | trace_enum_jmp_to_tail(union trace_eval_map_item *ptr) |
4841 | { | 4841 | { |
4842 | /* Return tail of array given the head */ | 4842 | /* Return tail of array given the head */ |
4843 | return ptr + ptr->head.length + 1; | 4843 | return ptr + ptr->head.length + 1; |
@@ -4849,13 +4849,13 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, | |||
4849 | { | 4849 | { |
4850 | struct trace_eval_map **stop; | 4850 | struct trace_eval_map **stop; |
4851 | struct trace_eval_map **map; | 4851 | struct trace_eval_map **map; |
4852 | union trace_enum_map_item *map_array; | 4852 | union trace_eval_map_item *map_array; |
4853 | union trace_enum_map_item *ptr; | 4853 | union trace_eval_map_item *ptr; |
4854 | 4854 | ||
4855 | stop = start + len; | 4855 | stop = start + len; |
4856 | 4856 | ||
4857 | /* | 4857 | /* |
4858 | * The trace_enum_maps contains the map plus a head and tail item, | 4858 | * The trace_eval_maps contains the map plus a head and tail item, |
4859 | * where the head holds the module and length of array, and the | 4859 | * where the head holds the module and length of array, and the |
4860 | * tail holds a pointer to the next list. | 4860 | * tail holds a pointer to the next list. |
4861 | */ | 4861 | */ |
@@ -4867,10 +4867,10 @@ trace_insert_enum_map_file(struct module *mod, struct trace_eval_map **start, | |||
4867 | 4867 | ||
4868 | mutex_lock(&trace_enum_mutex); | 4868 | mutex_lock(&trace_enum_mutex); |
4869 | 4869 | ||
4870 | if (!trace_enum_maps) | 4870 | if (!trace_eval_maps) |
4871 | trace_enum_maps = map_array; | 4871 | trace_eval_maps = map_array; |
4872 | else { | 4872 | else { |
4873 | ptr = trace_enum_maps; | 4873 | ptr = trace_eval_maps; |
4874 | for (;;) { | 4874 | for (;;) { |
4875 | ptr = trace_enum_jmp_to_tail(ptr); | 4875 | ptr = trace_enum_jmp_to_tail(ptr); |
4876 | if (!ptr->tail.next) | 4876 | if (!ptr->tail.next) |
@@ -7762,15 +7762,15 @@ static void trace_module_add_enums(struct module *mod) | |||
7762 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE | 7762 | #ifdef CONFIG_TRACE_ENUM_MAP_FILE |
7763 | static void trace_module_remove_enums(struct module *mod) | 7763 | static void trace_module_remove_enums(struct module *mod) |
7764 | { | 7764 | { |
7765 | union trace_enum_map_item *map; | 7765 | union trace_eval_map_item *map; |
7766 | union trace_enum_map_item **last = &trace_enum_maps; | 7766 | union trace_eval_map_item **last = &trace_eval_maps; |
7767 | 7767 | ||
7768 | if (!mod->num_trace_evals) | 7768 | if (!mod->num_trace_evals) |
7769 | return; | 7769 | return; |
7770 | 7770 | ||
7771 | mutex_lock(&trace_enum_mutex); | 7771 | mutex_lock(&trace_enum_mutex); |
7772 | 7772 | ||
7773 | map = trace_enum_maps; | 7773 | map = trace_eval_maps; |
7774 | 7774 | ||
7775 | while (map) { | 7775 | while (map) { |
7776 | if (map->head.mod == mod) | 7776 | if (map->head.mod == mod) |