aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
authorTzvetomir Stoyanov <tstoyanov@vmware.com>2019-04-01 12:43:20 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-04-01 14:18:10 -0400
commitc9bd7796959a8b92afe79c392dd54992bfc67328 (patch)
treef79076c195ccc9ca146aaaaebf5495803661aa76 /tools/lib/traceevent/event-parse.c
parent6b1f4c426a60387f1291d2ba3838c7b0914be12f (diff)
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>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c306
1 files changed, 153 insertions, 153 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 70ea638156f2..7d4faaecd243 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -148,14 +148,14 @@ struct cmdline_list {
148 int pid; 148 int pid;
149}; 149};
150 150
151static int cmdline_init(struct tep_handle *pevent) 151static int cmdline_init(struct tep_handle *tep)
152{ 152{
153 struct cmdline_list *cmdlist = pevent->cmdlist; 153 struct cmdline_list *cmdlist = tep->cmdlist;
154 struct cmdline_list *item; 154 struct cmdline_list *item;
155 struct tep_cmdline *cmdlines; 155 struct tep_cmdline *cmdlines;
156 int i; 156 int i;
157 157
158 cmdlines = malloc(sizeof(*cmdlines) * pevent->cmdline_count); 158 cmdlines = malloc(sizeof(*cmdlines) * tep->cmdline_count);
159 if (!cmdlines) 159 if (!cmdlines)
160 return -1; 160 return -1;
161 161
@@ -169,15 +169,15 @@ static int cmdline_init(struct tep_handle *pevent)
169 free(item); 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; 174 tep->cmdlines = cmdlines;
175 pevent->cmdlist = NULL; 175 tep->cmdlist = NULL;
176 176
177 return 0; 177 return 0;
178} 178}
179 179
180static const char *find_cmdline(struct tep_handle *pevent, int pid) 180static const char *find_cmdline(struct tep_handle *tep, int pid)
181{ 181{
182 const struct tep_cmdline *comm; 182 const struct tep_cmdline *comm;
183 struct tep_cmdline key; 183 struct tep_cmdline key;
@@ -185,13 +185,13 @@ static const char *find_cmdline(struct tep_handle *pevent, int pid)
185 if (!pid) 185 if (!pid)
186 return "<idle>"; 186 return "<idle>";
187 187
188 if (!pevent->cmdlines && cmdline_init(pevent)) 188 if (!tep->cmdlines && cmdline_init(tep))
189 return "<not enough memory for cmdlines!>"; 189 return "<not enough memory for cmdlines!>";
190 190
191 key.pid = pid; 191 key.pid = pid;
192 192
193 comm = bsearch(&key, pevent->cmdlines, pevent->cmdline_count, 193 comm = bsearch(&key, tep->cmdlines, tep->cmdline_count,
194 sizeof(*pevent->cmdlines), cmdline_cmp); 194 sizeof(*tep->cmdlines), cmdline_cmp);
195 195
196 if (comm) 196 if (comm)
197 return comm->comm; 197 return comm->comm;
@@ -232,10 +232,10 @@ bool tep_is_pid_registered(struct tep_handle *tep, int pid)
232 * we must add this pid. This is much slower than when cmdlines 232 * we must add this pid. This is much slower than when cmdlines
233 * are added before the array is initialized. 233 * are added before the array is initialized.
234 */ 234 */
235static int add_new_comm(struct tep_handle *pevent, 235static int add_new_comm(struct tep_handle *tep,
236 const char *comm, int pid, bool override) 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 struct tep_cmdline *cmdline; 239 struct tep_cmdline *cmdline;
240 struct tep_cmdline key; 240 struct tep_cmdline key;
241 char *new_comm; 241 char *new_comm;
@@ -246,8 +246,8 @@ static int add_new_comm(struct tep_handle *pevent,
246 /* avoid duplicates */ 246 /* avoid duplicates */
247 key.pid = pid; 247 key.pid = pid;
248 248
249 cmdline = bsearch(&key, pevent->cmdlines, pevent->cmdline_count, 249 cmdline = bsearch(&key, tep->cmdlines, tep->cmdline_count,
250 sizeof(*pevent->cmdlines), cmdline_cmp); 250 sizeof(*tep->cmdlines), cmdline_cmp);
251 if (cmdline) { 251 if (cmdline) {
252 if (!override) { 252 if (!override) {
253 errno = EEXIST; 253 errno = EEXIST;
@@ -264,26 +264,26 @@ static int add_new_comm(struct tep_handle *pevent,
264 return 0; 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 if (!cmdlines) { 268 if (!cmdlines) {
269 errno = ENOMEM; 269 errno = ENOMEM;
270 return -1; 270 return -1;
271 } 271 }
272 272
273 cmdlines[pevent->cmdline_count].comm = strdup(comm); 273 cmdlines[tep->cmdline_count].comm = strdup(comm);
274 if (!cmdlines[pevent->cmdline_count].comm) { 274 if (!cmdlines[tep->cmdline_count].comm) {
275 free(cmdlines); 275 free(cmdlines);
276 errno = ENOMEM; 276 errno = ENOMEM;
277 return -1; 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) 282 if (cmdlines[tep->cmdline_count].comm)
283 pevent->cmdline_count++; 283 tep->cmdline_count++;
284 284
285 qsort(cmdlines, pevent->cmdline_count, sizeof(*cmdlines), cmdline_cmp); 285 qsort(cmdlines, tep->cmdline_count, sizeof(*cmdlines), cmdline_cmp);
286 pevent->cmdlines = cmdlines; 286 tep->cmdlines = cmdlines;
287 287
288 return 0; 288 return 0;
289} 289}
@@ -408,18 +408,18 @@ static int func_bcmp(const void *a, const void *b)
408 return 1; 408 return 1;
409} 409}
410 410
411static int func_map_init(struct tep_handle *pevent) 411static int func_map_init(struct tep_handle *tep)
412{ 412{
413 struct func_list *funclist; 413 struct func_list *funclist;
414 struct func_list *item; 414 struct func_list *item;
415 struct func_map *func_map; 415 struct func_map *func_map;
416 int i; 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 if (!func_map) 419 if (!func_map)
420 return -1; 420 return -1;
421 421
422 funclist = pevent->funclist; 422 funclist = tep->funclist;
423 423
424 i = 0; 424 i = 0;
425 while (funclist) { 425 while (funclist) {
@@ -432,34 +432,34 @@ static int func_map_init(struct tep_handle *pevent)
432 free(item); 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 * Add a special record at the end. 438 * Add a special record at the end.
439 */ 439 */
440 func_map[pevent->func_count].func = NULL; 440 func_map[tep->func_count].func = NULL;
441 func_map[pevent->func_count].addr = 0; 441 func_map[tep->func_count].addr = 0;
442 func_map[pevent->func_count].mod = NULL; 442 func_map[tep->func_count].mod = NULL;
443 443
444 pevent->func_map = func_map; 444 tep->func_map = func_map;
445 pevent->funclist = NULL; 445 tep->funclist = NULL;
446 446
447 return 0; 447 return 0;
448} 448}
449 449
450static struct func_map * 450static 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 struct func_map *func; 453 struct func_map *func;
454 struct func_map key; 454 struct func_map key;
455 455
456 if (!pevent->func_map) 456 if (!tep->func_map)
457 func_map_init(pevent); 457 func_map_init(tep);
458 458
459 key.addr = addr; 459 key.addr = addr;
460 460
461 func = bsearch(&key, pevent->func_map, pevent->func_count, 461 func = bsearch(&key, tep->func_map, tep->func_count,
462 sizeof(*pevent->func_map), func_bcmp); 462 sizeof(*tep->func_map), func_bcmp);
463 463
464 return func; 464 return func;
465} 465}
@@ -510,18 +510,18 @@ void tep_reset_function_resolver(struct tep_handle *tep)
510} 510}
511 511
512static struct func_map * 512static struct func_map *
513find_func(struct tep_handle *pevent, unsigned long long addr) 513find_func(struct tep_handle *tep, unsigned long long addr)
514{ 514{
515 struct func_map *map; 515 struct func_map *map;
516 516
517 if (!pevent->func_resolver) 517 if (!tep->func_resolver)
518 return __find_func(pevent, addr); 518 return __find_func(tep, addr);
519 519
520 map = &pevent->func_resolver->map; 520 map = &tep->func_resolver->map;
521 map->mod = NULL; 521 map->mod = NULL;
522 map->addr = addr; 522 map->addr = addr;
523 map->func = pevent->func_resolver->func(pevent->func_resolver->priv, 523 map->func = tep->func_resolver->func(tep->func_resolver->priv,
524 &map->addr, &map->mod); 524 &map->addr, &map->mod);
525 if (map->func == NULL) 525 if (map->func == NULL)
526 return NULL; 526 return NULL;
527 527
@@ -662,18 +662,18 @@ static int printk_cmp(const void *a, const void *b)
662 return 0; 662 return 0;
663} 663}
664 664
665static int printk_map_init(struct tep_handle *pevent) 665static int printk_map_init(struct tep_handle *tep)
666{ 666{
667 struct printk_list *printklist; 667 struct printk_list *printklist;
668 struct printk_list *item; 668 struct printk_list *item;
669 struct printk_map *printk_map; 669 struct printk_map *printk_map;
670 int i; 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 if (!printk_map) 673 if (!printk_map)
674 return -1; 674 return -1;
675 675
676 printklist = pevent->printklist; 676 printklist = tep->printklist;
677 677
678 i = 0; 678 i = 0;
679 while (printklist) { 679 while (printklist) {
@@ -685,27 +685,27 @@ static int printk_map_init(struct tep_handle *pevent)
685 free(item); 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; 690 tep->printk_map = printk_map;
691 pevent->printklist = NULL; 691 tep->printklist = NULL;
692 692
693 return 0; 693 return 0;
694} 694}
695 695
696static struct printk_map * 696static struct printk_map *
697find_printk(struct tep_handle *pevent, unsigned long long addr) 697find_printk(struct tep_handle *tep, unsigned long long addr)
698{ 698{
699 struct printk_map *printk; 699 struct printk_map *printk;
700 struct printk_map key; 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 return NULL; 703 return NULL;
704 704
705 key.addr = addr; 705 key.addr = addr;
706 706
707 printk = bsearch(&key, pevent->printk_map, pevent->printk_count, 707 printk = bsearch(&key, tep->printk_map, tep->printk_count,
708 sizeof(*pevent->printk_map), printk_cmp); 708 sizeof(*tep->printk_map), printk_cmp);
709 709
710 return printk; 710 return printk;
711} 711}
@@ -782,29 +782,29 @@ static struct tep_event *alloc_event(void)
782 return calloc(1, sizeof(struct tep_event)); 782 return calloc(1, sizeof(struct tep_event));
783} 783}
784 784
785static int add_event(struct tep_handle *pevent, struct tep_event *event) 785static int add_event(struct tep_handle *tep, struct tep_event *event)
786{ 786{
787 int i; 787 int i;
788 struct tep_event **events = realloc(pevent->events, sizeof(event) * 788 struct tep_event **events = realloc(tep->events, sizeof(event) *
789 (pevent->nr_events + 1)); 789 (tep->nr_events + 1));
790 if (!events) 790 if (!events)
791 return -1; 791 return -1;
792 792
793 pevent->events = events; 793 tep->events = events;
794 794
795 for (i = 0; i < pevent->nr_events; i++) { 795 for (i = 0; i < tep->nr_events; i++) {
796 if (pevent->events[i]->id > event->id) 796 if (tep->events[i]->id > event->id)
797 break; 797 break;
798 } 798 }
799 if (i < pevent->nr_events) 799 if (i < tep->nr_events)
800 memmove(&pevent->events[i + 1], 800 memmove(&tep->events[i + 1],
801 &pevent->events[i], 801 &tep->events[i],
802 sizeof(event) * (pevent->nr_events - i)); 802 sizeof(event) * (tep->nr_events - i));
803 803
804 pevent->events[i] = event; 804 tep->events[i] = event;
805 pevent->nr_events++; 805 tep->nr_events++;
806 806
807 event->tep = pevent; 807 event->tep = tep;
808 808
809 return 0; 809 return 0;
810} 810}
@@ -2941,14 +2941,14 @@ process_bitmask(struct tep_event *event __maybe_unused, struct tep_print_arg *ar
2941} 2941}
2942 2942
2943static struct tep_function_handler * 2943static struct tep_function_handler *
2944find_func_handler(struct tep_handle *pevent, char *func_name) 2944find_func_handler(struct tep_handle *tep, char *func_name)
2945{ 2945{
2946 struct tep_function_handler *func; 2946 struct tep_function_handler *func;
2947 2947
2948 if (!pevent) 2948 if (!tep)
2949 return NULL; 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 if (strcmp(func->name, func_name) == 0) 2952 if (strcmp(func->name, func_name) == 0)
2953 break; 2953 break;
2954 } 2954 }
@@ -2956,12 +2956,12 @@ find_func_handler(struct tep_handle *pevent, char *func_name)
2956 return func; 2956 return func;
2957} 2957}
2958 2958
2959static void remove_func_handler(struct tep_handle *pevent, char *func_name) 2959static void remove_func_handler(struct tep_handle *tep, char *func_name)
2960{ 2960{
2961 struct tep_function_handler *func; 2961 struct tep_function_handler *func;
2962 struct tep_function_handler **next; 2962 struct tep_function_handler **next;
2963 2963
2964 next = &pevent->func_handlers; 2964 next = &tep->func_handlers;
2965 while ((func = *next)) { 2965 while ((func = *next)) {
2966 if (strcmp(func->name, func_name) == 0) { 2966 if (strcmp(func->name, func_name) == 0) {
2967 *next = func->next; 2967 *next = func->next;
@@ -3413,7 +3413,7 @@ int tep_read_number_field(struct tep_format_field *field, const void *data,
3413 } 3413 }
3414} 3414}
3415 3415
3416static int get_common_info(struct tep_handle *pevent, 3416static int get_common_info(struct tep_handle *tep,
3417 const char *type, int *offset, int *size) 3417 const char *type, int *offset, int *size)
3418{ 3418{
3419 struct tep_event *event; 3419 struct tep_event *event;
@@ -3423,12 +3423,12 @@ static int get_common_info(struct tep_handle *pevent,
3423 * All events should have the same common elements. 3423 * All events should have the same common elements.
3424 * Pick any event to find where the type is; 3424 * Pick any event to find where the type is;
3425 */ 3425 */
3426 if (!pevent->events) { 3426 if (!tep->events) {
3427 do_warning("no event_list!"); 3427 do_warning("no event_list!");
3428 return -1; 3428 return -1;
3429 } 3429 }
3430 3430
3431 event = pevent->events[0]; 3431 event = tep->events[0];
3432 field = tep_find_common_field(event, type); 3432 field = tep_find_common_field(event, type);
3433 if (!field) 3433 if (!field)
3434 return -1; 3434 return -1;
@@ -3439,58 +3439,58 @@ static int get_common_info(struct tep_handle *pevent,
3439 return 0; 3439 return 0;
3440} 3440}
3441 3441
3442static int __parse_common(struct tep_handle *pevent, void *data, 3442static int __parse_common(struct tep_handle *tep, void *data,
3443 int *size, int *offset, const char *name) 3443 int *size, int *offset, const char *name)
3444{ 3444{
3445 int ret; 3445 int ret;
3446 3446
3447 if (!*size) { 3447 if (!*size) {
3448 ret = get_common_info(pevent, name, offset, size); 3448 ret = get_common_info(tep, name, offset, size);
3449 if (ret < 0) 3449 if (ret < 0)
3450 return ret; 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
3455static int trace_parse_common_type(struct tep_handle *pevent, void *data) 3455static int trace_parse_common_type(struct tep_handle *tep, void *data)
3456{ 3456{
3457 return __parse_common(pevent, data, 3457 return __parse_common(tep, data,
3458 &pevent->type_size, &pevent->type_offset, 3458 &tep->type_size, &tep->type_offset,
3459 "common_type"); 3459 "common_type");
3460} 3460}
3461 3461
3462static int parse_common_pid(struct tep_handle *pevent, void *data) 3462static int parse_common_pid(struct tep_handle *tep, void *data)
3463{ 3463{
3464 return __parse_common(pevent, data, 3464 return __parse_common(tep, data,
3465 &pevent->pid_size, &pevent->pid_offset, 3465 &tep->pid_size, &tep->pid_offset,
3466 "common_pid"); 3466 "common_pid");
3467} 3467}
3468 3468
3469static int parse_common_pc(struct tep_handle *pevent, void *data) 3469static int parse_common_pc(struct tep_handle *tep, void *data)
3470{ 3470{
3471 return __parse_common(pevent, data, 3471 return __parse_common(tep, data,
3472 &pevent->pc_size, &pevent->pc_offset, 3472 &tep->pc_size, &tep->pc_offset,
3473 "common_preempt_count"); 3473 "common_preempt_count");
3474} 3474}
3475 3475
3476static int parse_common_flags(struct tep_handle *pevent, void *data) 3476static int parse_common_flags(struct tep_handle *tep, void *data)
3477{ 3477{
3478 return __parse_common(pevent, data, 3478 return __parse_common(tep, data,
3479 &pevent->flags_size, &pevent->flags_offset, 3479 &tep->flags_size, &tep->flags_offset,
3480 "common_flags"); 3480 "common_flags");
3481} 3481}
3482 3482
3483static int parse_common_lock_depth(struct tep_handle *pevent, void *data) 3483static int parse_common_lock_depth(struct tep_handle *tep, void *data)
3484{ 3484{
3485 return __parse_common(pevent, data, 3485 return __parse_common(tep, data,
3486 &pevent->ld_size, &pevent->ld_offset, 3486 &tep->ld_size, &tep->ld_offset,
3487 "common_lock_depth"); 3487 "common_lock_depth");
3488} 3488}
3489 3489
3490static int parse_common_migrate_disable(struct tep_handle *pevent, void *data) 3490static int parse_common_migrate_disable(struct tep_handle *tep, void *data)
3491{ 3491{
3492 return __parse_common(pevent, data, 3492 return __parse_common(tep, data,
3493 &pevent->ld_size, &pevent->ld_offset, 3493 &tep->ld_size, &tep->ld_offset,
3494 "common_migrate_disable"); 3494 "common_migrate_disable");
3495} 3495}
3496 3496
@@ -3566,7 +3566,7 @@ tep_find_event_by_name(struct tep_handle *tep,
3566static unsigned long long 3566static unsigned long long
3567eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg *arg) 3567eval_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 unsigned long long val = 0; 3570 unsigned long long val = 0;
3571 unsigned long long left, right; 3571 unsigned long long left, right;
3572 struct tep_print_arg *typearg = NULL; 3572 struct tep_print_arg *typearg = NULL;
@@ -3588,7 +3588,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
3588 3588
3589 } 3589 }
3590 /* must be a number */ 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 arg->field.field->size); 3592 arg->field.field->size);
3593 break; 3593 break;
3594 case TEP_PRINT_FLAGS: 3594 case TEP_PRINT_FLAGS:
@@ -3628,11 +3628,11 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
3628 } 3628 }
3629 3629
3630 /* Default to long size */ 3630 /* Default to long size */
3631 field_size = pevent->long_size; 3631 field_size = tep->long_size;
3632 3632
3633 switch (larg->type) { 3633 switch (larg->type) {
3634 case TEP_PRINT_DYNAMIC_ARRAY: 3634 case TEP_PRINT_DYNAMIC_ARRAY:
3635 offset = tep_read_number(pevent, 3635 offset = tep_read_number(tep,
3636 data + larg->dynarray.field->offset, 3636 data + larg->dynarray.field->offset,
3637 larg->dynarray.field->size); 3637 larg->dynarray.field->size);
3638 if (larg->dynarray.field->elementsize) 3638 if (larg->dynarray.field->elementsize)
@@ -3661,7 +3661,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
3661 default: 3661 default:
3662 goto default_op; /* oops, all bets off */ 3662 goto default_op; /* oops, all bets off */
3663 } 3663 }
3664 val = tep_read_number(pevent, 3664 val = tep_read_number(tep,
3665 data + offset, field_size); 3665 data + offset, field_size);
3666 if (typearg) 3666 if (typearg)
3667 val = eval_type(val, typearg, 1); 3667 val = eval_type(val, typearg, 1);
@@ -3762,7 +3762,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
3762 } 3762 }
3763 break; 3763 break;
3764 case TEP_PRINT_DYNAMIC_ARRAY_LEN: 3764 case TEP_PRINT_DYNAMIC_ARRAY_LEN:
3765 offset = tep_read_number(pevent, 3765 offset = tep_read_number(tep,
3766 data + arg->dynarray.field->offset, 3766 data + arg->dynarray.field->offset,
3767 arg->dynarray.field->size); 3767 arg->dynarray.field->size);
3768 /* 3768 /*
@@ -3774,7 +3774,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
3774 break; 3774 break;
3775 case TEP_PRINT_DYNAMIC_ARRAY: 3775 case TEP_PRINT_DYNAMIC_ARRAY:
3776 /* Without [], we pass the address to the dynamic data */ 3776 /* Without [], we pass the address to the dynamic data */
3777 offset = tep_read_number(pevent, 3777 offset = tep_read_number(tep,
3778 data + arg->dynarray.field->offset, 3778 data + arg->dynarray.field->offset,
3779 arg->dynarray.field->size); 3779 arg->dynarray.field->size);
3780 /* 3780 /*
@@ -3849,7 +3849,7 @@ static void print_str_to_seq(struct trace_seq *s, const char *format,
3849 trace_seq_printf(s, format, str); 3849 trace_seq_printf(s, format, str);
3850} 3850}
3851 3851
3852static void print_bitmask_to_seq(struct tep_handle *pevent, 3852static void print_bitmask_to_seq(struct tep_handle *tep,
3853 struct trace_seq *s, const char *format, 3853 struct trace_seq *s, const char *format,
3854 int len_arg, const void *data, int size) 3854 int len_arg, const void *data, int size)
3855{ 3855{
@@ -3881,7 +3881,7 @@ static void print_bitmask_to_seq(struct tep_handle *pevent,
3881 * In the kernel, this is an array of long words, thus 3881 * In the kernel, this is an array of long words, thus
3882 * endianness is very important. 3882 * endianness is very important.
3883 */ 3883 */
3884 if (pevent->file_bigendian) 3884 if (tep->file_bigendian)
3885 index = size - (len + 1); 3885 index = size - (len + 1);
3886 else 3886 else
3887 index = len; 3887 index = len;
@@ -3907,7 +3907,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3907 struct tep_event *event, const char *format, 3907 struct tep_event *event, const char *format,
3908 int len_arg, struct tep_print_arg *arg) 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 struct tep_print_flag_sym *flag; 3911 struct tep_print_flag_sym *flag;
3912 struct tep_format_field *field; 3912 struct tep_format_field *field;
3913 struct printk_map *printk; 3913 struct printk_map *printk;
@@ -3944,7 +3944,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3944 * is a pointer. 3944 * is a pointer.
3945 */ 3945 */
3946 if (!(field->flags & TEP_FIELD_IS_ARRAY) && 3946 if (!(field->flags & TEP_FIELD_IS_ARRAY) &&
3947 field->size == pevent->long_size) { 3947 field->size == tep->long_size) {
3948 3948
3949 /* Handle heterogeneous recording and processing 3949 /* Handle heterogeneous recording and processing
3950 * architectures 3950 * architectures
@@ -3959,12 +3959,12 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
3959 * on 32-bit devices: 3959 * on 32-bit devices:
3960 * In this case, 64 bits must be read. 3960 * In this case, 64 bits must be read.
3961 */ 3961 */
3962 addr = (pevent->long_size == 8) ? 3962 addr = (tep->long_size == 8) ?
3963 *(unsigned long long *)(data + field->offset) : 3963 *(unsigned long long *)(data + field->offset) :
3964 (unsigned long long)*(unsigned int *)(data + field->offset); 3964 (unsigned long long)*(unsigned int *)(data + field->offset);
3965 3965
3966 /* Check if it matches a print format */ 3966 /* Check if it matches a print format */
3967 printk = find_printk(pevent, addr); 3967 printk = find_printk(tep, addr);
3968 if (printk) 3968 if (printk)
3969 trace_seq_puts(s, printk->printk); 3969 trace_seq_puts(s, printk->printk);
3970 else 3970 else
@@ -4021,7 +4021,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
4021 case TEP_PRINT_HEX_STR: 4021 case TEP_PRINT_HEX_STR:
4022 if (arg->hex.field->type == TEP_PRINT_DYNAMIC_ARRAY) { 4022 if (arg->hex.field->type == TEP_PRINT_DYNAMIC_ARRAY) {
4023 unsigned long offset; 4023 unsigned long offset;
4024 offset = tep_read_number(pevent, 4024 offset = tep_read_number(tep,
4025 data + arg->hex.field->dynarray.field->offset, 4025 data + arg->hex.field->dynarray.field->offset,
4026 arg->hex.field->dynarray.field->size); 4026 arg->hex.field->dynarray.field->size);
4027 hex = data + (offset & 0xffff); 4027 hex = data + (offset & 0xffff);
@@ -4052,7 +4052,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
4052 unsigned long offset; 4052 unsigned long offset;
4053 struct tep_format_field *field = 4053 struct tep_format_field *field =
4054 arg->int_array.field->dynarray.field; 4054 arg->int_array.field->dynarray.field;
4055 offset = tep_read_number(pevent, 4055 offset = tep_read_number(tep,
4056 data + field->offset, 4056 data + field->offset,
4057 field->size); 4057 field->size);
4058 num = data + (offset & 0xffff); 4058 num = data + (offset & 0xffff);
@@ -4103,7 +4103,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
4103 f = tep_find_any_field(event, arg->string.string); 4103 f = tep_find_any_field(event, arg->string.string);
4104 arg->string.offset = f->offset; 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 str_offset &= 0xffff; 4107 str_offset &= 0xffff;
4108 print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset); 4108 print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset);
4109 break; 4109 break;
@@ -4121,10 +4121,10 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
4121 f = tep_find_any_field(event, arg->bitmask.bitmask); 4121 f = tep_find_any_field(event, arg->bitmask.bitmask);
4122 arg->bitmask.offset = f->offset; 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 bitmask_size = bitmask_offset >> 16; 4125 bitmask_size = bitmask_offset >> 16;
4126 bitmask_offset &= 0xffff; 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 data + bitmask_offset, bitmask_size); 4128 data + bitmask_offset, bitmask_size);
4129 break; 4129 break;
4130 } 4130 }
@@ -4256,7 +4256,7 @@ static void free_args(struct tep_print_arg *args)
4256 4256
4257static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, struct tep_event *event) 4257static 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 struct tep_format_field *field, *ip_field; 4260 struct tep_format_field *field, *ip_field;
4261 struct tep_print_arg *args, *arg, **next; 4261 struct tep_print_arg *args, *arg, **next;
4262 unsigned long long ip, val; 4262 unsigned long long ip, val;
@@ -4264,8 +4264,8 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
4264 void *bptr; 4264 void *bptr;
4265 int vsize = 0; 4265 int vsize = 0;
4266 4266
4267 field = pevent->bprint_buf_field; 4267 field = tep->bprint_buf_field;
4268 ip_field = pevent->bprint_ip_field; 4268 ip_field = tep->bprint_ip_field;
4269 4269
4270 if (!field) { 4270 if (!field) {
4271 field = tep_find_field(event, "buf"); 4271 field = tep_find_field(event, "buf");
@@ -4278,11 +4278,11 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
4278 do_warning_event(event, "can't find ip field for binary printk"); 4278 do_warning_event(event, "can't find ip field for binary printk");
4279 return NULL; 4279 return NULL;
4280 } 4280 }
4281 pevent->bprint_buf_field = field; 4281 tep->bprint_buf_field = field;
4282 pevent->bprint_ip_field = ip_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 * The first arg is the IP pointer. 4288 * The first arg is the IP pointer.
@@ -4360,7 +4360,7 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
4360 vsize = 4; 4360 vsize = 4;
4361 break; 4361 break;
4362 case 1: 4362 case 1:
4363 vsize = pevent->long_size; 4363 vsize = tep->long_size;
4364 break; 4364 break;
4365 case 2: 4365 case 2:
4366 vsize = 8; 4366 vsize = 8;
@@ -4377,7 +4377,7 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
4377 /* the pointers are always 4 bytes aligned */ 4377 /* the pointers are always 4 bytes aligned */
4378 bptr = (void *)(((unsigned long)bptr + 3) & 4378 bptr = (void *)(((unsigned long)bptr + 3) &
4379 ~3); 4379 ~3);
4380 val = tep_read_number(pevent, bptr, vsize); 4380 val = tep_read_number(tep, bptr, vsize);
4381 bptr += vsize; 4381 bptr += vsize;
4382 arg = alloc_arg(); 4382 arg = alloc_arg();
4383 if (!arg) { 4383 if (!arg) {
@@ -4434,13 +4434,13 @@ static char *
4434get_bprint_format(void *data, int size __maybe_unused, 4434get_bprint_format(void *data, int size __maybe_unused,
4435 struct tep_event *event) 4435 struct tep_event *event)
4436{ 4436{
4437 struct tep_handle *pevent = event->tep; 4437 struct tep_handle *tep = event->tep;
4438 unsigned long long addr; 4438 unsigned long long addr;
4439 struct tep_format_field *field; 4439 struct tep_format_field *field;
4440 struct printk_map *printk; 4440 struct printk_map *printk;
4441 char *format; 4441 char *format;
4442 4442
4443 field = pevent->bprint_fmt_field; 4443 field = tep->bprint_fmt_field;
4444 4444
4445 if (!field) { 4445 if (!field) {
4446 field = tep_find_field(event, "fmt"); 4446 field = tep_find_field(event, "fmt");
@@ -4448,12 +4448,12 @@ get_bprint_format(void *data, int size __maybe_unused,
4448 do_warning_event(event, "can't find format field for binary printk"); 4448 do_warning_event(event, "can't find format field for binary printk");
4449 return NULL; 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 if (!printk) { 4457 if (!printk) {
4458 if (asprintf(&format, "%%pf: (NO FORMAT FOUND at %llx)\n", addr) < 0) 4458 if (asprintf(&format, "%%pf: (NO FORMAT FOUND at %llx)\n", addr) < 0)
4459 return NULL; 4459 return NULL;
@@ -4835,13 +4835,13 @@ void tep_print_field(struct trace_seq *s, void *data,
4835{ 4835{
4836 unsigned long long val; 4836 unsigned long long val;
4837 unsigned int offset, len, i; 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 if (field->flags & TEP_FIELD_IS_ARRAY) { 4840 if (field->flags & TEP_FIELD_IS_ARRAY) {
4841 offset = field->offset; 4841 offset = field->offset;
4842 len = field->size; 4842 len = field->size;
4843 if (field->flags & TEP_FIELD_IS_DYNAMIC) { 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 offset = val; 4845 offset = val;
4846 len = offset >> 16; 4846 len = offset >> 16;
4847 offset &= 0xffff; 4847 offset &= 0xffff;
@@ -4861,7 +4861,7 @@ void tep_print_field(struct trace_seq *s, void *data,
4861 field->flags &= ~TEP_FIELD_IS_STRING; 4861 field->flags &= ~TEP_FIELD_IS_STRING;
4862 } 4862 }
4863 } else { 4863 } else {
4864 val = tep_read_number(pevent, data + field->offset, 4864 val = tep_read_number(tep, data + field->offset,
4865 field->size); 4865 field->size);
4866 if (field->flags & TEP_FIELD_IS_POINTER) { 4866 if (field->flags & TEP_FIELD_IS_POINTER) {
4867 trace_seq_printf(s, "0x%llx", val); 4867 trace_seq_printf(s, "0x%llx", val);
@@ -4910,7 +4910,7 @@ void tep_print_fields(struct trace_seq *s, void *data,
4910 4910
4911static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_event *event) 4911static 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 struct tep_print_fmt *print_fmt = &event->print_fmt; 4914 struct tep_print_fmt *print_fmt = &event->print_fmt;
4915 struct tep_print_arg *arg = print_fmt->args; 4915 struct tep_print_arg *arg = print_fmt->args;
4916 struct tep_print_arg *args = NULL; 4916 struct tep_print_arg *args = NULL;
@@ -5002,7 +5002,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e
5002 case '-': 5002 case '-':
5003 goto cont_process; 5003 goto cont_process;
5004 case 'p': 5004 case 'p':
5005 if (pevent->long_size == 4) 5005 if (tep->long_size == 4)
5006 ls = 1; 5006 ls = 1;
5007 else 5007 else
5008 ls = 2; 5008 ls = 2;
@@ -5063,7 +5063,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e
5063 arg = arg->next; 5063 arg = arg->next;
5064 5064
5065 if (show_func) { 5065 if (show_func) {
5066 func = find_func(pevent, val); 5066 func = find_func(tep, val);
5067 if (func) { 5067 if (func) {
5068 trace_seq_puts(s, func->func); 5068 trace_seq_puts(s, func->func);
5069 if (show_func == 'F') 5069 if (show_func == 'F')
@@ -5073,7 +5073,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e
5073 break; 5073 break;
5074 } 5074 }
5075 } 5075 }
5076 if (pevent->long_size == 8 && ls == 1 && 5076 if (tep->long_size == 8 && ls == 1 &&
5077 sizeof(long) != 8) { 5077 sizeof(long) != 8) {
5078 char *p; 5078 char *p;
5079 5079
@@ -5320,14 +5320,14 @@ const char *tep_data_comm_from_pid(struct tep_handle *tep, int pid)
5320} 5320}
5321 5321
5322static struct tep_cmdline * 5322static struct tep_cmdline *
5323pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct tep_cmdline *next) 5323pid_from_cmdlist(struct tep_handle *tep, const char *comm, struct tep_cmdline *next)
5324{ 5324{
5325 struct cmdline_list *cmdlist = (struct cmdline_list *)next; 5325 struct cmdline_list *cmdlist = (struct cmdline_list *)next;
5326 5326
5327 if (cmdlist) 5327 if (cmdlist)
5328 cmdlist = cmdlist->next; 5328 cmdlist = cmdlist->next;
5329 else 5329 else
5330 cmdlist = pevent->cmdlist; 5330 cmdlist = tep->cmdlist;
5331 5331
5332 while (cmdlist && strcmp(cmdlist->comm, comm) != 0) 5332 while (cmdlist && strcmp(cmdlist->comm, comm) != 0)
5333 cmdlist = cmdlist->next; 5333 cmdlist = cmdlist->next;
@@ -6078,11 +6078,11 @@ static void free_handler(struct event_handler *handle)
6078 free(handle); 6078 free(handle);
6079} 6079}
6080 6080
6081static int find_event_handle(struct tep_handle *pevent, struct tep_event *event) 6081static int find_event_handle(struct tep_handle *tep, struct tep_event *event)
6082{ 6082{
6083 struct event_handler *handle, **next; 6083 struct event_handler *handle, **next;
6084 6084
6085 for (next = &pevent->handlers; *next; 6085 for (next = &tep->handlers; *next;
6086 next = &(*next)->next) { 6086 next = &(*next)->next) {
6087 handle = *next; 6087 handle = *next;
6088 if (event_matches(event, handle->id, 6088 if (event_matches(event, handle->id,
@@ -6120,7 +6120,7 @@ static int find_event_handle(struct tep_handle *pevent, struct tep_event *event)
6120 * /sys/kernel/debug/tracing/events/.../.../format 6120 * /sys/kernel/debug/tracing/events/.../.../format
6121 */ 6121 */
6122enum tep_errno __tep_parse_format(struct tep_event **eventp, 6122enum 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 unsigned long size, const char *sys) 6124 unsigned long size, const char *sys)
6125{ 6125{
6126 struct tep_event *event; 6126 struct tep_event *event;
@@ -6162,8 +6162,8 @@ enum tep_errno __tep_parse_format(struct tep_event **eventp,
6162 goto event_alloc_failed; 6162 goto event_alloc_failed;
6163 } 6163 }
6164 6164
6165 /* Add pevent to event so that it can be referenced */ 6165 /* Add tep to event so that it can be referenced */
6166 event->tep = pevent; 6166 event->tep = tep;
6167 6167
6168 ret = event_read_format(event); 6168 ret = event_read_format(event);
6169 if (ret < 0) { 6169 if (ret < 0) {
@@ -6175,7 +6175,7 @@ enum tep_errno __tep_parse_format(struct tep_event **eventp,
6175 * If the event has an override, don't print warnings if the event 6175 * If the event has an override, don't print warnings if the event
6176 * print format fails to parse. 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 show_warning = 0; 6179 show_warning = 0;
6180 6180
6181 ret = event_read_print(event); 6181 ret = event_read_print(event);
@@ -6227,18 +6227,18 @@ enum tep_errno __tep_parse_format(struct tep_event **eventp,
6227} 6227}
6228 6228
6229static enum tep_errno 6229static enum tep_errno
6230__parse_event(struct tep_handle *pevent, 6230__parse_event(struct tep_handle *tep,
6231 struct tep_event **eventp, 6231 struct tep_event **eventp,
6232 const char *buf, unsigned long size, 6232 const char *buf, unsigned long size,
6233 const char *sys) 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 struct tep_event *event = *eventp; 6236 struct tep_event *event = *eventp;
6237 6237
6238 if (event == NULL) 6238 if (event == NULL)
6239 return ret; 6239 return ret;
6240 6240
6241 if (pevent && add_event(pevent, event)) { 6241 if (tep && add_event(tep, event)) {
6242 ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6242 ret = TEP_ERRNO__MEM_ALLOC_FAILED;
6243 goto event_add_failed; 6243 goto event_add_failed;
6244 } 6244 }
@@ -6492,7 +6492,7 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt,
6492 struct tep_record *record, int err) 6492 struct tep_record *record, int err)
6493{ 6493{
6494 struct tep_format_field *field = tep_find_field(event, name); 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 unsigned long long val; 6496 unsigned long long val;
6497 struct func_map *func; 6497 struct func_map *func;
6498 char tmp[128]; 6498 char tmp[128];
@@ -6503,7 +6503,7 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt,
6503 if (tep_read_number_field(field, record->data, &val)) 6503 if (tep_read_number_field(field, record->data, &val))
6504 goto failed; 6504 goto failed;
6505 6505
6506 func = find_func(pevent, val); 6506 func = find_func(tep, val);
6507 6507
6508 if (func) 6508 if (func)
6509 snprintf(tmp, 128, "%s/0x%llx", func->func, func->addr - val); 6509 snprintf(tmp, 128, "%s/0x%llx", func->func, func->addr - val);
@@ -6648,7 +6648,7 @@ int tep_unregister_print_function(struct tep_handle *tep,
6648 return -1; 6648 return -1;
6649} 6649}
6650 6650
6651static struct tep_event *search_event(struct tep_handle *pevent, int id, 6651static struct tep_event *search_event(struct tep_handle *tep, int id,
6652 const char *sys_name, 6652 const char *sys_name,
6653 const char *event_name) 6653 const char *event_name)
6654{ 6654{
@@ -6656,7 +6656,7 @@ static struct tep_event *search_event(struct tep_handle *pevent, int id,
6656 6656
6657 if (id >= 0) { 6657 if (id >= 0) {
6658 /* search by id */ 6658 /* search by id */
6659 event = tep_find_event(pevent, id); 6659 event = tep_find_event(tep, id);
6660 if (!event) 6660 if (!event)
6661 return NULL; 6661 return NULL;
6662 if (event_name && (strcmp(event_name, event->name) != 0)) 6662 if (event_name && (strcmp(event_name, event->name) != 0))
@@ -6664,7 +6664,7 @@ static struct tep_event *search_event(struct tep_handle *pevent, int id,
6664 if (sys_name && (strcmp(sys_name, event->system) != 0)) 6664 if (sys_name && (strcmp(sys_name, event->system) != 0))
6665 return NULL; 6665 return NULL;
6666 } else { 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 if (!event) 6668 if (!event)
6669 return NULL; 6669 return NULL;
6670 } 6670 }
@@ -6821,14 +6821,14 @@ not_found:
6821 */ 6821 */
6822struct tep_handle *tep_alloc(void) 6822struct 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) { 6826 if (tep) {
6827 pevent->ref_count = 1; 6827 tep->ref_count = 1;
6828 pevent->host_bigendian = tep_is_bigendian(); 6828 tep->host_bigendian = tep_is_bigendian();
6829 } 6829 }
6830 6830
6831 return pevent; 6831 return tep;
6832} 6832}
6833 6833
6834void tep_ref(struct tep_handle *tep) 6834void tep_ref(struct tep_handle *tep)