diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:25:21 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-26 14:25:21 -0400 |
| commit | d207ea8e74ff45be0838afa12bdd2492fa9dc8bc (patch) | |
| tree | 97cfb3ed5c1bb42790e98e62b823526f61000b9f /tools/lib | |
| parent | 2a8a2b7c49d6eb5f3348892c4676267376cfd40b (diff) | |
| parent | 66e5db4a1ccc64f278653bc69dc406d184dc750a (diff) | |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Thomas Gleixner:
"Kernel:
- Improve kallsyms coverage
- Add x86 entry trampolines to kcore
- Fix ARM SPE handling
- Correct PPC event post processing
Tools:
- Make the build system more robust
- Small fixes and enhancements all over the place
- Update kernel ABI header copies
- Preparatory work for converting libtraceevnt to a shared library
- License cleanups"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy'
tools arch x86: Update tools's copy of cpufeatures.h
perf python: Fix pyrf_evlist__read_on_cpu() interface
perf mmap: Store real cpu number in 'struct perf_mmap'
perf tools: Remove ext from struct kmod_path
perf tools: Add gzip_is_compressed function
perf tools: Add lzma_is_compressed function
perf tools: Add is_compressed callback to compressions array
perf tools: Move the temp file processing into decompress_kmodule
perf tools: Use compression id in decompress_kmodule()
perf tools: Store compression id into struct dso
perf tools: Add compression id into 'struct kmod_path'
perf tools: Make is_supported_compression() static
perf tools: Make decompress_to_file() function static
perf tools: Get rid of dso__needs_decompress() call in __open_dso()
perf tools: Get rid of dso__needs_decompress() call in symbol__disassemble()
perf tools: Get rid of dso__needs_decompress() call in read_object_code()
tools lib traceevent: Change to SPDX License format
perf llvm: Allow passing options to llc in addition to clang
perf parser: Improve error message for PMU address filters
...
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/lockdep/Makefile | 4 | ||||
| -rw-r--r-- | tools/lib/traceevent/Makefile | 4 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.c | 712 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.h | 458 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-plugin.c | 86 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-utils.h | 16 | ||||
| -rw-r--r-- | tools/lib/traceevent/kbuffer-parse.c | 17 | ||||
| -rw-r--r-- | tools/lib/traceevent/parse-filter.c | 304 | ||||
| -rw-r--r-- | tools/lib/traceevent/parse-utils.c | 16 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_cfg80211.c | 20 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_function.c | 34 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_hrtimer.c | 56 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_jbd2.c | 36 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_kmem.c | 66 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_kvm.c | 154 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_mac80211.c | 28 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_sched_switch.c | 60 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_scsi.c | 24 | ||||
| -rw-r--r-- | tools/lib/traceevent/plugin_xen.c | 20 | ||||
| -rw-r--r-- | tools/lib/traceevent/trace-seq.c | 16 |
20 files changed, 1016 insertions, 1115 deletions
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index 9b0ca3ad1ef3..9dafb8cb752f 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile | |||
| @@ -129,12 +129,12 @@ $(OUTPUT)liblockdep.a: $(LIB_IN) | |||
| 129 | tags: force | 129 | tags: force |
| 130 | $(RM) tags | 130 | $(RM) tags |
| 131 | find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ | 131 | find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ |
| 132 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' | 132 | --regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/' |
| 133 | 133 | ||
| 134 | TAGS: force | 134 | TAGS: force |
| 135 | $(RM) TAGS | 135 | $(RM) TAGS |
| 136 | find . -name '*.[ch]' | xargs etags \ | 136 | find . -name '*.[ch]' | xargs etags \ |
| 137 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' | 137 | --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/' |
| 138 | 138 | ||
| 139 | define do_install | 139 | define do_install |
| 140 | $(print_install) \ | 140 | $(print_install) \ |
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 46cd5f871ad7..0b4e833088a4 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
| @@ -233,12 +233,12 @@ endef | |||
| 233 | tags: force | 233 | tags: force |
| 234 | $(RM) tags | 234 | $(RM) tags |
| 235 | find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ | 235 | find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ |
| 236 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' | 236 | --regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/' |
| 237 | 237 | ||
| 238 | TAGS: force | 238 | TAGS: force |
| 239 | $(RM) TAGS | 239 | $(RM) TAGS |
| 240 | find . -name '*.[ch]' | xargs etags \ | 240 | find . -name '*.[ch]' | xargs etags \ |
| 241 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' | 241 | --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/' |
| 242 | 242 | ||
| 243 | define do_install_mkdir | 243 | define do_install_mkdir |
| 244 | if [ ! -d '$(DESTDIR_SQ)$1' ]; then \ | 244 | if [ ! -d '$(DESTDIR_SQ)$1' ]; then \ |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index e5f2acbb70cc..ce1e20227c64 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | * | 5 | * |
| 20 | * The parts for function graph printing was taken and modified from the | 6 | * The parts for function graph printing was taken and modified from the |
| 21 | * Linux Kernel that were written by | 7 | * Linux Kernel that were written by |
| @@ -73,12 +59,12 @@ static void init_input_buf(const char *buf, unsigned long long size) | |||
| 73 | input_buf_ptr = 0; | 59 | input_buf_ptr = 0; |
| 74 | } | 60 | } |
| 75 | 61 | ||
| 76 | const char *pevent_get_input_buf(void) | 62 | const char *tep_get_input_buf(void) |
| 77 | { | 63 | { |
| 78 | return input_buf; | 64 | return input_buf; |
| 79 | } | 65 | } |
| 80 | 66 | ||
| 81 | unsigned long long pevent_get_input_buf_ptr(void) | 67 | unsigned long long tep_get_input_buf_ptr(void) |
| 82 | { | 68 | { |
| 83 | return input_buf_ptr; | 69 | return input_buf_ptr; |
| 84 | } | 70 | } |
| @@ -88,21 +74,21 @@ struct event_handler { | |||
| 88 | int id; | 74 | int id; |
| 89 | const char *sys_name; | 75 | const char *sys_name; |
| 90 | const char *event_name; | 76 | const char *event_name; |
| 91 | pevent_event_handler_func func; | 77 | tep_event_handler_func func; |
| 92 | void *context; | 78 | void *context; |
| 93 | }; | 79 | }; |
| 94 | 80 | ||
| 95 | struct pevent_func_params { | 81 | struct func_params { |
| 96 | struct pevent_func_params *next; | 82 | struct func_params *next; |
| 97 | enum pevent_func_arg_type type; | 83 | enum tep_func_arg_type type; |
| 98 | }; | 84 | }; |
| 99 | 85 | ||
| 100 | struct pevent_function_handler { | 86 | struct tep_function_handler { |
| 101 | struct pevent_function_handler *next; | 87 | struct tep_function_handler *next; |
| 102 | enum pevent_func_arg_type ret_type; | 88 | enum tep_func_arg_type ret_type; |
| 103 | char *name; | 89 | char *name; |
| 104 | pevent_func_handler func; | 90 | tep_func_handler func; |
| 105 | struct pevent_func_params *params; | 91 | struct func_params *params; |
| 106 | int nr_args; | 92 | int nr_args; |
| 107 | }; | 93 | }; |
| 108 | 94 | ||
| @@ -110,17 +96,17 @@ static unsigned long long | |||
| 110 | process_defined_func(struct trace_seq *s, void *data, int size, | 96 | process_defined_func(struct trace_seq *s, void *data, int size, |
| 111 | struct event_format *event, struct print_arg *arg); | 97 | struct event_format *event, struct print_arg *arg); |
| 112 | 98 | ||
| 113 | static void free_func_handle(struct pevent_function_handler *func); | 99 | static void free_func_handle(struct tep_function_handler *func); |
| 114 | 100 | ||
| 115 | /** | 101 | /** |
| 116 | * pevent_buffer_init - init buffer for parsing | 102 | * tep_buffer_init - init buffer for parsing |
| 117 | * @buf: buffer to parse | 103 | * @buf: buffer to parse |
| 118 | * @size: the size of the buffer | 104 | * @size: the size of the buffer |
| 119 | * | 105 | * |
| 120 | * For use with pevent_read_token(), this initializes the internal | 106 | * For use with tep_read_token(), this initializes the internal |
| 121 | * buffer that pevent_read_token() will parse. | 107 | * buffer that tep_read_token() will parse. |
| 122 | */ | 108 | */ |
| 123 | void pevent_buffer_init(const char *buf, unsigned long long size) | 109 | void tep_buffer_init(const char *buf, unsigned long long size) |
| 124 | { | 110 | { |
| 125 | init_input_buf(buf, size); | 111 | init_input_buf(buf, size); |
| 126 | } | 112 | } |
| @@ -160,7 +146,7 @@ struct cmdline_list { | |||
| 160 | int pid; | 146 | int pid; |
| 161 | }; | 147 | }; |
| 162 | 148 | ||
| 163 | static int cmdline_init(struct pevent *pevent) | 149 | static int cmdline_init(struct tep_handle *pevent) |
| 164 | { | 150 | { |
| 165 | struct cmdline_list *cmdlist = pevent->cmdlist; | 151 | struct cmdline_list *cmdlist = pevent->cmdlist; |
| 166 | struct cmdline_list *item; | 152 | struct cmdline_list *item; |
| @@ -189,7 +175,7 @@ static int cmdline_init(struct pevent *pevent) | |||
| 189 | return 0; | 175 | return 0; |
| 190 | } | 176 | } |
| 191 | 177 | ||
| 192 | static const char *find_cmdline(struct pevent *pevent, int pid) | 178 | static const char *find_cmdline(struct tep_handle *pevent, int pid) |
| 193 | { | 179 | { |
| 194 | const struct cmdline *comm; | 180 | const struct cmdline *comm; |
| 195 | struct cmdline key; | 181 | struct cmdline key; |
| @@ -211,14 +197,14 @@ static const char *find_cmdline(struct pevent *pevent, int pid) | |||
| 211 | } | 197 | } |
| 212 | 198 | ||
| 213 | /** | 199 | /** |
| 214 | * pevent_pid_is_registered - return if a pid has a cmdline registered | 200 | * tep_pid_is_registered - return if a pid has a cmdline registered |
| 215 | * @pevent: handle for the pevent | 201 | * @pevent: handle for the pevent |
| 216 | * @pid: The pid to check if it has a cmdline registered with. | 202 | * @pid: The pid to check if it has a cmdline registered with. |
| 217 | * | 203 | * |
| 218 | * Returns 1 if the pid has a cmdline mapped to it | 204 | * Returns 1 if the pid has a cmdline mapped to it |
| 219 | * 0 otherwise. | 205 | * 0 otherwise. |
| 220 | */ | 206 | */ |
| 221 | int pevent_pid_is_registered(struct pevent *pevent, int pid) | 207 | int tep_pid_is_registered(struct tep_handle *pevent, int pid) |
| 222 | { | 208 | { |
| 223 | const struct cmdline *comm; | 209 | const struct cmdline *comm; |
| 224 | struct cmdline key; | 210 | struct cmdline key; |
| @@ -244,7 +230,7 @@ int pevent_pid_is_registered(struct pevent *pevent, int pid) | |||
| 244 | * we must add this pid. This is much slower than when cmdlines | 230 | * we must add this pid. This is much slower than when cmdlines |
| 245 | * are added before the array is initialized. | 231 | * are added before the array is initialized. |
| 246 | */ | 232 | */ |
| 247 | static int add_new_comm(struct pevent *pevent, const char *comm, int pid) | 233 | static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid) |
| 248 | { | 234 | { |
| 249 | struct cmdline *cmdlines = pevent->cmdlines; | 235 | struct cmdline *cmdlines = pevent->cmdlines; |
| 250 | const struct cmdline *cmdline; | 236 | const struct cmdline *cmdline; |
| @@ -288,7 +274,7 @@ static int add_new_comm(struct pevent *pevent, const char *comm, int pid) | |||
| 288 | } | 274 | } |
| 289 | 275 | ||
| 290 | /** | 276 | /** |
| 291 | * pevent_register_comm - register a pid / comm mapping | 277 | * tep_register_comm - register a pid / comm mapping |
| 292 | * @pevent: handle for the pevent | 278 | * @pevent: handle for the pevent |
| 293 | * @comm: the command line to register | 279 | * @comm: the command line to register |
| 294 | * @pid: the pid to map the command line to | 280 | * @pid: the pid to map the command line to |
| @@ -296,7 +282,7 @@ static int add_new_comm(struct pevent *pevent, const char *comm, int pid) | |||
| 296 | * This adds a mapping to search for command line names with | 282 | * This adds a mapping to search for command line names with |
| 297 | * a given pid. The comm is duplicated. | 283 | * a given pid. The comm is duplicated. |
| 298 | */ | 284 | */ |
| 299 | int pevent_register_comm(struct pevent *pevent, const char *comm, int pid) | 285 | int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid) |
| 300 | { | 286 | { |
| 301 | struct cmdline_list *item; | 287 | struct cmdline_list *item; |
| 302 | 288 | ||
| @@ -324,7 +310,7 @@ int pevent_register_comm(struct pevent *pevent, const char *comm, int pid) | |||
| 324 | return 0; | 310 | return 0; |
| 325 | } | 311 | } |
| 326 | 312 | ||
| 327 | int pevent_register_trace_clock(struct pevent *pevent, const char *trace_clock) | 313 | int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock) |
| 328 | { | 314 | { |
| 329 | pevent->trace_clock = strdup(trace_clock); | 315 | pevent->trace_clock = strdup(trace_clock); |
| 330 | if (!pevent->trace_clock) { | 316 | if (!pevent->trace_clock) { |
| @@ -381,7 +367,7 @@ static int func_bcmp(const void *a, const void *b) | |||
| 381 | return 1; | 367 | return 1; |
| 382 | } | 368 | } |
| 383 | 369 | ||
| 384 | static int func_map_init(struct pevent *pevent) | 370 | static int func_map_init(struct tep_handle *pevent) |
| 385 | { | 371 | { |
| 386 | struct func_list *funclist; | 372 | struct func_list *funclist; |
| 387 | struct func_list *item; | 373 | struct func_list *item; |
| @@ -421,7 +407,7 @@ static int func_map_init(struct pevent *pevent) | |||
| 421 | } | 407 | } |
| 422 | 408 | ||
| 423 | static struct func_map * | 409 | static struct func_map * |
| 424 | __find_func(struct pevent *pevent, unsigned long long addr) | 410 | __find_func(struct tep_handle *pevent, unsigned long long addr) |
| 425 | { | 411 | { |
| 426 | struct func_map *func; | 412 | struct func_map *func; |
| 427 | struct func_map key; | 413 | struct func_map key; |
| @@ -438,13 +424,13 @@ __find_func(struct pevent *pevent, unsigned long long addr) | |||
| 438 | } | 424 | } |
| 439 | 425 | ||
| 440 | struct func_resolver { | 426 | struct func_resolver { |
| 441 | pevent_func_resolver_t *func; | 427 | tep_func_resolver_t *func; |
| 442 | void *priv; | 428 | void *priv; |
| 443 | struct func_map map; | 429 | struct func_map map; |
| 444 | }; | 430 | }; |
| 445 | 431 | ||
| 446 | /** | 432 | /** |
| 447 | * pevent_set_function_resolver - set an alternative function resolver | 433 | * tep_set_function_resolver - set an alternative function resolver |
| 448 | * @pevent: handle for the pevent | 434 | * @pevent: handle for the pevent |
| 449 | * @resolver: function to be used | 435 | * @resolver: function to be used |
| 450 | * @priv: resolver function private state. | 436 | * @priv: resolver function private state. |
| @@ -453,8 +439,8 @@ struct func_resolver { | |||
| 453 | * keep using it instead of duplicating all the entries inside | 439 | * keep using it instead of duplicating all the entries inside |
| 454 | * pevent->funclist. | 440 | * pevent->funclist. |
| 455 | */ | 441 | */ |
| 456 | int pevent_set_function_resolver(struct pevent *pevent, | 442 | int tep_set_function_resolver(struct tep_handle *pevent, |
| 457 | pevent_func_resolver_t *func, void *priv) | 443 | tep_func_resolver_t *func, void *priv) |
| 458 | { | 444 | { |
| 459 | struct func_resolver *resolver = malloc(sizeof(*resolver)); | 445 | struct func_resolver *resolver = malloc(sizeof(*resolver)); |
| 460 | 446 | ||
| @@ -471,20 +457,20 @@ int pevent_set_function_resolver(struct pevent *pevent, | |||
| 471 | } | 457 | } |
| 472 | 458 | ||
| 473 | /** | 459 | /** |
| 474 | * pevent_reset_function_resolver - reset alternative function resolver | 460 | * tep_reset_function_resolver - reset alternative function resolver |
| 475 | * @pevent: handle for the pevent | 461 | * @pevent: handle for the pevent |
| 476 | * | 462 | * |
| 477 | * Stop using whatever alternative resolver was set, use the default | 463 | * Stop using whatever alternative resolver was set, use the default |
| 478 | * one instead. | 464 | * one instead. |
| 479 | */ | 465 | */ |
| 480 | void pevent_reset_function_resolver(struct pevent *pevent) | 466 | void tep_reset_function_resolver(struct tep_handle *pevent) |
| 481 | { | 467 | { |
| 482 | free(pevent->func_resolver); | 468 | free(pevent->func_resolver); |
| 483 | pevent->func_resolver = NULL; | 469 | pevent->func_resolver = NULL; |
| 484 | } | 470 | } |
| 485 | 471 | ||
| 486 | static struct func_map * | 472 | static struct func_map * |
| 487 | find_func(struct pevent *pevent, unsigned long long addr) | 473 | find_func(struct tep_handle *pevent, unsigned long long addr) |
| 488 | { | 474 | { |
| 489 | struct func_map *map; | 475 | struct func_map *map; |
| 490 | 476 | ||
| @@ -503,7 +489,7 @@ find_func(struct pevent *pevent, unsigned long long addr) | |||
| 503 | } | 489 | } |
| 504 | 490 | ||
| 505 | /** | 491 | /** |
| 506 | * pevent_find_function - find a function by a given address | 492 | * tep_find_function - find a function by a given address |
| 507 | * @pevent: handle for the pevent | 493 | * @pevent: handle for the pevent |
| 508 | * @addr: the address to find the function with | 494 | * @addr: the address to find the function with |
| 509 | * | 495 | * |
| @@ -511,7 +497,7 @@ find_func(struct pevent *pevent, unsigned long long addr) | |||
| 511 | * address. Note, the address does not have to be exact, it | 497 | * address. Note, the address does not have to be exact, it |
| 512 | * will select the function that would contain the address. | 498 | * will select the function that would contain the address. |
| 513 | */ | 499 | */ |
| 514 | const char *pevent_find_function(struct pevent *pevent, unsigned long long addr) | 500 | const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr) |
| 515 | { | 501 | { |
| 516 | struct func_map *map; | 502 | struct func_map *map; |
| 517 | 503 | ||
| @@ -523,16 +509,16 @@ const char *pevent_find_function(struct pevent *pevent, unsigned long long addr) | |||
| 523 | } | 509 | } |
| 524 | 510 | ||
| 525 | /** | 511 | /** |
| 526 | * pevent_find_function_address - find a function address by a given address | 512 | * tep_find_function_address - find a function address by a given address |
| 527 | * @pevent: handle for the pevent | 513 | * @pevent: handle for the pevent |
| 528 | * @addr: the address to find the function with | 514 | * @addr: the address to find the function with |
| 529 | * | 515 | * |
| 530 | * Returns the address the function starts at. This can be used in | 516 | * Returns the address the function starts at. This can be used in |
| 531 | * conjunction with pevent_find_function to print both the function | 517 | * conjunction with tep_find_function to print both the function |
| 532 | * name and the function offset. | 518 | * name and the function offset. |
| 533 | */ | 519 | */ |
| 534 | unsigned long long | 520 | unsigned long long |
| 535 | pevent_find_function_address(struct pevent *pevent, unsigned long long addr) | 521 | tep_find_function_address(struct tep_handle *pevent, unsigned long long addr) |
| 536 | { | 522 | { |
| 537 | struct func_map *map; | 523 | struct func_map *map; |
| 538 | 524 | ||
| @@ -544,7 +530,7 @@ pevent_find_function_address(struct pevent *pevent, unsigned long long addr) | |||
| 544 | } | 530 | } |
| 545 | 531 | ||
| 546 | /** | 532 | /** |
| 547 | * pevent_register_function - register a function with a given address | 533 | * tep_register_function - register a function with a given address |
| 548 | * @pevent: handle for the pevent | 534 | * @pevent: handle for the pevent |
| 549 | * @function: the function name to register | 535 | * @function: the function name to register |
| 550 | * @addr: the address the function starts at | 536 | * @addr: the address the function starts at |
| @@ -553,8 +539,8 @@ pevent_find_function_address(struct pevent *pevent, unsigned long long addr) | |||
| 553 | * This registers a function name with an address and module. | 539 | * This registers a function name with an address and module. |
| 554 | * The @func passed in is duplicated. | 540 | * The @func passed in is duplicated. |
| 555 | */ | 541 | */ |
| 556 | int pevent_register_function(struct pevent *pevent, char *func, | 542 | int tep_register_function(struct tep_handle *pevent, char *func, |
| 557 | unsigned long long addr, char *mod) | 543 | unsigned long long addr, char *mod) |
| 558 | { | 544 | { |
| 559 | struct func_list *item = malloc(sizeof(*item)); | 545 | struct func_list *item = malloc(sizeof(*item)); |
| 560 | 546 | ||
| @@ -589,12 +575,12 @@ out_free: | |||
| 589 | } | 575 | } |
| 590 | 576 | ||
| 591 | /** | 577 | /** |
| 592 | * pevent_print_funcs - print out the stored functions | 578 | * tep_print_funcs - print out the stored functions |
| 593 | * @pevent: handle for the pevent | 579 | * @pevent: handle for the pevent |
| 594 | * | 580 | * |
| 595 | * This prints out the stored functions. | 581 | * This prints out the stored functions. |
| 596 | */ | 582 | */ |
| 597 | void pevent_print_funcs(struct pevent *pevent) | 583 | void tep_print_funcs(struct tep_handle *pevent) |
| 598 | { | 584 | { |
| 599 | int i; | 585 | int i; |
| 600 | 586 | ||
| @@ -636,7 +622,7 @@ static int printk_cmp(const void *a, const void *b) | |||
| 636 | return 0; | 622 | return 0; |
| 637 | } | 623 | } |
| 638 | 624 | ||
| 639 | static int printk_map_init(struct pevent *pevent) | 625 | static int printk_map_init(struct tep_handle *pevent) |
| 640 | { | 626 | { |
| 641 | struct printk_list *printklist; | 627 | struct printk_list *printklist; |
| 642 | struct printk_list *item; | 628 | struct printk_list *item; |
| @@ -668,7 +654,7 @@ static int printk_map_init(struct pevent *pevent) | |||
| 668 | } | 654 | } |
| 669 | 655 | ||
| 670 | static struct printk_map * | 656 | static struct printk_map * |
| 671 | find_printk(struct pevent *pevent, unsigned long long addr) | 657 | find_printk(struct tep_handle *pevent, unsigned long long addr) |
| 672 | { | 658 | { |
| 673 | struct printk_map *printk; | 659 | struct printk_map *printk; |
| 674 | struct printk_map key; | 660 | struct printk_map key; |
| @@ -685,7 +671,7 @@ find_printk(struct pevent *pevent, unsigned long long addr) | |||
| 685 | } | 671 | } |
| 686 | 672 | ||
| 687 | /** | 673 | /** |
| 688 | * pevent_register_print_string - register a string by its address | 674 | * tep_register_print_string - register a string by its address |
| 689 | * @pevent: handle for the pevent | 675 | * @pevent: handle for the pevent |
| 690 | * @fmt: the string format to register | 676 | * @fmt: the string format to register |
| 691 | * @addr: the address the string was located at | 677 | * @addr: the address the string was located at |
| @@ -693,8 +679,8 @@ find_printk(struct pevent *pevent, unsigned long long addr) | |||
| 693 | * This registers a string by the address it was stored in the kernel. | 679 | * This registers a string by the address it was stored in the kernel. |
| 694 | * The @fmt passed in is duplicated. | 680 | * The @fmt passed in is duplicated. |
| 695 | */ | 681 | */ |
| 696 | int pevent_register_print_string(struct pevent *pevent, const char *fmt, | 682 | int tep_register_print_string(struct tep_handle *pevent, const char *fmt, |
| 697 | unsigned long long addr) | 683 | unsigned long long addr) |
| 698 | { | 684 | { |
| 699 | struct printk_list *item = malloc(sizeof(*item)); | 685 | struct printk_list *item = malloc(sizeof(*item)); |
| 700 | char *p; | 686 | char *p; |
| @@ -732,12 +718,12 @@ out_free: | |||
| 732 | } | 718 | } |
| 733 | 719 | ||
| 734 | /** | 720 | /** |
| 735 | * pevent_print_printk - print out the stored strings | 721 | * tep_print_printk - print out the stored strings |
| 736 | * @pevent: handle for the pevent | 722 | * @pevent: handle for the pevent |
| 737 | * | 723 | * |
| 738 | * This prints the string formats that were stored. | 724 | * This prints the string formats that were stored. |
| 739 | */ | 725 | */ |
| 740 | void pevent_print_printk(struct pevent *pevent) | 726 | void tep_print_printk(struct tep_handle *pevent) |
| 741 | { | 727 | { |
| 742 | int i; | 728 | int i; |
| 743 | 729 | ||
| @@ -756,7 +742,7 @@ static struct event_format *alloc_event(void) | |||
| 756 | return calloc(1, sizeof(struct event_format)); | 742 | return calloc(1, sizeof(struct event_format)); |
| 757 | } | 743 | } |
| 758 | 744 | ||
| 759 | static int add_event(struct pevent *pevent, struct event_format *event) | 745 | static int add_event(struct tep_handle *pevent, struct event_format *event) |
| 760 | { | 746 | { |
| 761 | int i; | 747 | int i; |
| 762 | struct event_format **events = realloc(pevent->events, sizeof(event) * | 748 | struct event_format **events = realloc(pevent->events, sizeof(event) * |
| @@ -913,11 +899,11 @@ static int __peek_char(void) | |||
| 913 | } | 899 | } |
| 914 | 900 | ||
| 915 | /** | 901 | /** |
| 916 | * pevent_peek_char - peek at the next character that will be read | 902 | * tep_peek_char - peek at the next character that will be read |
| 917 | * | 903 | * |
| 918 | * Returns the next character read, or -1 if end of buffer. | 904 | * Returns the next character read, or -1 if end of buffer. |
| 919 | */ | 905 | */ |
| 920 | int pevent_peek_char(void) | 906 | int tep_peek_char(void) |
| 921 | { | 907 | { |
| 922 | return __peek_char(); | 908 | return __peek_char(); |
| 923 | } | 909 | } |
| @@ -1157,24 +1143,24 @@ static enum event_type read_token(char **tok) | |||
| 1157 | } | 1143 | } |
| 1158 | 1144 | ||
| 1159 | /** | 1145 | /** |
| 1160 | * pevent_read_token - access to utilites to use the pevent parser | 1146 | * tep_read_token - access to utilites to use the pevent parser |
| 1161 | * @tok: The token to return | 1147 | * @tok: The token to return |
| 1162 | * | 1148 | * |
| 1163 | * This will parse tokens from the string given by | 1149 | * This will parse tokens from the string given by |
| 1164 | * pevent_init_data(). | 1150 | * tep_init_data(). |
| 1165 | * | 1151 | * |
| 1166 | * Returns the token type. | 1152 | * Returns the token type. |
| 1167 | */ | 1153 | */ |
| 1168 | enum event_type pevent_read_token(char **tok) | 1154 | enum event_type tep_read_token(char **tok) |
| 1169 | { | 1155 | { |
| 1170 | return read_token(tok); | 1156 | return read_token(tok); |
| 1171 | } | 1157 | } |
| 1172 | 1158 | ||
| 1173 | /** | 1159 | /** |
| 1174 | * pevent_free_token - free a token returned by pevent_read_token | 1160 | * tep_free_token - free a token returned by tep_read_token |
| 1175 | * @token: the token to free | 1161 | * @token: the token to free |
| 1176 | */ | 1162 | */ |
| 1177 | void pevent_free_token(char *token) | 1163 | void tep_free_token(char *token) |
| 1178 | { | 1164 | { |
| 1179 | free_token(token); | 1165 | free_token(token); |
| 1180 | } | 1166 | } |
| @@ -2101,11 +2087,11 @@ process_entry(struct event_format *event __maybe_unused, struct print_arg *arg, | |||
| 2101 | arg->field.name = field; | 2087 | arg->field.name = field; |
| 2102 | 2088 | ||
| 2103 | if (is_flag_field) { | 2089 | if (is_flag_field) { |
| 2104 | arg->field.field = pevent_find_any_field(event, arg->field.name); | 2090 | arg->field.field = tep_find_any_field(event, arg->field.name); |
| 2105 | arg->field.field->flags |= FIELD_IS_FLAG; | 2091 | arg->field.field->flags |= FIELD_IS_FLAG; |
| 2106 | is_flag_field = 0; | 2092 | is_flag_field = 0; |
| 2107 | } else if (is_symbolic_field) { | 2093 | } else if (is_symbolic_field) { |
| 2108 | arg->field.field = pevent_find_any_field(event, arg->field.name); | 2094 | arg->field.field = tep_find_any_field(event, arg->field.name); |
| 2109 | arg->field.field->flags |= FIELD_IS_SYMBOLIC; | 2095 | arg->field.field->flags |= FIELD_IS_SYMBOLIC; |
| 2110 | is_symbolic_field = 0; | 2096 | is_symbolic_field = 0; |
| 2111 | } | 2097 | } |
| @@ -2714,7 +2700,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char ** | |||
| 2714 | 2700 | ||
| 2715 | /* Find the field */ | 2701 | /* Find the field */ |
| 2716 | 2702 | ||
| 2717 | field = pevent_find_field(event, token); | 2703 | field = tep_find_field(event, token); |
| 2718 | if (!field) | 2704 | if (!field) |
| 2719 | goto out_free; | 2705 | goto out_free; |
| 2720 | 2706 | ||
| @@ -2771,7 +2757,7 @@ process_dynamic_array_len(struct event_format *event, struct print_arg *arg, | |||
| 2771 | arg->type = PRINT_DYNAMIC_ARRAY_LEN; | 2757 | arg->type = PRINT_DYNAMIC_ARRAY_LEN; |
| 2772 | 2758 | ||
| 2773 | /* Find the field */ | 2759 | /* Find the field */ |
| 2774 | field = pevent_find_field(event, token); | 2760 | field = tep_find_field(event, token); |
| 2775 | if (!field) | 2761 | if (!field) |
| 2776 | goto out_free; | 2762 | goto out_free; |
| 2777 | 2763 | ||
| @@ -2914,10 +2900,10 @@ process_bitmask(struct event_format *event __maybe_unused, struct print_arg *arg | |||
| 2914 | return EVENT_ERROR; | 2900 | return EVENT_ERROR; |
| 2915 | } | 2901 | } |
| 2916 | 2902 | ||
| 2917 | static struct pevent_function_handler * | 2903 | static struct tep_function_handler * |
| 2918 | find_func_handler(struct pevent *pevent, char *func_name) | 2904 | find_func_handler(struct tep_handle *pevent, char *func_name) |
| 2919 | { | 2905 | { |
| 2920 | struct pevent_function_handler *func; | 2906 | struct tep_function_handler *func; |
| 2921 | 2907 | ||
| 2922 | if (!pevent) | 2908 | if (!pevent) |
| 2923 | return NULL; | 2909 | return NULL; |
| @@ -2930,10 +2916,10 @@ find_func_handler(struct pevent *pevent, char *func_name) | |||
| 2930 | return func; | 2916 | return func; |
| 2931 | } | 2917 | } |
| 2932 | 2918 | ||
| 2933 | static void remove_func_handler(struct pevent *pevent, char *func_name) | 2919 | static void remove_func_handler(struct tep_handle *pevent, char *func_name) |
| 2934 | { | 2920 | { |
| 2935 | struct pevent_function_handler *func; | 2921 | struct tep_function_handler *func; |
| 2936 | struct pevent_function_handler **next; | 2922 | struct tep_function_handler **next; |
| 2937 | 2923 | ||
| 2938 | next = &pevent->func_handlers; | 2924 | next = &pevent->func_handlers; |
| 2939 | while ((func = *next)) { | 2925 | while ((func = *next)) { |
| @@ -2947,7 +2933,7 @@ static void remove_func_handler(struct pevent *pevent, char *func_name) | |||
| 2947 | } | 2933 | } |
| 2948 | 2934 | ||
| 2949 | static enum event_type | 2935 | static enum event_type |
| 2950 | process_func_handler(struct event_format *event, struct pevent_function_handler *func, | 2936 | process_func_handler(struct event_format *event, struct tep_function_handler *func, |
| 2951 | struct print_arg *arg, char **tok) | 2937 | struct print_arg *arg, char **tok) |
| 2952 | { | 2938 | { |
| 2953 | struct print_arg **next_arg; | 2939 | struct print_arg **next_arg; |
| @@ -3008,7 +2994,7 @@ static enum event_type | |||
| 3008 | process_function(struct event_format *event, struct print_arg *arg, | 2994 | process_function(struct event_format *event, struct print_arg *arg, |
| 3009 | char *token, char **tok) | 2995 | char *token, char **tok) |
| 3010 | { | 2996 | { |
| 3011 | struct pevent_function_handler *func; | 2997 | struct tep_function_handler *func; |
| 3012 | 2998 | ||
| 3013 | if (strcmp(token, "__print_flags") == 0) { | 2999 | if (strcmp(token, "__print_flags") == 0) { |
| 3014 | free_token(token); | 3000 | free_token(token); |
| @@ -3265,7 +3251,7 @@ static int event_read_print(struct event_format *event) | |||
| 3265 | } | 3251 | } |
| 3266 | 3252 | ||
| 3267 | /** | 3253 | /** |
| 3268 | * pevent_find_common_field - return a common field by event | 3254 | * tep_find_common_field - return a common field by event |
| 3269 | * @event: handle for the event | 3255 | * @event: handle for the event |
| 3270 | * @name: the name of the common field to return | 3256 | * @name: the name of the common field to return |
| 3271 | * | 3257 | * |
| @@ -3273,7 +3259,7 @@ static int event_read_print(struct event_format *event) | |||
| 3273 | * This only searchs the common fields and not all field. | 3259 | * This only searchs the common fields and not all field. |
| 3274 | */ | 3260 | */ |
| 3275 | struct format_field * | 3261 | struct format_field * |
| 3276 | pevent_find_common_field(struct event_format *event, const char *name) | 3262 | tep_find_common_field(struct event_format *event, const char *name) |
| 3277 | { | 3263 | { |
| 3278 | struct format_field *format; | 3264 | struct format_field *format; |
| 3279 | 3265 | ||
| @@ -3287,7 +3273,7 @@ pevent_find_common_field(struct event_format *event, const char *name) | |||
| 3287 | } | 3273 | } |
| 3288 | 3274 | ||
| 3289 | /** | 3275 | /** |
| 3290 | * pevent_find_field - find a non-common field | 3276 | * tep_find_field - find a non-common field |
| 3291 | * @event: handle for the event | 3277 | * @event: handle for the event |
| 3292 | * @name: the name of the non-common field | 3278 | * @name: the name of the non-common field |
| 3293 | * | 3279 | * |
| @@ -3295,7 +3281,7 @@ pevent_find_common_field(struct event_format *event, const char *name) | |||
| 3295 | * This does not search common fields. | 3281 | * This does not search common fields. |
| 3296 | */ | 3282 | */ |
| 3297 | struct format_field * | 3283 | struct format_field * |
| 3298 | pevent_find_field(struct event_format *event, const char *name) | 3284 | tep_find_field(struct event_format *event, const char *name) |
| 3299 | { | 3285 | { |
| 3300 | struct format_field *format; | 3286 | struct format_field *format; |
| 3301 | 3287 | ||
| @@ -3309,7 +3295,7 @@ pevent_find_field(struct event_format *event, const char *name) | |||
| 3309 | } | 3295 | } |
| 3310 | 3296 | ||
| 3311 | /** | 3297 | /** |
| 3312 | * pevent_find_any_field - find any field by name | 3298 | * tep_find_any_field - find any field by name |
| 3313 | * @event: handle for the event | 3299 | * @event: handle for the event |
| 3314 | * @name: the name of the field | 3300 | * @name: the name of the field |
| 3315 | * | 3301 | * |
| @@ -3318,18 +3304,18 @@ pevent_find_field(struct event_format *event, const char *name) | |||
| 3318 | * the non-common ones if a common one was not found. | 3304 | * the non-common ones if a common one was not found. |
| 3319 | */ | 3305 | */ |
| 3320 | struct format_field * | 3306 | struct format_field * |
| 3321 | pevent_find_any_field(struct event_format *event, const char *name) | 3307 | tep_find_any_field(struct event_format *event, const char *name) |
| 3322 | { | 3308 | { |
| 3323 | struct format_field *format; | 3309 | struct format_field *format; |
| 3324 | 3310 | ||
| 3325 | format = pevent_find_common_field(event, name); | 3311 | format = tep_find_common_field(event, name); |
| 3326 | if (format) | 3312 | if (format) |
| 3327 | return format; | 3313 | return format; |
| 3328 | return pevent_find_field(event, name); | 3314 | return tep_find_field(event, name); |
| 3329 | } | 3315 | } |
| 3330 | 3316 | ||
| 3331 | /** | 3317 | /** |
| 3332 | * pevent_read_number - read a number from data | 3318 | * tep_read_number - read a number from data |
| 3333 | * @pevent: handle for the pevent | 3319 | * @pevent: handle for the pevent |
| 3334 | * @ptr: the raw data | 3320 | * @ptr: the raw data |
| 3335 | * @size: the size of the data that holds the number | 3321 | * @size: the size of the data that holds the number |
| @@ -3337,8 +3323,8 @@ pevent_find_any_field(struct event_format *event, const char *name) | |||
| 3337 | * Returns the number (converted to host) from the | 3323 | * Returns the number (converted to host) from the |
| 3338 | * raw data. | 3324 | * raw data. |
| 3339 | */ | 3325 | */ |
| 3340 | unsigned long long pevent_read_number(struct pevent *pevent, | 3326 | unsigned long long tep_read_number(struct tep_handle *pevent, |
| 3341 | const void *ptr, int size) | 3327 | const void *ptr, int size) |
| 3342 | { | 3328 | { |
| 3343 | switch (size) { | 3329 | switch (size) { |
| 3344 | case 1: | 3330 | case 1: |
| @@ -3356,7 +3342,7 @@ unsigned long long pevent_read_number(struct pevent *pevent, | |||
| 3356 | } | 3342 | } |
| 3357 | 3343 | ||
| 3358 | /** | 3344 | /** |
| 3359 | * pevent_read_number_field - read a number from data | 3345 | * tep_read_number_field - read a number from data |
| 3360 | * @field: a handle to the field | 3346 | * @field: a handle to the field |
| 3361 | * @data: the raw data to read | 3347 | * @data: the raw data to read |
| 3362 | * @value: the value to place the number in | 3348 | * @value: the value to place the number in |
| @@ -3366,8 +3352,8 @@ unsigned long long pevent_read_number(struct pevent *pevent, | |||
| 3366 | * | 3352 | * |
| 3367 | * Returns 0 on success, -1 otherwise. | 3353 | * Returns 0 on success, -1 otherwise. |
| 3368 | */ | 3354 | */ |
| 3369 | int pevent_read_number_field(struct format_field *field, const void *data, | 3355 | int tep_read_number_field(struct format_field *field, const void *data, |
| 3370 | unsigned long long *value) | 3356 | unsigned long long *value) |
| 3371 | { | 3357 | { |
| 3372 | if (!field) | 3358 | if (!field) |
| 3373 | return -1; | 3359 | return -1; |
| @@ -3376,15 +3362,15 @@ int pevent_read_number_field(struct format_field *field, const void *data, | |||
| 3376 | case 2: | 3362 | case 2: |
| 3377 | case 4: | 3363 | case 4: |
| 3378 | case 8: | 3364 | case 8: |
| 3379 | *value = pevent_read_number(field->event->pevent, | 3365 | *value = tep_read_number(field->event->pevent, |
| 3380 | data + field->offset, field->size); | 3366 | data + field->offset, field->size); |
| 3381 | return 0; | 3367 | return 0; |
| 3382 | default: | 3368 | default: |
| 3383 | return -1; | 3369 | return -1; |
| 3384 | } | 3370 | } |
| 3385 | } | 3371 | } |
| 3386 | 3372 | ||
| 3387 | static int get_common_info(struct pevent *pevent, | 3373 | static int get_common_info(struct tep_handle *pevent, |
| 3388 | const char *type, int *offset, int *size) | 3374 | const char *type, int *offset, int *size) |
| 3389 | { | 3375 | { |
| 3390 | struct event_format *event; | 3376 | struct event_format *event; |
| @@ -3400,7 +3386,7 @@ static int get_common_info(struct pevent *pevent, | |||
| 3400 | } | 3386 | } |
| 3401 | 3387 | ||
| 3402 | event = pevent->events[0]; | 3388 | event = pevent->events[0]; |
| 3403 | field = pevent_find_common_field(event, type); | 3389 | field = tep_find_common_field(event, type); |
| 3404 | if (!field) | 3390 | if (!field) |
| 3405 | return -1; | 3391 | return -1; |
| 3406 | 3392 | ||
| @@ -3410,7 +3396,7 @@ static int get_common_info(struct pevent *pevent, | |||
| 3410 | return 0; | 3396 | return 0; |
| 3411 | } | 3397 | } |
| 3412 | 3398 | ||
| 3413 | static int __parse_common(struct pevent *pevent, void *data, | 3399 | static int __parse_common(struct tep_handle *pevent, void *data, |
| 3414 | int *size, int *offset, const char *name) | 3400 | int *size, int *offset, const char *name) |
| 3415 | { | 3401 | { |
| 3416 | int ret; | 3402 | int ret; |
| @@ -3420,45 +3406,45 @@ static int __parse_common(struct pevent *pevent, void *data, | |||
| 3420 | if (ret < 0) | 3406 | if (ret < 0) |
| 3421 | return ret; | 3407 | return ret; |
| 3422 | } | 3408 | } |
| 3423 | return pevent_read_number(pevent, data + *offset, *size); | 3409 | return tep_read_number(pevent, data + *offset, *size); |
| 3424 | } | 3410 | } |
| 3425 | 3411 | ||
| 3426 | static int trace_parse_common_type(struct pevent *pevent, void *data) | 3412 | static int trace_parse_common_type(struct tep_handle *pevent, void *data) |
| 3427 | { | 3413 | { |
| 3428 | return __parse_common(pevent, data, | 3414 | return __parse_common(pevent, data, |
| 3429 | &pevent->type_size, &pevent->type_offset, | 3415 | &pevent->type_size, &pevent->type_offset, |
| 3430 | "common_type"); | 3416 | "common_type"); |
| 3431 | } | 3417 | } |
| 3432 | 3418 | ||
| 3433 | static int parse_common_pid(struct pevent *pevent, void *data) | 3419 | static int parse_common_pid(struct tep_handle *pevent, void *data) |
| 3434 | { | 3420 | { |
| 3435 | return __parse_common(pevent, data, | 3421 | return __parse_common(pevent, data, |
| 3436 | &pevent->pid_size, &pevent->pid_offset, | 3422 | &pevent->pid_size, &pevent->pid_offset, |
| 3437 | "common_pid"); | 3423 | "common_pid"); |
| 3438 | } | 3424 | } |
| 3439 | 3425 | ||
| 3440 | static int parse_common_pc(struct pevent *pevent, void *data) | 3426 | static int parse_common_pc(struct tep_handle *pevent, void *data) |
| 3441 | { | 3427 | { |
| 3442 | return __parse_common(pevent, data, | 3428 | return __parse_common(pevent, data, |
| 3443 | &pevent->pc_size, &pevent->pc_offset, | 3429 | &pevent->pc_size, &pevent->pc_offset, |
| 3444 | "common_preempt_count"); | 3430 | "common_preempt_count"); |
| 3445 | } | 3431 | } |
| 3446 | 3432 | ||
| 3447 | static int parse_common_flags(struct pevent *pevent, void *data) | 3433 | static int parse_common_flags(struct tep_handle *pevent, void *data) |
| 3448 | { | 3434 | { |
| 3449 | return __parse_common(pevent, data, | 3435 | return __parse_common(pevent, data, |
| 3450 | &pevent->flags_size, &pevent->flags_offset, | 3436 | &pevent->flags_size, &pevent->flags_offset, |
| 3451 | "common_flags"); | 3437 | "common_flags"); |
| 3452 | } | 3438 | } |
| 3453 | 3439 | ||
| 3454 | static int parse_common_lock_depth(struct pevent *pevent, void *data) | 3440 | static int parse_common_lock_depth(struct tep_handle *pevent, void *data) |
| 3455 | { | 3441 | { |
| 3456 | return __parse_common(pevent, data, | 3442 | return __parse_common(pevent, data, |
| 3457 | &pevent->ld_size, &pevent->ld_offset, | 3443 | &pevent->ld_size, &pevent->ld_offset, |
| 3458 | "common_lock_depth"); | 3444 | "common_lock_depth"); |
| 3459 | } | 3445 | } |
| 3460 | 3446 | ||
| 3461 | static int parse_common_migrate_disable(struct pevent *pevent, void *data) | 3447 | static int parse_common_migrate_disable(struct tep_handle *pevent, void *data) |
| 3462 | { | 3448 | { |
| 3463 | return __parse_common(pevent, data, | 3449 | return __parse_common(pevent, data, |
| 3464 | &pevent->ld_size, &pevent->ld_offset, | 3450 | &pevent->ld_size, &pevent->ld_offset, |
| @@ -3468,13 +3454,13 @@ static int parse_common_migrate_disable(struct pevent *pevent, void *data) | |||
| 3468 | static int events_id_cmp(const void *a, const void *b); | 3454 | static int events_id_cmp(const void *a, const void *b); |
| 3469 | 3455 | ||
| 3470 | /** | 3456 | /** |
| 3471 | * pevent_find_event - find an event by given id | 3457 | * tep_find_event - find an event by given id |
| 3472 | * @pevent: a handle to the pevent | 3458 | * @pevent: a handle to the pevent |
| 3473 | * @id: the id of the event | 3459 | * @id: the id of the event |
| 3474 | * | 3460 | * |
| 3475 | * Returns an event that has a given @id. | 3461 | * Returns an event that has a given @id. |
| 3476 | */ | 3462 | */ |
| 3477 | struct event_format *pevent_find_event(struct pevent *pevent, int id) | 3463 | struct event_format *tep_find_event(struct tep_handle *pevent, int id) |
| 3478 | { | 3464 | { |
| 3479 | struct event_format **eventptr; | 3465 | struct event_format **eventptr; |
| 3480 | struct event_format key; | 3466 | struct event_format key; |
| @@ -3498,7 +3484,7 @@ struct event_format *pevent_find_event(struct pevent *pevent, int id) | |||
| 3498 | } | 3484 | } |
| 3499 | 3485 | ||
| 3500 | /** | 3486 | /** |
| 3501 | * pevent_find_event_by_name - find an event by given name | 3487 | * tep_find_event_by_name - find an event by given name |
| 3502 | * @pevent: a handle to the pevent | 3488 | * @pevent: a handle to the pevent |
| 3503 | * @sys: the system name to search for | 3489 | * @sys: the system name to search for |
| 3504 | * @name: the name of the event to search for | 3490 | * @name: the name of the event to search for |
| @@ -3507,8 +3493,8 @@ struct event_format *pevent_find_event(struct pevent *pevent, int id) | |||
| 3507 | * @sys. If @sys is NULL the first event with @name is returned. | 3493 | * @sys. If @sys is NULL the first event with @name is returned. |
| 3508 | */ | 3494 | */ |
| 3509 | struct event_format * | 3495 | struct event_format * |
| 3510 | pevent_find_event_by_name(struct pevent *pevent, | 3496 | tep_find_event_by_name(struct tep_handle *pevent, |
| 3511 | const char *sys, const char *name) | 3497 | const char *sys, const char *name) |
| 3512 | { | 3498 | { |
| 3513 | struct event_format *event; | 3499 | struct event_format *event; |
| 3514 | int i; | 3500 | int i; |
| @@ -3537,7 +3523,7 @@ pevent_find_event_by_name(struct pevent *pevent, | |||
| 3537 | static unsigned long long | 3523 | static unsigned long long |
| 3538 | eval_num_arg(void *data, int size, struct event_format *event, struct print_arg *arg) | 3524 | eval_num_arg(void *data, int size, struct event_format *event, struct print_arg *arg) |
| 3539 | { | 3525 | { |
| 3540 | struct pevent *pevent = event->pevent; | 3526 | struct tep_handle *pevent = event->pevent; |
| 3541 | unsigned long long val = 0; | 3527 | unsigned long long val = 0; |
| 3542 | unsigned long long left, right; | 3528 | unsigned long long left, right; |
| 3543 | struct print_arg *typearg = NULL; | 3529 | struct print_arg *typearg = NULL; |
| @@ -3553,14 +3539,14 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3553 | return strtoull(arg->atom.atom, NULL, 0); | 3539 | return strtoull(arg->atom.atom, NULL, 0); |
| 3554 | case PRINT_FIELD: | 3540 | case PRINT_FIELD: |
| 3555 | if (!arg->field.field) { | 3541 | if (!arg->field.field) { |
| 3556 | arg->field.field = pevent_find_any_field(event, arg->field.name); | 3542 | arg->field.field = tep_find_any_field(event, arg->field.name); |
| 3557 | if (!arg->field.field) | 3543 | if (!arg->field.field) |
| 3558 | goto out_warning_field; | 3544 | goto out_warning_field; |
| 3559 | 3545 | ||
| 3560 | } | 3546 | } |
| 3561 | /* must be a number */ | 3547 | /* must be a number */ |
| 3562 | val = pevent_read_number(pevent, data + arg->field.field->offset, | 3548 | val = tep_read_number(pevent, data + arg->field.field->offset, |
| 3563 | arg->field.field->size); | 3549 | arg->field.field->size); |
| 3564 | break; | 3550 | break; |
| 3565 | case PRINT_FLAGS: | 3551 | case PRINT_FLAGS: |
| 3566 | case PRINT_SYMBOL: | 3552 | case PRINT_SYMBOL: |
| @@ -3603,7 +3589,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3603 | 3589 | ||
| 3604 | switch (larg->type) { | 3590 | switch (larg->type) { |
| 3605 | case PRINT_DYNAMIC_ARRAY: | 3591 | case PRINT_DYNAMIC_ARRAY: |
| 3606 | offset = pevent_read_number(pevent, | 3592 | offset = tep_read_number(pevent, |
| 3607 | data + larg->dynarray.field->offset, | 3593 | data + larg->dynarray.field->offset, |
| 3608 | larg->dynarray.field->size); | 3594 | larg->dynarray.field->size); |
| 3609 | if (larg->dynarray.field->elementsize) | 3595 | if (larg->dynarray.field->elementsize) |
| @@ -3619,7 +3605,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3619 | case PRINT_FIELD: | 3605 | case PRINT_FIELD: |
| 3620 | if (!larg->field.field) { | 3606 | if (!larg->field.field) { |
| 3621 | larg->field.field = | 3607 | larg->field.field = |
| 3622 | pevent_find_any_field(event, larg->field.name); | 3608 | tep_find_any_field(event, larg->field.name); |
| 3623 | if (!larg->field.field) { | 3609 | if (!larg->field.field) { |
| 3624 | arg = larg; | 3610 | arg = larg; |
| 3625 | goto out_warning_field; | 3611 | goto out_warning_field; |
| @@ -3632,8 +3618,8 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3632 | default: | 3618 | default: |
| 3633 | goto default_op; /* oops, all bets off */ | 3619 | goto default_op; /* oops, all bets off */ |
| 3634 | } | 3620 | } |
| 3635 | val = pevent_read_number(pevent, | 3621 | val = tep_read_number(pevent, |
| 3636 | data + offset, field_size); | 3622 | data + offset, field_size); |
| 3637 | if (typearg) | 3623 | if (typearg) |
| 3638 | val = eval_type(val, typearg, 1); | 3624 | val = eval_type(val, typearg, 1); |
| 3639 | break; | 3625 | break; |
| @@ -3733,9 +3719,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3733 | } | 3719 | } |
| 3734 | break; | 3720 | break; |
| 3735 | case PRINT_DYNAMIC_ARRAY_LEN: | 3721 | case PRINT_DYNAMIC_ARRAY_LEN: |
| 3736 | offset = pevent_read_number(pevent, | 3722 | offset = tep_read_number(pevent, |
| 3737 | data + arg->dynarray.field->offset, | 3723 | data + arg->dynarray.field->offset, |
| 3738 | arg->dynarray.field->size); | 3724 | arg->dynarray.field->size); |
| 3739 | /* | 3725 | /* |
| 3740 | * The total allocated length of the dynamic array is | 3726 | * The total allocated length of the dynamic array is |
| 3741 | * stored in the top half of the field, and the offset | 3727 | * stored in the top half of the field, and the offset |
| @@ -3745,9 +3731,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
| 3745 | break; | 3731 | break; |
| 3746 | case PRINT_DYNAMIC_ARRAY: | 3732 | case PRINT_DYNAMIC_ARRAY: |
| 3747 | /* Without [], we pass the address to the dynamic data */ | 3733 | /* Without [], we pass the address to the dynamic data */ |
| 3748 | offset = pevent_read_number(pevent, | 3734 | offset = tep_read_number(pevent, |
| 3749 | data + arg->dynarray.field->offset, | 3735 | data + arg->dynarray.field->offset, |
| 3750 | arg->dynarray.field->size); | 3736 | arg->dynarray.field->size); |
| 3751 | /* | 3737 | /* |
| 3752 | * The total allocated length of the dynamic array is | 3738 | * The total allocated length of the dynamic array is |
| 3753 | * stored in the top half of the field, and the offset | 3739 | * stored in the top half of the field, and the offset |
| @@ -3820,7 +3806,7 @@ static void print_str_to_seq(struct trace_seq *s, const char *format, | |||
| 3820 | trace_seq_printf(s, format, str); | 3806 | trace_seq_printf(s, format, str); |
| 3821 | } | 3807 | } |
| 3822 | 3808 | ||
| 3823 | static void print_bitmask_to_seq(struct pevent *pevent, | 3809 | static void print_bitmask_to_seq(struct tep_handle *pevent, |
| 3824 | struct trace_seq *s, const char *format, | 3810 | struct trace_seq *s, const char *format, |
| 3825 | int len_arg, const void *data, int size) | 3811 | int len_arg, const void *data, int size) |
| 3826 | { | 3812 | { |
| @@ -3878,7 +3864,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 3878 | struct event_format *event, const char *format, | 3864 | struct event_format *event, const char *format, |
| 3879 | int len_arg, struct print_arg *arg) | 3865 | int len_arg, struct print_arg *arg) |
| 3880 | { | 3866 | { |
| 3881 | struct pevent *pevent = event->pevent; | 3867 | struct tep_handle *pevent = event->pevent; |
| 3882 | struct print_flag_sym *flag; | 3868 | struct print_flag_sym *flag; |
| 3883 | struct format_field *field; | 3869 | struct format_field *field; |
| 3884 | struct printk_map *printk; | 3870 | struct printk_map *printk; |
| @@ -3899,7 +3885,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 3899 | case PRINT_FIELD: | 3885 | case PRINT_FIELD: |
| 3900 | field = arg->field.field; | 3886 | field = arg->field.field; |
| 3901 | if (!field) { | 3887 | if (!field) { |
| 3902 | field = pevent_find_any_field(event, arg->field.name); | 3888 | field = tep_find_any_field(event, arg->field.name); |
| 3903 | if (!field) { | 3889 | if (!field) { |
| 3904 | str = arg->field.name; | 3890 | str = arg->field.name; |
| 3905 | goto out_warning_field; | 3891 | goto out_warning_field; |
| @@ -3992,7 +3978,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 3992 | case PRINT_HEX_STR: | 3978 | case PRINT_HEX_STR: |
| 3993 | if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) { | 3979 | if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) { |
| 3994 | unsigned long offset; | 3980 | unsigned long offset; |
| 3995 | offset = pevent_read_number(pevent, | 3981 | offset = tep_read_number(pevent, |
| 3996 | data + arg->hex.field->dynarray.field->offset, | 3982 | data + arg->hex.field->dynarray.field->offset, |
| 3997 | arg->hex.field->dynarray.field->size); | 3983 | arg->hex.field->dynarray.field->size); |
| 3998 | hex = data + (offset & 0xffff); | 3984 | hex = data + (offset & 0xffff); |
| @@ -4000,7 +3986,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 4000 | field = arg->hex.field->field.field; | 3986 | field = arg->hex.field->field.field; |
| 4001 | if (!field) { | 3987 | if (!field) { |
| 4002 | str = arg->hex.field->field.name; | 3988 | str = arg->hex.field->field.name; |
| 4003 | field = pevent_find_any_field(event, str); | 3989 | field = tep_find_any_field(event, str); |
| 4004 | if (!field) | 3990 | if (!field) |
| 4005 | goto out_warning_field; | 3991 | goto out_warning_field; |
| 4006 | arg->hex.field->field.field = field; | 3992 | arg->hex.field->field.field = field; |
| @@ -4023,15 +4009,15 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 4023 | unsigned long offset; | 4009 | unsigned long offset; |
| 4024 | struct format_field *field = | 4010 | struct format_field *field = |
| 4025 | arg->int_array.field->dynarray.field; | 4011 | arg->int_array.field->dynarray.field; |
| 4026 | offset = pevent_read_number(pevent, | 4012 | offset = tep_read_number(pevent, |
| 4027 | data + field->offset, | 4013 | data + field->offset, |
| 4028 | field->size); | 4014 | field->size); |
| 4029 | num = data + (offset & 0xffff); | 4015 | num = data + (offset & 0xffff); |
| 4030 | } else { | 4016 | } else { |
| 4031 | field = arg->int_array.field->field.field; | 4017 | field = arg->int_array.field->field.field; |
| 4032 | if (!field) { | 4018 | if (!field) { |
| 4033 | str = arg->int_array.field->field.name; | 4019 | str = arg->int_array.field->field.name; |
| 4034 | field = pevent_find_any_field(event, str); | 4020 | field = tep_find_any_field(event, str); |
| 4035 | if (!field) | 4021 | if (!field) |
| 4036 | goto out_warning_field; | 4022 | goto out_warning_field; |
| 4037 | arg->int_array.field->field.field = field; | 4023 | arg->int_array.field->field.field = field; |
| @@ -4071,7 +4057,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 4071 | if (arg->string.offset == -1) { | 4057 | if (arg->string.offset == -1) { |
| 4072 | struct format_field *f; | 4058 | struct format_field *f; |
| 4073 | 4059 | ||
| 4074 | f = pevent_find_any_field(event, arg->string.string); | 4060 | f = tep_find_any_field(event, arg->string.string); |
| 4075 | arg->string.offset = f->offset; | 4061 | arg->string.offset = f->offset; |
| 4076 | } | 4062 | } |
| 4077 | str_offset = data2host4(pevent, data + arg->string.offset); | 4063 | str_offset = data2host4(pevent, data + arg->string.offset); |
| @@ -4089,7 +4075,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
| 4089 | if (arg->bitmask.offset == -1) { | 4075 | if (arg->bitmask.offset == -1) { |
| 4090 | struct format_field *f; | 4076 | struct format_field *f; |
| 4091 | 4077 | ||
| 4092 | f = pevent_find_any_field(event, arg->bitmask.bitmask); | 4078 | f = tep_find_any_field(event, arg->bitmask.bitmask); |
| 4093 | arg->bitmask.offset = f->offset; | 4079 | arg->bitmask.offset = f->offset; |
| 4094 | } | 4080 | } |
| 4095 | bitmask_offset = data2host4(pevent, data + arg->bitmask.offset); | 4081 | bitmask_offset = data2host4(pevent, data + arg->bitmask.offset); |
| @@ -4132,8 +4118,8 @@ static unsigned long long | |||
| 4132 | process_defined_func(struct trace_seq *s, void *data, int size, | 4118 | process_defined_func(struct trace_seq *s, void *data, int size, |
| 4133 | struct event_format *event, struct print_arg *arg) | 4119 | struct event_format *event, struct print_arg *arg) |
| 4134 | { | 4120 | { |
| 4135 | struct pevent_function_handler *func_handle = arg->func.func; | 4121 | struct tep_function_handler *func_handle = arg->func.func; |
| 4136 | struct pevent_func_params *param; | 4122 | struct func_params *param; |
| 4137 | unsigned long long *args; | 4123 | unsigned long long *args; |
| 4138 | unsigned long long ret; | 4124 | unsigned long long ret; |
| 4139 | struct print_arg *farg; | 4125 | struct print_arg *farg; |
| @@ -4159,12 +4145,12 @@ process_defined_func(struct trace_seq *s, void *data, int size, | |||
| 4159 | 4145 | ||
| 4160 | for (i = 0; i < func_handle->nr_args; i++) { | 4146 | for (i = 0; i < func_handle->nr_args; i++) { |
| 4161 | switch (param->type) { | 4147 | switch (param->type) { |
| 4162 | case PEVENT_FUNC_ARG_INT: | 4148 | case TEP_FUNC_ARG_INT: |
| 4163 | case PEVENT_FUNC_ARG_LONG: | 4149 | case TEP_FUNC_ARG_LONG: |
| 4164 | case PEVENT_FUNC_ARG_PTR: | 4150 | case TEP_FUNC_ARG_PTR: |
| 4165 | args[i] = eval_num_arg(data, size, event, farg); | 4151 | args[i] = eval_num_arg(data, size, event, farg); |
| 4166 | break; | 4152 | break; |
| 4167 | case PEVENT_FUNC_ARG_STRING: | 4153 | case TEP_FUNC_ARG_STRING: |
| 4168 | trace_seq_init(&str); | 4154 | trace_seq_init(&str); |
| 4169 | print_str_arg(&str, data, size, event, "%s", -1, farg); | 4155 | print_str_arg(&str, data, size, event, "%s", -1, farg); |
| 4170 | trace_seq_terminate(&str); | 4156 | trace_seq_terminate(&str); |
| @@ -4227,7 +4213,7 @@ static void free_args(struct print_arg *args) | |||
| 4227 | 4213 | ||
| 4228 | static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struct event_format *event) | 4214 | static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struct event_format *event) |
| 4229 | { | 4215 | { |
| 4230 | struct pevent *pevent = event->pevent; | 4216 | struct tep_handle *pevent = event->pevent; |
| 4231 | struct format_field *field, *ip_field; | 4217 | struct format_field *field, *ip_field; |
| 4232 | struct print_arg *args, *arg, **next; | 4218 | struct print_arg *args, *arg, **next; |
| 4233 | unsigned long long ip, val; | 4219 | unsigned long long ip, val; |
| @@ -4239,12 +4225,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
| 4239 | ip_field = pevent->bprint_ip_field; | 4225 | ip_field = pevent->bprint_ip_field; |
| 4240 | 4226 | ||
| 4241 | if (!field) { | 4227 | if (!field) { |
| 4242 | field = pevent_find_field(event, "buf"); | 4228 | field = tep_find_field(event, "buf"); |
| 4243 | if (!field) { | 4229 | if (!field) { |
| 4244 | do_warning_event(event, "can't find buffer field for binary printk"); | 4230 | do_warning_event(event, "can't find buffer field for binary printk"); |
| 4245 | return NULL; | 4231 | return NULL; |
| 4246 | } | 4232 | } |
| 4247 | ip_field = pevent_find_field(event, "ip"); | 4233 | ip_field = tep_find_field(event, "ip"); |
| 4248 | if (!ip_field) { | 4234 | if (!ip_field) { |
| 4249 | do_warning_event(event, "can't find ip field for binary printk"); | 4235 | do_warning_event(event, "can't find ip field for binary printk"); |
| 4250 | return NULL; | 4236 | return NULL; |
| @@ -4253,7 +4239,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
| 4253 | pevent->bprint_ip_field = ip_field; | 4239 | pevent->bprint_ip_field = ip_field; |
| 4254 | } | 4240 | } |
| 4255 | 4241 | ||
| 4256 | ip = pevent_read_number(pevent, data + ip_field->offset, ip_field->size); | 4242 | ip = tep_read_number(pevent, data + ip_field->offset, ip_field->size); |
| 4257 | 4243 | ||
| 4258 | /* | 4244 | /* |
| 4259 | * The first arg is the IP pointer. | 4245 | * The first arg is the IP pointer. |
| @@ -4347,7 +4333,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
| 4347 | /* the pointers are always 4 bytes aligned */ | 4333 | /* the pointers are always 4 bytes aligned */ |
| 4348 | bptr = (void *)(((unsigned long)bptr + 3) & | 4334 | bptr = (void *)(((unsigned long)bptr + 3) & |
| 4349 | ~3); | 4335 | ~3); |
| 4350 | val = pevent_read_number(pevent, bptr, vsize); | 4336 | val = tep_read_number(pevent, bptr, vsize); |
| 4351 | bptr += vsize; | 4337 | bptr += vsize; |
| 4352 | arg = alloc_arg(); | 4338 | arg = alloc_arg(); |
| 4353 | if (!arg) { | 4339 | if (!arg) { |
| @@ -4404,7 +4390,7 @@ static char * | |||
| 4404 | get_bprint_format(void *data, int size __maybe_unused, | 4390 | get_bprint_format(void *data, int size __maybe_unused, |
| 4405 | struct event_format *event) | 4391 | struct event_format *event) |
| 4406 | { | 4392 | { |
| 4407 | struct pevent *pevent = event->pevent; | 4393 | struct tep_handle *pevent = event->pevent; |
| 4408 | unsigned long long addr; | 4394 | unsigned long long addr; |
| 4409 | struct format_field *field; | 4395 | struct format_field *field; |
| 4410 | struct printk_map *printk; | 4396 | struct printk_map *printk; |
| @@ -4413,7 +4399,7 @@ get_bprint_format(void *data, int size __maybe_unused, | |||
| 4413 | field = pevent->bprint_fmt_field; | 4399 | field = pevent->bprint_fmt_field; |
| 4414 | 4400 | ||
| 4415 | if (!field) { | 4401 | if (!field) { |
| 4416 | field = pevent_find_field(event, "fmt"); | 4402 | field = tep_find_field(event, "fmt"); |
| 4417 | if (!field) { | 4403 | if (!field) { |
| 4418 | do_warning_event(event, "can't find format field for binary printk"); | 4404 | do_warning_event(event, "can't find format field for binary printk"); |
| 4419 | return NULL; | 4405 | return NULL; |
| @@ -4421,7 +4407,7 @@ get_bprint_format(void *data, int size __maybe_unused, | |||
| 4421 | pevent->bprint_fmt_field = field; | 4407 | pevent->bprint_fmt_field = field; |
| 4422 | } | 4408 | } |
| 4423 | 4409 | ||
| 4424 | addr = pevent_read_number(pevent, data + field->offset, field->size); | 4410 | addr = tep_read_number(pevent, data + field->offset, field->size); |
| 4425 | 4411 | ||
| 4426 | printk = find_printk(pevent, addr); | 4412 | printk = find_printk(pevent, addr); |
| 4427 | if (!printk) { | 4413 | if (!printk) { |
| @@ -4457,7 +4443,7 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size, | |||
| 4457 | fmt = "%.2x%.2x%.2x%.2x%.2x%.2x"; | 4443 | fmt = "%.2x%.2x%.2x%.2x%.2x%.2x"; |
| 4458 | if (!arg->field.field) { | 4444 | if (!arg->field.field) { |
| 4459 | arg->field.field = | 4445 | arg->field.field = |
| 4460 | pevent_find_any_field(event, arg->field.name); | 4446 | tep_find_any_field(event, arg->field.name); |
| 4461 | if (!arg->field.field) { | 4447 | if (!arg->field.field) { |
| 4462 | do_warning_event(event, "%s: field %s not found", | 4448 | do_warning_event(event, "%s: field %s not found", |
| 4463 | __func__, arg->field.name); | 4449 | __func__, arg->field.name); |
| @@ -4607,7 +4593,7 @@ static int print_ipv4_arg(struct trace_seq *s, const char *ptr, char i, | |||
| 4607 | 4593 | ||
| 4608 | if (!arg->field.field) { | 4594 | if (!arg->field.field) { |
| 4609 | arg->field.field = | 4595 | arg->field.field = |
| 4610 | pevent_find_any_field(event, arg->field.name); | 4596 | tep_find_any_field(event, arg->field.name); |
| 4611 | if (!arg->field.field) { | 4597 | if (!arg->field.field) { |
| 4612 | do_warning("%s: field %s not found", | 4598 | do_warning("%s: field %s not found", |
| 4613 | __func__, arg->field.name); | 4599 | __func__, arg->field.name); |
| @@ -4653,7 +4639,7 @@ static int print_ipv6_arg(struct trace_seq *s, const char *ptr, char i, | |||
| 4653 | 4639 | ||
| 4654 | if (!arg->field.field) { | 4640 | if (!arg->field.field) { |
| 4655 | arg->field.field = | 4641 | arg->field.field = |
| 4656 | pevent_find_any_field(event, arg->field.name); | 4642 | tep_find_any_field(event, arg->field.name); |
| 4657 | if (!arg->field.field) { | 4643 | if (!arg->field.field) { |
| 4658 | do_warning("%s: field %s not found", | 4644 | do_warning("%s: field %s not found", |
| 4659 | __func__, arg->field.name); | 4645 | __func__, arg->field.name); |
| @@ -4711,7 +4697,7 @@ static int print_ipsa_arg(struct trace_seq *s, const char *ptr, char i, | |||
| 4711 | 4697 | ||
| 4712 | if (!arg->field.field) { | 4698 | if (!arg->field.field) { |
| 4713 | arg->field.field = | 4699 | arg->field.field = |
| 4714 | pevent_find_any_field(event, arg->field.name); | 4700 | tep_find_any_field(event, arg->field.name); |
| 4715 | if (!arg->field.field) { | 4701 | if (!arg->field.field) { |
| 4716 | do_warning("%s: field %s not found", | 4702 | do_warning("%s: field %s not found", |
| 4717 | __func__, arg->field.name); | 4703 | __func__, arg->field.name); |
| @@ -4800,18 +4786,18 @@ static int is_printable_array(char *p, unsigned int len) | |||
| 4800 | return 1; | 4786 | return 1; |
| 4801 | } | 4787 | } |
| 4802 | 4788 | ||
| 4803 | void pevent_print_field(struct trace_seq *s, void *data, | 4789 | void tep_print_field(struct trace_seq *s, void *data, |
| 4804 | struct format_field *field) | 4790 | struct format_field *field) |
| 4805 | { | 4791 | { |
| 4806 | unsigned long long val; | 4792 | unsigned long long val; |
| 4807 | unsigned int offset, len, i; | 4793 | unsigned int offset, len, i; |
| 4808 | struct pevent *pevent = field->event->pevent; | 4794 | struct tep_handle *pevent = field->event->pevent; |
| 4809 | 4795 | ||
| 4810 | if (field->flags & FIELD_IS_ARRAY) { | 4796 | if (field->flags & FIELD_IS_ARRAY) { |
| 4811 | offset = field->offset; | 4797 | offset = field->offset; |
| 4812 | len = field->size; | 4798 | len = field->size; |
| 4813 | if (field->flags & FIELD_IS_DYNAMIC) { | 4799 | if (field->flags & FIELD_IS_DYNAMIC) { |
| 4814 | val = pevent_read_number(pevent, data + offset, len); | 4800 | val = tep_read_number(pevent, data + offset, len); |
| 4815 | offset = val; | 4801 | offset = val; |
| 4816 | len = offset >> 16; | 4802 | len = offset >> 16; |
| 4817 | offset &= 0xffff; | 4803 | offset &= 0xffff; |
| @@ -4831,8 +4817,8 @@ void pevent_print_field(struct trace_seq *s, void *data, | |||
| 4831 | field->flags &= ~FIELD_IS_STRING; | 4817 | field->flags &= ~FIELD_IS_STRING; |
| 4832 | } | 4818 | } |
| 4833 | } else { | 4819 | } else { |
| 4834 | val = pevent_read_number(pevent, data + field->offset, | 4820 | val = tep_read_number(pevent, data + field->offset, |
| 4835 | field->size); | 4821 | field->size); |
| 4836 | if (field->flags & FIELD_IS_POINTER) { | 4822 | if (field->flags & FIELD_IS_POINTER) { |
| 4837 | trace_seq_printf(s, "0x%llx", val); | 4823 | trace_seq_printf(s, "0x%llx", val); |
| 4838 | } else if (field->flags & FIELD_IS_SIGNED) { | 4824 | } else if (field->flags & FIELD_IS_SIGNED) { |
| @@ -4865,22 +4851,22 @@ void pevent_print_field(struct trace_seq *s, void *data, | |||
| 4865 | } | 4851 | } |
| 4866 | } | 4852 | } |
| 4867 | 4853 | ||
| 4868 | void pevent_print_fields(struct trace_seq *s, void *data, | 4854 | void tep_print_fields(struct trace_seq *s, void *data, |
| 4869 | int size __maybe_unused, struct event_format *event) | 4855 | int size __maybe_unused, struct event_format *event) |
| 4870 | { | 4856 | { |
| 4871 | struct format_field *field; | 4857 | struct format_field *field; |
| 4872 | 4858 | ||
| 4873 | field = event->format.fields; | 4859 | field = event->format.fields; |
| 4874 | while (field) { | 4860 | while (field) { |
| 4875 | trace_seq_printf(s, " %s=", field->name); | 4861 | trace_seq_printf(s, " %s=", field->name); |
| 4876 | pevent_print_field(s, data, field); | 4862 | tep_print_field(s, data, field); |
| 4877 | field = field->next; | 4863 | field = field->next; |
| 4878 | } | 4864 | } |
| 4879 | } | 4865 | } |
| 4880 | 4866 | ||
| 4881 | static void pretty_print(struct trace_seq *s, void *data, int size, struct event_format *event) | 4867 | static void pretty_print(struct trace_seq *s, void *data, int size, struct event_format *event) |
| 4882 | { | 4868 | { |
| 4883 | struct pevent *pevent = event->pevent; | 4869 | struct tep_handle *pevent = event->pevent; |
| 4884 | struct print_fmt *print_fmt = &event->print_fmt; | 4870 | struct print_fmt *print_fmt = &event->print_fmt; |
| 4885 | struct print_arg *arg = print_fmt->args; | 4871 | struct print_arg *arg = print_fmt->args; |
| 4886 | struct print_arg *args = NULL; | 4872 | struct print_arg *args = NULL; |
| @@ -4899,7 +4885,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
| 4899 | 4885 | ||
| 4900 | if (event->flags & EVENT_FL_FAILED) { | 4886 | if (event->flags & EVENT_FL_FAILED) { |
| 4901 | trace_seq_printf(s, "[FAILED TO PARSE]"); | 4887 | trace_seq_printf(s, "[FAILED TO PARSE]"); |
| 4902 | pevent_print_fields(s, data, size, event); | 4888 | tep_print_fields(s, data, size, event); |
| 4903 | return; | 4889 | return; |
| 4904 | } | 4890 | } |
| 4905 | 4891 | ||
| @@ -5140,7 +5126,7 @@ out_failed: | |||
| 5140 | } | 5126 | } |
| 5141 | 5127 | ||
| 5142 | /** | 5128 | /** |
| 5143 | * pevent_data_lat_fmt - parse the data for the latency format | 5129 | * tep_data_lat_fmt - parse the data for the latency format |
| 5144 | * @pevent: a handle to the pevent | 5130 | * @pevent: a handle to the pevent |
| 5145 | * @s: the trace_seq to write to | 5131 | * @s: the trace_seq to write to |
| 5146 | * @record: the record to read from | 5132 | * @record: the record to read from |
| @@ -5149,8 +5135,8 @@ out_failed: | |||
| 5149 | * need rescheduling, in hard/soft interrupt, preempt count | 5135 | * need rescheduling, in hard/soft interrupt, preempt count |
| 5150 | * and lock depth) and places it into the trace_seq. | 5136 | * and lock depth) and places it into the trace_seq. |
| 5151 | */ | 5137 | */ |
| 5152 | void pevent_data_lat_fmt(struct pevent *pevent, | 5138 | void tep_data_lat_fmt(struct tep_handle *pevent, |
| 5153 | struct trace_seq *s, struct pevent_record *record) | 5139 | struct trace_seq *s, struct tep_record *record) |
| 5154 | { | 5140 | { |
| 5155 | static int check_lock_depth = 1; | 5141 | static int check_lock_depth = 1; |
| 5156 | static int check_migrate_disable = 1; | 5142 | static int check_migrate_disable = 1; |
| @@ -5223,55 +5209,55 @@ void pevent_data_lat_fmt(struct pevent *pevent, | |||
| 5223 | } | 5209 | } |
| 5224 | 5210 | ||
| 5225 | /** | 5211 | /** |
| 5226 | * pevent_data_type - parse out the given event type | 5212 | * tep_data_type - parse out the given event type |
| 5227 | * @pevent: a handle to the pevent | 5213 | * @pevent: a handle to the pevent |
| 5228 | * @rec: the record to read from | 5214 | * @rec: the record to read from |
| 5229 | * | 5215 | * |
| 5230 | * This returns the event id from the @rec. | 5216 | * This returns the event id from the @rec. |
| 5231 | */ | 5217 | */ |
| 5232 | int pevent_data_type(struct pevent *pevent, struct pevent_record *rec) | 5218 | int tep_data_type(struct tep_handle *pevent, struct tep_record *rec) |
| 5233 | { | 5219 | { |
| 5234 | return trace_parse_common_type(pevent, rec->data); | 5220 | return trace_parse_common_type(pevent, rec->data); |
| 5235 | } | 5221 | } |
| 5236 | 5222 | ||
| 5237 | /** | 5223 | /** |
| 5238 | * pevent_data_event_from_type - find the event by a given type | 5224 | * tep_data_event_from_type - find the event by a given type |
| 5239 | * @pevent: a handle to the pevent | 5225 | * @pevent: a handle to the pevent |
| 5240 | * @type: the type of the event. | 5226 | * @type: the type of the event. |
| 5241 | * | 5227 | * |
| 5242 | * This returns the event form a given @type; | 5228 | * This returns the event form a given @type; |
| 5243 | */ | 5229 | */ |
| 5244 | struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type) | 5230 | struct event_format *tep_data_event_from_type(struct tep_handle *pevent, int type) |
| 5245 | { | 5231 | { |
| 5246 | return pevent_find_event(pevent, type); | 5232 | return tep_find_event(pevent, type); |
| 5247 | } | 5233 | } |
| 5248 | 5234 | ||
| 5249 | /** | 5235 | /** |
| 5250 | * pevent_data_pid - parse the PID from record | 5236 | * tep_data_pid - parse the PID from record |
| 5251 | * @pevent: a handle to the pevent | 5237 | * @pevent: a handle to the pevent |
| 5252 | * @rec: the record to parse | 5238 | * @rec: the record to parse |
| 5253 | * | 5239 | * |
| 5254 | * This returns the PID from a record. | 5240 | * This returns the PID from a record. |
| 5255 | */ | 5241 | */ |
| 5256 | int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec) | 5242 | int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec) |
| 5257 | { | 5243 | { |
| 5258 | return parse_common_pid(pevent, rec->data); | 5244 | return parse_common_pid(pevent, rec->data); |
| 5259 | } | 5245 | } |
| 5260 | 5246 | ||
| 5261 | /** | 5247 | /** |
| 5262 | * pevent_data_preempt_count - parse the preempt count from the record | 5248 | * tep_data_preempt_count - parse the preempt count from the record |
| 5263 | * @pevent: a handle to the pevent | 5249 | * @pevent: a handle to the pevent |
| 5264 | * @rec: the record to parse | 5250 | * @rec: the record to parse |
| 5265 | * | 5251 | * |
| 5266 | * This returns the preempt count from a record. | 5252 | * This returns the preempt count from a record. |
| 5267 | */ | 5253 | */ |
| 5268 | int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec) | 5254 | int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec) |
| 5269 | { | 5255 | { |
| 5270 | return parse_common_pc(pevent, rec->data); | 5256 | return parse_common_pc(pevent, rec->data); |
| 5271 | } | 5257 | } |
| 5272 | 5258 | ||
| 5273 | /** | 5259 | /** |
| 5274 | * pevent_data_flags - parse the latency flags from the record | 5260 | * tep_data_flags - parse the latency flags from the record |
| 5275 | * @pevent: a handle to the pevent | 5261 | * @pevent: a handle to the pevent |
| 5276 | * @rec: the record to parse | 5262 | * @rec: the record to parse |
| 5277 | * | 5263 | * |
| @@ -5279,20 +5265,20 @@ int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec) | |||
| 5279 | * | 5265 | * |
| 5280 | * Use trace_flag_type enum for the flags (see event-parse.h). | 5266 | * Use trace_flag_type enum for the flags (see event-parse.h). |
| 5281 | */ | 5267 | */ |
| 5282 | int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec) | 5268 | int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec) |
| 5283 | { | 5269 | { |
| 5284 | return parse_common_flags(pevent, rec->data); | 5270 | return parse_common_flags(pevent, rec->data); |
| 5285 | } | 5271 | } |
| 5286 | 5272 | ||
| 5287 | /** | 5273 | /** |
| 5288 | * pevent_data_comm_from_pid - return the command line from PID | 5274 | * tep_data_comm_from_pid - return the command line from PID |
| 5289 | * @pevent: a handle to the pevent | 5275 | * @pevent: a handle to the pevent |
| 5290 | * @pid: the PID of the task to search for | 5276 | * @pid: the PID of the task to search for |
| 5291 | * | 5277 | * |
| 5292 | * This returns a pointer to the command line that has the given | 5278 | * This returns a pointer to the command line that has the given |
| 5293 | * @pid. | 5279 | * @pid. |
| 5294 | */ | 5280 | */ |
| 5295 | const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid) | 5281 | const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid) |
| 5296 | { | 5282 | { |
| 5297 | const char *comm; | 5283 | const char *comm; |
| 5298 | 5284 | ||
| @@ -5301,7 +5287,7 @@ const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid) | |||
| 5301 | } | 5287 | } |
| 5302 | 5288 | ||
| 5303 | static struct cmdline * | 5289 | static struct cmdline * |
| 5304 | pid_from_cmdlist(struct pevent *pevent, const char *comm, struct cmdline *next) | 5290 | pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct cmdline *next) |
| 5305 | { | 5291 | { |
| 5306 | struct cmdline_list *cmdlist = (struct cmdline_list *)next; | 5292 | struct cmdline_list *cmdlist = (struct cmdline_list *)next; |
| 5307 | 5293 | ||
| @@ -5317,7 +5303,7 @@ pid_from_cmdlist(struct pevent *pevent, const char *comm, struct cmdline *next) | |||
| 5317 | } | 5303 | } |
| 5318 | 5304 | ||
| 5319 | /** | 5305 | /** |
| 5320 | * pevent_data_pid_from_comm - return the pid from a given comm | 5306 | * tep_data_pid_from_comm - return the pid from a given comm |
| 5321 | * @pevent: a handle to the pevent | 5307 | * @pevent: a handle to the pevent |
| 5322 | * @comm: the cmdline to find the pid from | 5308 | * @comm: the cmdline to find the pid from |
| 5323 | * @next: the cmdline structure to find the next comm | 5309 | * @next: the cmdline structure to find the next comm |
| @@ -5329,8 +5315,8 @@ pid_from_cmdlist(struct pevent *pevent, const char *comm, struct cmdline *next) | |||
| 5329 | * next pid. | 5315 | * next pid. |
| 5330 | * Also, it does a linear seach, so it may be slow. | 5316 | * Also, it does a linear seach, so it may be slow. |
| 5331 | */ | 5317 | */ |
| 5332 | struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm, | 5318 | struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm, |
| 5333 | struct cmdline *next) | 5319 | struct cmdline *next) |
| 5334 | { | 5320 | { |
| 5335 | struct cmdline *cmdline; | 5321 | struct cmdline *cmdline; |
| 5336 | 5322 | ||
| @@ -5365,13 +5351,13 @@ struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *com | |||
| 5365 | } | 5351 | } |
| 5366 | 5352 | ||
| 5367 | /** | 5353 | /** |
| 5368 | * pevent_cmdline_pid - return the pid associated to a given cmdline | 5354 | * tep_cmdline_pid - return the pid associated to a given cmdline |
| 5369 | * @cmdline: The cmdline structure to get the pid from | 5355 | * @cmdline: The cmdline structure to get the pid from |
| 5370 | * | 5356 | * |
| 5371 | * Returns the pid for a give cmdline. If @cmdline is NULL, then | 5357 | * Returns the pid for a give cmdline. If @cmdline is NULL, then |
| 5372 | * -1 is returned. | 5358 | * -1 is returned. |
| 5373 | */ | 5359 | */ |
| 5374 | int pevent_cmdline_pid(struct pevent *pevent, struct cmdline *cmdline) | 5360 | int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline) |
| 5375 | { | 5361 | { |
| 5376 | struct cmdline_list *cmdlist = (struct cmdline_list *)cmdline; | 5362 | struct cmdline_list *cmdlist = (struct cmdline_list *)cmdline; |
| 5377 | 5363 | ||
| @@ -5391,7 +5377,7 @@ int pevent_cmdline_pid(struct pevent *pevent, struct cmdline *cmdline) | |||
| 5391 | } | 5377 | } |
| 5392 | 5378 | ||
| 5393 | /** | 5379 | /** |
| 5394 | * pevent_data_comm_from_pid - parse the data into the print format | 5380 | * tep_event_info - parse the data into the print format |
| 5395 | * @s: the trace_seq to write to | 5381 | * @s: the trace_seq to write to |
| 5396 | * @event: the handle to the event | 5382 | * @event: the handle to the event |
| 5397 | * @record: the record to read from | 5383 | * @record: the record to read from |
| @@ -5399,13 +5385,13 @@ int pevent_cmdline_pid(struct pevent *pevent, struct cmdline *cmdline) | |||
| 5399 | * This parses the raw @data using the given @event information and | 5385 | * This parses the raw @data using the given @event information and |
| 5400 | * writes the print format into the trace_seq. | 5386 | * writes the print format into the trace_seq. |
| 5401 | */ | 5387 | */ |
| 5402 | void pevent_event_info(struct trace_seq *s, struct event_format *event, | 5388 | void tep_event_info(struct trace_seq *s, struct event_format *event, |
| 5403 | struct pevent_record *record) | 5389 | struct tep_record *record) |
| 5404 | { | 5390 | { |
| 5405 | int print_pretty = 1; | 5391 | int print_pretty = 1; |
| 5406 | 5392 | ||
| 5407 | if (event->pevent->print_raw || (event->flags & EVENT_FL_PRINTRAW)) | 5393 | if (event->pevent->print_raw || (event->flags & EVENT_FL_PRINTRAW)) |
| 5408 | pevent_print_fields(s, record->data, record->size, event); | 5394 | tep_print_fields(s, record->data, record->size, event); |
| 5409 | else { | 5395 | else { |
| 5410 | 5396 | ||
| 5411 | if (event->handler && !(event->flags & EVENT_FL_NOHANDLE)) | 5397 | if (event->handler && !(event->flags & EVENT_FL_NOHANDLE)) |
| @@ -5433,7 +5419,7 @@ static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock) | |||
| 5433 | } | 5419 | } |
| 5434 | 5420 | ||
| 5435 | /** | 5421 | /** |
| 5436 | * pevent_find_event_by_record - return the event from a given record | 5422 | * tep_find_event_by_record - return the event from a given record |
| 5437 | * @pevent: a handle to the pevent | 5423 | * @pevent: a handle to the pevent |
| 5438 | * @record: The record to get the event from | 5424 | * @record: The record to get the event from |
| 5439 | * | 5425 | * |
| @@ -5441,7 +5427,7 @@ static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock) | |||
| 5441 | * is found. | 5427 | * is found. |
| 5442 | */ | 5428 | */ |
| 5443 | struct event_format * | 5429 | struct event_format * |
| 5444 | pevent_find_event_by_record(struct pevent *pevent, struct pevent_record *record) | 5430 | tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record) |
| 5445 | { | 5431 | { |
| 5446 | int type; | 5432 | int type; |
| 5447 | 5433 | ||
| @@ -5452,11 +5438,11 @@ pevent_find_event_by_record(struct pevent *pevent, struct pevent_record *record) | |||
| 5452 | 5438 | ||
| 5453 | type = trace_parse_common_type(pevent, record->data); | 5439 | type = trace_parse_common_type(pevent, record->data); |
| 5454 | 5440 | ||
| 5455 | return pevent_find_event(pevent, type); | 5441 | return tep_find_event(pevent, type); |
| 5456 | } | 5442 | } |
| 5457 | 5443 | ||
| 5458 | /** | 5444 | /** |
| 5459 | * pevent_print_event_task - Write the event task comm, pid and CPU | 5445 | * tep_print_event_task - Write the event task comm, pid and CPU |
| 5460 | * @pevent: a handle to the pevent | 5446 | * @pevent: a handle to the pevent |
| 5461 | * @s: the trace_seq to write to | 5447 | * @s: the trace_seq to write to |
| 5462 | * @event: the handle to the record's event | 5448 | * @event: the handle to the record's event |
| @@ -5464,9 +5450,9 @@ pevent_find_event_by_record(struct pevent *pevent, struct pevent_record *record) | |||
| 5464 | * | 5450 | * |
| 5465 | * Writes the tasks comm, pid and CPU to @s. | 5451 | * Writes the tasks comm, pid and CPU to @s. |
| 5466 | */ | 5452 | */ |
| 5467 | void pevent_print_event_task(struct pevent *pevent, struct trace_seq *s, | 5453 | void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, |
| 5468 | struct event_format *event, | 5454 | struct event_format *event, |
| 5469 | struct pevent_record *record) | 5455 | struct tep_record *record) |
| 5470 | { | 5456 | { |
| 5471 | void *data = record->data; | 5457 | void *data = record->data; |
| 5472 | const char *comm; | 5458 | const char *comm; |
| @@ -5483,7 +5469,7 @@ void pevent_print_event_task(struct pevent *pevent, struct trace_seq *s, | |||
| 5483 | } | 5469 | } |
| 5484 | 5470 | ||
| 5485 | /** | 5471 | /** |
| 5486 | * pevent_print_event_time - Write the event timestamp | 5472 | * tep_print_event_time - Write the event timestamp |
| 5487 | * @pevent: a handle to the pevent | 5473 | * @pevent: a handle to the pevent |
| 5488 | * @s: the trace_seq to write to | 5474 | * @s: the trace_seq to write to |
| 5489 | * @event: the handle to the record's event | 5475 | * @event: the handle to the record's event |
| @@ -5492,10 +5478,10 @@ void pevent_print_event_task(struct pevent *pevent, struct trace_seq *s, | |||
| 5492 | * | 5478 | * |
| 5493 | * Writes the timestamp of the record into @s. | 5479 | * Writes the timestamp of the record into @s. |
| 5494 | */ | 5480 | */ |
| 5495 | void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, | 5481 | void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, |
| 5496 | struct event_format *event, | 5482 | struct event_format *event, |
| 5497 | struct pevent_record *record, | 5483 | struct tep_record *record, |
| 5498 | bool use_trace_clock) | 5484 | bool use_trace_clock) |
| 5499 | { | 5485 | { |
| 5500 | unsigned long secs; | 5486 | unsigned long secs; |
| 5501 | unsigned long usecs; | 5487 | unsigned long usecs; |
| @@ -5511,11 +5497,11 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, | |||
| 5511 | } | 5497 | } |
| 5512 | 5498 | ||
| 5513 | if (pevent->latency_format) { | 5499 | if (pevent->latency_format) { |
| 5514 | pevent_data_lat_fmt(pevent, s, record); | 5500 | tep_data_lat_fmt(pevent, s, record); |
| 5515 | } | 5501 | } |
| 5516 | 5502 | ||
| 5517 | if (use_usec_format) { | 5503 | if (use_usec_format) { |
| 5518 | if (pevent->flags & PEVENT_NSEC_OUTPUT) { | 5504 | if (pevent->flags & TEP_NSEC_OUTPUT) { |
| 5519 | usecs = nsecs; | 5505 | usecs = nsecs; |
| 5520 | p = 9; | 5506 | p = 9; |
| 5521 | } else { | 5507 | } else { |
| @@ -5534,7 +5520,7 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, | |||
| 5534 | } | 5520 | } |
| 5535 | 5521 | ||
| 5536 | /** | 5522 | /** |
| 5537 | * pevent_print_event_data - Write the event data section | 5523 | * tep_print_event_data - Write the event data section |
| 5538 | * @pevent: a handle to the pevent | 5524 | * @pevent: a handle to the pevent |
| 5539 | * @s: the trace_seq to write to | 5525 | * @s: the trace_seq to write to |
| 5540 | * @event: the handle to the record's event | 5526 | * @event: the handle to the record's event |
| @@ -5542,9 +5528,9 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, | |||
| 5542 | * | 5528 | * |
| 5543 | * Writes the parsing of the record's data to @s. | 5529 | * Writes the parsing of the record's data to @s. |
| 5544 | */ | 5530 | */ |
| 5545 | void pevent_print_event_data(struct pevent *pevent, struct trace_seq *s, | 5531 | void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, |
| 5546 | struct event_format *event, | 5532 | struct event_format *event, |
| 5547 | struct pevent_record *record) | 5533 | struct tep_record *record) |
| 5548 | { | 5534 | { |
| 5549 | static const char *spaces = " "; /* 20 spaces */ | 5535 | static const char *spaces = " "; /* 20 spaces */ |
| 5550 | int len; | 5536 | int len; |
| @@ -5556,15 +5542,15 @@ void pevent_print_event_data(struct pevent *pevent, struct trace_seq *s, | |||
| 5556 | if (len < 20) | 5542 | if (len < 20) |
| 5557 | trace_seq_printf(s, "%.*s", 20 - len, spaces); | 5543 | trace_seq_printf(s, "%.*s", 20 - len, spaces); |
| 5558 | 5544 | ||
| 5559 | pevent_event_info(s, event, record); | 5545 | tep_event_info(s, event, record); |
| 5560 | } | 5546 | } |
| 5561 | 5547 | ||
| 5562 | void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | 5548 | void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, |
| 5563 | struct pevent_record *record, bool use_trace_clock) | 5549 | struct tep_record *record, bool use_trace_clock) |
| 5564 | { | 5550 | { |
| 5565 | struct event_format *event; | 5551 | struct event_format *event; |
| 5566 | 5552 | ||
| 5567 | event = pevent_find_event_by_record(pevent, record); | 5553 | event = tep_find_event_by_record(pevent, record); |
| 5568 | if (!event) { | 5554 | if (!event) { |
| 5569 | int i; | 5555 | int i; |
| 5570 | int type = trace_parse_common_type(pevent, record->data); | 5556 | int type = trace_parse_common_type(pevent, record->data); |
| @@ -5577,9 +5563,9 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
| 5577 | return; | 5563 | return; |
| 5578 | } | 5564 | } |
| 5579 | 5565 | ||
| 5580 | pevent_print_event_task(pevent, s, event, record); | 5566 | tep_print_event_task(pevent, s, event, record); |
| 5581 | pevent_print_event_time(pevent, s, event, record, use_trace_clock); | 5567 | tep_print_event_time(pevent, s, event, record, use_trace_clock); |
| 5582 | pevent_print_event_data(pevent, s, event, record); | 5568 | tep_print_event_data(pevent, s, event, record); |
| 5583 | } | 5569 | } |
| 5584 | 5570 | ||
| 5585 | static int events_id_cmp(const void *a, const void *b) | 5571 | static int events_id_cmp(const void *a, const void *b) |
| @@ -5630,7 +5616,7 @@ static int events_system_cmp(const void *a, const void *b) | |||
| 5630 | return events_id_cmp(a, b); | 5616 | return events_id_cmp(a, b); |
| 5631 | } | 5617 | } |
| 5632 | 5618 | ||
| 5633 | struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type sort_type) | 5619 | struct event_format **tep_list_events(struct tep_handle *pevent, enum event_sort_type sort_type) |
| 5634 | { | 5620 | { |
| 5635 | struct event_format **events; | 5621 | struct event_format **events; |
| 5636 | int (*sort)(const void *a, const void *b); | 5622 | int (*sort)(const void *a, const void *b); |
| @@ -5709,13 +5695,13 @@ get_event_fields(const char *type, const char *name, | |||
| 5709 | } | 5695 | } |
| 5710 | 5696 | ||
| 5711 | /** | 5697 | /** |
| 5712 | * pevent_event_common_fields - return a list of common fields for an event | 5698 | * tep_event_common_fields - return a list of common fields for an event |
| 5713 | * @event: the event to return the common fields of. | 5699 | * @event: the event to return the common fields of. |
| 5714 | * | 5700 | * |
| 5715 | * Returns an allocated array of fields. The last item in the array is NULL. | 5701 | * Returns an allocated array of fields. The last item in the array is NULL. |
| 5716 | * The array must be freed with free(). | 5702 | * The array must be freed with free(). |
| 5717 | */ | 5703 | */ |
| 5718 | struct format_field **pevent_event_common_fields(struct event_format *event) | 5704 | struct format_field **tep_event_common_fields(struct event_format *event) |
| 5719 | { | 5705 | { |
| 5720 | return get_event_fields("common", event->name, | 5706 | return get_event_fields("common", event->name, |
| 5721 | event->format.nr_common, | 5707 | event->format.nr_common, |
| @@ -5723,13 +5709,13 @@ struct format_field **pevent_event_common_fields(struct event_format *event) | |||
| 5723 | } | 5709 | } |
| 5724 | 5710 | ||
| 5725 | /** | 5711 | /** |
| 5726 | * pevent_event_fields - return a list of event specific fields for an event | 5712 | * tep_event_fields - return a list of event specific fields for an event |
| 5727 | * @event: the event to return the fields of. | 5713 | * @event: the event to return the fields of. |
| 5728 | * | 5714 | * |
| 5729 | * Returns an allocated array of fields. The last item in the array is NULL. | 5715 | * Returns an allocated array of fields. The last item in the array is NULL. |
| 5730 | * The array must be freed with free(). | 5716 | * The array must be freed with free(). |
| 5731 | */ | 5717 | */ |
| 5732 | struct format_field **pevent_event_fields(struct event_format *event) | 5718 | struct format_field **tep_event_fields(struct event_format *event) |
| 5733 | { | 5719 | { |
| 5734 | return get_event_fields("event", event->name, | 5720 | return get_event_fields("event", event->name, |
| 5735 | event->format.nr_fields, | 5721 | event->format.nr_fields, |
| @@ -5930,7 +5916,7 @@ static void parse_header_field(const char *field, | |||
| 5930 | } | 5916 | } |
| 5931 | 5917 | ||
| 5932 | /** | 5918 | /** |
| 5933 | * pevent_parse_header_page - parse the data stored in the header page | 5919 | * tep_parse_header_page - parse the data stored in the header page |
| 5934 | * @pevent: the handle to the pevent | 5920 | * @pevent: the handle to the pevent |
| 5935 | * @buf: the buffer storing the header page format string | 5921 | * @buf: the buffer storing the header page format string |
| 5936 | * @size: the size of @buf | 5922 | * @size: the size of @buf |
| @@ -5941,8 +5927,8 @@ static void parse_header_field(const char *field, | |||
| 5941 | * | 5927 | * |
| 5942 | * /sys/kernel/debug/tracing/events/header_page | 5928 | * /sys/kernel/debug/tracing/events/header_page |
| 5943 | */ | 5929 | */ |
| 5944 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, | 5930 | int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, |
| 5945 | int long_size) | 5931 | int long_size) |
| 5946 | { | 5932 | { |
| 5947 | int ignore; | 5933 | int ignore; |
| 5948 | 5934 | ||
| @@ -5994,7 +5980,7 @@ static void free_handler(struct event_handler *handle) | |||
| 5994 | free(handle); | 5980 | free(handle); |
| 5995 | } | 5981 | } |
| 5996 | 5982 | ||
| 5997 | static int find_event_handle(struct pevent *pevent, struct event_format *event) | 5983 | static int find_event_handle(struct tep_handle *pevent, struct event_format *event) |
| 5998 | { | 5984 | { |
| 5999 | struct event_handler *handle, **next; | 5985 | struct event_handler *handle, **next; |
| 6000 | 5986 | ||
| @@ -6023,7 +6009,7 @@ static int find_event_handle(struct pevent *pevent, struct event_format *event) | |||
| 6023 | } | 6009 | } |
| 6024 | 6010 | ||
| 6025 | /** | 6011 | /** |
| 6026 | * __pevent_parse_format - parse the event format | 6012 | * __tep_parse_format - parse the event format |
| 6027 | * @buf: the buffer storing the event format string | 6013 | * @buf: the buffer storing the event format string |
| 6028 | * @size: the size of @buf | 6014 | * @size: the size of @buf |
| 6029 | * @sys: the system the event belongs to | 6015 | * @sys: the system the event belongs to |
| @@ -6035,9 +6021,9 @@ static int find_event_handle(struct pevent *pevent, struct event_format *event) | |||
| 6035 | * | 6021 | * |
| 6036 | * /sys/kernel/debug/tracing/events/.../.../format | 6022 | * /sys/kernel/debug/tracing/events/.../.../format |
| 6037 | */ | 6023 | */ |
| 6038 | enum pevent_errno __pevent_parse_format(struct event_format **eventp, | 6024 | enum tep_errno __tep_parse_format(struct event_format **eventp, |
| 6039 | struct pevent *pevent, const char *buf, | 6025 | struct tep_handle *pevent, const char *buf, |
| 6040 | unsigned long size, const char *sys) | 6026 | unsigned long size, const char *sys) |
| 6041 | { | 6027 | { |
| 6042 | struct event_format *event; | 6028 | struct event_format *event; |
| 6043 | int ret; | 6029 | int ret; |
| @@ -6046,12 +6032,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6046 | 6032 | ||
| 6047 | *eventp = event = alloc_event(); | 6033 | *eventp = event = alloc_event(); |
| 6048 | if (!event) | 6034 | if (!event) |
| 6049 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6035 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6050 | 6036 | ||
| 6051 | event->name = event_read_name(); | 6037 | event->name = event_read_name(); |
| 6052 | if (!event->name) { | 6038 | if (!event->name) { |
| 6053 | /* Bad event? */ | 6039 | /* Bad event? */ |
| 6054 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6040 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6055 | goto event_alloc_failed; | 6041 | goto event_alloc_failed; |
| 6056 | } | 6042 | } |
| 6057 | 6043 | ||
| @@ -6064,7 +6050,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6064 | 6050 | ||
| 6065 | event->id = event_read_id(); | 6051 | event->id = event_read_id(); |
| 6066 | if (event->id < 0) { | 6052 | if (event->id < 0) { |
| 6067 | ret = PEVENT_ERRNO__READ_ID_FAILED; | 6053 | ret = TEP_ERRNO__READ_ID_FAILED; |
| 6068 | /* | 6054 | /* |
| 6069 | * This isn't an allocation error actually. | 6055 | * This isn't an allocation error actually. |
| 6070 | * But as the ID is critical, just bail out. | 6056 | * But as the ID is critical, just bail out. |
| @@ -6074,7 +6060,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6074 | 6060 | ||
| 6075 | event->system = strdup(sys); | 6061 | event->system = strdup(sys); |
| 6076 | if (!event->system) { | 6062 | if (!event->system) { |
| 6077 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6063 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6078 | goto event_alloc_failed; | 6064 | goto event_alloc_failed; |
| 6079 | } | 6065 | } |
| 6080 | 6066 | ||
| @@ -6083,7 +6069,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6083 | 6069 | ||
| 6084 | ret = event_read_format(event); | 6070 | ret = event_read_format(event); |
| 6085 | if (ret < 0) { | 6071 | if (ret < 0) { |
| 6086 | ret = PEVENT_ERRNO__READ_FORMAT_FAILED; | 6072 | ret = TEP_ERRNO__READ_FORMAT_FAILED; |
| 6087 | goto event_parse_failed; | 6073 | goto event_parse_failed; |
| 6088 | } | 6074 | } |
| 6089 | 6075 | ||
| @@ -6098,7 +6084,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6098 | show_warning = 1; | 6084 | show_warning = 1; |
| 6099 | 6085 | ||
| 6100 | if (ret < 0) { | 6086 | if (ret < 0) { |
| 6101 | ret = PEVENT_ERRNO__READ_PRINT_FAILED; | 6087 | ret = TEP_ERRNO__READ_PRINT_FAILED; |
| 6102 | goto event_parse_failed; | 6088 | goto event_parse_failed; |
| 6103 | } | 6089 | } |
| 6104 | 6090 | ||
| @@ -6112,14 +6098,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6112 | arg = alloc_arg(); | 6098 | arg = alloc_arg(); |
| 6113 | if (!arg) { | 6099 | if (!arg) { |
| 6114 | event->flags |= EVENT_FL_FAILED; | 6100 | event->flags |= EVENT_FL_FAILED; |
| 6115 | return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; | 6101 | return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; |
| 6116 | } | 6102 | } |
| 6117 | arg->type = PRINT_FIELD; | 6103 | arg->type = PRINT_FIELD; |
| 6118 | arg->field.name = strdup(field->name); | 6104 | arg->field.name = strdup(field->name); |
| 6119 | if (!arg->field.name) { | 6105 | if (!arg->field.name) { |
| 6120 | event->flags |= EVENT_FL_FAILED; | 6106 | event->flags |= EVENT_FL_FAILED; |
| 6121 | free_arg(arg); | 6107 | free_arg(arg); |
| 6122 | return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; | 6108 | return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; |
| 6123 | } | 6109 | } |
| 6124 | arg->field.field = field; | 6110 | arg->field.field = field; |
| 6125 | *list = arg; | 6111 | *list = arg; |
| @@ -6142,20 +6128,20 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, | |||
| 6142 | return ret; | 6128 | return ret; |
| 6143 | } | 6129 | } |
| 6144 | 6130 | ||
| 6145 | static enum pevent_errno | 6131 | static enum tep_errno |
| 6146 | __pevent_parse_event(struct pevent *pevent, | 6132 | __parse_event(struct tep_handle *pevent, |
| 6147 | struct event_format **eventp, | 6133 | struct event_format **eventp, |
| 6148 | const char *buf, unsigned long size, | 6134 | const char *buf, unsigned long size, |
| 6149 | const char *sys) | 6135 | const char *sys) |
| 6150 | { | 6136 | { |
| 6151 | int ret = __pevent_parse_format(eventp, pevent, buf, size, sys); | 6137 | int ret = __tep_parse_format(eventp, pevent, buf, size, sys); |
| 6152 | struct event_format *event = *eventp; | 6138 | struct event_format *event = *eventp; |
| 6153 | 6139 | ||
| 6154 | if (event == NULL) | 6140 | if (event == NULL) |
| 6155 | return ret; | 6141 | return ret; |
| 6156 | 6142 | ||
| 6157 | if (pevent && add_event(pevent, event)) { | 6143 | if (pevent && add_event(pevent, event)) { |
| 6158 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6144 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6159 | goto event_add_failed; | 6145 | goto event_add_failed; |
| 6160 | } | 6146 | } |
| 6161 | 6147 | ||
| @@ -6166,12 +6152,12 @@ __pevent_parse_event(struct pevent *pevent, | |||
| 6166 | return 0; | 6152 | return 0; |
| 6167 | 6153 | ||
| 6168 | event_add_failed: | 6154 | event_add_failed: |
| 6169 | pevent_free_format(event); | 6155 | tep_free_format(event); |
| 6170 | return ret; | 6156 | return ret; |
| 6171 | } | 6157 | } |
| 6172 | 6158 | ||
| 6173 | /** | 6159 | /** |
| 6174 | * pevent_parse_format - parse the event format | 6160 | * tep_parse_format - parse the event format |
| 6175 | * @pevent: the handle to the pevent | 6161 | * @pevent: the handle to the pevent |
| 6176 | * @eventp: returned format | 6162 | * @eventp: returned format |
| 6177 | * @buf: the buffer storing the event format string | 6163 | * @buf: the buffer storing the event format string |
| @@ -6185,16 +6171,16 @@ event_add_failed: | |||
| 6185 | * | 6171 | * |
| 6186 | * /sys/kernel/debug/tracing/events/.../.../format | 6172 | * /sys/kernel/debug/tracing/events/.../.../format |
| 6187 | */ | 6173 | */ |
| 6188 | enum pevent_errno pevent_parse_format(struct pevent *pevent, | 6174 | enum tep_errno tep_parse_format(struct tep_handle *pevent, |
| 6189 | struct event_format **eventp, | 6175 | struct event_format **eventp, |
| 6190 | const char *buf, | 6176 | const char *buf, |
| 6191 | unsigned long size, const char *sys) | 6177 | unsigned long size, const char *sys) |
| 6192 | { | 6178 | { |
| 6193 | return __pevent_parse_event(pevent, eventp, buf, size, sys); | 6179 | return __parse_event(pevent, eventp, buf, size, sys); |
| 6194 | } | 6180 | } |
| 6195 | 6181 | ||
| 6196 | /** | 6182 | /** |
| 6197 | * pevent_parse_event - parse the event format | 6183 | * tep_parse_event - parse the event format |
| 6198 | * @pevent: the handle to the pevent | 6184 | * @pevent: the handle to the pevent |
| 6199 | * @buf: the buffer storing the event format string | 6185 | * @buf: the buffer storing the event format string |
| 6200 | * @size: the size of @buf | 6186 | * @size: the size of @buf |
| @@ -6207,22 +6193,22 @@ enum pevent_errno pevent_parse_format(struct pevent *pevent, | |||
| 6207 | * | 6193 | * |
| 6208 | * /sys/kernel/debug/tracing/events/.../.../format | 6194 | * /sys/kernel/debug/tracing/events/.../.../format |
| 6209 | */ | 6195 | */ |
| 6210 | enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, | 6196 | enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, |
| 6211 | unsigned long size, const char *sys) | 6197 | unsigned long size, const char *sys) |
| 6212 | { | 6198 | { |
| 6213 | struct event_format *event = NULL; | 6199 | struct event_format *event = NULL; |
| 6214 | return __pevent_parse_event(pevent, &event, buf, size, sys); | 6200 | return __parse_event(pevent, &event, buf, size, sys); |
| 6215 | } | 6201 | } |
| 6216 | 6202 | ||
| 6217 | #undef _PE | 6203 | #undef _PE |
| 6218 | #define _PE(code, str) str | 6204 | #define _PE(code, str) str |
| 6219 | static const char * const pevent_error_str[] = { | 6205 | static const char * const tep_error_str[] = { |
| 6220 | PEVENT_ERRORS | 6206 | TEP_ERRORS |
| 6221 | }; | 6207 | }; |
| 6222 | #undef _PE | 6208 | #undef _PE |
| 6223 | 6209 | ||
| 6224 | int pevent_strerror(struct pevent *pevent __maybe_unused, | 6210 | int tep_strerror(struct tep_handle *pevent __maybe_unused, |
| 6225 | enum pevent_errno errnum, char *buf, size_t buflen) | 6211 | enum tep_errno errnum, char *buf, size_t buflen) |
| 6226 | { | 6212 | { |
| 6227 | int idx; | 6213 | int idx; |
| 6228 | const char *msg; | 6214 | const char *msg; |
| @@ -6232,19 +6218,19 @@ int pevent_strerror(struct pevent *pevent __maybe_unused, | |||
| 6232 | return 0; | 6218 | return 0; |
| 6233 | } | 6219 | } |
| 6234 | 6220 | ||
| 6235 | if (errnum <= __PEVENT_ERRNO__START || | 6221 | if (errnum <= __TEP_ERRNO__START || |
| 6236 | errnum >= __PEVENT_ERRNO__END) | 6222 | errnum >= __TEP_ERRNO__END) |
| 6237 | return -1; | 6223 | return -1; |
| 6238 | 6224 | ||
| 6239 | idx = errnum - __PEVENT_ERRNO__START - 1; | 6225 | idx = errnum - __TEP_ERRNO__START - 1; |
| 6240 | msg = pevent_error_str[idx]; | 6226 | msg = tep_error_str[idx]; |
| 6241 | snprintf(buf, buflen, "%s", msg); | 6227 | snprintf(buf, buflen, "%s", msg); |
| 6242 | 6228 | ||
| 6243 | return 0; | 6229 | return 0; |
| 6244 | } | 6230 | } |
| 6245 | 6231 | ||
| 6246 | int get_field_val(struct trace_seq *s, struct format_field *field, | 6232 | int get_field_val(struct trace_seq *s, struct format_field *field, |
| 6247 | const char *name, struct pevent_record *record, | 6233 | const char *name, struct tep_record *record, |
| 6248 | unsigned long long *val, int err) | 6234 | unsigned long long *val, int err) |
| 6249 | { | 6235 | { |
| 6250 | if (!field) { | 6236 | if (!field) { |
| @@ -6253,7 +6239,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field, | |||
| 6253 | return -1; | 6239 | return -1; |
| 6254 | } | 6240 | } |
| 6255 | 6241 | ||
| 6256 | if (pevent_read_number_field(field, record->data, val)) { | 6242 | if (tep_read_number_field(field, record->data, val)) { |
| 6257 | if (err) | 6243 | if (err) |
| 6258 | trace_seq_printf(s, " %s=INVALID", name); | 6244 | trace_seq_printf(s, " %s=INVALID", name); |
| 6259 | return -1; | 6245 | return -1; |
| @@ -6263,7 +6249,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field, | |||
| 6263 | } | 6249 | } |
| 6264 | 6250 | ||
| 6265 | /** | 6251 | /** |
| 6266 | * pevent_get_field_raw - return the raw pointer into the data field | 6252 | * tep_get_field_raw - return the raw pointer into the data field |
| 6267 | * @s: The seq to print to on error | 6253 | * @s: The seq to print to on error |
| 6268 | * @event: the event that the field is for | 6254 | * @event: the event that the field is for |
| 6269 | * @name: The name of the field | 6255 | * @name: The name of the field |
| @@ -6276,9 +6262,9 @@ int get_field_val(struct trace_seq *s, struct format_field *field, | |||
| 6276 | * | 6262 | * |
| 6277 | * On failure, it returns NULL. | 6263 | * On failure, it returns NULL. |
| 6278 | */ | 6264 | */ |
| 6279 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | 6265 | void *tep_get_field_raw(struct trace_seq *s, struct event_format *event, |
| 6280 | const char *name, struct pevent_record *record, | 6266 | const char *name, struct tep_record *record, |
| 6281 | int *len, int err) | 6267 | int *len, int err) |
| 6282 | { | 6268 | { |
| 6283 | struct format_field *field; | 6269 | struct format_field *field; |
| 6284 | void *data = record->data; | 6270 | void *data = record->data; |
| @@ -6288,7 +6274,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | |||
| 6288 | if (!event) | 6274 | if (!event) |
| 6289 | return NULL; | 6275 | return NULL; |
| 6290 | 6276 | ||
| 6291 | field = pevent_find_field(event, name); | 6277 | field = tep_find_field(event, name); |
| 6292 | 6278 | ||
| 6293 | if (!field) { | 6279 | if (!field) { |
| 6294 | if (err) | 6280 | if (err) |
| @@ -6302,7 +6288,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | |||
| 6302 | 6288 | ||
| 6303 | offset = field->offset; | 6289 | offset = field->offset; |
| 6304 | if (field->flags & FIELD_IS_DYNAMIC) { | 6290 | if (field->flags & FIELD_IS_DYNAMIC) { |
| 6305 | offset = pevent_read_number(event->pevent, | 6291 | offset = tep_read_number(event->pevent, |
| 6306 | data + offset, field->size); | 6292 | data + offset, field->size); |
| 6307 | *len = offset >> 16; | 6293 | *len = offset >> 16; |
| 6308 | offset &= 0xffff; | 6294 | offset &= 0xffff; |
| @@ -6313,7 +6299,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | |||
| 6313 | } | 6299 | } |
| 6314 | 6300 | ||
| 6315 | /** | 6301 | /** |
| 6316 | * pevent_get_field_val - find a field and return its value | 6302 | * tep_get_field_val - find a field and return its value |
| 6317 | * @s: The seq to print to on error | 6303 | * @s: The seq to print to on error |
| 6318 | * @event: the event that the field is for | 6304 | * @event: the event that the field is for |
| 6319 | * @name: The name of the field | 6305 | * @name: The name of the field |
| @@ -6323,22 +6309,22 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | |||
| 6323 | * | 6309 | * |
| 6324 | * Returns 0 on success -1 on field not found. | 6310 | * Returns 0 on success -1 on field not found. |
| 6325 | */ | 6311 | */ |
| 6326 | int pevent_get_field_val(struct trace_seq *s, struct event_format *event, | 6312 | int tep_get_field_val(struct trace_seq *s, struct event_format *event, |
| 6327 | const char *name, struct pevent_record *record, | 6313 | const char *name, struct tep_record *record, |
| 6328 | unsigned long long *val, int err) | 6314 | unsigned long long *val, int err) |
| 6329 | { | 6315 | { |
| 6330 | struct format_field *field; | 6316 | struct format_field *field; |
| 6331 | 6317 | ||
| 6332 | if (!event) | 6318 | if (!event) |
| 6333 | return -1; | 6319 | return -1; |
| 6334 | 6320 | ||
| 6335 | field = pevent_find_field(event, name); | 6321 | field = tep_find_field(event, name); |
| 6336 | 6322 | ||
| 6337 | return get_field_val(s, field, name, record, val, err); | 6323 | return get_field_val(s, field, name, record, val, err); |
| 6338 | } | 6324 | } |
| 6339 | 6325 | ||
| 6340 | /** | 6326 | /** |
| 6341 | * pevent_get_common_field_val - find a common field and return its value | 6327 | * tep_get_common_field_val - find a common field and return its value |
| 6342 | * @s: The seq to print to on error | 6328 | * @s: The seq to print to on error |
| 6343 | * @event: the event that the field is for | 6329 | * @event: the event that the field is for |
| 6344 | * @name: The name of the field | 6330 | * @name: The name of the field |
| @@ -6348,22 +6334,22 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, | |||
| 6348 | * | 6334 | * |
| 6349 | * Returns 0 on success -1 on field not found. | 6335 | * Returns 0 on success -1 on field not found. |
| 6350 | */ | 6336 | */ |
| 6351 | int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, | 6337 | int tep_get_common_field_val(struct trace_seq *s, struct event_format *event, |
| 6352 | const char *name, struct pevent_record *record, | 6338 | const char *name, struct tep_record *record, |
| 6353 | unsigned long long *val, int err) | 6339 | unsigned long long *val, int err) |
| 6354 | { | 6340 | { |
| 6355 | struct format_field *field; | 6341 | struct format_field *field; |
| 6356 | 6342 | ||
| 6357 | if (!event) | 6343 | if (!event) |
| 6358 | return -1; | 6344 | return -1; |
| 6359 | 6345 | ||
| 6360 | field = pevent_find_common_field(event, name); | 6346 | field = tep_find_common_field(event, name); |
| 6361 | 6347 | ||
| 6362 | return get_field_val(s, field, name, record, val, err); | 6348 | return get_field_val(s, field, name, record, val, err); |
| 6363 | } | 6349 | } |
| 6364 | 6350 | ||
| 6365 | /** | 6351 | /** |
| 6366 | * pevent_get_any_field_val - find a any field and return its value | 6352 | * tep_get_any_field_val - find a any field and return its value |
| 6367 | * @s: The seq to print to on error | 6353 | * @s: The seq to print to on error |
| 6368 | * @event: the event that the field is for | 6354 | * @event: the event that the field is for |
| 6369 | * @name: The name of the field | 6355 | * @name: The name of the field |
| @@ -6373,22 +6359,22 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, | |||
| 6373 | * | 6359 | * |
| 6374 | * Returns 0 on success -1 on field not found. | 6360 | * Returns 0 on success -1 on field not found. |
| 6375 | */ | 6361 | */ |
| 6376 | int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, | 6362 | int tep_get_any_field_val(struct trace_seq *s, struct event_format *event, |
| 6377 | const char *name, struct pevent_record *record, | 6363 | const char *name, struct tep_record *record, |
| 6378 | unsigned long long *val, int err) | 6364 | unsigned long long *val, int err) |
| 6379 | { | 6365 | { |
| 6380 | struct format_field *field; | 6366 | struct format_field *field; |
| 6381 | 6367 | ||
| 6382 | if (!event) | 6368 | if (!event) |
| 6383 | return -1; | 6369 | return -1; |
| 6384 | 6370 | ||
| 6385 | field = pevent_find_any_field(event, name); | 6371 | field = tep_find_any_field(event, name); |
| 6386 | 6372 | ||
| 6387 | return get_field_val(s, field, name, record, val, err); | 6373 | return get_field_val(s, field, name, record, val, err); |
| 6388 | } | 6374 | } |
| 6389 | 6375 | ||
| 6390 | /** | 6376 | /** |
| 6391 | * pevent_print_num_field - print a field and a format | 6377 | * tep_print_num_field - print a field and a format |
| 6392 | * @s: The seq to print to | 6378 | * @s: The seq to print to |
| 6393 | * @fmt: The printf format to print the field with. | 6379 | * @fmt: The printf format to print the field with. |
| 6394 | * @event: the event that the field is for | 6380 | * @event: the event that the field is for |
| @@ -6398,17 +6384,17 @@ int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, | |||
| 6398 | * | 6384 | * |
| 6399 | * Returns: 0 on success, -1 field not found, or 1 if buffer is full. | 6385 | * Returns: 0 on success, -1 field not found, or 1 if buffer is full. |
| 6400 | */ | 6386 | */ |
| 6401 | int pevent_print_num_field(struct trace_seq *s, const char *fmt, | 6387 | int tep_print_num_field(struct trace_seq *s, const char *fmt, |
| 6402 | struct event_format *event, const char *name, | 6388 | struct event_format *event, const char *name, |
| 6403 | struct pevent_record *record, int err) | 6389 | struct tep_record *record, int err) |
| 6404 | { | 6390 | { |
| 6405 | struct format_field *field = pevent_find_field(event, name); | 6391 | struct format_field *field = tep_find_field(event, name); |
| 6406 | unsigned long long val; | 6392 | unsigned long long val; |
| 6407 | 6393 | ||
| 6408 | if (!field) | 6394 | if (!field) |
| 6409 | goto failed; | 6395 | goto failed; |
| 6410 | 6396 | ||
| 6411 | if (pevent_read_number_field(field, record->data, &val)) | 6397 | if (tep_read_number_field(field, record->data, &val)) |
| 6412 | goto failed; | 6398 | goto failed; |
| 6413 | 6399 | ||
| 6414 | return trace_seq_printf(s, fmt, val); | 6400 | return trace_seq_printf(s, fmt, val); |
| @@ -6420,7 +6406,7 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, | |||
| 6420 | } | 6406 | } |
| 6421 | 6407 | ||
| 6422 | /** | 6408 | /** |
| 6423 | * pevent_print_func_field - print a field and a format for function pointers | 6409 | * tep_print_func_field - print a field and a format for function pointers |
| 6424 | * @s: The seq to print to | 6410 | * @s: The seq to print to |
| 6425 | * @fmt: The printf format to print the field with. | 6411 | * @fmt: The printf format to print the field with. |
| 6426 | * @event: the event that the field is for | 6412 | * @event: the event that the field is for |
| @@ -6430,12 +6416,12 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt, | |||
| 6430 | * | 6416 | * |
| 6431 | * Returns: 0 on success, -1 field not found, or 1 if buffer is full. | 6417 | * Returns: 0 on success, -1 field not found, or 1 if buffer is full. |
| 6432 | */ | 6418 | */ |
| 6433 | int pevent_print_func_field(struct trace_seq *s, const char *fmt, | 6419 | int tep_print_func_field(struct trace_seq *s, const char *fmt, |
| 6434 | struct event_format *event, const char *name, | 6420 | struct event_format *event, const char *name, |
| 6435 | struct pevent_record *record, int err) | 6421 | struct tep_record *record, int err) |
| 6436 | { | 6422 | { |
| 6437 | struct format_field *field = pevent_find_field(event, name); | 6423 | struct format_field *field = tep_find_field(event, name); |
| 6438 | struct pevent *pevent = event->pevent; | 6424 | struct tep_handle *pevent = event->pevent; |
| 6439 | unsigned long long val; | 6425 | unsigned long long val; |
| 6440 | struct func_map *func; | 6426 | struct func_map *func; |
| 6441 | char tmp[128]; | 6427 | char tmp[128]; |
| @@ -6443,7 +6429,7 @@ int pevent_print_func_field(struct trace_seq *s, const char *fmt, | |||
| 6443 | if (!field) | 6429 | if (!field) |
| 6444 | goto failed; | 6430 | goto failed; |
| 6445 | 6431 | ||
| 6446 | if (pevent_read_number_field(field, record->data, &val)) | 6432 | if (tep_read_number_field(field, record->data, &val)) |
| 6447 | goto failed; | 6433 | goto failed; |
| 6448 | 6434 | ||
| 6449 | func = find_func(pevent, val); | 6435 | func = find_func(pevent, val); |
| @@ -6461,9 +6447,9 @@ int pevent_print_func_field(struct trace_seq *s, const char *fmt, | |||
| 6461 | return -1; | 6447 | return -1; |
| 6462 | } | 6448 | } |
| 6463 | 6449 | ||
| 6464 | static void free_func_handle(struct pevent_function_handler *func) | 6450 | static void free_func_handle(struct tep_function_handler *func) |
| 6465 | { | 6451 | { |
| 6466 | struct pevent_func_params *params; | 6452 | struct func_params *params; |
| 6467 | 6453 | ||
| 6468 | free(func->name); | 6454 | free(func->name); |
| 6469 | 6455 | ||
| @@ -6477,29 +6463,29 @@ static void free_func_handle(struct pevent_function_handler *func) | |||
| 6477 | } | 6463 | } |
| 6478 | 6464 | ||
| 6479 | /** | 6465 | /** |
| 6480 | * pevent_register_print_function - register a helper function | 6466 | * tep_register_print_function - register a helper function |
| 6481 | * @pevent: the handle to the pevent | 6467 | * @pevent: the handle to the pevent |
| 6482 | * @func: the function to process the helper function | 6468 | * @func: the function to process the helper function |
| 6483 | * @ret_type: the return type of the helper function | 6469 | * @ret_type: the return type of the helper function |
| 6484 | * @name: the name of the helper function | 6470 | * @name: the name of the helper function |
| 6485 | * @parameters: A list of enum pevent_func_arg_type | 6471 | * @parameters: A list of enum tep_func_arg_type |
| 6486 | * | 6472 | * |
| 6487 | * Some events may have helper functions in the print format arguments. | 6473 | * Some events may have helper functions in the print format arguments. |
| 6488 | * This allows a plugin to dynamically create a way to process one | 6474 | * This allows a plugin to dynamically create a way to process one |
| 6489 | * of these functions. | 6475 | * of these functions. |
| 6490 | * | 6476 | * |
| 6491 | * The @parameters is a variable list of pevent_func_arg_type enums that | 6477 | * The @parameters is a variable list of tep_func_arg_type enums that |
| 6492 | * must end with PEVENT_FUNC_ARG_VOID. | 6478 | * must end with TEP_FUNC_ARG_VOID. |
| 6493 | */ | 6479 | */ |
| 6494 | int pevent_register_print_function(struct pevent *pevent, | 6480 | int tep_register_print_function(struct tep_handle *pevent, |
| 6495 | pevent_func_handler func, | 6481 | tep_func_handler func, |
| 6496 | enum pevent_func_arg_type ret_type, | 6482 | enum tep_func_arg_type ret_type, |
| 6497 | char *name, ...) | 6483 | char *name, ...) |
| 6498 | { | 6484 | { |
| 6499 | struct pevent_function_handler *func_handle; | 6485 | struct tep_function_handler *func_handle; |
| 6500 | struct pevent_func_params **next_param; | 6486 | struct func_params **next_param; |
| 6501 | struct pevent_func_params *param; | 6487 | struct func_params *param; |
| 6502 | enum pevent_func_arg_type type; | 6488 | enum tep_func_arg_type type; |
| 6503 | va_list ap; | 6489 | va_list ap; |
| 6504 | int ret; | 6490 | int ret; |
| 6505 | 6491 | ||
| @@ -6517,7 +6503,7 @@ int pevent_register_print_function(struct pevent *pevent, | |||
| 6517 | func_handle = calloc(1, sizeof(*func_handle)); | 6503 | func_handle = calloc(1, sizeof(*func_handle)); |
| 6518 | if (!func_handle) { | 6504 | if (!func_handle) { |
| 6519 | do_warning("Failed to allocate function handler"); | 6505 | do_warning("Failed to allocate function handler"); |
| 6520 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6506 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6521 | } | 6507 | } |
| 6522 | 6508 | ||
| 6523 | func_handle->ret_type = ret_type; | 6509 | func_handle->ret_type = ret_type; |
| @@ -6526,26 +6512,26 @@ int pevent_register_print_function(struct pevent *pevent, | |||
| 6526 | if (!func_handle->name) { | 6512 | if (!func_handle->name) { |
| 6527 | do_warning("Failed to allocate function name"); | 6513 | do_warning("Failed to allocate function name"); |
| 6528 | free(func_handle); | 6514 | free(func_handle); |
| 6529 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6515 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6530 | } | 6516 | } |
| 6531 | 6517 | ||
| 6532 | next_param = &(func_handle->params); | 6518 | next_param = &(func_handle->params); |
| 6533 | va_start(ap, name); | 6519 | va_start(ap, name); |
| 6534 | for (;;) { | 6520 | for (;;) { |
| 6535 | type = va_arg(ap, enum pevent_func_arg_type); | 6521 | type = va_arg(ap, enum tep_func_arg_type); |
| 6536 | if (type == PEVENT_FUNC_ARG_VOID) | 6522 | if (type == TEP_FUNC_ARG_VOID) |
| 6537 | break; | 6523 | break; |
| 6538 | 6524 | ||
| 6539 | if (type >= PEVENT_FUNC_ARG_MAX_TYPES) { | 6525 | if (type >= TEP_FUNC_ARG_MAX_TYPES) { |
| 6540 | do_warning("Invalid argument type %d", type); | 6526 | do_warning("Invalid argument type %d", type); |
| 6541 | ret = PEVENT_ERRNO__INVALID_ARG_TYPE; | 6527 | ret = TEP_ERRNO__INVALID_ARG_TYPE; |
| 6542 | goto out_free; | 6528 | goto out_free; |
| 6543 | } | 6529 | } |
| 6544 | 6530 | ||
| 6545 | param = malloc(sizeof(*param)); | 6531 | param = malloc(sizeof(*param)); |
| 6546 | if (!param) { | 6532 | if (!param) { |
| 6547 | do_warning("Failed to allocate function param"); | 6533 | do_warning("Failed to allocate function param"); |
| 6548 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6534 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6549 | goto out_free; | 6535 | goto out_free; |
| 6550 | } | 6536 | } |
| 6551 | param->type = type; | 6537 | param->type = type; |
| @@ -6569,7 +6555,7 @@ int pevent_register_print_function(struct pevent *pevent, | |||
| 6569 | } | 6555 | } |
| 6570 | 6556 | ||
| 6571 | /** | 6557 | /** |
| 6572 | * pevent_unregister_print_function - unregister a helper function | 6558 | * tep_unregister_print_function - unregister a helper function |
| 6573 | * @pevent: the handle to the pevent | 6559 | * @pevent: the handle to the pevent |
| 6574 | * @func: the function to process the helper function | 6560 | * @func: the function to process the helper function |
| 6575 | * @name: the name of the helper function | 6561 | * @name: the name of the helper function |
| @@ -6578,10 +6564,10 @@ int pevent_register_print_function(struct pevent *pevent, | |||
| 6578 | * | 6564 | * |
| 6579 | * Returns 0 if the handler was removed successully, -1 otherwise. | 6565 | * Returns 0 if the handler was removed successully, -1 otherwise. |
| 6580 | */ | 6566 | */ |
| 6581 | int pevent_unregister_print_function(struct pevent *pevent, | 6567 | int tep_unregister_print_function(struct tep_handle *pevent, |
| 6582 | pevent_func_handler func, char *name) | 6568 | tep_func_handler func, char *name) |
| 6583 | { | 6569 | { |
| 6584 | struct pevent_function_handler *func_handle; | 6570 | struct tep_function_handler *func_handle; |
| 6585 | 6571 | ||
| 6586 | func_handle = find_func_handler(pevent, name); | 6572 | func_handle = find_func_handler(pevent, name); |
| 6587 | if (func_handle && func_handle->func == func) { | 6573 | if (func_handle && func_handle->func == func) { |
| @@ -6591,15 +6577,15 @@ int pevent_unregister_print_function(struct pevent *pevent, | |||
| 6591 | return -1; | 6577 | return -1; |
| 6592 | } | 6578 | } |
| 6593 | 6579 | ||
| 6594 | static struct event_format *pevent_search_event(struct pevent *pevent, int id, | 6580 | static struct event_format *search_event(struct tep_handle *pevent, int id, |
| 6595 | const char *sys_name, | 6581 | const char *sys_name, |
| 6596 | const char *event_name) | 6582 | const char *event_name) |
| 6597 | { | 6583 | { |
| 6598 | struct event_format *event; | 6584 | struct event_format *event; |
| 6599 | 6585 | ||
| 6600 | if (id >= 0) { | 6586 | if (id >= 0) { |
| 6601 | /* search by id */ | 6587 | /* search by id */ |
| 6602 | event = pevent_find_event(pevent, id); | 6588 | event = tep_find_event(pevent, id); |
| 6603 | if (!event) | 6589 | if (!event) |
| 6604 | return NULL; | 6590 | return NULL; |
| 6605 | if (event_name && (strcmp(event_name, event->name) != 0)) | 6591 | if (event_name && (strcmp(event_name, event->name) != 0)) |
| @@ -6607,7 +6593,7 @@ static struct event_format *pevent_search_event(struct pevent *pevent, int id, | |||
| 6607 | if (sys_name && (strcmp(sys_name, event->system) != 0)) | 6593 | if (sys_name && (strcmp(sys_name, event->system) != 0)) |
| 6608 | return NULL; | 6594 | return NULL; |
| 6609 | } else { | 6595 | } else { |
| 6610 | event = pevent_find_event_by_name(pevent, sys_name, event_name); | 6596 | event = tep_find_event_by_name(pevent, sys_name, event_name); |
| 6611 | if (!event) | 6597 | if (!event) |
| 6612 | return NULL; | 6598 | return NULL; |
| 6613 | } | 6599 | } |
| @@ -6615,7 +6601,7 @@ static struct event_format *pevent_search_event(struct pevent *pevent, int id, | |||
| 6615 | } | 6601 | } |
| 6616 | 6602 | ||
| 6617 | /** | 6603 | /** |
| 6618 | * pevent_register_event_handler - register a way to parse an event | 6604 | * tep_register_event_handler - register a way to parse an event |
| 6619 | * @pevent: the handle to the pevent | 6605 | * @pevent: the handle to the pevent |
| 6620 | * @id: the id of the event to register | 6606 | * @id: the id of the event to register |
| 6621 | * @sys_name: the system name the event belongs to | 6607 | * @sys_name: the system name the event belongs to |
| @@ -6631,14 +6617,14 @@ static struct event_format *pevent_search_event(struct pevent *pevent, int id, | |||
| 6631 | * If @id is >= 0, then it is used to find the event. | 6617 | * If @id is >= 0, then it is used to find the event. |
| 6632 | * else @sys_name and @event_name are used. | 6618 | * else @sys_name and @event_name are used. |
| 6633 | */ | 6619 | */ |
| 6634 | int pevent_register_event_handler(struct pevent *pevent, int id, | 6620 | int tep_register_event_handler(struct tep_handle *pevent, int id, |
| 6635 | const char *sys_name, const char *event_name, | 6621 | const char *sys_name, const char *event_name, |
| 6636 | pevent_event_handler_func func, void *context) | 6622 | tep_event_handler_func func, void *context) |
| 6637 | { | 6623 | { |
| 6638 | struct event_format *event; | 6624 | struct event_format *event; |
| 6639 | struct event_handler *handle; | 6625 | struct event_handler *handle; |
| 6640 | 6626 | ||
| 6641 | event = pevent_search_event(pevent, id, sys_name, event_name); | 6627 | event = search_event(pevent, id, sys_name, event_name); |
| 6642 | if (event == NULL) | 6628 | if (event == NULL) |
| 6643 | goto not_found; | 6629 | goto not_found; |
| 6644 | 6630 | ||
| @@ -6654,7 +6640,7 @@ int pevent_register_event_handler(struct pevent *pevent, int id, | |||
| 6654 | handle = calloc(1, sizeof(*handle)); | 6640 | handle = calloc(1, sizeof(*handle)); |
| 6655 | if (!handle) { | 6641 | if (!handle) { |
| 6656 | do_warning("Failed to allocate event handler"); | 6642 | do_warning("Failed to allocate event handler"); |
| 6657 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6643 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6658 | } | 6644 | } |
| 6659 | 6645 | ||
| 6660 | handle->id = id; | 6646 | handle->id = id; |
| @@ -6669,7 +6655,7 @@ int pevent_register_event_handler(struct pevent *pevent, int id, | |||
| 6669 | free((void *)handle->event_name); | 6655 | free((void *)handle->event_name); |
| 6670 | free((void *)handle->sys_name); | 6656 | free((void *)handle->sys_name); |
| 6671 | free(handle); | 6657 | free(handle); |
| 6672 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 6658 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 6673 | } | 6659 | } |
| 6674 | 6660 | ||
| 6675 | handle->func = func; | 6661 | handle->func = func; |
| @@ -6682,7 +6668,7 @@ int pevent_register_event_handler(struct pevent *pevent, int id, | |||
| 6682 | 6668 | ||
| 6683 | static int handle_matches(struct event_handler *handler, int id, | 6669 | static int handle_matches(struct event_handler *handler, int id, |
| 6684 | const char *sys_name, const char *event_name, | 6670 | const char *sys_name, const char *event_name, |
| 6685 | pevent_event_handler_func func, void *context) | 6671 | tep_event_handler_func func, void *context) |
| 6686 | { | 6672 | { |
| 6687 | if (id >= 0 && id != handler->id) | 6673 | if (id >= 0 && id != handler->id) |
| 6688 | return 0; | 6674 | return 0; |
| @@ -6700,7 +6686,7 @@ static int handle_matches(struct event_handler *handler, int id, | |||
| 6700 | } | 6686 | } |
| 6701 | 6687 | ||
| 6702 | /** | 6688 | /** |
| 6703 | * pevent_unregister_event_handler - unregister an existing event handler | 6689 | * tep_unregister_event_handler - unregister an existing event handler |
| 6704 | * @pevent: the handle to the pevent | 6690 | * @pevent: the handle to the pevent |
| 6705 | * @id: the id of the event to unregister | 6691 | * @id: the id of the event to unregister |
| 6706 | * @sys_name: the system name the handler belongs to | 6692 | * @sys_name: the system name the handler belongs to |
| @@ -6715,15 +6701,15 @@ static int handle_matches(struct event_handler *handler, int id, | |||
| 6715 | * | 6701 | * |
| 6716 | * Returns 0 if handler was removed successfully, -1 if event was not found. | 6702 | * Returns 0 if handler was removed successfully, -1 if event was not found. |
| 6717 | */ | 6703 | */ |
| 6718 | int pevent_unregister_event_handler(struct pevent *pevent, int id, | 6704 | int tep_unregister_event_handler(struct tep_handle *pevent, int id, |
| 6719 | const char *sys_name, const char *event_name, | 6705 | const char *sys_name, const char *event_name, |
| 6720 | pevent_event_handler_func func, void *context) | 6706 | tep_event_handler_func func, void *context) |
| 6721 | { | 6707 | { |
| 6722 | struct event_format *event; | 6708 | struct event_format *event; |
| 6723 | struct event_handler *handle; | 6709 | struct event_handler *handle; |
| 6724 | struct event_handler **next; | 6710 | struct event_handler **next; |
| 6725 | 6711 | ||
| 6726 | event = pevent_search_event(pevent, id, sys_name, event_name); | 6712 | event = search_event(pevent, id, sys_name, event_name); |
| 6727 | if (event == NULL) | 6713 | if (event == NULL) |
| 6728 | goto not_found; | 6714 | goto not_found; |
| 6729 | 6715 | ||
| @@ -6754,11 +6740,11 @@ not_found: | |||
| 6754 | } | 6740 | } |
| 6755 | 6741 | ||
| 6756 | /** | 6742 | /** |
| 6757 | * pevent_alloc - create a pevent handle | 6743 | * tep_alloc - create a pevent handle |
| 6758 | */ | 6744 | */ |
| 6759 | struct pevent *pevent_alloc(void) | 6745 | struct tep_handle *tep_alloc(void) |
| 6760 | { | 6746 | { |
| 6761 | struct pevent *pevent = calloc(1, sizeof(*pevent)); | 6747 | struct tep_handle *pevent = calloc(1, sizeof(*pevent)); |
| 6762 | 6748 | ||
| 6763 | if (pevent) | 6749 | if (pevent) |
| 6764 | pevent->ref_count = 1; | 6750 | pevent->ref_count = 1; |
| @@ -6766,12 +6752,12 @@ struct pevent *pevent_alloc(void) | |||
| 6766 | return pevent; | 6752 | return pevent; |
| 6767 | } | 6753 | } |
| 6768 | 6754 | ||
| 6769 | void pevent_ref(struct pevent *pevent) | 6755 | void tep_ref(struct tep_handle *pevent) |
| 6770 | { | 6756 | { |
| 6771 | pevent->ref_count++; | 6757 | pevent->ref_count++; |
| 6772 | } | 6758 | } |
| 6773 | 6759 | ||
| 6774 | void pevent_free_format_field(struct format_field *field) | 6760 | void tep_free_format_field(struct format_field *field) |
| 6775 | { | 6761 | { |
| 6776 | free(field->type); | 6762 | free(field->type); |
| 6777 | if (field->alias != field->name) | 6763 | if (field->alias != field->name) |
| @@ -6786,7 +6772,7 @@ static void free_format_fields(struct format_field *field) | |||
| 6786 | 6772 | ||
| 6787 | while (field) { | 6773 | while (field) { |
| 6788 | next = field->next; | 6774 | next = field->next; |
| 6789 | pevent_free_format_field(field); | 6775 | tep_free_format_field(field); |
| 6790 | field = next; | 6776 | field = next; |
| 6791 | } | 6777 | } |
| 6792 | } | 6778 | } |
| @@ -6797,7 +6783,7 @@ static void free_formats(struct format *format) | |||
| 6797 | free_format_fields(format->fields); | 6783 | free_format_fields(format->fields); |
| 6798 | } | 6784 | } |
| 6799 | 6785 | ||
| 6800 | void pevent_free_format(struct event_format *event) | 6786 | void tep_free_format(struct event_format *event) |
| 6801 | { | 6787 | { |
| 6802 | free(event->name); | 6788 | free(event->name); |
| 6803 | free(event->system); | 6789 | free(event->system); |
| @@ -6811,15 +6797,15 @@ void pevent_free_format(struct event_format *event) | |||
| 6811 | } | 6797 | } |
| 6812 | 6798 | ||
| 6813 | /** | 6799 | /** |
| 6814 | * pevent_free - free a pevent handle | 6800 | * tep_free - free a pevent handle |
| 6815 | * @pevent: the pevent handle to free | 6801 | * @pevent: the pevent handle to free |
| 6816 | */ | 6802 | */ |
| 6817 | void pevent_free(struct pevent *pevent) | 6803 | void tep_free(struct tep_handle *pevent) |
| 6818 | { | 6804 | { |
| 6819 | struct cmdline_list *cmdlist, *cmdnext; | 6805 | struct cmdline_list *cmdlist, *cmdnext; |
| 6820 | struct func_list *funclist, *funcnext; | 6806 | struct func_list *funclist, *funcnext; |
| 6821 | struct printk_list *printklist, *printknext; | 6807 | struct printk_list *printklist, *printknext; |
| 6822 | struct pevent_function_handler *func_handler; | 6808 | struct tep_function_handler *func_handler; |
| 6823 | struct event_handler *handle; | 6809 | struct event_handler *handle; |
| 6824 | int i; | 6810 | int i; |
| 6825 | 6811 | ||
| @@ -6883,7 +6869,7 @@ void pevent_free(struct pevent *pevent) | |||
| 6883 | } | 6869 | } |
| 6884 | 6870 | ||
| 6885 | for (i = 0; i < pevent->nr_events; i++) | 6871 | for (i = 0; i < pevent->nr_events; i++) |
| 6886 | pevent_free_format(pevent->events[i]); | 6872 | tep_free_format(pevent->events[i]); |
| 6887 | 6873 | ||
| 6888 | while (pevent->handlers) { | 6874 | while (pevent->handlers) { |
| 6889 | handle = pevent->handlers; | 6875 | handle = pevent->handlers; |
| @@ -6899,7 +6885,7 @@ void pevent_free(struct pevent *pevent) | |||
| 6899 | free(pevent); | 6885 | free(pevent); |
| 6900 | } | 6886 | } |
| 6901 | 6887 | ||
| 6902 | void pevent_unref(struct pevent *pevent) | 6888 | void tep_unref(struct tep_handle *pevent) |
| 6903 | { | 6889 | { |
| 6904 | pevent_free(pevent); | 6890 | tep_free(pevent); |
| 6905 | } | 6891 | } |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 0c03538df74c..44b7c2d41f9f 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | #define DEBUG_RECORD 0 | 41 | #define DEBUG_RECORD 0 |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | struct pevent_record { | 44 | struct tep_record { |
| 45 | unsigned long long ts; | 45 | unsigned long long ts; |
| 46 | unsigned long long offset; | 46 | unsigned long long offset; |
| 47 | long long missed_events; /* buffer dropped events before */ | 47 | long long missed_events; /* buffer dropped events before */ |
| @@ -53,8 +53,8 @@ struct pevent_record { | |||
| 53 | int locked; /* Do not free, even if ref_count is zero */ | 53 | int locked; /* Do not free, even if ref_count is zero */ |
| 54 | void *priv; | 54 | void *priv; |
| 55 | #if DEBUG_RECORD | 55 | #if DEBUG_RECORD |
| 56 | struct pevent_record *prev; | 56 | struct tep_record *prev; |
| 57 | struct pevent_record *next; | 57 | struct tep_record *next; |
| 58 | long alloc_addr; | 58 | long alloc_addr; |
| 59 | #endif | 59 | #endif |
| 60 | }; | 60 | }; |
| @@ -98,19 +98,19 @@ extern int trace_seq_do_printf(struct trace_seq *s); | |||
| 98 | 98 | ||
| 99 | /* ----------------------- pevent ----------------------- */ | 99 | /* ----------------------- pevent ----------------------- */ |
| 100 | 100 | ||
| 101 | struct pevent; | 101 | struct tep_handle; |
| 102 | struct event_format; | 102 | struct event_format; |
| 103 | 103 | ||
| 104 | typedef int (*pevent_event_handler_func)(struct trace_seq *s, | 104 | typedef int (*tep_event_handler_func)(struct trace_seq *s, |
| 105 | struct pevent_record *record, | 105 | struct tep_record *record, |
| 106 | struct event_format *event, | 106 | struct event_format *event, |
| 107 | void *context); | 107 | void *context); |
| 108 | 108 | ||
| 109 | typedef int (*pevent_plugin_load_func)(struct pevent *pevent); | 109 | typedef int (*tep_plugin_load_func)(struct tep_handle *pevent); |
| 110 | typedef int (*pevent_plugin_unload_func)(struct pevent *pevent); | 110 | typedef int (*tep_plugin_unload_func)(struct tep_handle *pevent); |
| 111 | 111 | ||
| 112 | struct pevent_plugin_option { | 112 | struct tep_plugin_option { |
| 113 | struct pevent_plugin_option *next; | 113 | struct tep_plugin_option *next; |
| 114 | void *handle; | 114 | void *handle; |
| 115 | char *file; | 115 | char *file; |
| 116 | char *name; | 116 | char *name; |
| @@ -124,20 +124,20 @@ struct pevent_plugin_option { | |||
| 124 | /* | 124 | /* |
| 125 | * Plugin hooks that can be called: | 125 | * Plugin hooks that can be called: |
| 126 | * | 126 | * |
| 127 | * PEVENT_PLUGIN_LOADER: (required) | 127 | * TEP_PLUGIN_LOADER: (required) |
| 128 | * The function name to initialized the plugin. | 128 | * The function name to initialized the plugin. |
| 129 | * | 129 | * |
| 130 | * int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 130 | * int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 131 | * | 131 | * |
| 132 | * PEVENT_PLUGIN_UNLOADER: (optional) | 132 | * TEP_PLUGIN_UNLOADER: (optional) |
| 133 | * The function called just before unloading | 133 | * The function called just before unloading |
| 134 | * | 134 | * |
| 135 | * int PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 135 | * int TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 136 | * | 136 | * |
| 137 | * PEVENT_PLUGIN_OPTIONS: (optional) | 137 | * TEP_PLUGIN_OPTIONS: (optional) |
| 138 | * Plugin options that can be set before loading | 138 | * Plugin options that can be set before loading |
| 139 | * | 139 | * |
| 140 | * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { | 140 | * struct tep_plugin_option TEP_PLUGIN_OPTIONS[] = { |
| 141 | * { | 141 | * { |
| 142 | * .name = "option-name", | 142 | * .name = "option-name", |
| 143 | * .plugin_alias = "override-file-name", (optional) | 143 | * .plugin_alias = "override-file-name", (optional) |
| @@ -158,19 +158,19 @@ struct pevent_plugin_option { | |||
| 158 | * .set will be processed. If .value is defined, then it is considered | 158 | * .set will be processed. If .value is defined, then it is considered |
| 159 | * a string option and .set will be ignored. | 159 | * a string option and .set will be ignored. |
| 160 | * | 160 | * |
| 161 | * PEVENT_PLUGIN_ALIAS: (optional) | 161 | * TEP_PLUGIN_ALIAS: (optional) |
| 162 | * The name to use for finding options (uses filename if not defined) | 162 | * The name to use for finding options (uses filename if not defined) |
| 163 | */ | 163 | */ |
| 164 | #define PEVENT_PLUGIN_LOADER pevent_plugin_loader | 164 | #define TEP_PLUGIN_LOADER tep_plugin_loader |
| 165 | #define PEVENT_PLUGIN_UNLOADER pevent_plugin_unloader | 165 | #define TEP_PLUGIN_UNLOADER tep_plugin_unloader |
| 166 | #define PEVENT_PLUGIN_OPTIONS pevent_plugin_options | 166 | #define TEP_PLUGIN_OPTIONS tep_plugin_options |
| 167 | #define PEVENT_PLUGIN_ALIAS pevent_plugin_alias | 167 | #define TEP_PLUGIN_ALIAS tep_plugin_alias |
| 168 | #define _MAKE_STR(x) #x | 168 | #define _MAKE_STR(x) #x |
| 169 | #define MAKE_STR(x) _MAKE_STR(x) | 169 | #define MAKE_STR(x) _MAKE_STR(x) |
| 170 | #define PEVENT_PLUGIN_LOADER_NAME MAKE_STR(PEVENT_PLUGIN_LOADER) | 170 | #define TEP_PLUGIN_LOADER_NAME MAKE_STR(TEP_PLUGIN_LOADER) |
| 171 | #define PEVENT_PLUGIN_UNLOADER_NAME MAKE_STR(PEVENT_PLUGIN_UNLOADER) | 171 | #define TEP_PLUGIN_UNLOADER_NAME MAKE_STR(TEP_PLUGIN_UNLOADER) |
| 172 | #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS) | 172 | #define TEP_PLUGIN_OPTIONS_NAME MAKE_STR(TEP_PLUGIN_OPTIONS) |
| 173 | #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS) | 173 | #define TEP_PLUGIN_ALIAS_NAME MAKE_STR(TEP_PLUGIN_ALIAS) |
| 174 | 174 | ||
| 175 | enum format_flags { | 175 | enum format_flags { |
| 176 | FIELD_IS_ARRAY = 1, | 176 | FIELD_IS_ARRAY = 1, |
| @@ -269,10 +269,10 @@ struct print_arg_op { | |||
| 269 | struct print_arg *right; | 269 | struct print_arg *right; |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | struct pevent_function_handler; | 272 | struct tep_function_handler; |
| 273 | 273 | ||
| 274 | struct print_arg_func { | 274 | struct print_arg_func { |
| 275 | struct pevent_function_handler *func; | 275 | struct tep_function_handler *func; |
| 276 | struct print_arg *args; | 276 | struct print_arg *args; |
| 277 | }; | 277 | }; |
| 278 | 278 | ||
| @@ -320,14 +320,14 @@ struct print_fmt { | |||
| 320 | }; | 320 | }; |
| 321 | 321 | ||
| 322 | struct event_format { | 322 | struct event_format { |
| 323 | struct pevent *pevent; | 323 | struct tep_handle *pevent; |
| 324 | char *name; | 324 | char *name; |
| 325 | int id; | 325 | int id; |
| 326 | int flags; | 326 | int flags; |
| 327 | struct format format; | 327 | struct format format; |
| 328 | struct print_fmt print_fmt; | 328 | struct print_fmt print_fmt; |
| 329 | char *system; | 329 | char *system; |
| 330 | pevent_event_handler_func handler; | 330 | tep_event_handler_func handler; |
| 331 | void *context; | 331 | void *context; |
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| @@ -361,25 +361,25 @@ enum event_type { | |||
| 361 | EVENT_SQUOTE, | 361 | EVENT_SQUOTE, |
| 362 | }; | 362 | }; |
| 363 | 363 | ||
| 364 | typedef unsigned long long (*pevent_func_handler)(struct trace_seq *s, | 364 | typedef unsigned long long (*tep_func_handler)(struct trace_seq *s, |
| 365 | unsigned long long *args); | 365 | unsigned long long *args); |
| 366 | 366 | ||
| 367 | enum pevent_func_arg_type { | 367 | enum tep_func_arg_type { |
| 368 | PEVENT_FUNC_ARG_VOID, | 368 | TEP_FUNC_ARG_VOID, |
| 369 | PEVENT_FUNC_ARG_INT, | 369 | TEP_FUNC_ARG_INT, |
| 370 | PEVENT_FUNC_ARG_LONG, | 370 | TEP_FUNC_ARG_LONG, |
| 371 | PEVENT_FUNC_ARG_STRING, | 371 | TEP_FUNC_ARG_STRING, |
| 372 | PEVENT_FUNC_ARG_PTR, | 372 | TEP_FUNC_ARG_PTR, |
| 373 | PEVENT_FUNC_ARG_MAX_TYPES | 373 | TEP_FUNC_ARG_MAX_TYPES |
| 374 | }; | 374 | }; |
| 375 | 375 | ||
| 376 | enum pevent_flag { | 376 | enum tep_flag { |
| 377 | PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ | 377 | TEP_NSEC_OUTPUT = 1, /* output in NSECS */ |
| 378 | PEVENT_DISABLE_SYS_PLUGINS = 1 << 1, | 378 | TEP_DISABLE_SYS_PLUGINS = 1 << 1, |
| 379 | PEVENT_DISABLE_PLUGINS = 1 << 2, | 379 | TEP_DISABLE_PLUGINS = 1 << 2, |
| 380 | }; | 380 | }; |
| 381 | 381 | ||
| 382 | #define PEVENT_ERRORS \ | 382 | #define TEP_ERRORS \ |
| 383 | _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \ | 383 | _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \ |
| 384 | _PE(PARSE_EVENT_FAILED, "failed to parse event"), \ | 384 | _PE(PARSE_EVENT_FAILED, "failed to parse event"), \ |
| 385 | _PE(READ_ID_FAILED, "failed to read event id"), \ | 385 | _PE(READ_ID_FAILED, "failed to read event id"), \ |
| @@ -411,10 +411,10 @@ enum pevent_flag { | |||
| 411 | _PE(FILTER_MISS, "record does not match to filter") | 411 | _PE(FILTER_MISS, "record does not match to filter") |
| 412 | 412 | ||
| 413 | #undef _PE | 413 | #undef _PE |
| 414 | #define _PE(__code, __str) PEVENT_ERRNO__ ## __code | 414 | #define _PE(__code, __str) TEP_ERRNO__ ## __code |
| 415 | enum pevent_errno { | 415 | enum tep_errno { |
| 416 | PEVENT_ERRNO__SUCCESS = 0, | 416 | TEP_ERRNO__SUCCESS = 0, |
| 417 | PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS, | 417 | TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS, |
| 418 | 418 | ||
| 419 | /* | 419 | /* |
| 420 | * Choose an arbitrary negative big number not to clash with standard | 420 | * Choose an arbitrary negative big number not to clash with standard |
| @@ -423,11 +423,11 @@ enum pevent_errno { | |||
| 423 | * | 423 | * |
| 424 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html | 424 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html |
| 425 | */ | 425 | */ |
| 426 | __PEVENT_ERRNO__START = -100000, | 426 | __TEP_ERRNO__START = -100000, |
| 427 | 427 | ||
| 428 | PEVENT_ERRORS, | 428 | TEP_ERRORS, |
| 429 | 429 | ||
| 430 | __PEVENT_ERRNO__END, | 430 | __TEP_ERRNO__END, |
| 431 | }; | 431 | }; |
| 432 | #undef _PE | 432 | #undef _PE |
| 433 | 433 | ||
| @@ -435,17 +435,17 @@ struct plugin_list; | |||
| 435 | 435 | ||
| 436 | #define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) | 436 | #define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1)) |
| 437 | 437 | ||
| 438 | struct plugin_list *traceevent_load_plugins(struct pevent *pevent); | 438 | struct plugin_list *tep_load_plugins(struct tep_handle *pevent); |
| 439 | void traceevent_unload_plugins(struct plugin_list *plugin_list, | 439 | void tep_unload_plugins(struct plugin_list *plugin_list, |
| 440 | struct pevent *pevent); | 440 | struct tep_handle *pevent); |
| 441 | char **traceevent_plugin_list_options(void); | 441 | char **tep_plugin_list_options(void); |
| 442 | void traceevent_plugin_free_options_list(char **list); | 442 | void tep_plugin_free_options_list(char **list); |
| 443 | int traceevent_plugin_add_options(const char *name, | 443 | int tep_plugin_add_options(const char *name, |
| 444 | struct pevent_plugin_option *options); | 444 | struct tep_plugin_option *options); |
| 445 | void traceevent_plugin_remove_options(struct pevent_plugin_option *options); | 445 | void tep_plugin_remove_options(struct tep_plugin_option *options); |
| 446 | void traceevent_print_plugins(struct trace_seq *s, | 446 | void tep_print_plugins(struct trace_seq *s, |
| 447 | const char *prefix, const char *suffix, | 447 | const char *prefix, const char *suffix, |
| 448 | const struct plugin_list *list); | 448 | const struct plugin_list *list); |
| 449 | 449 | ||
| 450 | struct cmdline; | 450 | struct cmdline; |
| 451 | struct cmdline_list; | 451 | struct cmdline_list; |
| @@ -454,10 +454,10 @@ struct func_list; | |||
| 454 | struct event_handler; | 454 | struct event_handler; |
| 455 | struct func_resolver; | 455 | struct func_resolver; |
| 456 | 456 | ||
| 457 | typedef char *(pevent_func_resolver_t)(void *priv, | 457 | typedef char *(tep_func_resolver_t)(void *priv, |
| 458 | unsigned long long *addrp, char **modp); | 458 | unsigned long long *addrp, char **modp); |
| 459 | 459 | ||
| 460 | struct pevent { | 460 | struct tep_handle { |
| 461 | int ref_count; | 461 | int ref_count; |
| 462 | 462 | ||
| 463 | int header_page_ts_offset; | 463 | int header_page_ts_offset; |
| @@ -524,7 +524,7 @@ struct pevent { | |||
| 524 | struct format_field *bprint_buf_field; | 524 | struct format_field *bprint_buf_field; |
| 525 | 525 | ||
| 526 | struct event_handler *handlers; | 526 | struct event_handler *handlers; |
| 527 | struct pevent_function_handler *func_handlers; | 527 | struct tep_function_handler *func_handlers; |
| 528 | 528 | ||
| 529 | /* cache */ | 529 | /* cache */ |
| 530 | struct event_format *last_event; | 530 | struct event_format *last_event; |
| @@ -532,13 +532,13 @@ struct pevent { | |||
| 532 | char *trace_clock; | 532 | char *trace_clock; |
| 533 | }; | 533 | }; |
| 534 | 534 | ||
| 535 | static inline void pevent_set_flag(struct pevent *pevent, int flag) | 535 | static inline void tep_set_flag(struct tep_handle *pevent, int flag) |
| 536 | { | 536 | { |
| 537 | pevent->flags |= flag; | 537 | pevent->flags |= flag; |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | static inline unsigned short | 540 | static inline unsigned short |
| 541 | __data2host2(struct pevent *pevent, unsigned short data) | 541 | __data2host2(struct tep_handle *pevent, unsigned short data) |
| 542 | { | 542 | { |
| 543 | unsigned short swap; | 543 | unsigned short swap; |
| 544 | 544 | ||
| @@ -552,7 +552,7 @@ __data2host2(struct pevent *pevent, unsigned short data) | |||
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | static inline unsigned int | 554 | static inline unsigned int |
| 555 | __data2host4(struct pevent *pevent, unsigned int data) | 555 | __data2host4(struct tep_handle *pevent, unsigned int data) |
| 556 | { | 556 | { |
| 557 | unsigned int swap; | 557 | unsigned int swap; |
| 558 | 558 | ||
| @@ -568,7 +568,7 @@ __data2host4(struct pevent *pevent, unsigned int data) | |||
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | static inline unsigned long long | 570 | static inline unsigned long long |
| 571 | __data2host8(struct pevent *pevent, unsigned long long data) | 571 | __data2host8(struct tep_handle *pevent, unsigned long long data) |
| 572 | { | 572 | { |
| 573 | unsigned long long swap; | 573 | unsigned long long swap; |
| 574 | 574 | ||
| @@ -597,7 +597,7 @@ __data2host8(struct pevent *pevent, unsigned long long data) | |||
| 597 | __data2host8(pevent, __val); \ | 597 | __data2host8(pevent, __val); \ |
| 598 | }) | 598 | }) |
| 599 | 599 | ||
| 600 | static inline int traceevent_host_bigendian(void) | 600 | static inline int tep_host_bigendian(void) |
| 601 | { | 601 | { |
| 602 | unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 }; | 602 | unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 }; |
| 603 | unsigned int val; | 603 | unsigned int val; |
| @@ -615,198 +615,198 @@ enum trace_flag_type { | |||
| 615 | TRACE_FLAG_SOFTIRQ = 0x10, | 615 | TRACE_FLAG_SOFTIRQ = 0x10, |
| 616 | }; | 616 | }; |
| 617 | 617 | ||
| 618 | int pevent_set_function_resolver(struct pevent *pevent, | 618 | int tep_set_function_resolver(struct tep_handle *pevent, |
| 619 | pevent_func_resolver_t *func, void *priv); | 619 | tep_func_resolver_t *func, void *priv); |
| 620 | void pevent_reset_function_resolver(struct pevent *pevent); | 620 | void tep_reset_function_resolver(struct tep_handle *pevent); |
| 621 | int pevent_register_comm(struct pevent *pevent, const char *comm, int pid); | 621 | int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid); |
| 622 | int pevent_register_trace_clock(struct pevent *pevent, const char *trace_clock); | 622 | int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock); |
| 623 | int pevent_register_function(struct pevent *pevent, char *name, | 623 | int tep_register_function(struct tep_handle *pevent, char *name, |
| 624 | unsigned long long addr, char *mod); | 624 | unsigned long long addr, char *mod); |
| 625 | int pevent_register_print_string(struct pevent *pevent, const char *fmt, | 625 | int tep_register_print_string(struct tep_handle *pevent, const char *fmt, |
| 626 | unsigned long long addr); | 626 | unsigned long long addr); |
| 627 | int pevent_pid_is_registered(struct pevent *pevent, int pid); | 627 | int tep_pid_is_registered(struct tep_handle *pevent, int pid); |
| 628 | 628 | ||
| 629 | void pevent_print_event_task(struct pevent *pevent, struct trace_seq *s, | 629 | void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s, |
| 630 | struct event_format *event, | 630 | struct event_format *event, |
| 631 | struct pevent_record *record); | 631 | struct tep_record *record); |
| 632 | void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, | 632 | void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s, |
| 633 | struct event_format *event, | 633 | struct event_format *event, |
| 634 | struct pevent_record *record, | 634 | struct tep_record *record, |
| 635 | bool use_trace_clock); | 635 | bool use_trace_clock); |
| 636 | void pevent_print_event_data(struct pevent *pevent, struct trace_seq *s, | 636 | void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s, |
| 637 | struct event_format *event, | 637 | struct event_format *event, |
| 638 | struct pevent_record *record); | 638 | struct tep_record *record); |
| 639 | void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | 639 | void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, |
| 640 | struct pevent_record *record, bool use_trace_clock); | 640 | struct tep_record *record, bool use_trace_clock); |
| 641 | 641 | ||
| 642 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, | 642 | int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, |
| 643 | int long_size); | 643 | int long_size); |
| 644 | 644 | ||
| 645 | enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, | 645 | enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, |
| 646 | unsigned long size, const char *sys); | 646 | unsigned long size, const char *sys); |
| 647 | enum pevent_errno pevent_parse_format(struct pevent *pevent, | 647 | enum tep_errno tep_parse_format(struct tep_handle *pevent, |
| 648 | struct event_format **eventp, | 648 | struct event_format **eventp, |
| 649 | const char *buf, | 649 | const char *buf, |
| 650 | unsigned long size, const char *sys); | 650 | unsigned long size, const char *sys); |
| 651 | void pevent_free_format(struct event_format *event); | 651 | void tep_free_format(struct event_format *event); |
| 652 | void pevent_free_format_field(struct format_field *field); | 652 | void tep_free_format_field(struct format_field *field); |
| 653 | 653 | ||
| 654 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | 654 | void *tep_get_field_raw(struct trace_seq *s, struct event_format *event, |
| 655 | const char *name, struct pevent_record *record, | 655 | const char *name, struct tep_record *record, |
| 656 | int *len, int err); | 656 | int *len, int err); |
| 657 | 657 | ||
| 658 | int pevent_get_field_val(struct trace_seq *s, struct event_format *event, | 658 | int tep_get_field_val(struct trace_seq *s, struct event_format *event, |
| 659 | const char *name, struct pevent_record *record, | 659 | const char *name, struct tep_record *record, |
| 660 | unsigned long long *val, int err); | 660 | unsigned long long *val, int err); |
| 661 | int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, | 661 | int tep_get_common_field_val(struct trace_seq *s, struct event_format *event, |
| 662 | const char *name, struct pevent_record *record, | 662 | const char *name, struct tep_record *record, |
| 663 | unsigned long long *val, int err); | ||
| 664 | int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, | ||
| 665 | const char *name, struct pevent_record *record, | ||
| 666 | unsigned long long *val, int err); | 663 | unsigned long long *val, int err); |
| 664 | int tep_get_any_field_val(struct trace_seq *s, struct event_format *event, | ||
| 665 | const char *name, struct tep_record *record, | ||
| 666 | unsigned long long *val, int err); | ||
| 667 | 667 | ||
| 668 | int pevent_print_num_field(struct trace_seq *s, const char *fmt, | 668 | int tep_print_num_field(struct trace_seq *s, const char *fmt, |
| 669 | struct event_format *event, const char *name, | 669 | struct event_format *event, const char *name, |
| 670 | struct pevent_record *record, int err); | 670 | struct tep_record *record, int err); |
| 671 | 671 | ||
| 672 | int pevent_print_func_field(struct trace_seq *s, const char *fmt, | 672 | int tep_print_func_field(struct trace_seq *s, const char *fmt, |
| 673 | struct event_format *event, const char *name, | 673 | struct event_format *event, const char *name, |
| 674 | struct pevent_record *record, int err); | 674 | struct tep_record *record, int err); |
| 675 | 675 | ||
| 676 | int pevent_register_event_handler(struct pevent *pevent, int id, | 676 | int tep_register_event_handler(struct tep_handle *pevent, int id, |
| 677 | const char *sys_name, const char *event_name, | 677 | const char *sys_name, const char *event_name, |
| 678 | pevent_event_handler_func func, void *context); | 678 | tep_event_handler_func func, void *context); |
| 679 | int pevent_unregister_event_handler(struct pevent *pevent, int id, | 679 | int tep_unregister_event_handler(struct tep_handle *pevent, int id, |
| 680 | const char *sys_name, const char *event_name, | 680 | const char *sys_name, const char *event_name, |
| 681 | pevent_event_handler_func func, void *context); | 681 | tep_event_handler_func func, void *context); |
| 682 | int pevent_register_print_function(struct pevent *pevent, | 682 | int tep_register_print_function(struct tep_handle *pevent, |
| 683 | pevent_func_handler func, | 683 | tep_func_handler func, |
| 684 | enum pevent_func_arg_type ret_type, | 684 | enum tep_func_arg_type ret_type, |
| 685 | char *name, ...); | 685 | char *name, ...); |
| 686 | int pevent_unregister_print_function(struct pevent *pevent, | 686 | int tep_unregister_print_function(struct tep_handle *pevent, |
| 687 | pevent_func_handler func, char *name); | 687 | tep_func_handler func, char *name); |
| 688 | 688 | ||
| 689 | struct format_field *pevent_find_common_field(struct event_format *event, const char *name); | 689 | struct format_field *tep_find_common_field(struct event_format *event, const char *name); |
| 690 | struct format_field *pevent_find_field(struct event_format *event, const char *name); | 690 | struct format_field *tep_find_field(struct event_format *event, const char *name); |
| 691 | struct format_field *pevent_find_any_field(struct event_format *event, const char *name); | 691 | struct format_field *tep_find_any_field(struct event_format *event, const char *name); |
| 692 | 692 | ||
| 693 | const char *pevent_find_function(struct pevent *pevent, unsigned long long addr); | 693 | const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr); |
| 694 | unsigned long long | 694 | unsigned long long |
| 695 | pevent_find_function_address(struct pevent *pevent, unsigned long long addr); | 695 | tep_find_function_address(struct tep_handle *pevent, unsigned long long addr); |
| 696 | unsigned long long pevent_read_number(struct pevent *pevent, const void *ptr, int size); | 696 | unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, int size); |
| 697 | int pevent_read_number_field(struct format_field *field, const void *data, | 697 | int tep_read_number_field(struct format_field *field, const void *data, |
| 698 | unsigned long long *value); | 698 | unsigned long long *value); |
| 699 | 699 | ||
| 700 | struct event_format *pevent_find_event(struct pevent *pevent, int id); | 700 | struct event_format *tep_find_event(struct tep_handle *pevent, int id); |
| 701 | 701 | ||
| 702 | struct event_format * | 702 | struct event_format * |
| 703 | pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *name); | 703 | tep_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name); |
| 704 | 704 | ||
| 705 | struct event_format * | 705 | struct event_format * |
| 706 | pevent_find_event_by_record(struct pevent *pevent, struct pevent_record *record); | 706 | tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record); |
| 707 | 707 | ||
| 708 | void pevent_data_lat_fmt(struct pevent *pevent, | 708 | void tep_data_lat_fmt(struct tep_handle *pevent, |
| 709 | struct trace_seq *s, struct pevent_record *record); | 709 | struct trace_seq *s, struct tep_record *record); |
| 710 | int pevent_data_type(struct pevent *pevent, struct pevent_record *rec); | 710 | int tep_data_type(struct tep_handle *pevent, struct tep_record *rec); |
| 711 | struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type); | 711 | struct event_format *tep_data_event_from_type(struct tep_handle *pevent, int type); |
| 712 | int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec); | 712 | int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec); |
| 713 | int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec); | 713 | int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec); |
| 714 | int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec); | 714 | int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec); |
| 715 | const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid); | 715 | const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid); |
| 716 | struct cmdline; | 716 | struct cmdline; |
| 717 | struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm, | 717 | struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm, |
| 718 | struct cmdline *next); | 718 | struct cmdline *next); |
| 719 | int pevent_cmdline_pid(struct pevent *pevent, struct cmdline *cmdline); | 719 | int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline); |
| 720 | 720 | ||
| 721 | void pevent_print_field(struct trace_seq *s, void *data, | 721 | void tep_print_field(struct trace_seq *s, void *data, |
| 722 | struct format_field *field); | 722 | struct format_field *field); |
| 723 | void pevent_print_fields(struct trace_seq *s, void *data, | 723 | void tep_print_fields(struct trace_seq *s, void *data, |
| 724 | int size __maybe_unused, struct event_format *event); | 724 | int size __maybe_unused, struct event_format *event); |
| 725 | void pevent_event_info(struct trace_seq *s, struct event_format *event, | 725 | void tep_event_info(struct trace_seq *s, struct event_format *event, |
| 726 | struct pevent_record *record); | 726 | struct tep_record *record); |
| 727 | int pevent_strerror(struct pevent *pevent, enum pevent_errno errnum, | 727 | int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum, |
| 728 | char *buf, size_t buflen); | 728 | char *buf, size_t buflen); |
| 729 | 729 | ||
| 730 | struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type); | 730 | struct event_format **tep_list_events(struct tep_handle *pevent, enum event_sort_type); |
| 731 | struct format_field **pevent_event_common_fields(struct event_format *event); | 731 | struct format_field **tep_event_common_fields(struct event_format *event); |
| 732 | struct format_field **pevent_event_fields(struct event_format *event); | 732 | struct format_field **tep_event_fields(struct event_format *event); |
| 733 | 733 | ||
| 734 | static inline int pevent_get_cpus(struct pevent *pevent) | 734 | static inline int tep_get_cpus(struct tep_handle *pevent) |
| 735 | { | 735 | { |
| 736 | return pevent->cpus; | 736 | return pevent->cpus; |
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | static inline void pevent_set_cpus(struct pevent *pevent, int cpus) | 739 | static inline void tep_set_cpus(struct tep_handle *pevent, int cpus) |
| 740 | { | 740 | { |
| 741 | pevent->cpus = cpus; | 741 | pevent->cpus = cpus; |
| 742 | } | 742 | } |
| 743 | 743 | ||
| 744 | static inline int pevent_get_long_size(struct pevent *pevent) | 744 | static inline int tep_get_long_size(struct tep_handle *pevent) |
| 745 | { | 745 | { |
| 746 | return pevent->long_size; | 746 | return pevent->long_size; |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | static inline void pevent_set_long_size(struct pevent *pevent, int long_size) | 749 | static inline void tep_set_long_size(struct tep_handle *pevent, int long_size) |
| 750 | { | 750 | { |
| 751 | pevent->long_size = long_size; | 751 | pevent->long_size = long_size; |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | static inline int pevent_get_page_size(struct pevent *pevent) | 754 | static inline int tep_get_page_size(struct tep_handle *pevent) |
| 755 | { | 755 | { |
| 756 | return pevent->page_size; | 756 | return pevent->page_size; |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | static inline void pevent_set_page_size(struct pevent *pevent, int _page_size) | 759 | static inline void tep_set_page_size(struct tep_handle *pevent, int _page_size) |
| 760 | { | 760 | { |
| 761 | pevent->page_size = _page_size; | 761 | pevent->page_size = _page_size; |
| 762 | } | 762 | } |
| 763 | 763 | ||
| 764 | static inline int pevent_is_file_bigendian(struct pevent *pevent) | 764 | static inline int tep_is_file_bigendian(struct tep_handle *pevent) |
| 765 | { | 765 | { |
| 766 | return pevent->file_bigendian; | 766 | return pevent->file_bigendian; |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | static inline void pevent_set_file_bigendian(struct pevent *pevent, int endian) | 769 | static inline void tep_set_file_bigendian(struct tep_handle *pevent, int endian) |
| 770 | { | 770 | { |
| 771 | pevent->file_bigendian = endian; | 771 | pevent->file_bigendian = endian; |
| 772 | } | 772 | } |
| 773 | 773 | ||
| 774 | static inline int pevent_is_host_bigendian(struct pevent *pevent) | 774 | static inline int tep_is_host_bigendian(struct tep_handle *pevent) |
| 775 | { | 775 | { |
| 776 | return pevent->host_bigendian; | 776 | return pevent->host_bigendian; |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | static inline void pevent_set_host_bigendian(struct pevent *pevent, int endian) | 779 | static inline void tep_set_host_bigendian(struct tep_handle *pevent, int endian) |
| 780 | { | 780 | { |
| 781 | pevent->host_bigendian = endian; | 781 | pevent->host_bigendian = endian; |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | static inline int pevent_is_latency_format(struct pevent *pevent) | 784 | static inline int tep_is_latency_format(struct tep_handle *pevent) |
| 785 | { | 785 | { |
| 786 | return pevent->latency_format; | 786 | return pevent->latency_format; |
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | static inline void pevent_set_latency_format(struct pevent *pevent, int lat) | 789 | static inline void tep_set_latency_format(struct tep_handle *pevent, int lat) |
| 790 | { | 790 | { |
| 791 | pevent->latency_format = lat; | 791 | pevent->latency_format = lat; |
| 792 | } | 792 | } |
| 793 | 793 | ||
| 794 | struct pevent *pevent_alloc(void); | 794 | struct tep_handle *tep_alloc(void); |
| 795 | void pevent_free(struct pevent *pevent); | 795 | void tep_free(struct tep_handle *pevent); |
| 796 | void pevent_ref(struct pevent *pevent); | 796 | void tep_ref(struct tep_handle *pevent); |
| 797 | void pevent_unref(struct pevent *pevent); | 797 | void tep_unref(struct tep_handle *pevent); |
| 798 | 798 | ||
| 799 | /* access to the internal parser */ | 799 | /* access to the internal parser */ |
| 800 | void pevent_buffer_init(const char *buf, unsigned long long size); | 800 | void tep_buffer_init(const char *buf, unsigned long long size); |
| 801 | enum event_type pevent_read_token(char **tok); | 801 | enum event_type tep_read_token(char **tok); |
| 802 | void pevent_free_token(char *token); | 802 | void tep_free_token(char *token); |
| 803 | int pevent_peek_char(void); | 803 | int tep_peek_char(void); |
| 804 | const char *pevent_get_input_buf(void); | 804 | const char *tep_get_input_buf(void); |
| 805 | unsigned long long pevent_get_input_buf_ptr(void); | 805 | unsigned long long tep_get_input_buf_ptr(void); |
| 806 | 806 | ||
| 807 | /* for debugging */ | 807 | /* for debugging */ |
| 808 | void pevent_print_funcs(struct pevent *pevent); | 808 | void tep_print_funcs(struct tep_handle *pevent); |
| 809 | void pevent_print_printk(struct pevent *pevent); | 809 | void tep_print_printk(struct tep_handle *pevent); |
| 810 | 810 | ||
| 811 | /* ----------------------- filtering ----------------------- */ | 811 | /* ----------------------- filtering ----------------------- */ |
| 812 | 812 | ||
| @@ -930,22 +930,22 @@ struct filter_type { | |||
| 930 | struct filter_arg *filter; | 930 | struct filter_arg *filter; |
| 931 | }; | 931 | }; |
| 932 | 932 | ||
| 933 | #define PEVENT_FILTER_ERROR_BUFSZ 1024 | 933 | #define TEP_FILTER_ERROR_BUFSZ 1024 |
| 934 | 934 | ||
| 935 | struct event_filter { | 935 | struct event_filter { |
| 936 | struct pevent *pevent; | 936 | struct tep_handle *pevent; |
| 937 | int filters; | 937 | int filters; |
| 938 | struct filter_type *event_filters; | 938 | struct filter_type *event_filters; |
| 939 | char error_buffer[PEVENT_FILTER_ERROR_BUFSZ]; | 939 | char error_buffer[TEP_FILTER_ERROR_BUFSZ]; |
| 940 | }; | 940 | }; |
| 941 | 941 | ||
| 942 | struct event_filter *pevent_filter_alloc(struct pevent *pevent); | 942 | struct event_filter *tep_filter_alloc(struct tep_handle *pevent); |
| 943 | 943 | ||
| 944 | /* for backward compatibility */ | 944 | /* for backward compatibility */ |
| 945 | #define FILTER_NONE PEVENT_ERRNO__NO_FILTER | 945 | #define FILTER_NONE TEP_ERRNO__NO_FILTER |
| 946 | #define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND | 946 | #define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND |
| 947 | #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS | 947 | #define FILTER_MISS TEP_ERRNO__FILTER_MISS |
| 948 | #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH | 948 | #define FILTER_MATCH TEP_ERRNO__FILTER_MATCH |
| 949 | 949 | ||
| 950 | enum filter_trivial_type { | 950 | enum filter_trivial_type { |
| 951 | FILTER_TRIVIAL_FALSE, | 951 | FILTER_TRIVIAL_FALSE, |
| @@ -953,39 +953,39 @@ enum filter_trivial_type { | |||
| 953 | FILTER_TRIVIAL_BOTH, | 953 | FILTER_TRIVIAL_BOTH, |
| 954 | }; | 954 | }; |
| 955 | 955 | ||
| 956 | enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | 956 | enum tep_errno tep_filter_add_filter_str(struct event_filter *filter, |
| 957 | const char *filter_str); | 957 | const char *filter_str); |
| 958 | 958 | ||
| 959 | enum pevent_errno pevent_filter_match(struct event_filter *filter, | 959 | enum tep_errno tep_filter_match(struct event_filter *filter, |
| 960 | struct pevent_record *record); | 960 | struct tep_record *record); |
| 961 | 961 | ||
| 962 | int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, | 962 | int tep_filter_strerror(struct event_filter *filter, enum tep_errno err, |
| 963 | char *buf, size_t buflen); | 963 | char *buf, size_t buflen); |
| 964 | 964 | ||
| 965 | int pevent_event_filtered(struct event_filter *filter, | 965 | int tep_event_filtered(struct event_filter *filter, |
| 966 | int event_id); | 966 | int event_id); |
| 967 | 967 | ||
| 968 | void pevent_filter_reset(struct event_filter *filter); | 968 | void tep_filter_reset(struct event_filter *filter); |
| 969 | 969 | ||
| 970 | int pevent_filter_clear_trivial(struct event_filter *filter, | 970 | int tep_filter_clear_trivial(struct event_filter *filter, |
| 971 | enum filter_trivial_type type); | 971 | enum filter_trivial_type type); |
| 972 | 972 | ||
| 973 | void pevent_filter_free(struct event_filter *filter); | 973 | void tep_filter_free(struct event_filter *filter); |
| 974 | 974 | ||
| 975 | char *pevent_filter_make_string(struct event_filter *filter, int event_id); | 975 | char *tep_filter_make_string(struct event_filter *filter, int event_id); |
| 976 | 976 | ||
| 977 | int pevent_filter_remove_event(struct event_filter *filter, | 977 | int tep_filter_remove_event(struct event_filter *filter, |
| 978 | int event_id); | 978 | int event_id); |
| 979 | 979 | ||
| 980 | int pevent_filter_event_has_trivial(struct event_filter *filter, | 980 | int tep_filter_event_has_trivial(struct event_filter *filter, |
| 981 | int event_id, | 981 | int event_id, |
| 982 | enum filter_trivial_type type); | 982 | enum filter_trivial_type type); |
| 983 | 983 | ||
| 984 | int pevent_filter_copy(struct event_filter *dest, struct event_filter *source); | 984 | int tep_filter_copy(struct event_filter *dest, struct event_filter *source); |
| 985 | 985 | ||
| 986 | int pevent_update_trivial(struct event_filter *dest, struct event_filter *source, | 986 | int tep_update_trivial(struct event_filter *dest, struct event_filter *source, |
| 987 | enum filter_trivial_type type); | 987 | enum filter_trivial_type type); |
| 988 | 988 | ||
| 989 | int pevent_filter_compare(struct event_filter *filter1, struct event_filter *filter2); | 989 | int tep_filter_compare(struct event_filter *filter1, struct event_filter *filter2); |
| 990 | 990 | ||
| 991 | #endif /* _PARSE_EVENTS_H */ | 991 | #endif /* _PARSE_EVENTS_H */ |
diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c index d542cb60ca1a..f17e25097e1e 100644 --- a/tools/lib/traceevent/event-plugin.c +++ b/tools/lib/traceevent/event-plugin.c | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | */ | 5 | */ |
| 20 | 6 | ||
| 21 | #include <ctype.h> | 7 | #include <ctype.h> |
| @@ -34,7 +20,7 @@ | |||
| 34 | 20 | ||
| 35 | static struct registered_plugin_options { | 21 | static struct registered_plugin_options { |
| 36 | struct registered_plugin_options *next; | 22 | struct registered_plugin_options *next; |
| 37 | struct pevent_plugin_option *options; | 23 | struct tep_plugin_option *options; |
| 38 | } *registered_options; | 24 | } *registered_options; |
| 39 | 25 | ||
| 40 | static struct trace_plugin_options { | 26 | static struct trace_plugin_options { |
| @@ -58,7 +44,7 @@ static void lower_case(char *str) | |||
| 58 | *str = tolower(*str); | 44 | *str = tolower(*str); |
| 59 | } | 45 | } |
| 60 | 46 | ||
| 61 | static int update_option_value(struct pevent_plugin_option *op, const char *val) | 47 | static int update_option_value(struct tep_plugin_option *op, const char *val) |
| 62 | { | 48 | { |
| 63 | char *op_val; | 49 | char *op_val; |
| 64 | 50 | ||
| @@ -97,7 +83,7 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val) | |||
| 97 | } | 83 | } |
| 98 | 84 | ||
| 99 | /** | 85 | /** |
| 100 | * traceevent_plugin_list_options - get list of plugin options | 86 | * tep_plugin_list_options - get list of plugin options |
| 101 | * | 87 | * |
| 102 | * Returns an array of char strings that list the currently registered | 88 | * Returns an array of char strings that list the currently registered |
| 103 | * plugin options in the format of <plugin>:<option>. This list can be | 89 | * plugin options in the format of <plugin>:<option>. This list can be |
| @@ -106,12 +92,12 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val) | |||
| 106 | * Returns NULL if there's no options registered. On error it returns | 92 | * Returns NULL if there's no options registered. On error it returns |
| 107 | * INVALID_PLUGIN_LIST_OPTION | 93 | * INVALID_PLUGIN_LIST_OPTION |
| 108 | * | 94 | * |
| 109 | * Must be freed with traceevent_plugin_free_options_list(). | 95 | * Must be freed with tep_plugin_free_options_list(). |
| 110 | */ | 96 | */ |
| 111 | char **traceevent_plugin_list_options(void) | 97 | char **tep_plugin_list_options(void) |
| 112 | { | 98 | { |
| 113 | struct registered_plugin_options *reg; | 99 | struct registered_plugin_options *reg; |
| 114 | struct pevent_plugin_option *op; | 100 | struct tep_plugin_option *op; |
| 115 | char **list = NULL; | 101 | char **list = NULL; |
| 116 | char *name; | 102 | char *name; |
| 117 | int count = 0; | 103 | int count = 0; |
| @@ -146,7 +132,7 @@ char **traceevent_plugin_list_options(void) | |||
| 146 | return INVALID_PLUGIN_LIST_OPTION; | 132 | return INVALID_PLUGIN_LIST_OPTION; |
| 147 | } | 133 | } |
| 148 | 134 | ||
| 149 | void traceevent_plugin_free_options_list(char **list) | 135 | void tep_plugin_free_options_list(char **list) |
| 150 | { | 136 | { |
| 151 | int i; | 137 | int i; |
| 152 | 138 | ||
| @@ -163,7 +149,7 @@ void traceevent_plugin_free_options_list(char **list) | |||
| 163 | } | 149 | } |
| 164 | 150 | ||
| 165 | static int | 151 | static int |
| 166 | update_option(const char *file, struct pevent_plugin_option *option) | 152 | update_option(const char *file, struct tep_plugin_option *option) |
| 167 | { | 153 | { |
| 168 | struct trace_plugin_options *op; | 154 | struct trace_plugin_options *op; |
| 169 | char *plugin; | 155 | char *plugin; |
| @@ -215,14 +201,14 @@ update_option(const char *file, struct pevent_plugin_option *option) | |||
| 215 | } | 201 | } |
| 216 | 202 | ||
| 217 | /** | 203 | /** |
| 218 | * traceevent_plugin_add_options - Add a set of options by a plugin | 204 | * tep_plugin_add_options - Add a set of options by a plugin |
| 219 | * @name: The name of the plugin adding the options | 205 | * @name: The name of the plugin adding the options |
| 220 | * @options: The set of options being loaded | 206 | * @options: The set of options being loaded |
| 221 | * | 207 | * |
| 222 | * Sets the options with the values that have been added by user. | 208 | * Sets the options with the values that have been added by user. |
| 223 | */ | 209 | */ |
| 224 | int traceevent_plugin_add_options(const char *name, | 210 | int tep_plugin_add_options(const char *name, |
| 225 | struct pevent_plugin_option *options) | 211 | struct tep_plugin_option *options) |
| 226 | { | 212 | { |
| 227 | struct registered_plugin_options *reg; | 213 | struct registered_plugin_options *reg; |
| 228 | 214 | ||
| @@ -241,10 +227,10 @@ int traceevent_plugin_add_options(const char *name, | |||
| 241 | } | 227 | } |
| 242 | 228 | ||
| 243 | /** | 229 | /** |
| 244 | * traceevent_plugin_remove_options - remove plugin options that were registered | 230 | * tep_plugin_remove_options - remove plugin options that were registered |
| 245 | * @options: Options to removed that were registered with traceevent_plugin_add_options | 231 | * @options: Options to removed that were registered with tep_plugin_add_options |
| 246 | */ | 232 | */ |
| 247 | void traceevent_plugin_remove_options(struct pevent_plugin_option *options) | 233 | void tep_plugin_remove_options(struct tep_plugin_option *options) |
| 248 | { | 234 | { |
| 249 | struct registered_plugin_options **last; | 235 | struct registered_plugin_options **last; |
| 250 | struct registered_plugin_options *reg; | 236 | struct registered_plugin_options *reg; |
| @@ -260,19 +246,19 @@ void traceevent_plugin_remove_options(struct pevent_plugin_option *options) | |||
| 260 | } | 246 | } |
| 261 | 247 | ||
| 262 | /** | 248 | /** |
| 263 | * traceevent_print_plugins - print out the list of plugins loaded | 249 | * tep_print_plugins - print out the list of plugins loaded |
| 264 | * @s: the trace_seq descripter to write to | 250 | * @s: the trace_seq descripter to write to |
| 265 | * @prefix: The prefix string to add before listing the option name | 251 | * @prefix: The prefix string to add before listing the option name |
| 266 | * @suffix: The suffix string ot append after the option name | 252 | * @suffix: The suffix string ot append after the option name |
| 267 | * @list: The list of plugins (usually returned by traceevent_load_plugins() | 253 | * @list: The list of plugins (usually returned by tep_load_plugins() |
| 268 | * | 254 | * |
| 269 | * Writes to the trace_seq @s the list of plugins (files) that is | 255 | * Writes to the trace_seq @s the list of plugins (files) that is |
| 270 | * returned by traceevent_load_plugins(). Use @prefix and @suffix for formating: | 256 | * returned by tep_load_plugins(). Use @prefix and @suffix for formating: |
| 271 | * @prefix = " ", @suffix = "\n". | 257 | * @prefix = " ", @suffix = "\n". |
| 272 | */ | 258 | */ |
| 273 | void traceevent_print_plugins(struct trace_seq *s, | 259 | void tep_print_plugins(struct trace_seq *s, |
| 274 | const char *prefix, const char *suffix, | 260 | const char *prefix, const char *suffix, |
| 275 | const struct plugin_list *list) | 261 | const struct plugin_list *list) |
| 276 | { | 262 | { |
| 277 | while (list) { | 263 | while (list) { |
| 278 | trace_seq_printf(s, "%s%s%s", prefix, list->name, suffix); | 264 | trace_seq_printf(s, "%s%s%s", prefix, list->name, suffix); |
| @@ -281,11 +267,11 @@ void traceevent_print_plugins(struct trace_seq *s, | |||
| 281 | } | 267 | } |
| 282 | 268 | ||
| 283 | static void | 269 | static void |
| 284 | load_plugin(struct pevent *pevent, const char *path, | 270 | load_plugin(struct tep_handle *pevent, const char *path, |
| 285 | const char *file, void *data) | 271 | const char *file, void *data) |
| 286 | { | 272 | { |
| 287 | struct plugin_list **plugin_list = data; | 273 | struct plugin_list **plugin_list = data; |
| 288 | pevent_plugin_load_func func; | 274 | tep_plugin_load_func func; |
| 289 | struct plugin_list *list; | 275 | struct plugin_list *list; |
| 290 | const char *alias; | 276 | const char *alias; |
| 291 | char *plugin; | 277 | char *plugin; |
| @@ -305,14 +291,14 @@ load_plugin(struct pevent *pevent, const char *path, | |||
| 305 | goto out_free; | 291 | goto out_free; |
| 306 | } | 292 | } |
| 307 | 293 | ||
| 308 | alias = dlsym(handle, PEVENT_PLUGIN_ALIAS_NAME); | 294 | alias = dlsym(handle, TEP_PLUGIN_ALIAS_NAME); |
| 309 | if (!alias) | 295 | if (!alias) |
| 310 | alias = file; | 296 | alias = file; |
| 311 | 297 | ||
| 312 | func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME); | 298 | func = dlsym(handle, TEP_PLUGIN_LOADER_NAME); |
| 313 | if (!func) { | 299 | if (!func) { |
| 314 | warning("could not find func '%s' in plugin '%s'\n%s\n", | 300 | warning("could not find func '%s' in plugin '%s'\n%s\n", |
| 315 | PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror()); | 301 | TEP_PLUGIN_LOADER_NAME, plugin, dlerror()); |
| 316 | goto out_free; | 302 | goto out_free; |
| 317 | } | 303 | } |
| 318 | 304 | ||
| @@ -336,9 +322,9 @@ load_plugin(struct pevent *pevent, const char *path, | |||
| 336 | } | 322 | } |
| 337 | 323 | ||
| 338 | static void | 324 | static void |
| 339 | load_plugins_dir(struct pevent *pevent, const char *suffix, | 325 | load_plugins_dir(struct tep_handle *pevent, const char *suffix, |
| 340 | const char *path, | 326 | const char *path, |
| 341 | void (*load_plugin)(struct pevent *pevent, | 327 | void (*load_plugin)(struct tep_handle *pevent, |
| 342 | const char *path, | 328 | const char *path, |
| 343 | const char *name, | 329 | const char *name, |
| 344 | void *data), | 330 | void *data), |
| @@ -378,8 +364,8 @@ load_plugins_dir(struct pevent *pevent, const char *suffix, | |||
| 378 | } | 364 | } |
| 379 | 365 | ||
| 380 | static void | 366 | static void |
| 381 | load_plugins(struct pevent *pevent, const char *suffix, | 367 | load_plugins(struct tep_handle *pevent, const char *suffix, |
| 382 | void (*load_plugin)(struct pevent *pevent, | 368 | void (*load_plugin)(struct tep_handle *pevent, |
| 383 | const char *path, | 369 | const char *path, |
| 384 | const char *name, | 370 | const char *name, |
| 385 | void *data), | 371 | void *data), |
| @@ -390,7 +376,7 @@ load_plugins(struct pevent *pevent, const char *suffix, | |||
| 390 | char *envdir; | 376 | char *envdir; |
| 391 | int ret; | 377 | int ret; |
| 392 | 378 | ||
| 393 | if (pevent->flags & PEVENT_DISABLE_PLUGINS) | 379 | if (pevent->flags & TEP_DISABLE_PLUGINS) |
| 394 | return; | 380 | return; |
| 395 | 381 | ||
| 396 | /* | 382 | /* |
| @@ -398,7 +384,7 @@ load_plugins(struct pevent *pevent, const char *suffix, | |||
| 398 | * check that first. | 384 | * check that first. |
| 399 | */ | 385 | */ |
| 400 | #ifdef PLUGIN_DIR | 386 | #ifdef PLUGIN_DIR |
| 401 | if (!(pevent->flags & PEVENT_DISABLE_SYS_PLUGINS)) | 387 | if (!(pevent->flags & TEP_DISABLE_SYS_PLUGINS)) |
| 402 | load_plugins_dir(pevent, suffix, PLUGIN_DIR, | 388 | load_plugins_dir(pevent, suffix, PLUGIN_DIR, |
| 403 | load_plugin, data); | 389 | load_plugin, data); |
| 404 | #endif | 390 | #endif |
| @@ -431,7 +417,7 @@ load_plugins(struct pevent *pevent, const char *suffix, | |||
| 431 | } | 417 | } |
| 432 | 418 | ||
| 433 | struct plugin_list* | 419 | struct plugin_list* |
| 434 | traceevent_load_plugins(struct pevent *pevent) | 420 | tep_load_plugins(struct tep_handle *pevent) |
| 435 | { | 421 | { |
| 436 | struct plugin_list *list = NULL; | 422 | struct plugin_list *list = NULL; |
| 437 | 423 | ||
| @@ -440,15 +426,15 @@ traceevent_load_plugins(struct pevent *pevent) | |||
| 440 | } | 426 | } |
| 441 | 427 | ||
| 442 | void | 428 | void |
| 443 | traceevent_unload_plugins(struct plugin_list *plugin_list, struct pevent *pevent) | 429 | tep_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent) |
| 444 | { | 430 | { |
| 445 | pevent_plugin_unload_func func; | 431 | tep_plugin_unload_func func; |
| 446 | struct plugin_list *list; | 432 | struct plugin_list *list; |
| 447 | 433 | ||
| 448 | while (plugin_list) { | 434 | while (plugin_list) { |
| 449 | list = plugin_list; | 435 | list = plugin_list; |
| 450 | plugin_list = list->next; | 436 | plugin_list = list->next; |
| 451 | func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME); | 437 | func = dlsym(list->handle, TEP_PLUGIN_UNLOADER_NAME); |
| 452 | if (func) | 438 | if (func) |
| 453 | func(pevent); | 439 | func(pevent); |
| 454 | dlclose(list->handle); | 440 | dlclose(list->handle); |
diff --git a/tools/lib/traceevent/event-utils.h b/tools/lib/traceevent/event-utils.h index d1dc2170e402..0560b96a31d1 100644 --- a/tools/lib/traceevent/event-utils.h +++ b/tools/lib/traceevent/event-utils.h | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | /* SPDX-License-Identifier: LGPL-2.1 */ | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | */ | 5 | */ |
| 20 | #ifndef __UTIL_H | 6 | #ifndef __UTIL_H |
| 21 | #define __UTIL_H | 7 | #define __UTIL_H |
diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c index ca424b157e46..af2a1f3b7424 100644 --- a/tools/lib/traceevent/kbuffer-parse.c +++ b/tools/lib/traceevent/kbuffer-parse.c | |||
| @@ -1,22 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | * | ||
| 19 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 20 | */ | 5 | */ |
| 21 | #include <stdio.h> | 6 | #include <stdio.h> |
| 22 | #include <stdlib.h> | 7 | #include <stdlib.h> |
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c index 431e8b309f6e..e76154c02ee7 100644 --- a/tools/lib/traceevent/parse-filter.c +++ b/tools/lib/traceevent/parse-filter.c | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | */ | 5 | */ |
| 20 | #include <stdio.h> | 6 | #include <stdio.h> |
| 21 | #include <stdlib.h> | 7 | #include <stdlib.h> |
| @@ -51,8 +37,8 @@ static void show_error(char *error_buf, const char *fmt, ...) | |||
| 51 | int len; | 37 | int len; |
| 52 | int i; | 38 | int i; |
| 53 | 39 | ||
| 54 | input = pevent_get_input_buf(); | 40 | input = tep_get_input_buf(); |
| 55 | index = pevent_get_input_buf_ptr(); | 41 | index = tep_get_input_buf_ptr(); |
| 56 | len = input ? strlen(input) : 0; | 42 | len = input ? strlen(input) : 0; |
| 57 | 43 | ||
| 58 | if (len) { | 44 | if (len) { |
| @@ -66,13 +52,13 @@ static void show_error(char *error_buf, const char *fmt, ...) | |||
| 66 | } | 52 | } |
| 67 | 53 | ||
| 68 | va_start(ap, fmt); | 54 | va_start(ap, fmt); |
| 69 | vsnprintf(error_buf + len, PEVENT_FILTER_ERROR_BUFSZ - len, fmt, ap); | 55 | vsnprintf(error_buf + len, TEP_FILTER_ERROR_BUFSZ - len, fmt, ap); |
| 70 | va_end(ap); | 56 | va_end(ap); |
| 71 | } | 57 | } |
| 72 | 58 | ||
| 73 | static void free_token(char *token) | 59 | static void free_token(char *token) |
| 74 | { | 60 | { |
| 75 | pevent_free_token(token); | 61 | tep_free_token(token); |
| 76 | } | 62 | } |
| 77 | 63 | ||
| 78 | static enum event_type read_token(char **tok) | 64 | static enum event_type read_token(char **tok) |
| @@ -82,13 +68,13 @@ static enum event_type read_token(char **tok) | |||
| 82 | 68 | ||
| 83 | do { | 69 | do { |
| 84 | free_token(token); | 70 | free_token(token); |
| 85 | type = pevent_read_token(&token); | 71 | type = tep_read_token(&token); |
| 86 | } while (type == EVENT_NEWLINE || type == EVENT_SPACE); | 72 | } while (type == EVENT_NEWLINE || type == EVENT_SPACE); |
| 87 | 73 | ||
| 88 | /* If token is = or ! check to see if the next char is ~ */ | 74 | /* If token is = or ! check to see if the next char is ~ */ |
| 89 | if (token && | 75 | if (token && |
| 90 | (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) && | 76 | (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) && |
| 91 | pevent_peek_char() == '~') { | 77 | tep_peek_char() == '~') { |
| 92 | /* append it */ | 78 | /* append it */ |
| 93 | *tok = malloc(3); | 79 | *tok = malloc(3); |
| 94 | if (*tok == NULL) { | 80 | if (*tok == NULL) { |
| @@ -98,7 +84,7 @@ static enum event_type read_token(char **tok) | |||
| 98 | sprintf(*tok, "%c%c", *token, '~'); | 84 | sprintf(*tok, "%c%c", *token, '~'); |
| 99 | free_token(token); | 85 | free_token(token); |
| 100 | /* Now remove the '~' from the buffer */ | 86 | /* Now remove the '~' from the buffer */ |
| 101 | pevent_read_token(&token); | 87 | tep_read_token(&token); |
| 102 | free_token(token); | 88 | free_token(token); |
| 103 | } else | 89 | } else |
| 104 | *tok = token; | 90 | *tok = token; |
| @@ -167,7 +153,7 @@ add_filter_type(struct event_filter *filter, int id) | |||
| 167 | 153 | ||
| 168 | filter_type = &filter->event_filters[i]; | 154 | filter_type = &filter->event_filters[i]; |
| 169 | filter_type->event_id = id; | 155 | filter_type->event_id = id; |
| 170 | filter_type->event = pevent_find_event(filter->pevent, id); | 156 | filter_type->event = tep_find_event(filter->pevent, id); |
| 171 | filter_type->filter = NULL; | 157 | filter_type->filter = NULL; |
| 172 | 158 | ||
| 173 | filter->filters++; | 159 | filter->filters++; |
| @@ -176,10 +162,10 @@ add_filter_type(struct event_filter *filter, int id) | |||
| 176 | } | 162 | } |
| 177 | 163 | ||
| 178 | /** | 164 | /** |
| 179 | * pevent_filter_alloc - create a new event filter | 165 | * tep_filter_alloc - create a new event filter |
| 180 | * @pevent: The pevent that this filter is associated with | 166 | * @pevent: The pevent that this filter is associated with |
| 181 | */ | 167 | */ |
| 182 | struct event_filter *pevent_filter_alloc(struct pevent *pevent) | 168 | struct event_filter *tep_filter_alloc(struct tep_handle *pevent) |
| 183 | { | 169 | { |
| 184 | struct event_filter *filter; | 170 | struct event_filter *filter; |
| 185 | 171 | ||
| @@ -189,7 +175,7 @@ struct event_filter *pevent_filter_alloc(struct pevent *pevent) | |||
| 189 | 175 | ||
| 190 | memset(filter, 0, sizeof(*filter)); | 176 | memset(filter, 0, sizeof(*filter)); |
| 191 | filter->pevent = pevent; | 177 | filter->pevent = pevent; |
| 192 | pevent_ref(pevent); | 178 | tep_ref(pevent); |
| 193 | 179 | ||
| 194 | return filter; | 180 | return filter; |
| 195 | } | 181 | } |
| @@ -268,8 +254,8 @@ static int event_match(struct event_format *event, | |||
| 268 | !regexec(ereg, event->name, 0, NULL, 0); | 254 | !regexec(ereg, event->name, 0, NULL, 0); |
| 269 | } | 255 | } |
| 270 | 256 | ||
| 271 | static enum pevent_errno | 257 | static enum tep_errno |
| 272 | find_event(struct pevent *pevent, struct event_list **events, | 258 | find_event(struct tep_handle *pevent, struct event_list **events, |
| 273 | char *sys_name, char *event_name) | 259 | char *sys_name, char *event_name) |
| 274 | { | 260 | { |
| 275 | struct event_format *event; | 261 | struct event_format *event; |
| @@ -289,26 +275,26 @@ find_event(struct pevent *pevent, struct event_list **events, | |||
| 289 | 275 | ||
| 290 | ret = asprintf(®, "^%s$", event_name); | 276 | ret = asprintf(®, "^%s$", event_name); |
| 291 | if (ret < 0) | 277 | if (ret < 0) |
| 292 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 278 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 293 | 279 | ||
| 294 | ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB); | 280 | ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB); |
| 295 | free(reg); | 281 | free(reg); |
| 296 | 282 | ||
| 297 | if (ret) | 283 | if (ret) |
| 298 | return PEVENT_ERRNO__INVALID_EVENT_NAME; | 284 | return TEP_ERRNO__INVALID_EVENT_NAME; |
| 299 | 285 | ||
| 300 | if (sys_name) { | 286 | if (sys_name) { |
| 301 | ret = asprintf(®, "^%s$", sys_name); | 287 | ret = asprintf(®, "^%s$", sys_name); |
| 302 | if (ret < 0) { | 288 | if (ret < 0) { |
| 303 | regfree(&ereg); | 289 | regfree(&ereg); |
| 304 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 290 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 305 | } | 291 | } |
| 306 | 292 | ||
| 307 | ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB); | 293 | ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB); |
| 308 | free(reg); | 294 | free(reg); |
| 309 | if (ret) { | 295 | if (ret) { |
| 310 | regfree(&ereg); | 296 | regfree(&ereg); |
| 311 | return PEVENT_ERRNO__INVALID_EVENT_NAME; | 297 | return TEP_ERRNO__INVALID_EVENT_NAME; |
| 312 | } | 298 | } |
| 313 | } | 299 | } |
| 314 | 300 | ||
| @@ -328,9 +314,9 @@ find_event(struct pevent *pevent, struct event_list **events, | |||
| 328 | regfree(&sreg); | 314 | regfree(&sreg); |
| 329 | 315 | ||
| 330 | if (!match) | 316 | if (!match) |
| 331 | return PEVENT_ERRNO__EVENT_NOT_FOUND; | 317 | return TEP_ERRNO__EVENT_NOT_FOUND; |
| 332 | if (fail) | 318 | if (fail) |
| 333 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 319 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 334 | 320 | ||
| 335 | return 0; | 321 | return 0; |
| 336 | } | 322 | } |
| @@ -346,7 +332,7 @@ static void free_events(struct event_list *events) | |||
| 346 | } | 332 | } |
| 347 | } | 333 | } |
| 348 | 334 | ||
| 349 | static enum pevent_errno | 335 | static enum tep_errno |
| 350 | create_arg_item(struct event_format *event, const char *token, | 336 | create_arg_item(struct event_format *event, const char *token, |
| 351 | enum event_type type, struct filter_arg **parg, char *error_str) | 337 | enum event_type type, struct filter_arg **parg, char *error_str) |
| 352 | { | 338 | { |
| @@ -356,7 +342,7 @@ create_arg_item(struct event_format *event, const char *token, | |||
| 356 | arg = allocate_arg(); | 342 | arg = allocate_arg(); |
| 357 | if (arg == NULL) { | 343 | if (arg == NULL) { |
| 358 | show_error(error_str, "failed to allocate filter arg"); | 344 | show_error(error_str, "failed to allocate filter arg"); |
| 359 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 345 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 360 | } | 346 | } |
| 361 | 347 | ||
| 362 | switch (type) { | 348 | switch (type) { |
| @@ -370,7 +356,7 @@ create_arg_item(struct event_format *event, const char *token, | |||
| 370 | if (!arg->value.str) { | 356 | if (!arg->value.str) { |
| 371 | free_arg(arg); | 357 | free_arg(arg); |
| 372 | show_error(error_str, "failed to allocate string filter arg"); | 358 | show_error(error_str, "failed to allocate string filter arg"); |
| 373 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 359 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 374 | } | 360 | } |
| 375 | break; | 361 | break; |
| 376 | case EVENT_ITEM: | 362 | case EVENT_ITEM: |
| @@ -382,7 +368,7 @@ create_arg_item(struct event_format *event, const char *token, | |||
| 382 | break; | 368 | break; |
| 383 | } | 369 | } |
| 384 | /* Consider this a field */ | 370 | /* Consider this a field */ |
| 385 | field = pevent_find_any_field(event, token); | 371 | field = tep_find_any_field(event, token); |
| 386 | if (!field) { | 372 | if (!field) { |
| 387 | /* If token is 'COMM' or 'CPU' then it is special */ | 373 | /* If token is 'COMM' or 'CPU' then it is special */ |
| 388 | if (strcmp(token, COMM) == 0) { | 374 | if (strcmp(token, COMM) == 0) { |
| @@ -402,7 +388,7 @@ create_arg_item(struct event_format *event, const char *token, | |||
| 402 | default: | 388 | default: |
| 403 | free_arg(arg); | 389 | free_arg(arg); |
| 404 | show_error(error_str, "expected a value but found %s", token); | 390 | show_error(error_str, "expected a value but found %s", token); |
| 405 | return PEVENT_ERRNO__UNEXPECTED_TYPE; | 391 | return TEP_ERRNO__UNEXPECTED_TYPE; |
| 406 | } | 392 | } |
| 407 | *parg = arg; | 393 | *parg = arg; |
| 408 | return 0; | 394 | return 0; |
| @@ -454,7 +440,7 @@ create_arg_cmp(enum filter_cmp_type ctype) | |||
| 454 | return arg; | 440 | return arg; |
| 455 | } | 441 | } |
| 456 | 442 | ||
| 457 | static enum pevent_errno | 443 | static enum tep_errno |
| 458 | add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | 444 | add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) |
| 459 | { | 445 | { |
| 460 | struct filter_arg *left; | 446 | struct filter_arg *left; |
| @@ -487,7 +473,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 487 | break; | 473 | break; |
| 488 | default: | 474 | default: |
| 489 | show_error(error_str, "Illegal rvalue"); | 475 | show_error(error_str, "Illegal rvalue"); |
| 490 | return PEVENT_ERRNO__ILLEGAL_RVALUE; | 476 | return TEP_ERRNO__ILLEGAL_RVALUE; |
| 491 | } | 477 | } |
| 492 | 478 | ||
| 493 | /* | 479 | /* |
| @@ -534,7 +520,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 534 | if (left->type != FILTER_ARG_FIELD) { | 520 | if (left->type != FILTER_ARG_FIELD) { |
| 535 | show_error(error_str, | 521 | show_error(error_str, |
| 536 | "Illegal lvalue for string comparison"); | 522 | "Illegal lvalue for string comparison"); |
| 537 | return PEVENT_ERRNO__ILLEGAL_LVALUE; | 523 | return TEP_ERRNO__ILLEGAL_LVALUE; |
| 538 | } | 524 | } |
| 539 | 525 | ||
| 540 | /* Make sure this is a valid string compare */ | 526 | /* Make sure this is a valid string compare */ |
| @@ -553,13 +539,13 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 553 | show_error(error_str, | 539 | show_error(error_str, |
| 554 | "RegEx '%s' did not compute", | 540 | "RegEx '%s' did not compute", |
| 555 | str); | 541 | str); |
| 556 | return PEVENT_ERRNO__INVALID_REGEX; | 542 | return TEP_ERRNO__INVALID_REGEX; |
| 557 | } | 543 | } |
| 558 | break; | 544 | break; |
| 559 | default: | 545 | default: |
| 560 | show_error(error_str, | 546 | show_error(error_str, |
| 561 | "Illegal comparison for string"); | 547 | "Illegal comparison for string"); |
| 562 | return PEVENT_ERRNO__ILLEGAL_STRING_CMP; | 548 | return TEP_ERRNO__ILLEGAL_STRING_CMP; |
| 563 | } | 549 | } |
| 564 | 550 | ||
| 565 | op->type = FILTER_ARG_STR; | 551 | op->type = FILTER_ARG_STR; |
| @@ -568,7 +554,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 568 | op->str.val = strdup(str); | 554 | op->str.val = strdup(str); |
| 569 | if (!op->str.val) { | 555 | if (!op->str.val) { |
| 570 | show_error(error_str, "Failed to allocate string filter"); | 556 | show_error(error_str, "Failed to allocate string filter"); |
| 571 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 557 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 572 | } | 558 | } |
| 573 | /* | 559 | /* |
| 574 | * Need a buffer to copy data for tests | 560 | * Need a buffer to copy data for tests |
| @@ -576,7 +562,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 576 | op->str.buffer = malloc(op->str.field->size + 1); | 562 | op->str.buffer = malloc(op->str.field->size + 1); |
| 577 | if (!op->str.buffer) { | 563 | if (!op->str.buffer) { |
| 578 | show_error(error_str, "Failed to allocate string filter"); | 564 | show_error(error_str, "Failed to allocate string filter"); |
| 579 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 565 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 580 | } | 566 | } |
| 581 | /* Null terminate this buffer */ | 567 | /* Null terminate this buffer */ |
| 582 | op->str.buffer[op->str.field->size] = 0; | 568 | op->str.buffer[op->str.field->size] = 0; |
| @@ -595,7 +581,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 595 | case FILTER_CMP_NOT_REGEX: | 581 | case FILTER_CMP_NOT_REGEX: |
| 596 | show_error(error_str, | 582 | show_error(error_str, |
| 597 | "Op not allowed with integers"); | 583 | "Op not allowed with integers"); |
| 598 | return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; | 584 | return TEP_ERRNO__ILLEGAL_INTEGER_CMP; |
| 599 | 585 | ||
| 600 | default: | 586 | default: |
| 601 | break; | 587 | break; |
| @@ -616,7 +602,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) | |||
| 616 | 602 | ||
| 617 | out_fail: | 603 | out_fail: |
| 618 | show_error(error_str, "Syntax error"); | 604 | show_error(error_str, "Syntax error"); |
| 619 | return PEVENT_ERRNO__SYNTAX_ERROR; | 605 | return TEP_ERRNO__SYNTAX_ERROR; |
| 620 | } | 606 | } |
| 621 | 607 | ||
| 622 | static struct filter_arg * | 608 | static struct filter_arg * |
| @@ -629,7 +615,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b) | |||
| 629 | return arg; | 615 | return arg; |
| 630 | } | 616 | } |
| 631 | 617 | ||
| 632 | static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) | 618 | static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg) |
| 633 | { | 619 | { |
| 634 | switch (op->type) { | 620 | switch (op->type) { |
| 635 | case FILTER_ARG_EXP: | 621 | case FILTER_ARG_EXP: |
| @@ -648,11 +634,11 @@ static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) | |||
| 648 | /* left arg of compares must be a field */ | 634 | /* left arg of compares must be a field */ |
| 649 | if (arg->type != FILTER_ARG_FIELD && | 635 | if (arg->type != FILTER_ARG_FIELD && |
| 650 | arg->type != FILTER_ARG_BOOLEAN) | 636 | arg->type != FILTER_ARG_BOOLEAN) |
| 651 | return PEVENT_ERRNO__INVALID_ARG_TYPE; | 637 | return TEP_ERRNO__INVALID_ARG_TYPE; |
| 652 | op->num.left = arg; | 638 | op->num.left = arg; |
| 653 | break; | 639 | break; |
| 654 | default: | 640 | default: |
| 655 | return PEVENT_ERRNO__INVALID_ARG_TYPE; | 641 | return TEP_ERRNO__INVALID_ARG_TYPE; |
| 656 | } | 642 | } |
| 657 | return 0; | 643 | return 0; |
| 658 | } | 644 | } |
| @@ -765,7 +751,7 @@ enum filter_vals { | |||
| 765 | FILTER_VAL_TRUE, | 751 | FILTER_VAL_TRUE, |
| 766 | }; | 752 | }; |
| 767 | 753 | ||
| 768 | static enum pevent_errno | 754 | static enum tep_errno |
| 769 | reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, | 755 | reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, |
| 770 | struct filter_arg *arg, char *error_str) | 756 | struct filter_arg *arg, char *error_str) |
| 771 | { | 757 | { |
| @@ -775,7 +761,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, | |||
| 775 | if (parent->type != FILTER_ARG_OP && | 761 | if (parent->type != FILTER_ARG_OP && |
| 776 | arg->type != FILTER_ARG_OP) { | 762 | arg->type != FILTER_ARG_OP) { |
| 777 | show_error(error_str, "can not reparent other than OP"); | 763 | show_error(error_str, "can not reparent other than OP"); |
| 778 | return PEVENT_ERRNO__REPARENT_NOT_OP; | 764 | return TEP_ERRNO__REPARENT_NOT_OP; |
| 779 | } | 765 | } |
| 780 | 766 | ||
| 781 | /* Get the sibling */ | 767 | /* Get the sibling */ |
| @@ -787,7 +773,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, | |||
| 787 | other_child = old_child->op.right; | 773 | other_child = old_child->op.right; |
| 788 | } else { | 774 | } else { |
| 789 | show_error(error_str, "Error in reparent op, find other child"); | 775 | show_error(error_str, "Error in reparent op, find other child"); |
| 790 | return PEVENT_ERRNO__REPARENT_FAILED; | 776 | return TEP_ERRNO__REPARENT_FAILED; |
| 791 | } | 777 | } |
| 792 | 778 | ||
| 793 | /* Detach arg from old_child */ | 779 | /* Detach arg from old_child */ |
| @@ -808,7 +794,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, | |||
| 808 | ptr = &parent->op.left; | 794 | ptr = &parent->op.left; |
| 809 | else { | 795 | else { |
| 810 | show_error(error_str, "Error in reparent op"); | 796 | show_error(error_str, "Error in reparent op"); |
| 811 | return PEVENT_ERRNO__REPARENT_FAILED; | 797 | return TEP_ERRNO__REPARENT_FAILED; |
| 812 | } | 798 | } |
| 813 | 799 | ||
| 814 | *ptr = arg; | 800 | *ptr = arg; |
| @@ -817,7 +803,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, | |||
| 817 | return 0; | 803 | return 0; |
| 818 | } | 804 | } |
| 819 | 805 | ||
| 820 | /* Returns either filter_vals (success) or pevent_errno (failfure) */ | 806 | /* Returns either filter_vals (success) or tep_errno (failfure) */ |
| 821 | static int test_arg(struct filter_arg *parent, struct filter_arg *arg, | 807 | static int test_arg(struct filter_arg *parent, struct filter_arg *arg, |
| 822 | char *error_str) | 808 | char *error_str) |
| 823 | { | 809 | { |
| @@ -912,7 +898,7 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg, | |||
| 912 | return rval; | 898 | return rval; |
| 913 | default: | 899 | default: |
| 914 | show_error(error_str, "bad arg in filter tree"); | 900 | show_error(error_str, "bad arg in filter tree"); |
| 915 | return PEVENT_ERRNO__BAD_FILTER_ARG; | 901 | return TEP_ERRNO__BAD_FILTER_ARG; |
| 916 | } | 902 | } |
| 917 | return FILTER_VAL_NORM; | 903 | return FILTER_VAL_NORM; |
| 918 | } | 904 | } |
| @@ -937,7 +923,7 @@ static int collapse_tree(struct filter_arg *arg, | |||
| 937 | arg->boolean.value = ret == FILTER_VAL_TRUE; | 923 | arg->boolean.value = ret == FILTER_VAL_TRUE; |
| 938 | } else { | 924 | } else { |
| 939 | show_error(error_str, "Failed to allocate filter arg"); | 925 | show_error(error_str, "Failed to allocate filter arg"); |
| 940 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 926 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 941 | } | 927 | } |
| 942 | break; | 928 | break; |
| 943 | 929 | ||
| @@ -952,7 +938,7 @@ static int collapse_tree(struct filter_arg *arg, | |||
| 952 | return ret; | 938 | return ret; |
| 953 | } | 939 | } |
| 954 | 940 | ||
| 955 | static enum pevent_errno | 941 | static enum tep_errno |
| 956 | process_filter(struct event_format *event, struct filter_arg **parg, | 942 | process_filter(struct event_format *event, struct filter_arg **parg, |
| 957 | char *error_str, int not) | 943 | char *error_str, int not) |
| 958 | { | 944 | { |
| @@ -966,7 +952,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 966 | enum filter_op_type btype; | 952 | enum filter_op_type btype; |
| 967 | enum filter_exp_type etype; | 953 | enum filter_exp_type etype; |
| 968 | enum filter_cmp_type ctype; | 954 | enum filter_cmp_type ctype; |
| 969 | enum pevent_errno ret; | 955 | enum tep_errno ret; |
| 970 | 956 | ||
| 971 | *parg = NULL; | 957 | *parg = NULL; |
| 972 | 958 | ||
| @@ -1004,7 +990,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1004 | case EVENT_DELIM: | 990 | case EVENT_DELIM: |
| 1005 | if (*token == ',') { | 991 | if (*token == ',') { |
| 1006 | show_error(error_str, "Illegal token ','"); | 992 | show_error(error_str, "Illegal token ','"); |
| 1007 | ret = PEVENT_ERRNO__ILLEGAL_TOKEN; | 993 | ret = TEP_ERRNO__ILLEGAL_TOKEN; |
| 1008 | goto fail; | 994 | goto fail; |
| 1009 | } | 995 | } |
| 1010 | 996 | ||
| @@ -1012,22 +998,22 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1012 | if (left_item) { | 998 | if (left_item) { |
| 1013 | show_error(error_str, | 999 | show_error(error_str, |
| 1014 | "Open paren can not come after item"); | 1000 | "Open paren can not come after item"); |
| 1015 | ret = PEVENT_ERRNO__INVALID_PAREN; | 1001 | ret = TEP_ERRNO__INVALID_PAREN; |
| 1016 | goto fail; | 1002 | goto fail; |
| 1017 | } | 1003 | } |
| 1018 | if (current_exp) { | 1004 | if (current_exp) { |
| 1019 | show_error(error_str, | 1005 | show_error(error_str, |
| 1020 | "Open paren can not come after expression"); | 1006 | "Open paren can not come after expression"); |
| 1021 | ret = PEVENT_ERRNO__INVALID_PAREN; | 1007 | ret = TEP_ERRNO__INVALID_PAREN; |
| 1022 | goto fail; | 1008 | goto fail; |
| 1023 | } | 1009 | } |
| 1024 | 1010 | ||
| 1025 | ret = process_filter(event, &arg, error_str, 0); | 1011 | ret = process_filter(event, &arg, error_str, 0); |
| 1026 | if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) { | 1012 | if (ret != TEP_ERRNO__UNBALANCED_PAREN) { |
| 1027 | if (ret == 0) { | 1013 | if (ret == 0) { |
| 1028 | show_error(error_str, | 1014 | show_error(error_str, |
| 1029 | "Unbalanced number of '('"); | 1015 | "Unbalanced number of '('"); |
| 1030 | ret = PEVENT_ERRNO__UNBALANCED_PAREN; | 1016 | ret = TEP_ERRNO__UNBALANCED_PAREN; |
| 1031 | } | 1017 | } |
| 1032 | goto fail; | 1018 | goto fail; |
| 1033 | } | 1019 | } |
| @@ -1064,7 +1050,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1064 | else | 1050 | else |
| 1065 | *parg = current_exp; | 1051 | *parg = current_exp; |
| 1066 | free(token); | 1052 | free(token); |
| 1067 | return PEVENT_ERRNO__UNBALANCED_PAREN; | 1053 | return TEP_ERRNO__UNBALANCED_PAREN; |
| 1068 | } | 1054 | } |
| 1069 | break; | 1055 | break; |
| 1070 | 1056 | ||
| @@ -1091,7 +1077,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1091 | case OP_NONE: | 1077 | case OP_NONE: |
| 1092 | show_error(error_str, | 1078 | show_error(error_str, |
| 1093 | "Unknown op token %s", token); | 1079 | "Unknown op token %s", token); |
| 1094 | ret = PEVENT_ERRNO__UNKNOWN_TOKEN; | 1080 | ret = TEP_ERRNO__UNKNOWN_TOKEN; |
| 1095 | goto fail; | 1081 | goto fail; |
| 1096 | } | 1082 | } |
| 1097 | 1083 | ||
| @@ -1179,11 +1165,11 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1179 | 1165 | ||
| 1180 | fail_alloc: | 1166 | fail_alloc: |
| 1181 | show_error(error_str, "failed to allocate filter arg"); | 1167 | show_error(error_str, "failed to allocate filter arg"); |
| 1182 | ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; | 1168 | ret = TEP_ERRNO__MEM_ALLOC_FAILED; |
| 1183 | goto fail; | 1169 | goto fail; |
| 1184 | fail_syntax: | 1170 | fail_syntax: |
| 1185 | show_error(error_str, "Syntax error"); | 1171 | show_error(error_str, "Syntax error"); |
| 1186 | ret = PEVENT_ERRNO__SYNTAX_ERROR; | 1172 | ret = TEP_ERRNO__SYNTAX_ERROR; |
| 1187 | fail: | 1173 | fail: |
| 1188 | free_arg(current_op); | 1174 | free_arg(current_op); |
| 1189 | free_arg(current_exp); | 1175 | free_arg(current_exp); |
| @@ -1192,13 +1178,13 @@ process_filter(struct event_format *event, struct filter_arg **parg, | |||
| 1192 | return ret; | 1178 | return ret; |
| 1193 | } | 1179 | } |
| 1194 | 1180 | ||
| 1195 | static enum pevent_errno | 1181 | static enum tep_errno |
| 1196 | process_event(struct event_format *event, const char *filter_str, | 1182 | process_event(struct event_format *event, const char *filter_str, |
| 1197 | struct filter_arg **parg, char *error_str) | 1183 | struct filter_arg **parg, char *error_str) |
| 1198 | { | 1184 | { |
| 1199 | int ret; | 1185 | int ret; |
| 1200 | 1186 | ||
| 1201 | pevent_buffer_init(filter_str, strlen(filter_str)); | 1187 | tep_buffer_init(filter_str, strlen(filter_str)); |
| 1202 | 1188 | ||
| 1203 | ret = process_filter(event, parg, error_str, 0); | 1189 | ret = process_filter(event, parg, error_str, 0); |
| 1204 | if (ret < 0) | 1190 | if (ret < 0) |
| @@ -1208,7 +1194,7 @@ process_event(struct event_format *event, const char *filter_str, | |||
| 1208 | if (!*parg) { | 1194 | if (!*parg) { |
| 1209 | *parg = allocate_arg(); | 1195 | *parg = allocate_arg(); |
| 1210 | if (*parg == NULL) | 1196 | if (*parg == NULL) |
| 1211 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 1197 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 1212 | 1198 | ||
| 1213 | (*parg)->type = FILTER_ARG_BOOLEAN; | 1199 | (*parg)->type = FILTER_ARG_BOOLEAN; |
| 1214 | (*parg)->boolean.value = FILTER_FALSE; | 1200 | (*parg)->boolean.value = FILTER_FALSE; |
| @@ -1217,13 +1203,13 @@ process_event(struct event_format *event, const char *filter_str, | |||
| 1217 | return 0; | 1203 | return 0; |
| 1218 | } | 1204 | } |
| 1219 | 1205 | ||
| 1220 | static enum pevent_errno | 1206 | static enum tep_errno |
| 1221 | filter_event(struct event_filter *filter, struct event_format *event, | 1207 | filter_event(struct event_filter *filter, struct event_format *event, |
| 1222 | const char *filter_str, char *error_str) | 1208 | const char *filter_str, char *error_str) |
| 1223 | { | 1209 | { |
| 1224 | struct filter_type *filter_type; | 1210 | struct filter_type *filter_type; |
| 1225 | struct filter_arg *arg; | 1211 | struct filter_arg *arg; |
| 1226 | enum pevent_errno ret; | 1212 | enum tep_errno ret; |
| 1227 | 1213 | ||
| 1228 | if (filter_str) { | 1214 | if (filter_str) { |
| 1229 | ret = process_event(event, filter_str, &arg, error_str); | 1215 | ret = process_event(event, filter_str, &arg, error_str); |
| @@ -1234,7 +1220,7 @@ filter_event(struct event_filter *filter, struct event_format *event, | |||
| 1234 | /* just add a TRUE arg */ | 1220 | /* just add a TRUE arg */ |
| 1235 | arg = allocate_arg(); | 1221 | arg = allocate_arg(); |
| 1236 | if (arg == NULL) | 1222 | if (arg == NULL) |
| 1237 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 1223 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 1238 | 1224 | ||
| 1239 | arg->type = FILTER_ARG_BOOLEAN; | 1225 | arg->type = FILTER_ARG_BOOLEAN; |
| 1240 | arg->boolean.value = FILTER_TRUE; | 1226 | arg->boolean.value = FILTER_TRUE; |
| @@ -1242,7 +1228,7 @@ filter_event(struct event_filter *filter, struct event_format *event, | |||
| 1242 | 1228 | ||
| 1243 | filter_type = add_filter_type(filter, event->id); | 1229 | filter_type = add_filter_type(filter, event->id); |
| 1244 | if (filter_type == NULL) | 1230 | if (filter_type == NULL) |
| 1245 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 1231 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 1246 | 1232 | ||
| 1247 | if (filter_type->filter) | 1233 | if (filter_type->filter) |
| 1248 | free_arg(filter_type->filter); | 1234 | free_arg(filter_type->filter); |
| @@ -1254,23 +1240,23 @@ filter_event(struct event_filter *filter, struct event_format *event, | |||
| 1254 | static void filter_init_error_buf(struct event_filter *filter) | 1240 | static void filter_init_error_buf(struct event_filter *filter) |
| 1255 | { | 1241 | { |
| 1256 | /* clear buffer to reset show error */ | 1242 | /* clear buffer to reset show error */ |
| 1257 | pevent_buffer_init("", 0); | 1243 | tep_buffer_init("", 0); |
| 1258 | filter->error_buffer[0] = '\0'; | 1244 | filter->error_buffer[0] = '\0'; |
| 1259 | } | 1245 | } |
| 1260 | 1246 | ||
| 1261 | /** | 1247 | /** |
| 1262 | * pevent_filter_add_filter_str - add a new filter | 1248 | * tep_filter_add_filter_str - add a new filter |
| 1263 | * @filter: the event filter to add to | 1249 | * @filter: the event filter to add to |
| 1264 | * @filter_str: the filter string that contains the filter | 1250 | * @filter_str: the filter string that contains the filter |
| 1265 | * | 1251 | * |
| 1266 | * Returns 0 if the filter was successfully added or a | 1252 | * Returns 0 if the filter was successfully added or a |
| 1267 | * negative error code. Use pevent_filter_strerror() to see | 1253 | * negative error code. Use tep_filter_strerror() to see |
| 1268 | * actual error message in case of error. | 1254 | * actual error message in case of error. |
| 1269 | */ | 1255 | */ |
| 1270 | enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | 1256 | enum tep_errno tep_filter_add_filter_str(struct event_filter *filter, |
| 1271 | const char *filter_str) | 1257 | const char *filter_str) |
| 1272 | { | 1258 | { |
| 1273 | struct pevent *pevent = filter->pevent; | 1259 | struct tep_handle *pevent = filter->pevent; |
| 1274 | struct event_list *event; | 1260 | struct event_list *event; |
| 1275 | struct event_list *events = NULL; | 1261 | struct event_list *events = NULL; |
| 1276 | const char *filter_start; | 1262 | const char *filter_start; |
| @@ -1279,7 +1265,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | |||
| 1279 | char *event_name = NULL; | 1265 | char *event_name = NULL; |
| 1280 | char *sys_name = NULL; | 1266 | char *sys_name = NULL; |
| 1281 | char *sp; | 1267 | char *sp; |
| 1282 | enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */ | 1268 | enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */ |
| 1283 | int len; | 1269 | int len; |
| 1284 | int ret; | 1270 | int ret; |
| 1285 | 1271 | ||
| @@ -1305,7 +1291,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | |||
| 1305 | if (this_event == NULL) { | 1291 | if (this_event == NULL) { |
| 1306 | /* This can only happen when events is NULL, but still */ | 1292 | /* This can only happen when events is NULL, but still */ |
| 1307 | free_events(events); | 1293 | free_events(events); |
| 1308 | return PEVENT_ERRNO__MEM_ALLOC_FAILED; | 1294 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 1309 | } | 1295 | } |
| 1310 | memcpy(this_event, filter_str, len); | 1296 | memcpy(this_event, filter_str, len); |
| 1311 | this_event[len] = 0; | 1297 | this_event[len] = 0; |
| @@ -1322,7 +1308,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | |||
| 1322 | /* This can only happen when events is NULL, but still */ | 1308 | /* This can only happen when events is NULL, but still */ |
| 1323 | free_events(events); | 1309 | free_events(events); |
| 1324 | free(this_event); | 1310 | free(this_event); |
| 1325 | return PEVENT_ERRNO__FILTER_NOT_FOUND; | 1311 | return TEP_ERRNO__FILTER_NOT_FOUND; |
| 1326 | } | 1312 | } |
| 1327 | 1313 | ||
| 1328 | /* Find this event */ | 1314 | /* Find this event */ |
| @@ -1349,7 +1335,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, | |||
| 1349 | 1335 | ||
| 1350 | if (ret >= 0 && pevent->test_filters) { | 1336 | if (ret >= 0 && pevent->test_filters) { |
| 1351 | char *test; | 1337 | char *test; |
| 1352 | test = pevent_filter_make_string(filter, event->event->id); | 1338 | test = tep_filter_make_string(filter, event->event->id); |
| 1353 | if (test) { | 1339 | if (test) { |
| 1354 | printf(" '%s: %s'\n", event->event->name, test); | 1340 | printf(" '%s: %s'\n", event->event->name, test); |
| 1355 | free(test); | 1341 | free(test); |
| @@ -1371,7 +1357,7 @@ static void free_filter_type(struct filter_type *filter_type) | |||
| 1371 | } | 1357 | } |
| 1372 | 1358 | ||
| 1373 | /** | 1359 | /** |
| 1374 | * pevent_filter_strerror - fill error message in a buffer | 1360 | * tep_filter_strerror - fill error message in a buffer |
| 1375 | * @filter: the event filter contains error | 1361 | * @filter: the event filter contains error |
| 1376 | * @err: the error code | 1362 | * @err: the error code |
| 1377 | * @buf: the buffer to be filled in | 1363 | * @buf: the buffer to be filled in |
| @@ -1379,10 +1365,10 @@ static void free_filter_type(struct filter_type *filter_type) | |||
| 1379 | * | 1365 | * |
| 1380 | * Returns 0 if message was filled successfully, -1 if error | 1366 | * Returns 0 if message was filled successfully, -1 if error |
| 1381 | */ | 1367 | */ |
| 1382 | int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, | 1368 | int tep_filter_strerror(struct event_filter *filter, enum tep_errno err, |
| 1383 | char *buf, size_t buflen) | 1369 | char *buf, size_t buflen) |
| 1384 | { | 1370 | { |
| 1385 | if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END) | 1371 | if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END) |
| 1386 | return -1; | 1372 | return -1; |
| 1387 | 1373 | ||
| 1388 | if (strlen(filter->error_buffer) > 0) { | 1374 | if (strlen(filter->error_buffer) > 0) { |
| @@ -1393,11 +1379,11 @@ int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, | |||
| 1393 | return 0; | 1379 | return 0; |
| 1394 | } | 1380 | } |
| 1395 | 1381 | ||
| 1396 | return pevent_strerror(filter->pevent, err, buf, buflen); | 1382 | return tep_strerror(filter->pevent, err, buf, buflen); |
| 1397 | } | 1383 | } |
| 1398 | 1384 | ||
| 1399 | /** | 1385 | /** |
| 1400 | * pevent_filter_remove_event - remove a filter for an event | 1386 | * tep_filter_remove_event - remove a filter for an event |
| 1401 | * @filter: the event filter to remove from | 1387 | * @filter: the event filter to remove from |
| 1402 | * @event_id: the event to remove a filter for | 1388 | * @event_id: the event to remove a filter for |
| 1403 | * | 1389 | * |
| @@ -1407,8 +1393,8 @@ int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, | |||
| 1407 | * Returns 1: if an event was removed | 1393 | * Returns 1: if an event was removed |
| 1408 | * 0: if the event was not found | 1394 | * 0: if the event was not found |
| 1409 | */ | 1395 | */ |
| 1410 | int pevent_filter_remove_event(struct event_filter *filter, | 1396 | int tep_filter_remove_event(struct event_filter *filter, |
| 1411 | int event_id) | 1397 | int event_id) |
| 1412 | { | 1398 | { |
| 1413 | struct filter_type *filter_type; | 1399 | struct filter_type *filter_type; |
| 1414 | unsigned long len; | 1400 | unsigned long len; |
| @@ -1437,12 +1423,12 @@ int pevent_filter_remove_event(struct event_filter *filter, | |||
| 1437 | } | 1423 | } |
| 1438 | 1424 | ||
| 1439 | /** | 1425 | /** |
| 1440 | * pevent_filter_reset - clear all filters in a filter | 1426 | * tep_filter_reset - clear all filters in a filter |
| 1441 | * @filter: the event filter to reset | 1427 | * @filter: the event filter to reset |
| 1442 | * | 1428 | * |
| 1443 | * Removes all filters from a filter and resets it. | 1429 | * Removes all filters from a filter and resets it. |
| 1444 | */ | 1430 | */ |
| 1445 | void pevent_filter_reset(struct event_filter *filter) | 1431 | void tep_filter_reset(struct event_filter *filter) |
| 1446 | { | 1432 | { |
| 1447 | int i; | 1433 | int i; |
| 1448 | 1434 | ||
| @@ -1454,11 +1440,11 @@ void pevent_filter_reset(struct event_filter *filter) | |||
| 1454 | filter->event_filters = NULL; | 1440 | filter->event_filters = NULL; |
| 1455 | } | 1441 | } |
| 1456 | 1442 | ||
| 1457 | void pevent_filter_free(struct event_filter *filter) | 1443 | void tep_filter_free(struct event_filter *filter) |
| 1458 | { | 1444 | { |
| 1459 | pevent_unref(filter->pevent); | 1445 | tep_unref(filter->pevent); |
| 1460 | 1446 | ||
| 1461 | pevent_filter_reset(filter); | 1447 | tep_filter_reset(filter); |
| 1462 | 1448 | ||
| 1463 | free(filter); | 1449 | free(filter); |
| 1464 | } | 1450 | } |
| @@ -1478,7 +1464,7 @@ static int copy_filter_type(struct event_filter *filter, | |||
| 1478 | /* Can't assume that the pevent's are the same */ | 1464 | /* Can't assume that the pevent's are the same */ |
| 1479 | sys = filter_type->event->system; | 1465 | sys = filter_type->event->system; |
| 1480 | name = filter_type->event->name; | 1466 | name = filter_type->event->name; |
| 1481 | event = pevent_find_event_by_name(filter->pevent, sys, name); | 1467 | event = tep_find_event_by_name(filter->pevent, sys, name); |
| 1482 | if (!event) | 1468 | if (!event) |
| 1483 | return -1; | 1469 | return -1; |
| 1484 | 1470 | ||
| @@ -1515,18 +1501,18 @@ static int copy_filter_type(struct event_filter *filter, | |||
| 1515 | } | 1501 | } |
| 1516 | 1502 | ||
| 1517 | /** | 1503 | /** |
| 1518 | * pevent_filter_copy - copy a filter using another filter | 1504 | * tep_filter_copy - copy a filter using another filter |
| 1519 | * @dest - the filter to copy to | 1505 | * @dest - the filter to copy to |
| 1520 | * @source - the filter to copy from | 1506 | * @source - the filter to copy from |
| 1521 | * | 1507 | * |
| 1522 | * Returns 0 on success and -1 if not all filters were copied | 1508 | * Returns 0 on success and -1 if not all filters were copied |
| 1523 | */ | 1509 | */ |
| 1524 | int pevent_filter_copy(struct event_filter *dest, struct event_filter *source) | 1510 | int tep_filter_copy(struct event_filter *dest, struct event_filter *source) |
| 1525 | { | 1511 | { |
| 1526 | int ret = 0; | 1512 | int ret = 0; |
| 1527 | int i; | 1513 | int i; |
| 1528 | 1514 | ||
| 1529 | pevent_filter_reset(dest); | 1515 | tep_filter_reset(dest); |
| 1530 | 1516 | ||
| 1531 | for (i = 0; i < source->filters; i++) { | 1517 | for (i = 0; i < source->filters; i++) { |
| 1532 | if (copy_filter_type(dest, source, &source->event_filters[i])) | 1518 | if (copy_filter_type(dest, source, &source->event_filters[i])) |
| @@ -1537,7 +1523,7 @@ int pevent_filter_copy(struct event_filter *dest, struct event_filter *source) | |||
| 1537 | 1523 | ||
| 1538 | 1524 | ||
| 1539 | /** | 1525 | /** |
| 1540 | * pevent_update_trivial - update the trivial filters with the given filter | 1526 | * tep_update_trivial - update the trivial filters with the given filter |
| 1541 | * @dest - the filter to update | 1527 | * @dest - the filter to update |
| 1542 | * @source - the filter as the source of the update | 1528 | * @source - the filter as the source of the update |
| 1543 | * @type - the type of trivial filter to update. | 1529 | * @type - the type of trivial filter to update. |
| @@ -1547,11 +1533,11 @@ int pevent_filter_copy(struct event_filter *dest, struct event_filter *source) | |||
| 1547 | * Returns 0 on success and -1 if there was a problem updating, but | 1533 | * Returns 0 on success and -1 if there was a problem updating, but |
| 1548 | * events may have still been updated on error. | 1534 | * events may have still been updated on error. |
| 1549 | */ | 1535 | */ |
| 1550 | int pevent_update_trivial(struct event_filter *dest, struct event_filter *source, | 1536 | int tep_update_trivial(struct event_filter *dest, struct event_filter *source, |
| 1551 | enum filter_trivial_type type) | 1537 | enum filter_trivial_type type) |
| 1552 | { | 1538 | { |
| 1553 | struct pevent *src_pevent; | 1539 | struct tep_handle *src_pevent; |
| 1554 | struct pevent *dest_pevent; | 1540 | struct tep_handle *dest_pevent; |
| 1555 | struct event_format *event; | 1541 | struct event_format *event; |
| 1556 | struct filter_type *filter_type; | 1542 | struct filter_type *filter_type; |
| 1557 | struct filter_arg *arg; | 1543 | struct filter_arg *arg; |
| @@ -1578,14 +1564,14 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source | |||
| 1578 | 1564 | ||
| 1579 | if (src_pevent != dest_pevent) { | 1565 | if (src_pevent != dest_pevent) { |
| 1580 | /* do a look up */ | 1566 | /* do a look up */ |
| 1581 | event = pevent_find_event_by_name(src_pevent, | 1567 | event = tep_find_event_by_name(src_pevent, |
| 1582 | event->system, | 1568 | event->system, |
| 1583 | event->name); | 1569 | event->name); |
| 1584 | if (!event) | 1570 | if (!event) |
| 1585 | return -1; | 1571 | return -1; |
| 1586 | } | 1572 | } |
| 1587 | 1573 | ||
| 1588 | str = pevent_filter_make_string(source, event->id); | 1574 | str = tep_filter_make_string(source, event->id); |
| 1589 | if (!str) | 1575 | if (!str) |
| 1590 | continue; | 1576 | continue; |
| 1591 | 1577 | ||
| @@ -1598,7 +1584,7 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source | |||
| 1598 | } | 1584 | } |
| 1599 | 1585 | ||
| 1600 | /** | 1586 | /** |
| 1601 | * pevent_filter_clear_trivial - clear TRUE and FALSE filters | 1587 | * tep_filter_clear_trivial - clear TRUE and FALSE filters |
| 1602 | * @filter: the filter to remove trivial filters from | 1588 | * @filter: the filter to remove trivial filters from |
| 1603 | * @type: remove only true, false, or both | 1589 | * @type: remove only true, false, or both |
| 1604 | * | 1590 | * |
| @@ -1606,8 +1592,8 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source | |||
| 1606 | * | 1592 | * |
| 1607 | * Returns 0 on success and -1 if there was a problem. | 1593 | * Returns 0 on success and -1 if there was a problem. |
| 1608 | */ | 1594 | */ |
| 1609 | int pevent_filter_clear_trivial(struct event_filter *filter, | 1595 | int tep_filter_clear_trivial(struct event_filter *filter, |
| 1610 | enum filter_trivial_type type) | 1596 | enum filter_trivial_type type) |
| 1611 | { | 1597 | { |
| 1612 | struct filter_type *filter_type; | 1598 | struct filter_type *filter_type; |
| 1613 | int count = 0; | 1599 | int count = 0; |
| @@ -1653,14 +1639,14 @@ int pevent_filter_clear_trivial(struct event_filter *filter, | |||
| 1653 | return 0; | 1639 | return 0; |
| 1654 | 1640 | ||
| 1655 | for (i = 0; i < count; i++) | 1641 | for (i = 0; i < count; i++) |
| 1656 | pevent_filter_remove_event(filter, ids[i]); | 1642 | tep_filter_remove_event(filter, ids[i]); |
| 1657 | 1643 | ||
| 1658 | free(ids); | 1644 | free(ids); |
| 1659 | return 0; | 1645 | return 0; |
| 1660 | } | 1646 | } |
| 1661 | 1647 | ||
| 1662 | /** | 1648 | /** |
| 1663 | * pevent_filter_event_has_trivial - return true event contains trivial filter | 1649 | * tep_filter_event_has_trivial - return true event contains trivial filter |
| 1664 | * @filter: the filter with the information | 1650 | * @filter: the filter with the information |
| 1665 | * @event_id: the id of the event to test | 1651 | * @event_id: the id of the event to test |
| 1666 | * @type: trivial type to test for (TRUE, FALSE, EITHER) | 1652 | * @type: trivial type to test for (TRUE, FALSE, EITHER) |
| @@ -1668,9 +1654,9 @@ int pevent_filter_clear_trivial(struct event_filter *filter, | |||
| 1668 | * Returns 1 if the event contains a matching trivial type | 1654 | * Returns 1 if the event contains a matching trivial type |
| 1669 | * otherwise 0. | 1655 | * otherwise 0. |
| 1670 | */ | 1656 | */ |
| 1671 | int pevent_filter_event_has_trivial(struct event_filter *filter, | 1657 | int tep_filter_event_has_trivial(struct event_filter *filter, |
| 1672 | int event_id, | 1658 | int event_id, |
| 1673 | enum filter_trivial_type type) | 1659 | enum filter_trivial_type type) |
| 1674 | { | 1660 | { |
| 1675 | struct filter_type *filter_type; | 1661 | struct filter_type *filter_type; |
| 1676 | 1662 | ||
| @@ -1697,22 +1683,22 @@ int pevent_filter_event_has_trivial(struct event_filter *filter, | |||
| 1697 | } | 1683 | } |
| 1698 | 1684 | ||
| 1699 | static int test_filter(struct event_format *event, struct filter_arg *arg, | 1685 | static int test_filter(struct event_format *event, struct filter_arg *arg, |
| 1700 | struct pevent_record *record, enum pevent_errno *err); | 1686 | struct tep_record *record, enum tep_errno *err); |
| 1701 | 1687 | ||
| 1702 | static const char * | 1688 | static const char * |
| 1703 | get_comm(struct event_format *event, struct pevent_record *record) | 1689 | get_comm(struct event_format *event, struct tep_record *record) |
| 1704 | { | 1690 | { |
| 1705 | const char *comm; | 1691 | const char *comm; |
| 1706 | int pid; | 1692 | int pid; |
| 1707 | 1693 | ||
| 1708 | pid = pevent_data_pid(event->pevent, record); | 1694 | pid = tep_data_pid(event->pevent, record); |
| 1709 | comm = pevent_data_comm_from_pid(event->pevent, pid); | 1695 | comm = tep_data_comm_from_pid(event->pevent, pid); |
| 1710 | return comm; | 1696 | return comm; |
| 1711 | } | 1697 | } |
| 1712 | 1698 | ||
| 1713 | static unsigned long long | 1699 | static unsigned long long |
| 1714 | get_value(struct event_format *event, | 1700 | get_value(struct event_format *event, |
| 1715 | struct format_field *field, struct pevent_record *record) | 1701 | struct format_field *field, struct tep_record *record) |
| 1716 | { | 1702 | { |
| 1717 | unsigned long long val; | 1703 | unsigned long long val; |
| 1718 | 1704 | ||
| @@ -1728,7 +1714,7 @@ get_value(struct event_format *event, | |||
| 1728 | if (field == &cpu) | 1714 | if (field == &cpu) |
| 1729 | return record->cpu; | 1715 | return record->cpu; |
| 1730 | 1716 | ||
| 1731 | pevent_read_number_field(field, record->data, &val); | 1717 | tep_read_number_field(field, record->data, &val); |
| 1732 | 1718 | ||
| 1733 | if (!(field->flags & FIELD_IS_SIGNED)) | 1719 | if (!(field->flags & FIELD_IS_SIGNED)) |
| 1734 | return val; | 1720 | return val; |
| @@ -1748,11 +1734,11 @@ get_value(struct event_format *event, | |||
| 1748 | 1734 | ||
| 1749 | static unsigned long long | 1735 | static unsigned long long |
| 1750 | get_arg_value(struct event_format *event, struct filter_arg *arg, | 1736 | get_arg_value(struct event_format *event, struct filter_arg *arg, |
| 1751 | struct pevent_record *record, enum pevent_errno *err); | 1737 | struct tep_record *record, enum tep_errno *err); |
| 1752 | 1738 | ||
| 1753 | static unsigned long long | 1739 | static unsigned long long |
| 1754 | get_exp_value(struct event_format *event, struct filter_arg *arg, | 1740 | get_exp_value(struct event_format *event, struct filter_arg *arg, |
| 1755 | struct pevent_record *record, enum pevent_errno *err) | 1741 | struct tep_record *record, enum tep_errno *err) |
| 1756 | { | 1742 | { |
| 1757 | unsigned long long lval, rval; | 1743 | unsigned long long lval, rval; |
| 1758 | 1744 | ||
| @@ -1800,14 +1786,14 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, | |||
| 1800 | case FILTER_EXP_NOT: | 1786 | case FILTER_EXP_NOT: |
| 1801 | default: | 1787 | default: |
| 1802 | if (!*err) | 1788 | if (!*err) |
| 1803 | *err = PEVENT_ERRNO__INVALID_EXP_TYPE; | 1789 | *err = TEP_ERRNO__INVALID_EXP_TYPE; |
| 1804 | } | 1790 | } |
| 1805 | return 0; | 1791 | return 0; |
| 1806 | } | 1792 | } |
| 1807 | 1793 | ||
| 1808 | static unsigned long long | 1794 | static unsigned long long |
| 1809 | get_arg_value(struct event_format *event, struct filter_arg *arg, | 1795 | get_arg_value(struct event_format *event, struct filter_arg *arg, |
| 1810 | struct pevent_record *record, enum pevent_errno *err) | 1796 | struct tep_record *record, enum tep_errno *err) |
| 1811 | { | 1797 | { |
| 1812 | switch (arg->type) { | 1798 | switch (arg->type) { |
| 1813 | case FILTER_ARG_FIELD: | 1799 | case FILTER_ARG_FIELD: |
| @@ -1816,7 +1802,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, | |||
| 1816 | case FILTER_ARG_VALUE: | 1802 | case FILTER_ARG_VALUE: |
| 1817 | if (arg->value.type != FILTER_NUMBER) { | 1803 | if (arg->value.type != FILTER_NUMBER) { |
| 1818 | if (!*err) | 1804 | if (!*err) |
| 1819 | *err = PEVENT_ERRNO__NOT_A_NUMBER; | 1805 | *err = TEP_ERRNO__NOT_A_NUMBER; |
| 1820 | } | 1806 | } |
| 1821 | return arg->value.val; | 1807 | return arg->value.val; |
| 1822 | 1808 | ||
| @@ -1825,13 +1811,13 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, | |||
| 1825 | 1811 | ||
| 1826 | default: | 1812 | default: |
| 1827 | if (!*err) | 1813 | if (!*err) |
| 1828 | *err = PEVENT_ERRNO__INVALID_ARG_TYPE; | 1814 | *err = TEP_ERRNO__INVALID_ARG_TYPE; |
| 1829 | } | 1815 | } |
| 1830 | return 0; | 1816 | return 0; |
| 1831 | } | 1817 | } |
| 1832 | 1818 | ||
| 1833 | static int test_num(struct event_format *event, struct filter_arg *arg, | 1819 | static int test_num(struct event_format *event, struct filter_arg *arg, |
| 1834 | struct pevent_record *record, enum pevent_errno *err) | 1820 | struct tep_record *record, enum tep_errno *err) |
| 1835 | { | 1821 | { |
| 1836 | unsigned long long lval, rval; | 1822 | unsigned long long lval, rval; |
| 1837 | 1823 | ||
| @@ -1866,15 +1852,15 @@ static int test_num(struct event_format *event, struct filter_arg *arg, | |||
| 1866 | 1852 | ||
| 1867 | default: | 1853 | default: |
| 1868 | if (!*err) | 1854 | if (!*err) |
| 1869 | *err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; | 1855 | *err = TEP_ERRNO__ILLEGAL_INTEGER_CMP; |
| 1870 | return 0; | 1856 | return 0; |
| 1871 | } | 1857 | } |
| 1872 | } | 1858 | } |
| 1873 | 1859 | ||
| 1874 | static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record) | 1860 | static const char *get_field_str(struct filter_arg *arg, struct tep_record *record) |
| 1875 | { | 1861 | { |
| 1876 | struct event_format *event; | 1862 | struct event_format *event; |
| 1877 | struct pevent *pevent; | 1863 | struct tep_handle *pevent; |
| 1878 | unsigned long long addr; | 1864 | unsigned long long addr; |
| 1879 | const char *val = NULL; | 1865 | const char *val = NULL; |
| 1880 | unsigned int size; | 1866 | unsigned int size; |
| @@ -1909,7 +1895,7 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r | |||
| 1909 | 1895 | ||
| 1910 | if (arg->str.field->flags & (FIELD_IS_POINTER | FIELD_IS_LONG)) | 1896 | if (arg->str.field->flags & (FIELD_IS_POINTER | FIELD_IS_LONG)) |
| 1911 | /* convert to a kernel symbol */ | 1897 | /* convert to a kernel symbol */ |
| 1912 | val = pevent_find_function(pevent, addr); | 1898 | val = tep_find_function(pevent, addr); |
| 1913 | 1899 | ||
| 1914 | if (val == NULL) { | 1900 | if (val == NULL) { |
| 1915 | /* just use the hex of the string name */ | 1901 | /* just use the hex of the string name */ |
| @@ -1922,7 +1908,7 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r | |||
| 1922 | } | 1908 | } |
| 1923 | 1909 | ||
| 1924 | static int test_str(struct event_format *event, struct filter_arg *arg, | 1910 | static int test_str(struct event_format *event, struct filter_arg *arg, |
| 1925 | struct pevent_record *record, enum pevent_errno *err) | 1911 | struct tep_record *record, enum tep_errno *err) |
| 1926 | { | 1912 | { |
| 1927 | const char *val; | 1913 | const char *val; |
| 1928 | 1914 | ||
| @@ -1947,13 +1933,13 @@ static int test_str(struct event_format *event, struct filter_arg *arg, | |||
| 1947 | 1933 | ||
| 1948 | default: | 1934 | default: |
| 1949 | if (!*err) | 1935 | if (!*err) |
| 1950 | *err = PEVENT_ERRNO__ILLEGAL_STRING_CMP; | 1936 | *err = TEP_ERRNO__ILLEGAL_STRING_CMP; |
| 1951 | return 0; | 1937 | return 0; |
| 1952 | } | 1938 | } |
| 1953 | } | 1939 | } |
| 1954 | 1940 | ||
| 1955 | static int test_op(struct event_format *event, struct filter_arg *arg, | 1941 | static int test_op(struct event_format *event, struct filter_arg *arg, |
| 1956 | struct pevent_record *record, enum pevent_errno *err) | 1942 | struct tep_record *record, enum tep_errno *err) |
| 1957 | { | 1943 | { |
| 1958 | switch (arg->op.type) { | 1944 | switch (arg->op.type) { |
| 1959 | case FILTER_OP_AND: | 1945 | case FILTER_OP_AND: |
| @@ -1969,13 +1955,13 @@ static int test_op(struct event_format *event, struct filter_arg *arg, | |||
| 1969 | 1955 | ||
| 1970 | default: | 1956 | default: |
| 1971 | if (!*err) | 1957 | if (!*err) |
| 1972 | *err = PEVENT_ERRNO__INVALID_OP_TYPE; | 1958 | *err = TEP_ERRNO__INVALID_OP_TYPE; |
| 1973 | return 0; | 1959 | return 0; |
| 1974 | } | 1960 | } |
| 1975 | } | 1961 | } |
| 1976 | 1962 | ||
| 1977 | static int test_filter(struct event_format *event, struct filter_arg *arg, | 1963 | static int test_filter(struct event_format *event, struct filter_arg *arg, |
| 1978 | struct pevent_record *record, enum pevent_errno *err) | 1964 | struct tep_record *record, enum tep_errno *err) |
| 1979 | { | 1965 | { |
| 1980 | if (*err) { | 1966 | if (*err) { |
| 1981 | /* | 1967 | /* |
| @@ -2009,20 +1995,20 @@ static int test_filter(struct event_format *event, struct filter_arg *arg, | |||
| 2009 | 1995 | ||
| 2010 | default: | 1996 | default: |
| 2011 | if (!*err) | 1997 | if (!*err) |
| 2012 | *err = PEVENT_ERRNO__INVALID_ARG_TYPE; | 1998 | *err = TEP_ERRNO__INVALID_ARG_TYPE; |
| 2013 | return 0; | 1999 | return 0; |
| 2014 | } | 2000 | } |
| 2015 | } | 2001 | } |
| 2016 | 2002 | ||
| 2017 | /** | 2003 | /** |
| 2018 | * pevent_event_filtered - return true if event has filter | 2004 | * tep_event_filtered - return true if event has filter |
| 2019 | * @filter: filter struct with filter information | 2005 | * @filter: filter struct with filter information |
| 2020 | * @event_id: event id to test if filter exists | 2006 | * @event_id: event id to test if filter exists |
| 2021 | * | 2007 | * |
| 2022 | * Returns 1 if filter found for @event_id | 2008 | * Returns 1 if filter found for @event_id |
| 2023 | * otherwise 0; | 2009 | * otherwise 0; |
| 2024 | */ | 2010 | */ |
| 2025 | int pevent_event_filtered(struct event_filter *filter, int event_id) | 2011 | int tep_event_filtered(struct event_filter *filter, int event_id) |
| 2026 | { | 2012 | { |
| 2027 | struct filter_type *filter_type; | 2013 | struct filter_type *filter_type; |
| 2028 | 2014 | ||
| @@ -2035,42 +2021,42 @@ int pevent_event_filtered(struct event_filter *filter, int event_id) | |||
| 2035 | } | 2021 | } |
| 2036 | 2022 | ||
| 2037 | /** | 2023 | /** |
| 2038 | * pevent_filter_match - test if a record matches a filter | 2024 | * tep_filter_match - test if a record matches a filter |
| 2039 | * @filter: filter struct with filter information | 2025 | * @filter: filter struct with filter information |
| 2040 | * @record: the record to test against the filter | 2026 | * @record: the record to test against the filter |
| 2041 | * | 2027 | * |
| 2042 | * Returns: match result or error code (prefixed with PEVENT_ERRNO__) | 2028 | * Returns: match result or error code (prefixed with TEP_ERRNO__) |
| 2043 | * FILTER_MATCH - filter found for event and @record matches | 2029 | * FILTER_MATCH - filter found for event and @record matches |
| 2044 | * FILTER_MISS - filter found for event and @record does not match | 2030 | * FILTER_MISS - filter found for event and @record does not match |
| 2045 | * FILTER_NOT_FOUND - no filter found for @record's event | 2031 | * FILTER_NOT_FOUND - no filter found for @record's event |
| 2046 | * NO_FILTER - if no filters exist | 2032 | * NO_FILTER - if no filters exist |
| 2047 | * otherwise - error occurred during test | 2033 | * otherwise - error occurred during test |
| 2048 | */ | 2034 | */ |
| 2049 | enum pevent_errno pevent_filter_match(struct event_filter *filter, | 2035 | enum tep_errno tep_filter_match(struct event_filter *filter, |
| 2050 | struct pevent_record *record) | 2036 | struct tep_record *record) |
| 2051 | { | 2037 | { |
| 2052 | struct pevent *pevent = filter->pevent; | 2038 | struct tep_handle *pevent = filter->pevent; |
| 2053 | struct filter_type *filter_type; | 2039 | struct filter_type *filter_type; |
| 2054 | int event_id; | 2040 | int event_id; |
| 2055 | int ret; | 2041 | int ret; |
| 2056 | enum pevent_errno err = 0; | 2042 | enum tep_errno err = 0; |
| 2057 | 2043 | ||
| 2058 | filter_init_error_buf(filter); | 2044 | filter_init_error_buf(filter); |
| 2059 | 2045 | ||
| 2060 | if (!filter->filters) | 2046 | if (!filter->filters) |
| 2061 | return PEVENT_ERRNO__NO_FILTER; | 2047 | return TEP_ERRNO__NO_FILTER; |
| 2062 | 2048 | ||
| 2063 | event_id = pevent_data_type(pevent, record); | 2049 | event_id = tep_data_type(pevent, record); |
| 2064 | 2050 | ||
| 2065 | filter_type = find_filter_type(filter, event_id); | 2051 | filter_type = find_filter_type(filter, event_id); |
| 2066 | if (!filter_type) | 2052 | if (!filter_type) |
| 2067 | return PEVENT_ERRNO__FILTER_NOT_FOUND; | 2053 | return TEP_ERRNO__FILTER_NOT_FOUND; |
| 2068 | 2054 | ||
| 2069 | ret = test_filter(filter_type->event, filter_type->filter, record, &err); | 2055 | ret = test_filter(filter_type->event, filter_type->filter, record, &err); |
| 2070 | if (err) | 2056 | if (err) |
| 2071 | return err; | 2057 | return err; |
| 2072 | 2058 | ||
| 2073 | return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS; | 2059 | return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS; |
| 2074 | } | 2060 | } |
| 2075 | 2061 | ||
| 2076 | static char *op_to_str(struct event_filter *filter, struct filter_arg *arg) | 2062 | static char *op_to_str(struct event_filter *filter, struct filter_arg *arg) |
| @@ -2364,7 +2350,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg) | |||
| 2364 | } | 2350 | } |
| 2365 | 2351 | ||
| 2366 | /** | 2352 | /** |
| 2367 | * pevent_filter_make_string - return a string showing the filter | 2353 | * tep_filter_make_string - return a string showing the filter |
| 2368 | * @filter: filter struct with filter information | 2354 | * @filter: filter struct with filter information |
| 2369 | * @event_id: the event id to return the filter string with | 2355 | * @event_id: the event id to return the filter string with |
| 2370 | * | 2356 | * |
| @@ -2373,7 +2359,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg) | |||
| 2373 | * NULL is returned if no filter is found or allocation failed. | 2359 | * NULL is returned if no filter is found or allocation failed. |
| 2374 | */ | 2360 | */ |
| 2375 | char * | 2361 | char * |
| 2376 | pevent_filter_make_string(struct event_filter *filter, int event_id) | 2362 | tep_filter_make_string(struct event_filter *filter, int event_id) |
| 2377 | { | 2363 | { |
| 2378 | struct filter_type *filter_type; | 2364 | struct filter_type *filter_type; |
| 2379 | 2365 | ||
| @@ -2389,7 +2375,7 @@ pevent_filter_make_string(struct event_filter *filter, int event_id) | |||
| 2389 | } | 2375 | } |
| 2390 | 2376 | ||
| 2391 | /** | 2377 | /** |
| 2392 | * pevent_filter_compare - compare two filters and return if they are the same | 2378 | * tep_filter_compare - compare two filters and return if they are the same |
| 2393 | * @filter1: Filter to compare with @filter2 | 2379 | * @filter1: Filter to compare with @filter2 |
| 2394 | * @filter2: Filter to compare with @filter1 | 2380 | * @filter2: Filter to compare with @filter1 |
| 2395 | * | 2381 | * |
| @@ -2397,7 +2383,7 @@ pevent_filter_make_string(struct event_filter *filter, int event_id) | |||
| 2397 | * 1 if the two filters hold the same content. | 2383 | * 1 if the two filters hold the same content. |
| 2398 | * 0 if they do not. | 2384 | * 0 if they do not. |
| 2399 | */ | 2385 | */ |
| 2400 | int pevent_filter_compare(struct event_filter *filter1, struct event_filter *filter2) | 2386 | int tep_filter_compare(struct event_filter *filter1, struct event_filter *filter2) |
| 2401 | { | 2387 | { |
| 2402 | struct filter_type *filter_type1; | 2388 | struct filter_type *filter_type1; |
| 2403 | struct filter_type *filter_type2; | 2389 | struct filter_type *filter_type2; |
diff --git a/tools/lib/traceevent/parse-utils.c b/tools/lib/traceevent/parse-utils.c index eda07fa31dca..77e4ec6402dd 100644 --- a/tools/lib/traceevent/parse-utils.c +++ b/tools/lib/traceevent/parse-utils.c | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | */ | 5 | */ |
| 20 | #include <stdio.h> | 6 | #include <stdio.h> |
| 21 | #include <stdlib.h> | 7 | #include <stdlib.h> |
diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugin_cfg80211.c index 8f8586912da7..a51b366f47da 100644 --- a/tools/lib/traceevent/plugin_cfg80211.c +++ b/tools/lib/traceevent/plugin_cfg80211.c | |||
| @@ -25,19 +25,19 @@ process___le16_to_cpup(struct trace_seq *s, unsigned long long *args) | |||
| 25 | return val ? (long long) le16toh(*val) : 0; | 25 | return val ? (long long) le16toh(*val) : 0; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 28 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 29 | { | 29 | { |
| 30 | pevent_register_print_function(pevent, | 30 | tep_register_print_function(pevent, |
| 31 | process___le16_to_cpup, | 31 | process___le16_to_cpup, |
| 32 | PEVENT_FUNC_ARG_INT, | 32 | TEP_FUNC_ARG_INT, |
| 33 | "__le16_to_cpup", | 33 | "__le16_to_cpup", |
| 34 | PEVENT_FUNC_ARG_PTR, | 34 | TEP_FUNC_ARG_PTR, |
| 35 | PEVENT_FUNC_ARG_VOID); | 35 | TEP_FUNC_ARG_VOID); |
| 36 | return 0; | 36 | return 0; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 39 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 40 | { | 40 | { |
| 41 | pevent_unregister_print_function(pevent, process___le16_to_cpup, | 41 | tep_unregister_print_function(pevent, process___le16_to_cpup, |
| 42 | "__le16_to_cpup"); | 42 | "__le16_to_cpup"); |
| 43 | } | 43 | } |
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index 42dbf73758f3..424747475d37 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c | |||
| @@ -33,7 +33,7 @@ static int cpus = -1; | |||
| 33 | 33 | ||
| 34 | #define STK_BLK 10 | 34 | #define STK_BLK 10 |
| 35 | 35 | ||
| 36 | struct pevent_plugin_option plugin_options[] = | 36 | struct tep_plugin_option plugin_options[] = |
| 37 | { | 37 | { |
| 38 | { | 38 | { |
| 39 | .name = "parent", | 39 | .name = "parent", |
| @@ -53,8 +53,8 @@ struct pevent_plugin_option plugin_options[] = | |||
| 53 | } | 53 | } |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | static struct pevent_plugin_option *ftrace_parent = &plugin_options[0]; | 56 | static struct tep_plugin_option *ftrace_parent = &plugin_options[0]; |
| 57 | static struct pevent_plugin_option *ftrace_indent = &plugin_options[1]; | 57 | static struct tep_plugin_option *ftrace_indent = &plugin_options[1]; |
| 58 | 58 | ||
| 59 | static void add_child(struct func_stack *stack, const char *child, int pos) | 59 | static void add_child(struct func_stack *stack, const char *child, int pos) |
| 60 | { | 60 | { |
| @@ -122,25 +122,25 @@ static int add_and_get_index(const char *parent, const char *child, int cpu) | |||
| 122 | return 0; | 122 | return 0; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int function_handler(struct trace_seq *s, struct pevent_record *record, | 125 | static int function_handler(struct trace_seq *s, struct tep_record *record, |
| 126 | struct event_format *event, void *context) | 126 | struct event_format *event, void *context) |
| 127 | { | 127 | { |
| 128 | struct pevent *pevent = event->pevent; | 128 | struct tep_handle *pevent = event->pevent; |
| 129 | unsigned long long function; | 129 | unsigned long long function; |
| 130 | unsigned long long pfunction; | 130 | unsigned long long pfunction; |
| 131 | const char *func; | 131 | const char *func; |
| 132 | const char *parent; | 132 | const char *parent; |
| 133 | int index = 0; | 133 | int index = 0; |
| 134 | 134 | ||
| 135 | if (pevent_get_field_val(s, event, "ip", record, &function, 1)) | 135 | if (tep_get_field_val(s, event, "ip", record, &function, 1)) |
| 136 | return trace_seq_putc(s, '!'); | 136 | return trace_seq_putc(s, '!'); |
| 137 | 137 | ||
| 138 | func = pevent_find_function(pevent, function); | 138 | func = tep_find_function(pevent, function); |
| 139 | 139 | ||
| 140 | if (pevent_get_field_val(s, event, "parent_ip", record, &pfunction, 1)) | 140 | if (tep_get_field_val(s, event, "parent_ip", record, &pfunction, 1)) |
| 141 | return trace_seq_putc(s, '!'); | 141 | return trace_seq_putc(s, '!'); |
| 142 | 142 | ||
| 143 | parent = pevent_find_function(pevent, pfunction); | 143 | parent = tep_find_function(pevent, pfunction); |
| 144 | 144 | ||
| 145 | if (parent && ftrace_indent->set) | 145 | if (parent && ftrace_indent->set) |
| 146 | index = add_and_get_index(parent, func, record->cpu); | 146 | index = add_and_get_index(parent, func, record->cpu); |
| @@ -163,22 +163,22 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
| 163 | return 0; | 163 | return 0; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 166 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 167 | { | 167 | { |
| 168 | pevent_register_event_handler(pevent, -1, "ftrace", "function", | 168 | tep_register_event_handler(pevent, -1, "ftrace", "function", |
| 169 | function_handler, NULL); | 169 | function_handler, NULL); |
| 170 | 170 | ||
| 171 | traceevent_plugin_add_options("ftrace", plugin_options); | 171 | tep_plugin_add_options("ftrace", plugin_options); |
| 172 | 172 | ||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 176 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 177 | { | 177 | { |
| 178 | int i, x; | 178 | int i, x; |
| 179 | 179 | ||
| 180 | pevent_unregister_event_handler(pevent, -1, "ftrace", "function", | 180 | tep_unregister_event_handler(pevent, -1, "ftrace", "function", |
| 181 | function_handler, NULL); | 181 | function_handler, NULL); |
| 182 | 182 | ||
| 183 | for (i = 0; i <= cpus; i++) { | 183 | for (i = 0; i <= cpus; i++) { |
| 184 | for (x = 0; x < fstack[i].size && fstack[i].stack[x]; x++) | 184 | for (x = 0; x < fstack[i].size && fstack[i].stack[x]; x++) |
| @@ -186,7 +186,7 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | |||
| 186 | free(fstack[i].stack); | 186 | free(fstack[i].stack); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | traceevent_plugin_remove_options(plugin_options); | 189 | tep_plugin_remove_options(plugin_options); |
| 190 | 190 | ||
| 191 | free(fstack); | 191 | free(fstack); |
| 192 | fstack = NULL; | 192 | fstack = NULL; |
diff --git a/tools/lib/traceevent/plugin_hrtimer.c b/tools/lib/traceevent/plugin_hrtimer.c index 12bf14cc1152..b43bfec565d8 100644 --- a/tools/lib/traceevent/plugin_hrtimer.c +++ b/tools/lib/traceevent/plugin_hrtimer.c | |||
| @@ -25,64 +25,64 @@ | |||
| 25 | #include "event-parse.h" | 25 | #include "event-parse.h" |
| 26 | 26 | ||
| 27 | static int timer_expire_handler(struct trace_seq *s, | 27 | static int timer_expire_handler(struct trace_seq *s, |
| 28 | struct pevent_record *record, | 28 | struct tep_record *record, |
| 29 | struct event_format *event, void *context) | 29 | struct event_format *event, void *context) |
| 30 | { | 30 | { |
| 31 | trace_seq_printf(s, "hrtimer="); | 31 | trace_seq_printf(s, "hrtimer="); |
| 32 | 32 | ||
| 33 | if (pevent_print_num_field(s, "0x%llx", event, "timer", | 33 | if (tep_print_num_field(s, "0x%llx", event, "timer", |
| 34 | record, 0) == -1) | 34 | record, 0) == -1) |
| 35 | pevent_print_num_field(s, "0x%llx", event, "hrtimer", | 35 | tep_print_num_field(s, "0x%llx", event, "hrtimer", |
| 36 | record, 1); | 36 | record, 1); |
| 37 | 37 | ||
| 38 | trace_seq_printf(s, " now="); | 38 | trace_seq_printf(s, " now="); |
| 39 | 39 | ||
| 40 | pevent_print_num_field(s, "%llu", event, "now", record, 1); | 40 | tep_print_num_field(s, "%llu", event, "now", record, 1); |
| 41 | 41 | ||
| 42 | pevent_print_func_field(s, " function=%s", event, "function", | 42 | tep_print_func_field(s, " function=%s", event, "function", |
| 43 | record, 0); | 43 | record, 0); |
| 44 | return 0; | 44 | return 0; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static int timer_start_handler(struct trace_seq *s, | 47 | static int timer_start_handler(struct trace_seq *s, |
| 48 | struct pevent_record *record, | 48 | struct tep_record *record, |
| 49 | struct event_format *event, void *context) | 49 | struct event_format *event, void *context) |
| 50 | { | 50 | { |
| 51 | trace_seq_printf(s, "hrtimer="); | 51 | trace_seq_printf(s, "hrtimer="); |
| 52 | 52 | ||
| 53 | if (pevent_print_num_field(s, "0x%llx", event, "timer", | 53 | if (tep_print_num_field(s, "0x%llx", event, "timer", |
| 54 | record, 0) == -1) | 54 | record, 0) == -1) |
| 55 | pevent_print_num_field(s, "0x%llx", event, "hrtimer", | 55 | tep_print_num_field(s, "0x%llx", event, "hrtimer", |
| 56 | record, 1); | 56 | record, 1); |
| 57 | 57 | ||
| 58 | pevent_print_func_field(s, " function=%s", event, "function", | 58 | tep_print_func_field(s, " function=%s", event, "function", |
| 59 | record, 0); | 59 | record, 0); |
| 60 | 60 | ||
| 61 | trace_seq_printf(s, " expires="); | 61 | trace_seq_printf(s, " expires="); |
| 62 | pevent_print_num_field(s, "%llu", event, "expires", record, 1); | 62 | tep_print_num_field(s, "%llu", event, "expires", record, 1); |
| 63 | 63 | ||
| 64 | trace_seq_printf(s, " softexpires="); | 64 | trace_seq_printf(s, " softexpires="); |
| 65 | pevent_print_num_field(s, "%llu", event, "softexpires", record, 1); | 65 | tep_print_num_field(s, "%llu", event, "softexpires", record, 1); |
| 66 | return 0; | 66 | return 0; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 69 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 70 | { | 70 | { |
| 71 | pevent_register_event_handler(pevent, -1, | 71 | tep_register_event_handler(pevent, -1, |
| 72 | "timer", "hrtimer_expire_entry", | 72 | "timer", "hrtimer_expire_entry", |
| 73 | timer_expire_handler, NULL); | 73 | timer_expire_handler, NULL); |
| 74 | 74 | ||
| 75 | pevent_register_event_handler(pevent, -1, "timer", "hrtimer_start", | 75 | tep_register_event_handler(pevent, -1, "timer", "hrtimer_start", |
| 76 | timer_start_handler, NULL); | 76 | timer_start_handler, NULL); |
| 77 | return 0; | 77 | return 0; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 80 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 81 | { | 81 | { |
| 82 | pevent_unregister_event_handler(pevent, -1, | 82 | tep_unregister_event_handler(pevent, -1, |
| 83 | "timer", "hrtimer_expire_entry", | 83 | "timer", "hrtimer_expire_entry", |
| 84 | timer_expire_handler, NULL); | 84 | timer_expire_handler, NULL); |
| 85 | 85 | ||
| 86 | pevent_unregister_event_handler(pevent, -1, "timer", "hrtimer_start", | 86 | tep_unregister_event_handler(pevent, -1, "timer", "hrtimer_start", |
| 87 | timer_start_handler, NULL); | 87 | timer_start_handler, NULL); |
| 88 | } | 88 | } |
diff --git a/tools/lib/traceevent/plugin_jbd2.c b/tools/lib/traceevent/plugin_jbd2.c index 5c23d5bd27ce..45a9acd19640 100644 --- a/tools/lib/traceevent/plugin_jbd2.c +++ b/tools/lib/traceevent/plugin_jbd2.c | |||
| @@ -47,29 +47,29 @@ process_jiffies_to_msecs(struct trace_seq *s, unsigned long long *args) | |||
| 47 | return jiffies; | 47 | return jiffies; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 50 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 51 | { | 51 | { |
| 52 | pevent_register_print_function(pevent, | 52 | tep_register_print_function(pevent, |
| 53 | process_jbd2_dev_to_name, | 53 | process_jbd2_dev_to_name, |
| 54 | PEVENT_FUNC_ARG_STRING, | 54 | TEP_FUNC_ARG_STRING, |
| 55 | "jbd2_dev_to_name", | 55 | "jbd2_dev_to_name", |
| 56 | PEVENT_FUNC_ARG_INT, | 56 | TEP_FUNC_ARG_INT, |
| 57 | PEVENT_FUNC_ARG_VOID); | 57 | TEP_FUNC_ARG_VOID); |
| 58 | 58 | ||
| 59 | pevent_register_print_function(pevent, | 59 | tep_register_print_function(pevent, |
| 60 | process_jiffies_to_msecs, | 60 | process_jiffies_to_msecs, |
| 61 | PEVENT_FUNC_ARG_LONG, | 61 | TEP_FUNC_ARG_LONG, |
| 62 | "jiffies_to_msecs", | 62 | "jiffies_to_msecs", |
| 63 | PEVENT_FUNC_ARG_LONG, | 63 | TEP_FUNC_ARG_LONG, |
| 64 | PEVENT_FUNC_ARG_VOID); | 64 | TEP_FUNC_ARG_VOID); |
| 65 | return 0; | 65 | return 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 68 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 69 | { | 69 | { |
| 70 | pevent_unregister_print_function(pevent, process_jbd2_dev_to_name, | 70 | tep_unregister_print_function(pevent, process_jbd2_dev_to_name, |
| 71 | "jbd2_dev_to_name"); | 71 | "jbd2_dev_to_name"); |
| 72 | 72 | ||
| 73 | pevent_unregister_print_function(pevent, process_jiffies_to_msecs, | 73 | tep_unregister_print_function(pevent, process_jiffies_to_msecs, |
| 74 | "jiffies_to_msecs"); | 74 | "jiffies_to_msecs"); |
| 75 | } | 75 | } |
diff --git a/tools/lib/traceevent/plugin_kmem.c b/tools/lib/traceevent/plugin_kmem.c index 70650ff48d78..73966b05abce 100644 --- a/tools/lib/traceevent/plugin_kmem.c +++ b/tools/lib/traceevent/plugin_kmem.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include "event-parse.h" | 24 | #include "event-parse.h" |
| 25 | 25 | ||
| 26 | static int call_site_handler(struct trace_seq *s, struct pevent_record *record, | 26 | static int call_site_handler(struct trace_seq *s, struct tep_record *record, |
| 27 | struct event_format *event, void *context) | 27 | struct event_format *event, void *context) |
| 28 | { | 28 | { |
| 29 | struct format_field *field; | 29 | struct format_field *field; |
| @@ -31,64 +31,64 @@ static int call_site_handler(struct trace_seq *s, struct pevent_record *record, | |||
| 31 | void *data = record->data; | 31 | void *data = record->data; |
| 32 | const char *func; | 32 | const char *func; |
| 33 | 33 | ||
| 34 | field = pevent_find_field(event, "call_site"); | 34 | field = tep_find_field(event, "call_site"); |
| 35 | if (!field) | 35 | if (!field) |
| 36 | return 1; | 36 | return 1; |
| 37 | 37 | ||
| 38 | if (pevent_read_number_field(field, data, &val)) | 38 | if (tep_read_number_field(field, data, &val)) |
| 39 | return 1; | 39 | return 1; |
| 40 | 40 | ||
| 41 | func = pevent_find_function(event->pevent, val); | 41 | func = tep_find_function(event->pevent, val); |
| 42 | if (!func) | 42 | if (!func) |
| 43 | return 1; | 43 | return 1; |
| 44 | 44 | ||
| 45 | addr = pevent_find_function_address(event->pevent, val); | 45 | addr = tep_find_function_address(event->pevent, val); |
| 46 | 46 | ||
| 47 | trace_seq_printf(s, "(%s+0x%x) ", func, (int)(val - addr)); | 47 | trace_seq_printf(s, "(%s+0x%x) ", func, (int)(val - addr)); |
| 48 | return 1; | 48 | return 1; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 51 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 52 | { | 52 | { |
| 53 | pevent_register_event_handler(pevent, -1, "kmem", "kfree", | 53 | tep_register_event_handler(pevent, -1, "kmem", "kfree", |
| 54 | call_site_handler, NULL); | 54 | call_site_handler, NULL); |
| 55 | 55 | ||
| 56 | pevent_register_event_handler(pevent, -1, "kmem", "kmalloc", | 56 | tep_register_event_handler(pevent, -1, "kmem", "kmalloc", |
| 57 | call_site_handler, NULL); | 57 | call_site_handler, NULL); |
| 58 | 58 | ||
| 59 | pevent_register_event_handler(pevent, -1, "kmem", "kmalloc_node", | 59 | tep_register_event_handler(pevent, -1, "kmem", "kmalloc_node", |
| 60 | call_site_handler, NULL); | 60 | call_site_handler, NULL); |
| 61 | 61 | ||
| 62 | pevent_register_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", | 62 | tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", |
| 63 | call_site_handler, NULL); | 63 | call_site_handler, NULL); |
| 64 | 64 | ||
| 65 | pevent_register_event_handler(pevent, -1, "kmem", | 65 | tep_register_event_handler(pevent, -1, "kmem", |
| 66 | "kmem_cache_alloc_node", | 66 | "kmem_cache_alloc_node", |
| 67 | call_site_handler, NULL); | 67 | call_site_handler, NULL); |
| 68 | 68 | ||
| 69 | pevent_register_event_handler(pevent, -1, "kmem", "kmem_cache_free", | 69 | tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_free", |
| 70 | call_site_handler, NULL); | 70 | call_site_handler, NULL); |
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 74 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 75 | { | 75 | { |
| 76 | pevent_unregister_event_handler(pevent, -1, "kmem", "kfree", | 76 | tep_unregister_event_handler(pevent, -1, "kmem", "kfree", |
| 77 | call_site_handler, NULL); | 77 | call_site_handler, NULL); |
| 78 | 78 | ||
| 79 | pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc", | 79 | tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc", |
| 80 | call_site_handler, NULL); | 80 | call_site_handler, NULL); |
| 81 | 81 | ||
| 82 | pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node", | 82 | tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node", |
| 83 | call_site_handler, NULL); | 83 | call_site_handler, NULL); |
| 84 | 84 | ||
| 85 | pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", | 85 | tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc", |
| 86 | call_site_handler, NULL); | 86 | call_site_handler, NULL); |
| 87 | 87 | ||
| 88 | pevent_unregister_event_handler(pevent, -1, "kmem", | 88 | tep_unregister_event_handler(pevent, -1, "kmem", |
| 89 | "kmem_cache_alloc_node", | 89 | "kmem_cache_alloc_node", |
| 90 | call_site_handler, NULL); | 90 | call_site_handler, NULL); |
| 91 | 91 | ||
| 92 | pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free", | 92 | tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free", |
| 93 | call_site_handler, NULL); | 93 | call_site_handler, NULL); |
| 94 | } | 94 | } |
diff --git a/tools/lib/traceevent/plugin_kvm.c b/tools/lib/traceevent/plugin_kvm.c index 18536f756577..1d0d15906225 100644 --- a/tools/lib/traceevent/plugin_kvm.c +++ b/tools/lib/traceevent/plugin_kvm.c | |||
| @@ -247,17 +247,17 @@ static const char *find_exit_reason(unsigned isa, int val) | |||
| 247 | return strings[i].str; | 247 | return strings[i].str; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static int print_exit_reason(struct trace_seq *s, struct pevent_record *record, | 250 | static int print_exit_reason(struct trace_seq *s, struct tep_record *record, |
| 251 | struct event_format *event, const char *field) | 251 | struct event_format *event, const char *field) |
| 252 | { | 252 | { |
| 253 | unsigned long long isa; | 253 | unsigned long long isa; |
| 254 | unsigned long long val; | 254 | unsigned long long val; |
| 255 | const char *reason; | 255 | const char *reason; |
| 256 | 256 | ||
| 257 | if (pevent_get_field_val(s, event, field, record, &val, 1) < 0) | 257 | if (tep_get_field_val(s, event, field, record, &val, 1) < 0) |
| 258 | return -1; | 258 | return -1; |
| 259 | 259 | ||
| 260 | if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) | 260 | if (tep_get_field_val(s, event, "isa", record, &isa, 0) < 0) |
| 261 | isa = 1; | 261 | isa = 1; |
| 262 | 262 | ||
| 263 | reason = find_exit_reason(isa, val); | 263 | reason = find_exit_reason(isa, val); |
| @@ -268,7 +268,7 @@ static int print_exit_reason(struct trace_seq *s, struct pevent_record *record, | |||
| 268 | return 0; | 268 | return 0; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | 271 | static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record, |
| 272 | struct event_format *event, void *context) | 272 | struct event_format *event, void *context) |
| 273 | { | 273 | { |
| 274 | unsigned long long info1 = 0, info2 = 0; | 274 | unsigned long long info1 = 0, info2 = 0; |
| @@ -276,10 +276,10 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | |||
| 276 | if (print_exit_reason(s, record, event, "exit_reason") < 0) | 276 | if (print_exit_reason(s, record, event, "exit_reason") < 0) |
| 277 | return -1; | 277 | return -1; |
| 278 | 278 | ||
| 279 | pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); | 279 | tep_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); |
| 280 | 280 | ||
| 281 | if (pevent_get_field_val(s, event, "info1", record, &info1, 0) >= 0 | 281 | if (tep_get_field_val(s, event, "info1", record, &info1, 0) >= 0 |
| 282 | && pevent_get_field_val(s, event, "info2", record, &info2, 0) >= 0) | 282 | && tep_get_field_val(s, event, "info2", record, &info2, 0) >= 0) |
| 283 | trace_seq_printf(s, " info %llx %llx", info1, info2); | 283 | trace_seq_printf(s, " info %llx %llx", info1, info2); |
| 284 | 284 | ||
| 285 | return 0; | 285 | return 0; |
| @@ -291,7 +291,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | |||
| 291 | #define KVM_EMUL_INSN_F_CS_L (1 << 3) | 291 | #define KVM_EMUL_INSN_F_CS_L (1 << 3) |
| 292 | 292 | ||
| 293 | static int kvm_emulate_insn_handler(struct trace_seq *s, | 293 | static int kvm_emulate_insn_handler(struct trace_seq *s, |
| 294 | struct pevent_record *record, | 294 | struct tep_record *record, |
| 295 | struct event_format *event, void *context) | 295 | struct event_format *event, void *context) |
| 296 | { | 296 | { |
| 297 | unsigned long long rip, csbase, len, flags, failed; | 297 | unsigned long long rip, csbase, len, flags, failed; |
| @@ -299,22 +299,22 @@ static int kvm_emulate_insn_handler(struct trace_seq *s, | |||
| 299 | uint8_t *insn; | 299 | uint8_t *insn; |
| 300 | const char *disasm; | 300 | const char *disasm; |
| 301 | 301 | ||
| 302 | if (pevent_get_field_val(s, event, "rip", record, &rip, 1) < 0) | 302 | if (tep_get_field_val(s, event, "rip", record, &rip, 1) < 0) |
| 303 | return -1; | 303 | return -1; |
| 304 | 304 | ||
| 305 | if (pevent_get_field_val(s, event, "csbase", record, &csbase, 1) < 0) | 305 | if (tep_get_field_val(s, event, "csbase", record, &csbase, 1) < 0) |
| 306 | return -1; | 306 | return -1; |
| 307 | 307 | ||
| 308 | if (pevent_get_field_val(s, event, "len", record, &len, 1) < 0) | 308 | if (tep_get_field_val(s, event, "len", record, &len, 1) < 0) |
| 309 | return -1; | 309 | return -1; |
| 310 | 310 | ||
| 311 | if (pevent_get_field_val(s, event, "flags", record, &flags, 1) < 0) | 311 | if (tep_get_field_val(s, event, "flags", record, &flags, 1) < 0) |
| 312 | return -1; | 312 | return -1; |
| 313 | 313 | ||
| 314 | if (pevent_get_field_val(s, event, "failed", record, &failed, 1) < 0) | 314 | if (tep_get_field_val(s, event, "failed", record, &failed, 1) < 0) |
| 315 | return -1; | 315 | return -1; |
| 316 | 316 | ||
| 317 | insn = pevent_get_field_raw(s, event, "insn", record, &llen, 1); | 317 | insn = tep_get_field_raw(s, event, "insn", record, &llen, 1); |
| 318 | if (!insn) | 318 | if (!insn) |
| 319 | return -1; | 319 | return -1; |
| 320 | 320 | ||
| @@ -330,24 +330,24 @@ static int kvm_emulate_insn_handler(struct trace_seq *s, | |||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | 332 | ||
| 333 | static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_record *record, | 333 | static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_record *record, |
| 334 | struct event_format *event, void *context) | 334 | struct event_format *event, void *context) |
| 335 | { | 335 | { |
| 336 | if (print_exit_reason(s, record, event, "exit_code") < 0) | 336 | if (print_exit_reason(s, record, event, "exit_code") < 0) |
| 337 | return -1; | 337 | return -1; |
| 338 | 338 | ||
| 339 | pevent_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1); | 339 | tep_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1); |
| 340 | pevent_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1); | 340 | tep_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1); |
| 341 | pevent_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1); | 341 | tep_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1); |
| 342 | pevent_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1); | 342 | tep_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1); |
| 343 | 343 | ||
| 344 | return 0; | 344 | return 0; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | static int kvm_nested_vmexit_handler(struct trace_seq *s, struct pevent_record *record, | 347 | static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *record, |
| 348 | struct event_format *event, void *context) | 348 | struct event_format *event, void *context) |
| 349 | { | 349 | { |
| 350 | pevent_print_num_field(s, "rip %llx ", event, "rip", record, 1); | 350 | tep_print_num_field(s, "rip %llx ", event, "rip", record, 1); |
| 351 | 351 | ||
| 352 | return kvm_nested_vmexit_inject_handler(s, record, event, context); | 352 | return kvm_nested_vmexit_inject_handler(s, record, event, context); |
| 353 | } | 353 | } |
| @@ -370,7 +370,7 @@ union kvm_mmu_page_role { | |||
| 370 | }; | 370 | }; |
| 371 | }; | 371 | }; |
| 372 | 372 | ||
| 373 | static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, | 373 | static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record, |
| 374 | struct event_format *event, void *context) | 374 | struct event_format *event, void *context) |
| 375 | { | 375 | { |
| 376 | unsigned long long val; | 376 | unsigned long long val; |
| @@ -379,7 +379,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, | |||
| 379 | }; | 379 | }; |
| 380 | union kvm_mmu_page_role role; | 380 | union kvm_mmu_page_role role; |
| 381 | 381 | ||
| 382 | if (pevent_get_field_val(s, event, "role", record, &val, 1) < 0) | 382 | if (tep_get_field_val(s, event, "role", record, &val, 1) < 0) |
| 383 | return -1; | 383 | return -1; |
| 384 | 384 | ||
| 385 | role.word = (int)val; | 385 | role.word = (int)val; |
| @@ -388,8 +388,8 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, | |||
| 388 | * We can only use the structure if file is of the same | 388 | * We can only use the structure if file is of the same |
| 389 | * endianess. | 389 | * endianess. |
| 390 | */ | 390 | */ |
| 391 | if (pevent_is_file_bigendian(event->pevent) == | 391 | if (tep_is_file_bigendian(event->pevent) == |
| 392 | pevent_is_host_bigendian(event->pevent)) { | 392 | tep_is_host_bigendian(event->pevent)) { |
| 393 | 393 | ||
| 394 | trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s", | 394 | trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s", |
| 395 | role.level, | 395 | role.level, |
| @@ -406,10 +406,10 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, | |||
| 406 | } else | 406 | } else |
| 407 | trace_seq_printf(s, "WORD: %08x", role.word); | 407 | trace_seq_printf(s, "WORD: %08x", role.word); |
| 408 | 408 | ||
| 409 | pevent_print_num_field(s, " root %u ", event, | 409 | tep_print_num_field(s, " root %u ", event, |
| 410 | "root_count", record, 1); | 410 | "root_count", record, 1); |
| 411 | 411 | ||
| 412 | if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0) | 412 | if (tep_get_field_val(s, event, "unsync", record, &val, 1) < 0) |
| 413 | return -1; | 413 | return -1; |
| 414 | 414 | ||
| 415 | trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0); | 415 | trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0); |
| @@ -417,17 +417,17 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record, | |||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | static int kvm_mmu_get_page_handler(struct trace_seq *s, | 419 | static int kvm_mmu_get_page_handler(struct trace_seq *s, |
| 420 | struct pevent_record *record, | 420 | struct tep_record *record, |
| 421 | struct event_format *event, void *context) | 421 | struct event_format *event, void *context) |
| 422 | { | 422 | { |
| 423 | unsigned long long val; | 423 | unsigned long long val; |
| 424 | 424 | ||
| 425 | if (pevent_get_field_val(s, event, "created", record, &val, 1) < 0) | 425 | if (tep_get_field_val(s, event, "created", record, &val, 1) < 0) |
| 426 | return -1; | 426 | return -1; |
| 427 | 427 | ||
| 428 | trace_seq_printf(s, "%s ", val ? "new" : "existing"); | 428 | trace_seq_printf(s, "%s ", val ? "new" : "existing"); |
| 429 | 429 | ||
| 430 | if (pevent_get_field_val(s, event, "gfn", record, &val, 1) < 0) | 430 | if (tep_get_field_val(s, event, "gfn", record, &val, 1) < 0) |
| 431 | return -1; | 431 | return -1; |
| 432 | 432 | ||
| 433 | trace_seq_printf(s, "sp gfn %llx ", val); | 433 | trace_seq_printf(s, "sp gfn %llx ", val); |
| @@ -444,79 +444,79 @@ process_is_writable_pte(struct trace_seq *s, unsigned long long *args) | |||
| 444 | return pte & PT_WRITABLE_MASK; | 444 | return pte & PT_WRITABLE_MASK; |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 447 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 448 | { | 448 | { |
| 449 | init_disassembler(); | 449 | init_disassembler(); |
| 450 | 450 | ||
| 451 | pevent_register_event_handler(pevent, -1, "kvm", "kvm_exit", | 451 | tep_register_event_handler(pevent, -1, "kvm", "kvm_exit", |
| 452 | kvm_exit_handler, NULL); | 452 | kvm_exit_handler, NULL); |
| 453 | 453 | ||
| 454 | pevent_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", | 454 | tep_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", |
| 455 | kvm_emulate_insn_handler, NULL); | 455 | kvm_emulate_insn_handler, NULL); |
| 456 | 456 | ||
| 457 | pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", | 457 | tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", |
| 458 | kvm_nested_vmexit_handler, NULL); | 458 | kvm_nested_vmexit_handler, NULL); |
| 459 | 459 | ||
| 460 | pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", | 460 | tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", |
| 461 | kvm_nested_vmexit_inject_handler, NULL); | 461 | kvm_nested_vmexit_inject_handler, NULL); |
| 462 | 462 | ||
| 463 | pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", | 463 | tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", |
| 464 | kvm_mmu_get_page_handler, NULL); | 464 | kvm_mmu_get_page_handler, NULL); |
| 465 | 465 | ||
| 466 | pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", | 466 | tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", |
| 467 | kvm_mmu_print_role, NULL); | 467 | kvm_mmu_print_role, NULL); |
| 468 | 468 | ||
| 469 | pevent_register_event_handler(pevent, -1, | 469 | tep_register_event_handler(pevent, -1, |
| 470 | "kvmmmu", "kvm_mmu_unsync_page", | 470 | "kvmmmu", "kvm_mmu_unsync_page", |
| 471 | kvm_mmu_print_role, NULL); | 471 | kvm_mmu_print_role, NULL); |
| 472 | 472 | ||
| 473 | pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", | 473 | tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", |
| 474 | kvm_mmu_print_role, NULL); | 474 | kvm_mmu_print_role, NULL); |
| 475 | 475 | ||
| 476 | pevent_register_event_handler(pevent, -1, "kvmmmu", | 476 | tep_register_event_handler(pevent, -1, "kvmmmu", |
| 477 | "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, | 477 | "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, |
| 478 | NULL); | 478 | NULL); |
| 479 | 479 | ||
| 480 | pevent_register_print_function(pevent, | 480 | tep_register_print_function(pevent, |
| 481 | process_is_writable_pte, | 481 | process_is_writable_pte, |
| 482 | PEVENT_FUNC_ARG_INT, | 482 | TEP_FUNC_ARG_INT, |
| 483 | "is_writable_pte", | 483 | "is_writable_pte", |
| 484 | PEVENT_FUNC_ARG_LONG, | 484 | TEP_FUNC_ARG_LONG, |
| 485 | PEVENT_FUNC_ARG_VOID); | 485 | TEP_FUNC_ARG_VOID); |
| 486 | return 0; | 486 | return 0; |
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 489 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 490 | { | 490 | { |
| 491 | pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_exit", | 491 | tep_unregister_event_handler(pevent, -1, "kvm", "kvm_exit", |
| 492 | kvm_exit_handler, NULL); | 492 | kvm_exit_handler, NULL); |
| 493 | 493 | ||
| 494 | pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", | 494 | tep_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn", |
| 495 | kvm_emulate_insn_handler, NULL); | 495 | kvm_emulate_insn_handler, NULL); |
| 496 | 496 | ||
| 497 | pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", | 497 | tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit", |
| 498 | kvm_nested_vmexit_handler, NULL); | 498 | kvm_nested_vmexit_handler, NULL); |
| 499 | 499 | ||
| 500 | pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", | 500 | tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject", |
| 501 | kvm_nested_vmexit_inject_handler, NULL); | 501 | kvm_nested_vmexit_inject_handler, NULL); |
| 502 | 502 | ||
| 503 | pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", | 503 | tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page", |
| 504 | kvm_mmu_get_page_handler, NULL); | 504 | kvm_mmu_get_page_handler, NULL); |
| 505 | 505 | ||
| 506 | pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", | 506 | tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page", |
| 507 | kvm_mmu_print_role, NULL); | 507 | kvm_mmu_print_role, NULL); |
| 508 | 508 | ||
| 509 | pevent_unregister_event_handler(pevent, -1, | 509 | tep_unregister_event_handler(pevent, -1, |
| 510 | "kvmmmu", "kvm_mmu_unsync_page", | 510 | "kvmmmu", "kvm_mmu_unsync_page", |
| 511 | kvm_mmu_print_role, NULL); | 511 | kvm_mmu_print_role, NULL); |
| 512 | 512 | ||
| 513 | pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", | 513 | tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page", |
| 514 | kvm_mmu_print_role, NULL); | 514 | kvm_mmu_print_role, NULL); |
| 515 | 515 | ||
| 516 | pevent_unregister_event_handler(pevent, -1, "kvmmmu", | 516 | tep_unregister_event_handler(pevent, -1, "kvmmmu", |
| 517 | "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, | 517 | "kvm_mmu_prepare_zap_page", kvm_mmu_print_role, |
| 518 | NULL); | 518 | NULL); |
| 519 | 519 | ||
| 520 | pevent_unregister_print_function(pevent, process_is_writable_pte, | 520 | tep_unregister_print_function(pevent, process_is_writable_pte, |
| 521 | "is_writable_pte"); | 521 | "is_writable_pte"); |
| 522 | } | 522 | } |
diff --git a/tools/lib/traceevent/plugin_mac80211.c b/tools/lib/traceevent/plugin_mac80211.c index 7e15a0f1c2fd..de50a5316203 100644 --- a/tools/lib/traceevent/plugin_mac80211.c +++ b/tools/lib/traceevent/plugin_mac80211.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | static void print_string(struct trace_seq *s, struct event_format *event, | 28 | static void print_string(struct trace_seq *s, struct event_format *event, |
| 29 | const char *name, const void *data) | 29 | const char *name, const void *data) |
| 30 | { | 30 | { |
| 31 | struct format_field *f = pevent_find_field(event, name); | 31 | struct format_field *f = tep_find_field(event, name); |
| 32 | int offset; | 32 | int offset; |
| 33 | int length; | 33 | int length; |
| 34 | 34 | ||
| @@ -42,7 +42,7 @@ static void print_string(struct trace_seq *s, struct event_format *event, | |||
| 42 | 42 | ||
| 43 | if (!strncmp(f->type, "__data_loc", 10)) { | 43 | if (!strncmp(f->type, "__data_loc", 10)) { |
| 44 | unsigned long long v; | 44 | unsigned long long v; |
| 45 | if (pevent_read_number_field(f, data, &v)) { | 45 | if (tep_read_number_field(f, data, &v)) { |
| 46 | trace_seq_printf(s, "invalid_data_loc"); | 46 | trace_seq_printf(s, "invalid_data_loc"); |
| 47 | return; | 47 | return; |
| 48 | } | 48 | } |
| @@ -53,12 +53,12 @@ static void print_string(struct trace_seq *s, struct event_format *event, | |||
| 53 | trace_seq_printf(s, "%.*s", length, (char *)data + offset); | 53 | trace_seq_printf(s, "%.*s", length, (char *)data + offset); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | #define SF(fn) pevent_print_num_field(s, fn ":%d", event, fn, record, 0) | 56 | #define SF(fn) tep_print_num_field(s, fn ":%d", event, fn, record, 0) |
| 57 | #define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0) | 57 | #define SFX(fn) tep_print_num_field(s, fn ":%#x", event, fn, record, 0) |
| 58 | #define SP() trace_seq_putc(s, ' ') | 58 | #define SP() trace_seq_putc(s, ' ') |
| 59 | 59 | ||
| 60 | static int drv_bss_info_changed(struct trace_seq *s, | 60 | static int drv_bss_info_changed(struct trace_seq *s, |
| 61 | struct pevent_record *record, | 61 | struct tep_record *record, |
| 62 | struct event_format *event, void *context) | 62 | struct event_format *event, void *context) |
| 63 | { | 63 | { |
| 64 | void *data = record->data; | 64 | void *data = record->data; |
| @@ -66,7 +66,7 @@ static int drv_bss_info_changed(struct trace_seq *s, | |||
| 66 | print_string(s, event, "wiphy_name", data); | 66 | print_string(s, event, "wiphy_name", data); |
| 67 | trace_seq_printf(s, " vif:"); | 67 | trace_seq_printf(s, " vif:"); |
| 68 | print_string(s, event, "vif_name", data); | 68 | print_string(s, event, "vif_name", data); |
| 69 | pevent_print_num_field(s, "(%d)", event, "vif_type", record, 1); | 69 | tep_print_num_field(s, "(%d)", event, "vif_type", record, 1); |
| 70 | 70 | ||
| 71 | trace_seq_printf(s, "\n%*s", INDENT, ""); | 71 | trace_seq_printf(s, "\n%*s", INDENT, ""); |
| 72 | SF("assoc"); SP(); | 72 | SF("assoc"); SP(); |
| @@ -86,17 +86,17 @@ static int drv_bss_info_changed(struct trace_seq *s, | |||
| 86 | return 0; | 86 | return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 89 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 90 | { | 90 | { |
| 91 | pevent_register_event_handler(pevent, -1, "mac80211", | 91 | tep_register_event_handler(pevent, -1, "mac80211", |
| 92 | "drv_bss_info_changed", | 92 | "drv_bss_info_changed", |
| 93 | drv_bss_info_changed, NULL); | 93 | drv_bss_info_changed, NULL); |
| 94 | return 0; | 94 | return 0; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 97 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 98 | { | 98 | { |
| 99 | pevent_unregister_event_handler(pevent, -1, "mac80211", | 99 | tep_unregister_event_handler(pevent, -1, "mac80211", |
| 100 | "drv_bss_info_changed", | 100 | "drv_bss_info_changed", |
| 101 | drv_bss_info_changed, NULL); | 101 | drv_bss_info_changed, NULL); |
| 102 | } | 102 | } |
diff --git a/tools/lib/traceevent/plugin_sched_switch.c b/tools/lib/traceevent/plugin_sched_switch.c index ec30c2fcbac0..eecb4bd95c11 100644 --- a/tools/lib/traceevent/plugin_sched_switch.c +++ b/tools/lib/traceevent/plugin_sched_switch.c | |||
| @@ -45,7 +45,7 @@ static void write_state(struct trace_seq *s, int val) | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static void write_and_save_comm(struct format_field *field, | 47 | static void write_and_save_comm(struct format_field *field, |
| 48 | struct pevent_record *record, | 48 | struct tep_record *record, |
| 49 | struct trace_seq *s, int pid) | 49 | struct trace_seq *s, int pid) |
| 50 | { | 50 | { |
| 51 | const char *comm; | 51 | const char *comm; |
| @@ -61,100 +61,100 @@ static void write_and_save_comm(struct format_field *field, | |||
| 61 | comm = &s->buffer[len]; | 61 | comm = &s->buffer[len]; |
| 62 | 62 | ||
| 63 | /* Help out the comm to ids. This will handle dups */ | 63 | /* Help out the comm to ids. This will handle dups */ |
| 64 | pevent_register_comm(field->event->pevent, comm, pid); | 64 | tep_register_comm(field->event->pevent, comm, pid); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static int sched_wakeup_handler(struct trace_seq *s, | 67 | static int sched_wakeup_handler(struct trace_seq *s, |
| 68 | struct pevent_record *record, | 68 | struct tep_record *record, |
| 69 | struct event_format *event, void *context) | 69 | struct event_format *event, void *context) |
| 70 | { | 70 | { |
| 71 | struct format_field *field; | 71 | struct format_field *field; |
| 72 | unsigned long long val; | 72 | unsigned long long val; |
| 73 | 73 | ||
| 74 | if (pevent_get_field_val(s, event, "pid", record, &val, 1)) | 74 | if (tep_get_field_val(s, event, "pid", record, &val, 1)) |
| 75 | return trace_seq_putc(s, '!'); | 75 | return trace_seq_putc(s, '!'); |
| 76 | 76 | ||
| 77 | field = pevent_find_any_field(event, "comm"); | 77 | field = tep_find_any_field(event, "comm"); |
| 78 | if (field) { | 78 | if (field) { |
| 79 | write_and_save_comm(field, record, s, val); | 79 | write_and_save_comm(field, record, s, val); |
| 80 | trace_seq_putc(s, ':'); | 80 | trace_seq_putc(s, ':'); |
| 81 | } | 81 | } |
| 82 | trace_seq_printf(s, "%lld", val); | 82 | trace_seq_printf(s, "%lld", val); |
| 83 | 83 | ||
| 84 | if (pevent_get_field_val(s, event, "prio", record, &val, 0) == 0) | 84 | if (tep_get_field_val(s, event, "prio", record, &val, 0) == 0) |
| 85 | trace_seq_printf(s, " [%lld]", val); | 85 | trace_seq_printf(s, " [%lld]", val); |
| 86 | 86 | ||
| 87 | if (pevent_get_field_val(s, event, "success", record, &val, 1) == 0) | 87 | if (tep_get_field_val(s, event, "success", record, &val, 1) == 0) |
| 88 | trace_seq_printf(s, " success=%lld", val); | 88 | trace_seq_printf(s, " success=%lld", val); |
| 89 | 89 | ||
| 90 | if (pevent_get_field_val(s, event, "target_cpu", record, &val, 0) == 0) | 90 | if (tep_get_field_val(s, event, "target_cpu", record, &val, 0) == 0) |
| 91 | trace_seq_printf(s, " CPU:%03llu", val); | 91 | trace_seq_printf(s, " CPU:%03llu", val); |
| 92 | 92 | ||
| 93 | return 0; | 93 | return 0; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static int sched_switch_handler(struct trace_seq *s, | 96 | static int sched_switch_handler(struct trace_seq *s, |
| 97 | struct pevent_record *record, | 97 | struct tep_record *record, |
| 98 | struct event_format *event, void *context) | 98 | struct event_format *event, void *context) |
| 99 | { | 99 | { |
| 100 | struct format_field *field; | 100 | struct format_field *field; |
| 101 | unsigned long long val; | 101 | unsigned long long val; |
| 102 | 102 | ||
| 103 | if (pevent_get_field_val(s, event, "prev_pid", record, &val, 1)) | 103 | if (tep_get_field_val(s, event, "prev_pid", record, &val, 1)) |
| 104 | return trace_seq_putc(s, '!'); | 104 | return trace_seq_putc(s, '!'); |
| 105 | 105 | ||
| 106 | field = pevent_find_any_field(event, "prev_comm"); | 106 | field = tep_find_any_field(event, "prev_comm"); |
| 107 | if (field) { | 107 | if (field) { |
| 108 | write_and_save_comm(field, record, s, val); | 108 | write_and_save_comm(field, record, s, val); |
| 109 | trace_seq_putc(s, ':'); | 109 | trace_seq_putc(s, ':'); |
| 110 | } | 110 | } |
| 111 | trace_seq_printf(s, "%lld ", val); | 111 | trace_seq_printf(s, "%lld ", val); |
| 112 | 112 | ||
| 113 | if (pevent_get_field_val(s, event, "prev_prio", record, &val, 0) == 0) | 113 | if (tep_get_field_val(s, event, "prev_prio", record, &val, 0) == 0) |
| 114 | trace_seq_printf(s, "[%d] ", (int) val); | 114 | trace_seq_printf(s, "[%d] ", (int) val); |
| 115 | 115 | ||
| 116 | if (pevent_get_field_val(s, event, "prev_state", record, &val, 0) == 0) | 116 | if (tep_get_field_val(s, event, "prev_state", record, &val, 0) == 0) |
| 117 | write_state(s, val); | 117 | write_state(s, val); |
| 118 | 118 | ||
| 119 | trace_seq_puts(s, " ==> "); | 119 | trace_seq_puts(s, " ==> "); |
| 120 | 120 | ||
| 121 | if (pevent_get_field_val(s, event, "next_pid", record, &val, 1)) | 121 | if (tep_get_field_val(s, event, "next_pid", record, &val, 1)) |
| 122 | return trace_seq_putc(s, '!'); | 122 | return trace_seq_putc(s, '!'); |
| 123 | 123 | ||
| 124 | field = pevent_find_any_field(event, "next_comm"); | 124 | field = tep_find_any_field(event, "next_comm"); |
| 125 | if (field) { | 125 | if (field) { |
| 126 | write_and_save_comm(field, record, s, val); | 126 | write_and_save_comm(field, record, s, val); |
| 127 | trace_seq_putc(s, ':'); | 127 | trace_seq_putc(s, ':'); |
| 128 | } | 128 | } |
| 129 | trace_seq_printf(s, "%lld", val); | 129 | trace_seq_printf(s, "%lld", val); |
| 130 | 130 | ||
| 131 | if (pevent_get_field_val(s, event, "next_prio", record, &val, 0) == 0) | 131 | if (tep_get_field_val(s, event, "next_prio", record, &val, 0) == 0) |
| 132 | trace_seq_printf(s, " [%d]", (int) val); | 132 | trace_seq_printf(s, " [%d]", (int) val); |
| 133 | 133 | ||
| 134 | return 0; | 134 | return 0; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 137 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 138 | { | 138 | { |
| 139 | pevent_register_event_handler(pevent, -1, "sched", "sched_switch", | 139 | tep_register_event_handler(pevent, -1, "sched", "sched_switch", |
| 140 | sched_switch_handler, NULL); | 140 | sched_switch_handler, NULL); |
| 141 | 141 | ||
| 142 | pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup", | 142 | tep_register_event_handler(pevent, -1, "sched", "sched_wakeup", |
| 143 | sched_wakeup_handler, NULL); | 143 | sched_wakeup_handler, NULL); |
| 144 | 144 | ||
| 145 | pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup_new", | 145 | tep_register_event_handler(pevent, -1, "sched", "sched_wakeup_new", |
| 146 | sched_wakeup_handler, NULL); | 146 | sched_wakeup_handler, NULL); |
| 147 | return 0; | 147 | return 0; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 150 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 151 | { | 151 | { |
| 152 | pevent_unregister_event_handler(pevent, -1, "sched", "sched_switch", | 152 | tep_unregister_event_handler(pevent, -1, "sched", "sched_switch", |
| 153 | sched_switch_handler, NULL); | 153 | sched_switch_handler, NULL); |
| 154 | 154 | ||
| 155 | pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup", | 155 | tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup", |
| 156 | sched_wakeup_handler, NULL); | 156 | sched_wakeup_handler, NULL); |
| 157 | 157 | ||
| 158 | pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new", | 158 | tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new", |
| 159 | sched_wakeup_handler, NULL); | 159 | sched_wakeup_handler, NULL); |
| 160 | } | 160 | } |
diff --git a/tools/lib/traceevent/plugin_scsi.c b/tools/lib/traceevent/plugin_scsi.c index 5e750af2b461..5ec346f6b842 100644 --- a/tools/lib/traceevent/plugin_scsi.c +++ b/tools/lib/traceevent/plugin_scsi.c | |||
| @@ -413,21 +413,21 @@ unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s, | |||
| 413 | return 0; | 413 | return 0; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 416 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 417 | { | 417 | { |
| 418 | pevent_register_print_function(pevent, | 418 | tep_register_print_function(pevent, |
| 419 | process_scsi_trace_parse_cdb, | 419 | process_scsi_trace_parse_cdb, |
| 420 | PEVENT_FUNC_ARG_STRING, | 420 | TEP_FUNC_ARG_STRING, |
| 421 | "scsi_trace_parse_cdb", | 421 | "scsi_trace_parse_cdb", |
| 422 | PEVENT_FUNC_ARG_PTR, | 422 | TEP_FUNC_ARG_PTR, |
| 423 | PEVENT_FUNC_ARG_PTR, | 423 | TEP_FUNC_ARG_PTR, |
| 424 | PEVENT_FUNC_ARG_INT, | 424 | TEP_FUNC_ARG_INT, |
| 425 | PEVENT_FUNC_ARG_VOID); | 425 | TEP_FUNC_ARG_VOID); |
| 426 | return 0; | 426 | return 0; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 429 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 430 | { | 430 | { |
| 431 | pevent_unregister_print_function(pevent, process_scsi_trace_parse_cdb, | 431 | tep_unregister_print_function(pevent, process_scsi_trace_parse_cdb, |
| 432 | "scsi_trace_parse_cdb"); | 432 | "scsi_trace_parse_cdb"); |
| 433 | } | 433 | } |
diff --git a/tools/lib/traceevent/plugin_xen.c b/tools/lib/traceevent/plugin_xen.c index 690173bfa13e..b2acbd6e9c86 100644 --- a/tools/lib/traceevent/plugin_xen.c +++ b/tools/lib/traceevent/plugin_xen.c | |||
| @@ -119,19 +119,19 @@ unsigned long long process_xen_hypercall_name(struct trace_seq *s, | |||
| 119 | return 0; | 119 | return 0; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | 122 | int TEP_PLUGIN_LOADER(struct tep_handle *pevent) |
| 123 | { | 123 | { |
| 124 | pevent_register_print_function(pevent, | 124 | tep_register_print_function(pevent, |
| 125 | process_xen_hypercall_name, | 125 | process_xen_hypercall_name, |
| 126 | PEVENT_FUNC_ARG_STRING, | 126 | TEP_FUNC_ARG_STRING, |
| 127 | "xen_hypercall_name", | 127 | "xen_hypercall_name", |
| 128 | PEVENT_FUNC_ARG_INT, | 128 | TEP_FUNC_ARG_INT, |
| 129 | PEVENT_FUNC_ARG_VOID); | 129 | TEP_FUNC_ARG_VOID); |
| 130 | return 0; | 130 | return 0; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | 133 | void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent) |
| 134 | { | 134 | { |
| 135 | pevent_unregister_print_function(pevent, process_xen_hypercall_name, | 135 | tep_unregister_print_function(pevent, process_xen_hypercall_name, |
| 136 | "xen_hypercall_name"); | 136 | "xen_hypercall_name"); |
| 137 | } | 137 | } |
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c index 292dc9f1d233..e3bac4543d3b 100644 --- a/tools/lib/traceevent/trace-seq.c +++ b/tools/lib/traceevent/trace-seq.c | |||
| @@ -1,21 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: LGPL-2.1 | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | 3 | * Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
| 3 | * | 4 | * |
| 4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; | ||
| 8 | * version 2.1 of the License (not later!) | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
| 17 | * | ||
| 18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 19 | */ | 5 | */ |
| 20 | #include <stdio.h> | 6 | #include <stdio.h> |
| 21 | #include <stdlib.h> | 7 | #include <stdlib.h> |
