Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib traceevent: Rename input arguments and local variables of libtraceevent from pevent to tep

"pevent" to "tep" renaming of:
- all "pevent" input arguments of libtraceevent internal functions.
- all local "pevent" variables of libtraceevent.

This makes the implementation consistent with the chosen naming
convention, tep (trace event parser), and will avoid any confusion with
the old pevent name

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/linux-trace-devel/20190401132111.13727-5-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190401164344.944953447@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
c9bd7796 6b1f4c42

+180 -180
+153 -153
tools/lib/traceevent/event-parse.c
··· 148 148 int pid; 149 149 }; 150 150 151 - static int cmdline_init(struct tep_handle *pevent) 151 + static int cmdline_init(struct tep_handle *tep) 152 152 { 153 - struct cmdline_list *cmdlist = pevent->cmdlist; 153 + struct cmdline_list *cmdlist = tep->cmdlist; 154 154 struct cmdline_list *item; 155 155 struct tep_cmdline *cmdlines; 156 156 int i; 157 157 158 - cmdlines = malloc(sizeof(*cmdlines) * pevent->cmdline_count); 158 + cmdlines = malloc(sizeof(*cmdlines) * tep->cmdline_count); 159 159 if (!cmdlines) 160 160 return -1; 161 161 ··· 169 169 free(item); 170 170 } 171 171 172 - qsort(cmdlines, pevent->cmdline_count, sizeof(*cmdlines), cmdline_cmp); 172 + qsort(cmdlines, tep->cmdline_count, sizeof(*cmdlines), cmdline_cmp); 173 173 174 - pevent->cmdlines = cmdlines; 175 - pevent->cmdlist = NULL; 174 + tep->cmdlines = cmdlines; 175 + tep->cmdlist = NULL; 176 176 177 177 return 0; 178 178 } 179 179 180 - static const char *find_cmdline(struct tep_handle *pevent, int pid) 180 + static const char *find_cmdline(struct tep_handle *tep, int pid) 181 181 { 182 182 const struct tep_cmdline *comm; 183 183 struct tep_cmdline key; ··· 185 185 if (!pid) 186 186 return "<idle>"; 187 187 188 - if (!pevent->cmdlines && cmdline_init(pevent)) 188 + if (!tep->cmdlines && cmdline_init(tep)) 189 189 return "<not enough memory for cmdlines!>"; 190 190 191 191 key.pid = pid; 192 192 193 - comm = bsearch(&key, pevent->cmdlines, pevent->cmdline_count, 194 - sizeof(*pevent->cmdlines), cmdline_cmp); 193 + comm = bsearch(&key, tep->cmdlines, tep->cmdline_count, 194 + sizeof(*tep->cmdlines), cmdline_cmp); 195 195 196 196 if (comm) 197 197 return comm->comm; ··· 232 232 * we must add this pid. This is much slower than when cmdlines 233 233 * are added before the array is initialized. 234 234 */ 235 - static int add_new_comm(struct tep_handle *pevent, 235 + static int add_new_comm(struct tep_handle *tep, 236 236 const char *comm, int pid, bool override) 237 237 { 238 - struct tep_cmdline *cmdlines = pevent->cmdlines; 238 + struct tep_cmdline *cmdlines = tep->cmdlines; 239 239 struct tep_cmdline *cmdline; 240 240 struct tep_cmdline key; 241 241 char *new_comm; ··· 246 246 /* avoid duplicates */ 247 247 key.pid = pid; 248 248 249 - cmdline = bsearch(&key, pevent->cmdlines, pevent->cmdline_count, 250 - sizeof(*pevent->cmdlines), cmdline_cmp); 249 + cmdline = bsearch(&key, tep->cmdlines, tep->cmdline_count, 250 + sizeof(*tep->cmdlines), cmdline_cmp); 251 251 if (cmdline) { 252 252 if (!override) { 253 253 errno = EEXIST; ··· 264 264 return 0; 265 265 } 266 266 267 - cmdlines = realloc(cmdlines, sizeof(*cmdlines) * (pevent->cmdline_count + 1)); 267 + cmdlines = realloc(cmdlines, sizeof(*cmdlines) * (tep->cmdline_count + 1)); 268 268 if (!cmdlines) { 269 269 errno = ENOMEM; 270 270 return -1; 271 271 } 272 272 273 - cmdlines[pevent->cmdline_count].comm = strdup(comm); 274 - if (!cmdlines[pevent->cmdline_count].comm) { 273 + cmdlines[tep->cmdline_count].comm = strdup(comm); 274 + if (!cmdlines[tep->cmdline_count].comm) { 275 275 free(cmdlines); 276 276 errno = ENOMEM; 277 277 return -1; 278 278 } 279 279 280 - cmdlines[pevent->cmdline_count].pid = pid; 280 + cmdlines[tep->cmdline_count].pid = pid; 281 281 282 - if (cmdlines[pevent->cmdline_count].comm) 283 - pevent->cmdline_count++; 282 + if (cmdlines[tep->cmdline_count].comm) 283 + tep->cmdline_count++; 284 284 285 - qsort(cmdlines, pevent->cmdline_count, sizeof(*cmdlines), cmdline_cmp); 286 - pevent->cmdlines = cmdlines; 285 + qsort(cmdlines, tep->cmdline_count, sizeof(*cmdlines), cmdline_cmp); 286 + tep->cmdlines = cmdlines; 287 287 288 288 return 0; 289 289 } ··· 408 408 return 1; 409 409 } 410 410 411 - static int func_map_init(struct tep_handle *pevent) 411 + static int func_map_init(struct tep_handle *tep) 412 412 { 413 413 struct func_list *funclist; 414 414 struct func_list *item; 415 415 struct func_map *func_map; 416 416 int i; 417 417 418 - func_map = malloc(sizeof(*func_map) * (pevent->func_count + 1)); 418 + func_map = malloc(sizeof(*func_map) * (tep->func_count + 1)); 419 419 if (!func_map) 420 420 return -1; 421 421 422 - funclist = pevent->funclist; 422 + funclist = tep->funclist; 423 423 424 424 i = 0; 425 425 while (funclist) { ··· 432 432 free(item); 433 433 } 434 434 435 - qsort(func_map, pevent->func_count, sizeof(*func_map), func_cmp); 435 + qsort(func_map, tep->func_count, sizeof(*func_map), func_cmp); 436 436 437 437 /* 438 438 * Add a special record at the end. 439 439 */ 440 - func_map[pevent->func_count].func = NULL; 441 - func_map[pevent->func_count].addr = 0; 442 - func_map[pevent->func_count].mod = NULL; 440 + func_map[tep->func_count].func = NULL; 441 + func_map[tep->func_count].addr = 0; 442 + func_map[tep->func_count].mod = NULL; 443 443 444 - pevent->func_map = func_map; 445 - pevent->funclist = NULL; 444 + tep->func_map = func_map; 445 + tep->funclist = NULL; 446 446 447 447 return 0; 448 448 } 449 449 450 450 static struct func_map * 451 - __find_func(struct tep_handle *pevent, unsigned long long addr) 451 + __find_func(struct tep_handle *tep, unsigned long long addr) 452 452 { 453 453 struct func_map *func; 454 454 struct func_map key; 455 455 456 - if (!pevent->func_map) 457 - func_map_init(pevent); 456 + if (!tep->func_map) 457 + func_map_init(tep); 458 458 459 459 key.addr = addr; 460 460 461 - func = bsearch(&key, pevent->func_map, pevent->func_count, 462 - sizeof(*pevent->func_map), func_bcmp); 461 + func = bsearch(&key, tep->func_map, tep->func_count, 462 + sizeof(*tep->func_map), func_bcmp); 463 463 464 464 return func; 465 465 } ··· 510 510 } 511 511 512 512 static struct func_map * 513 - find_func(struct tep_handle *pevent, unsigned long long addr) 513 + find_func(struct tep_handle *tep, unsigned long long addr) 514 514 { 515 515 struct func_map *map; 516 516 517 - if (!pevent->func_resolver) 518 - return __find_func(pevent, addr); 517 + if (!tep->func_resolver) 518 + return __find_func(tep, addr); 519 519 520 - map = &pevent->func_resolver->map; 520 + map = &tep->func_resolver->map; 521 521 map->mod = NULL; 522 522 map->addr = addr; 523 - map->func = pevent->func_resolver->func(pevent->func_resolver->priv, 524 - &map->addr, &map->mod); 523 + map->func = tep->func_resolver->func(tep->func_resolver->priv, 524 + &map->addr, &map->mod); 525 525 if (map->func == NULL) 526 526 return NULL; 527 527 ··· 662 662 return 0; 663 663 } 664 664 665 - static int printk_map_init(struct tep_handle *pevent) 665 + static int printk_map_init(struct tep_handle *tep) 666 666 { 667 667 struct printk_list *printklist; 668 668 struct printk_list *item; 669 669 struct printk_map *printk_map; 670 670 int i; 671 671 672 - printk_map = malloc(sizeof(*printk_map) * (pevent->printk_count + 1)); 672 + printk_map = malloc(sizeof(*printk_map) * (tep->printk_count + 1)); 673 673 if (!printk_map) 674 674 return -1; 675 675 676 - printklist = pevent->printklist; 676 + printklist = tep->printklist; 677 677 678 678 i = 0; 679 679 while (printklist) { ··· 685 685 free(item); 686 686 } 687 687 688 - qsort(printk_map, pevent->printk_count, sizeof(*printk_map), printk_cmp); 688 + qsort(printk_map, tep->printk_count, sizeof(*printk_map), printk_cmp); 689 689 690 - pevent->printk_map = printk_map; 691 - pevent->printklist = NULL; 690 + tep->printk_map = printk_map; 691 + tep->printklist = NULL; 692 692 693 693 return 0; 694 694 } 695 695 696 696 static struct printk_map * 697 - find_printk(struct tep_handle *pevent, unsigned long long addr) 697 + find_printk(struct tep_handle *tep, unsigned long long addr) 698 698 { 699 699 struct printk_map *printk; 700 700 struct printk_map key; 701 701 702 - if (!pevent->printk_map && printk_map_init(pevent)) 702 + if (!tep->printk_map && printk_map_init(tep)) 703 703 return NULL; 704 704 705 705 key.addr = addr; 706 706 707 - printk = bsearch(&key, pevent->printk_map, pevent->printk_count, 708 - sizeof(*pevent->printk_map), printk_cmp); 707 + printk = bsearch(&key, tep->printk_map, tep->printk_count, 708 + sizeof(*tep->printk_map), printk_cmp); 709 709 710 710 return printk; 711 711 } ··· 782 782 return calloc(1, sizeof(struct tep_event)); 783 783 } 784 784 785 - static int add_event(struct tep_handle *pevent, struct tep_event *event) 785 + static int add_event(struct tep_handle *tep, struct tep_event *event) 786 786 { 787 787 int i; 788 - struct tep_event **events = realloc(pevent->events, sizeof(event) * 789 - (pevent->nr_events + 1)); 788 + struct tep_event **events = realloc(tep->events, sizeof(event) * 789 + (tep->nr_events + 1)); 790 790 if (!events) 791 791 return -1; 792 792 793 - pevent->events = events; 793 + tep->events = events; 794 794 795 - for (i = 0; i < pevent->nr_events; i++) { 796 - if (pevent->events[i]->id > event->id) 795 + for (i = 0; i < tep->nr_events; i++) { 796 + if (tep->events[i]->id > event->id) 797 797 break; 798 798 } 799 - if (i < pevent->nr_events) 800 - memmove(&pevent->events[i + 1], 801 - &pevent->events[i], 802 - sizeof(event) * (pevent->nr_events - i)); 799 + if (i < tep->nr_events) 800 + memmove(&tep->events[i + 1], 801 + &tep->events[i], 802 + sizeof(event) * (tep->nr_events - i)); 803 803 804 - pevent->events[i] = event; 805 - pevent->nr_events++; 804 + tep->events[i] = event; 805 + tep->nr_events++; 806 806 807 - event->tep = pevent; 807 + event->tep = tep; 808 808 809 809 return 0; 810 810 } ··· 2941 2941 } 2942 2942 2943 2943 static struct tep_function_handler * 2944 - find_func_handler(struct tep_handle *pevent, char *func_name) 2944 + find_func_handler(struct tep_handle *tep, char *func_name) 2945 2945 { 2946 2946 struct tep_function_handler *func; 2947 2947 2948 - if (!pevent) 2948 + if (!tep) 2949 2949 return NULL; 2950 2950 2951 - for (func = pevent->func_handlers; func; func = func->next) { 2951 + for (func = tep->func_handlers; func; func = func->next) { 2952 2952 if (strcmp(func->name, func_name) == 0) 2953 2953 break; 2954 2954 } ··· 2956 2956 return func; 2957 2957 } 2958 2958 2959 - static void remove_func_handler(struct tep_handle *pevent, char *func_name) 2959 + static void remove_func_handler(struct tep_handle *tep, char *func_name) 2960 2960 { 2961 2961 struct tep_function_handler *func; 2962 2962 struct tep_function_handler **next; 2963 2963 2964 - next = &pevent->func_handlers; 2964 + next = &tep->func_handlers; 2965 2965 while ((func = *next)) { 2966 2966 if (strcmp(func->name, func_name) == 0) { 2967 2967 *next = func->next; ··· 3413 3413 } 3414 3414 } 3415 3415 3416 - static int get_common_info(struct tep_handle *pevent, 3416 + static int get_common_info(struct tep_handle *tep, 3417 3417 const char *type, int *offset, int *size) 3418 3418 { 3419 3419 struct tep_event *event; ··· 3423 3423 * All events should have the same common elements. 3424 3424 * Pick any event to find where the type is; 3425 3425 */ 3426 - if (!pevent->events) { 3426 + if (!tep->events) { 3427 3427 do_warning("no event_list!"); 3428 3428 return -1; 3429 3429 } 3430 3430 3431 - event = pevent->events[0]; 3431 + event = tep->events[0]; 3432 3432 field = tep_find_common_field(event, type); 3433 3433 if (!field) 3434 3434 return -1; ··· 3439 3439 return 0; 3440 3440 } 3441 3441 3442 - static int __parse_common(struct tep_handle *pevent, void *data, 3442 + static int __parse_common(struct tep_handle *tep, void *data, 3443 3443 int *size, int *offset, const char *name) 3444 3444 { 3445 3445 int ret; 3446 3446 3447 3447 if (!*size) { 3448 - ret = get_common_info(pevent, name, offset, size); 3448 + ret = get_common_info(tep, name, offset, size); 3449 3449 if (ret < 0) 3450 3450 return ret; 3451 3451 } 3452 - return tep_read_number(pevent, data + *offset, *size); 3452 + return tep_read_number(tep, data + *offset, *size); 3453 3453 } 3454 3454 3455 - static int trace_parse_common_type(struct tep_handle *pevent, void *data) 3455 + static int trace_parse_common_type(struct tep_handle *tep, void *data) 3456 3456 { 3457 - return __parse_common(pevent, data, 3458 - &pevent->type_size, &pevent->type_offset, 3457 + return __parse_common(tep, data, 3458 + &tep->type_size, &tep->type_offset, 3459 3459 "common_type"); 3460 3460 } 3461 3461 3462 - static int parse_common_pid(struct tep_handle *pevent, void *data) 3462 + static int parse_common_pid(struct tep_handle *tep, void *data) 3463 3463 { 3464 - return __parse_common(pevent, data, 3465 - &pevent->pid_size, &pevent->pid_offset, 3464 + return __parse_common(tep, data, 3465 + &tep->pid_size, &tep->pid_offset, 3466 3466 "common_pid"); 3467 3467 } 3468 3468 3469 - static int parse_common_pc(struct tep_handle *pevent, void *data) 3469 + static int parse_common_pc(struct tep_handle *tep, void *data) 3470 3470 { 3471 - return __parse_common(pevent, data, 3472 - &pevent->pc_size, &pevent->pc_offset, 3471 + return __parse_common(tep, data, 3472 + &tep->pc_size, &tep->pc_offset, 3473 3473 "common_preempt_count"); 3474 3474 } 3475 3475 3476 - static int parse_common_flags(struct tep_handle *pevent, void *data) 3476 + static int parse_common_flags(struct tep_handle *tep, void *data) 3477 3477 { 3478 - return __parse_common(pevent, data, 3479 - &pevent->flags_size, &pevent->flags_offset, 3478 + return __parse_common(tep, data, 3479 + &tep->flags_size, &tep->flags_offset, 3480 3480 "common_flags"); 3481 3481 } 3482 3482 3483 - static int parse_common_lock_depth(struct tep_handle *pevent, void *data) 3483 + static int parse_common_lock_depth(struct tep_handle *tep, void *data) 3484 3484 { 3485 - return __parse_common(pevent, data, 3486 - &pevent->ld_size, &pevent->ld_offset, 3485 + return __parse_common(tep, data, 3486 + &tep->ld_size, &tep->ld_offset, 3487 3487 "common_lock_depth"); 3488 3488 } 3489 3489 3490 - static int parse_common_migrate_disable(struct tep_handle *pevent, void *data) 3490 + static int parse_common_migrate_disable(struct tep_handle *tep, void *data) 3491 3491 { 3492 - return __parse_common(pevent, data, 3493 - &pevent->ld_size, &pevent->ld_offset, 3492 + return __parse_common(tep, data, 3493 + &tep->ld_size, &tep->ld_offset, 3494 3494 "common_migrate_disable"); 3495 3495 } 3496 3496 ··· 3566 3566 static unsigned long long 3567 3567 eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg *arg) 3568 3568 { 3569 - struct tep_handle *pevent = event->tep; 3569 + struct tep_handle *tep = event->tep; 3570 3570 unsigned long long val = 0; 3571 3571 unsigned long long left, right; 3572 3572 struct tep_print_arg *typearg = NULL; ··· 3588 3588 3589 3589 } 3590 3590 /* must be a number */ 3591 - val = tep_read_number(pevent, data + arg->field.field->offset, 3591 + val = tep_read_number(tep, data + arg->field.field->offset, 3592 3592 arg->field.field->size); 3593 3593 break; 3594 3594 case TEP_PRINT_FLAGS: ··· 3628 3628 } 3629 3629 3630 3630 /* Default to long size */ 3631 - field_size = pevent->long_size; 3631 + field_size = tep->long_size; 3632 3632 3633 3633 switch (larg->type) { 3634 3634 case TEP_PRINT_DYNAMIC_ARRAY: 3635 - offset = tep_read_number(pevent, 3635 + offset = tep_read_number(tep, 3636 3636 data + larg->dynarray.field->offset, 3637 3637 larg->dynarray.field->size); 3638 3638 if (larg->dynarray.field->elementsize) ··· 3661 3661 default: 3662 3662 goto default_op; /* oops, all bets off */ 3663 3663 } 3664 - val = tep_read_number(pevent, 3664 + val = tep_read_number(tep, 3665 3665 data + offset, field_size); 3666 3666 if (typearg) 3667 3667 val = eval_type(val, typearg, 1); ··· 3762 3762 } 3763 3763 break; 3764 3764 case TEP_PRINT_DYNAMIC_ARRAY_LEN: 3765 - offset = tep_read_number(pevent, 3765 + offset = tep_read_number(tep, 3766 3766 data + arg->dynarray.field->offset, 3767 3767 arg->dynarray.field->size); 3768 3768 /* ··· 3774 3774 break; 3775 3775 case TEP_PRINT_DYNAMIC_ARRAY: 3776 3776 /* Without [], we pass the address to the dynamic data */ 3777 - offset = tep_read_number(pevent, 3777 + offset = tep_read_number(tep, 3778 3778 data + arg->dynarray.field->offset, 3779 3779 arg->dynarray.field->size); 3780 3780 /* ··· 3849 3849 trace_seq_printf(s, format, str); 3850 3850 } 3851 3851 3852 - static void print_bitmask_to_seq(struct tep_handle *pevent, 3852 + static void print_bitmask_to_seq(struct tep_handle *tep, 3853 3853 struct trace_seq *s, const char *format, 3854 3854 int len_arg, const void *data, int size) 3855 3855 { ··· 3881 3881 * In the kernel, this is an array of long words, thus 3882 3882 * endianness is very important. 3883 3883 */ 3884 - if (pevent->file_bigendian) 3884 + if (tep->file_bigendian) 3885 3885 index = size - (len + 1); 3886 3886 else 3887 3887 index = len; ··· 3907 3907 struct tep_event *event, const char *format, 3908 3908 int len_arg, struct tep_print_arg *arg) 3909 3909 { 3910 - struct tep_handle *pevent = event->tep; 3910 + struct tep_handle *tep = event->tep; 3911 3911 struct tep_print_flag_sym *flag; 3912 3912 struct tep_format_field *field; 3913 3913 struct printk_map *printk; ··· 3944 3944 * is a pointer. 3945 3945 */ 3946 3946 if (!(field->flags & TEP_FIELD_IS_ARRAY) && 3947 - field->size == pevent->long_size) { 3947 + field->size == tep->long_size) { 3948 3948 3949 3949 /* Handle heterogeneous recording and processing 3950 3950 * architectures ··· 3959 3959 * on 32-bit devices: 3960 3960 * In this case, 64 bits must be read. 3961 3961 */ 3962 - addr = (pevent->long_size == 8) ? 3962 + addr = (tep->long_size == 8) ? 3963 3963 *(unsigned long long *)(data + field->offset) : 3964 3964 (unsigned long long)*(unsigned int *)(data + field->offset); 3965 3965 3966 3966 /* Check if it matches a print format */ 3967 - printk = find_printk(pevent, addr); 3967 + printk = find_printk(tep, addr); 3968 3968 if (printk) 3969 3969 trace_seq_puts(s, printk->printk); 3970 3970 else ··· 4021 4021 case TEP_PRINT_HEX_STR: 4022 4022 if (arg->hex.field->type == TEP_PRINT_DYNAMIC_ARRAY) { 4023 4023 unsigned long offset; 4024 - offset = tep_read_number(pevent, 4024 + offset = tep_read_number(tep, 4025 4025 data + arg->hex.field->dynarray.field->offset, 4026 4026 arg->hex.field->dynarray.field->size); 4027 4027 hex = data + (offset & 0xffff); ··· 4052 4052 unsigned long offset; 4053 4053 struct tep_format_field *field = 4054 4054 arg->int_array.field->dynarray.field; 4055 - offset = tep_read_number(pevent, 4055 + offset = tep_read_number(tep, 4056 4056 data + field->offset, 4057 4057 field->size); 4058 4058 num = data + (offset & 0xffff); ··· 4103 4103 f = tep_find_any_field(event, arg->string.string); 4104 4104 arg->string.offset = f->offset; 4105 4105 } 4106 - str_offset = tep_data2host4(pevent, *(unsigned int *)(data + arg->string.offset)); 4106 + str_offset = tep_data2host4(tep, *(unsigned int *)(data + arg->string.offset)); 4107 4107 str_offset &= 0xffff; 4108 4108 print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset); 4109 4109 break; ··· 4121 4121 f = tep_find_any_field(event, arg->bitmask.bitmask); 4122 4122 arg->bitmask.offset = f->offset; 4123 4123 } 4124 - bitmask_offset = tep_data2host4(pevent, *(unsigned int *)(data + arg->bitmask.offset)); 4124 + bitmask_offset = tep_data2host4(tep, *(unsigned int *)(data + arg->bitmask.offset)); 4125 4125 bitmask_size = bitmask_offset >> 16; 4126 4126 bitmask_offset &= 0xffff; 4127 - print_bitmask_to_seq(pevent, s, format, len_arg, 4127 + print_bitmask_to_seq(tep, s, format, len_arg, 4128 4128 data + bitmask_offset, bitmask_size); 4129 4129 break; 4130 4130 } ··· 4256 4256 4257 4257 static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, struct tep_event *event) 4258 4258 { 4259 - struct tep_handle *pevent = event->tep; 4259 + struct tep_handle *tep = event->tep; 4260 4260 struct tep_format_field *field, *ip_field; 4261 4261 struct tep_print_arg *args, *arg, **next; 4262 4262 unsigned long long ip, val; ··· 4264 4264 void *bptr; 4265 4265 int vsize = 0; 4266 4266 4267 - field = pevent->bprint_buf_field; 4268 - ip_field = pevent->bprint_ip_field; 4267 + field = tep->bprint_buf_field; 4268 + ip_field = tep->bprint_ip_field; 4269 4269 4270 4270 if (!field) { 4271 4271 field = tep_find_field(event, "buf"); ··· 4278 4278 do_warning_event(event, "can't find ip field for binary printk"); 4279 4279 return NULL; 4280 4280 } 4281 - pevent->bprint_buf_field = field; 4282 - pevent->bprint_ip_field = ip_field; 4281 + tep->bprint_buf_field = field; 4282 + tep->bprint_ip_field = ip_field; 4283 4283 } 4284 4284 4285 - ip = tep_read_number(pevent, data + ip_field->offset, ip_field->size); 4285 + ip = tep_read_number(tep, data + ip_field->offset, ip_field->size); 4286 4286 4287 4287 /* 4288 4288 * The first arg is the IP pointer. ··· 4360 4360 vsize = 4; 4361 4361 break; 4362 4362 case 1: 4363 - vsize = pevent->long_size; 4363 + vsize = tep->long_size; 4364 4364 break; 4365 4365 case 2: 4366 4366 vsize = 8; ··· 4377 4377 /* the pointers are always 4 bytes aligned */ 4378 4378 bptr = (void *)(((unsigned long)bptr + 3) & 4379 4379 ~3); 4380 - val = tep_read_number(pevent, bptr, vsize); 4380 + val = tep_read_number(tep, bptr, vsize); 4381 4381 bptr += vsize; 4382 4382 arg = alloc_arg(); 4383 4383 if (!arg) { ··· 4434 4434 get_bprint_format(void *data, int size __maybe_unused, 4435 4435 struct tep_event *event) 4436 4436 { 4437 - struct tep_handle *pevent = event->tep; 4437 + struct tep_handle *tep = event->tep; 4438 4438 unsigned long long addr; 4439 4439 struct tep_format_field *field; 4440 4440 struct printk_map *printk; 4441 4441 char *format; 4442 4442 4443 - field = pevent->bprint_fmt_field; 4443 + field = tep->bprint_fmt_field; 4444 4444 4445 4445 if (!field) { 4446 4446 field = tep_find_field(event, "fmt"); ··· 4448 4448 do_warning_event(event, "can't find format field for binary printk"); 4449 4449 return NULL; 4450 4450 } 4451 - pevent->bprint_fmt_field = field; 4451 + tep->bprint_fmt_field = field; 4452 4452 } 4453 4453 4454 - addr = tep_read_number(pevent, data + field->offset, field->size); 4454 + addr = tep_read_number(tep, data + field->offset, field->size); 4455 4455 4456 - printk = find_printk(pevent, addr); 4456 + printk = find_printk(tep, addr); 4457 4457 if (!printk) { 4458 4458 if (asprintf(&format, "%%pf: (NO FORMAT FOUND at %llx)\n", addr) < 0) 4459 4459 return NULL; ··· 4835 4835 { 4836 4836 unsigned long long val; 4837 4837 unsigned int offset, len, i; 4838 - struct tep_handle *pevent = field->event->tep; 4838 + struct tep_handle *tep = field->event->tep; 4839 4839 4840 4840 if (field->flags & TEP_FIELD_IS_ARRAY) { 4841 4841 offset = field->offset; 4842 4842 len = field->size; 4843 4843 if (field->flags & TEP_FIELD_IS_DYNAMIC) { 4844 - val = tep_read_number(pevent, data + offset, len); 4844 + val = tep_read_number(tep, data + offset, len); 4845 4845 offset = val; 4846 4846 len = offset >> 16; 4847 4847 offset &= 0xffff; ··· 4861 4861 field->flags &= ~TEP_FIELD_IS_STRING; 4862 4862 } 4863 4863 } else { 4864 - val = tep_read_number(pevent, data + field->offset, 4864 + val = tep_read_number(tep, data + field->offset, 4865 4865 field->size); 4866 4866 if (field->flags & TEP_FIELD_IS_POINTER) { 4867 4867 trace_seq_printf(s, "0x%llx", val); ··· 4910 4910 4911 4911 static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_event *event) 4912 4912 { 4913 - struct tep_handle *pevent = event->tep; 4913 + struct tep_handle *tep = event->tep; 4914 4914 struct tep_print_fmt *print_fmt = &event->print_fmt; 4915 4915 struct tep_print_arg *arg = print_fmt->args; 4916 4916 struct tep_print_arg *args = NULL; ··· 5002 5002 case '-': 5003 5003 goto cont_process; 5004 5004 case 'p': 5005 - if (pevent->long_size == 4) 5005 + if (tep->long_size == 4) 5006 5006 ls = 1; 5007 5007 else 5008 5008 ls = 2; ··· 5063 5063 arg = arg->next; 5064 5064 5065 5065 if (show_func) { 5066 - func = find_func(pevent, val); 5066 + func = find_func(tep, val); 5067 5067 if (func) { 5068 5068 trace_seq_puts(s, func->func); 5069 5069 if (show_func == 'F') ··· 5073 5073 break; 5074 5074 } 5075 5075 } 5076 - if (pevent->long_size == 8 && ls == 1 && 5076 + if (tep->long_size == 8 && ls == 1 && 5077 5077 sizeof(long) != 8) { 5078 5078 char *p; 5079 5079 ··· 5320 5320 } 5321 5321 5322 5322 static struct tep_cmdline * 5323 - pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct tep_cmdline *next) 5323 + pid_from_cmdlist(struct tep_handle *tep, const char *comm, struct tep_cmdline *next) 5324 5324 { 5325 5325 struct cmdline_list *cmdlist = (struct cmdline_list *)next; 5326 5326 5327 5327 if (cmdlist) 5328 5328 cmdlist = cmdlist->next; 5329 5329 else 5330 - cmdlist = pevent->cmdlist; 5330 + cmdlist = tep->cmdlist; 5331 5331 5332 5332 while (cmdlist && strcmp(cmdlist->comm, comm) != 0) 5333 5333 cmdlist = cmdlist->next; ··· 6078 6078 free(handle); 6079 6079 } 6080 6080 6081 - static int find_event_handle(struct tep_handle *pevent, struct tep_event *event) 6081 + static int find_event_handle(struct tep_handle *tep, struct tep_event *event) 6082 6082 { 6083 6083 struct event_handler *handle, **next; 6084 6084 6085 - for (next = &pevent->handlers; *next; 6085 + for (next = &tep->handlers; *next; 6086 6086 next = &(*next)->next) { 6087 6087 handle = *next; 6088 6088 if (event_matches(event, handle->id, ··· 6120 6120 * /sys/kernel/debug/tracing/events/.../.../format 6121 6121 */ 6122 6122 enum tep_errno __tep_parse_format(struct tep_event **eventp, 6123 - struct tep_handle *pevent, const char *buf, 6123 + struct tep_handle *tep, const char *buf, 6124 6124 unsigned long size, const char *sys) 6125 6125 { 6126 6126 struct tep_event *event; ··· 6162 6162 goto event_alloc_failed; 6163 6163 } 6164 6164 6165 - /* Add pevent to event so that it can be referenced */ 6166 - event->tep = pevent; 6165 + /* Add tep to event so that it can be referenced */ 6166 + event->tep = tep; 6167 6167 6168 6168 ret = event_read_format(event); 6169 6169 if (ret < 0) { ··· 6175 6175 * If the event has an override, don't print warnings if the event 6176 6176 * print format fails to parse. 6177 6177 */ 6178 - if (pevent && find_event_handle(pevent, event)) 6178 + if (tep && find_event_handle(tep, event)) 6179 6179 show_warning = 0; 6180 6180 6181 6181 ret = event_read_print(event); ··· 6227 6227 } 6228 6228 6229 6229 static enum tep_errno 6230 - __parse_event(struct tep_handle *pevent, 6230 + __parse_event(struct tep_handle *tep, 6231 6231 struct tep_event **eventp, 6232 6232 const char *buf, unsigned long size, 6233 6233 const char *sys) 6234 6234 { 6235 - int ret = __tep_parse_format(eventp, pevent, buf, size, sys); 6235 + int ret = __tep_parse_format(eventp, tep, buf, size, sys); 6236 6236 struct tep_event *event = *eventp; 6237 6237 6238 6238 if (event == NULL) 6239 6239 return ret; 6240 6240 6241 - if (pevent && add_event(pevent, event)) { 6241 + if (tep && add_event(tep, event)) { 6242 6242 ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6243 6243 goto event_add_failed; 6244 6244 } ··· 6492 6492 struct tep_record *record, int err) 6493 6493 { 6494 6494 struct tep_format_field *field = tep_find_field(event, name); 6495 - struct tep_handle *pevent = event->tep; 6495 + struct tep_handle *tep = event->tep; 6496 6496 unsigned long long val; 6497 6497 struct func_map *func; 6498 6498 char tmp[128]; ··· 6503 6503 if (tep_read_number_field(field, record->data, &val)) 6504 6504 goto failed; 6505 6505 6506 - func = find_func(pevent, val); 6506 + func = find_func(tep, val); 6507 6507 6508 6508 if (func) 6509 6509 snprintf(tmp, 128, "%s/0x%llx", func->func, func->addr - val); ··· 6648 6648 return -1; 6649 6649 } 6650 6650 6651 - static struct tep_event *search_event(struct tep_handle *pevent, int id, 6651 + static struct tep_event *search_event(struct tep_handle *tep, int id, 6652 6652 const char *sys_name, 6653 6653 const char *event_name) 6654 6654 { ··· 6656 6656 6657 6657 if (id >= 0) { 6658 6658 /* search by id */ 6659 - event = tep_find_event(pevent, id); 6659 + event = tep_find_event(tep, id); 6660 6660 if (!event) 6661 6661 return NULL; 6662 6662 if (event_name && (strcmp(event_name, event->name) != 0)) ··· 6664 6664 if (sys_name && (strcmp(sys_name, event->system) != 0)) 6665 6665 return NULL; 6666 6666 } else { 6667 - event = tep_find_event_by_name(pevent, sys_name, event_name); 6667 + event = tep_find_event_by_name(tep, sys_name, event_name); 6668 6668 if (!event) 6669 6669 return NULL; 6670 6670 } ··· 6821 6821 */ 6822 6822 struct tep_handle *tep_alloc(void) 6823 6823 { 6824 - struct tep_handle *pevent = calloc(1, sizeof(*pevent)); 6824 + struct tep_handle *tep = calloc(1, sizeof(*tep)); 6825 6825 6826 - if (pevent) { 6827 - pevent->ref_count = 1; 6828 - pevent->host_bigendian = tep_is_bigendian(); 6826 + if (tep) { 6827 + tep->ref_count = 1; 6828 + tep->host_bigendian = tep_is_bigendian(); 6829 6829 } 6830 6830 6831 - return pevent; 6831 + return tep; 6832 6832 } 6833 6833 6834 6834 void tep_ref(struct tep_handle *tep)
+12 -12
tools/lib/traceevent/event-plugin.c
··· 269 269 } 270 270 271 271 static void 272 - load_plugin(struct tep_handle *pevent, const char *path, 272 + load_plugin(struct tep_handle *tep, const char *path, 273 273 const char *file, void *data) 274 274 { 275 275 struct tep_plugin_list **plugin_list = data; ··· 316 316 *plugin_list = list; 317 317 318 318 pr_stat("registering plugin: %s", plugin); 319 - func(pevent); 319 + func(tep); 320 320 return; 321 321 322 322 out_free: ··· 324 324 } 325 325 326 326 static void 327 - load_plugins_dir(struct tep_handle *pevent, const char *suffix, 327 + load_plugins_dir(struct tep_handle *tep, const char *suffix, 328 328 const char *path, 329 - void (*load_plugin)(struct tep_handle *pevent, 329 + void (*load_plugin)(struct tep_handle *tep, 330 330 const char *path, 331 331 const char *name, 332 332 void *data), ··· 359 359 if (strcmp(name + (strlen(name) - strlen(suffix)), suffix) != 0) 360 360 continue; 361 361 362 - load_plugin(pevent, path, name, data); 362 + load_plugin(tep, path, name, data); 363 363 } 364 364 365 365 closedir(dir); 366 366 } 367 367 368 368 static void 369 - load_plugins(struct tep_handle *pevent, const char *suffix, 370 - void (*load_plugin)(struct tep_handle *pevent, 369 + load_plugins(struct tep_handle *tep, const char *suffix, 370 + void (*load_plugin)(struct tep_handle *tep, 371 371 const char *path, 372 372 const char *name, 373 373 void *data), ··· 378 378 char *envdir; 379 379 int ret; 380 380 381 - if (pevent->flags & TEP_DISABLE_PLUGINS) 381 + if (tep->flags & TEP_DISABLE_PLUGINS) 382 382 return; 383 383 384 384 /* ··· 386 386 * check that first. 387 387 */ 388 388 #ifdef PLUGIN_DIR 389 - if (!(pevent->flags & TEP_DISABLE_SYS_PLUGINS)) 390 - load_plugins_dir(pevent, suffix, PLUGIN_DIR, 389 + if (!(tep->flags & TEP_DISABLE_SYS_PLUGINS)) 390 + load_plugins_dir(tep, suffix, PLUGIN_DIR, 391 391 load_plugin, data); 392 392 #endif 393 393 ··· 397 397 */ 398 398 envdir = getenv("TRACEEVENT_PLUGIN_DIR"); 399 399 if (envdir) 400 - load_plugins_dir(pevent, suffix, envdir, load_plugin, data); 400 + load_plugins_dir(tep, suffix, envdir, load_plugin, data); 401 401 402 402 /* 403 403 * Now let the home directory override the environment ··· 413 413 return; 414 414 } 415 415 416 - load_plugins_dir(pevent, suffix, path, load_plugin, data); 416 + load_plugins_dir(tep, suffix, path, load_plugin, data); 417 417 418 418 free(path); 419 419 }
+12 -12
tools/lib/traceevent/parse-filter.c
··· 256 256 } 257 257 258 258 static enum tep_errno 259 - find_event(struct tep_handle *pevent, struct event_list **events, 259 + find_event(struct tep_handle *tep, struct event_list **events, 260 260 char *sys_name, char *event_name) 261 261 { 262 262 struct tep_event *event; ··· 299 299 } 300 300 } 301 301 302 - for (i = 0; i < pevent->nr_events; i++) { 303 - event = pevent->events[i]; 302 + for (i = 0; i < tep->nr_events; i++) { 303 + event = tep->events[i]; 304 304 if (event_match(event, sys_name ? &sreg : NULL, &ereg)) { 305 305 match = 1; 306 306 if (add_event(events, event) < 0) { ··· 1257 1257 enum tep_errno tep_filter_add_filter_str(struct tep_event_filter *filter, 1258 1258 const char *filter_str) 1259 1259 { 1260 - struct tep_handle *pevent = filter->tep; 1260 + struct tep_handle *tep = filter->tep; 1261 1261 struct event_list *event; 1262 1262 struct event_list *events = NULL; 1263 1263 const char *filter_start; ··· 1313 1313 } 1314 1314 1315 1315 /* Find this event */ 1316 - ret = find_event(pevent, &events, strim(sys_name), strim(event_name)); 1316 + ret = find_event(tep, &events, strim(sys_name), strim(event_name)); 1317 1317 if (ret < 0) { 1318 1318 free_events(events); 1319 1319 free(this_event); ··· 1334 1334 if (ret < 0) 1335 1335 rtn = ret; 1336 1336 1337 - if (ret >= 0 && pevent->test_filters) { 1337 + if (ret >= 0 && tep->test_filters) { 1338 1338 char *test; 1339 1339 test = tep_filter_make_string(filter, event->event->id); 1340 1340 if (test) { ··· 1459 1459 const char *name; 1460 1460 char *str; 1461 1461 1462 - /* Can't assume that the pevent's are the same */ 1462 + /* Can't assume that the tep's are the same */ 1463 1463 sys = filter_type->event->system; 1464 1464 name = filter_type->event->name; 1465 1465 event = tep_find_event_by_name(filter->tep, sys, name); ··· 1697 1697 static const char *get_field_str(struct tep_filter_arg *arg, struct tep_record *record) 1698 1698 { 1699 1699 struct tep_event *event; 1700 - struct tep_handle *pevent; 1700 + struct tep_handle *tep; 1701 1701 unsigned long long addr; 1702 1702 const char *val = NULL; 1703 1703 unsigned int size; ··· 1727 1727 1728 1728 } else { 1729 1729 event = arg->str.field->event; 1730 - pevent = event->tep; 1730 + tep = event->tep; 1731 1731 addr = get_value(event, arg->str.field, record); 1732 1732 1733 1733 if (arg->str.field->flags & (TEP_FIELD_IS_POINTER | TEP_FIELD_IS_LONG)) 1734 1734 /* convert to a kernel symbol */ 1735 - val = tep_find_function(pevent, addr); 1735 + val = tep_find_function(tep, addr); 1736 1736 1737 1737 if (val == NULL) { 1738 1738 /* just use the hex of the string name */ ··· 1872 1872 enum tep_errno tep_filter_match(struct tep_event_filter *filter, 1873 1873 struct tep_record *record) 1874 1874 { 1875 - struct tep_handle *pevent = filter->tep; 1875 + struct tep_handle *tep = filter->tep; 1876 1876 struct tep_filter_type *filter_type; 1877 1877 int event_id; 1878 1878 int ret; ··· 1883 1883 if (!filter->filters) 1884 1884 return TEP_ERRNO__NO_FILTER; 1885 1885 1886 - event_id = tep_data_type(pevent, record); 1886 + event_id = tep_data_type(tep, record); 1887 1887 1888 1888 filter_type = find_filter_type(filter, event_id); 1889 1889 if (!filter_type)
+3 -3
tools/lib/traceevent/plugin_function.c
··· 126 126 static int function_handler(struct trace_seq *s, struct tep_record *record, 127 127 struct tep_event *event, void *context) 128 128 { 129 - struct tep_handle *pevent = event->tep; 129 + struct tep_handle *tep = event->tep; 130 130 unsigned long long function; 131 131 unsigned long long pfunction; 132 132 const char *func; ··· 136 136 if (tep_get_field_val(s, event, "ip", record, &function, 1)) 137 137 return trace_seq_putc(s, '!'); 138 138 139 - func = tep_find_function(pevent, function); 139 + func = tep_find_function(tep, function); 140 140 141 141 if (tep_get_field_val(s, event, "parent_ip", record, &pfunction, 1)) 142 142 return trace_seq_putc(s, '!'); 143 143 144 - parent = tep_find_function(pevent, pfunction); 144 + parent = tep_find_function(tep, pfunction); 145 145 146 146 if (parent && ftrace_indent->set) 147 147 index = add_and_get_index(parent, func, record->cpu);