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

tools lib traceevent, tools lib lockdep: Rename 'enum pevent_errno' to 'enum tep_errno'

In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_" and not "pevent_". This changes
'enum pevent_errno' to 'enum tep_errno'.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180808180701.770475059@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov (VMware) and committed by
Arnaldo Carvalho de Melo
d97f4ef1 6fed932e

+133 -133
+2 -2
tools/lib/lockdep/Makefile
··· 129 129 tags: force 130 130 $(RM) tags 131 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 134 TAGS: force 135 135 $(RM) TAGS 136 136 find . -name '*.[ch]' | xargs etags \ 137 - --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' 137 + --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/' 138 138 139 139 define do_install 140 140 $(print_install) \
+2 -2
tools/lib/traceevent/Makefile
··· 233 233 tags: force 234 234 $(RM) tags 235 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 238 TAGS: force 239 239 $(RM) TAGS 240 240 find . -name '*.[ch]' | xargs etags \ 241 - --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' 241 + --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/' 242 242 243 243 define do_install_mkdir 244 244 if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
+30 -30
tools/lib/traceevent/event-parse.c
··· 6035 6035 * 6036 6036 * /sys/kernel/debug/tracing/events/.../.../format 6037 6037 */ 6038 - enum pevent_errno __pevent_parse_format(struct event_format **eventp, 6039 - struct tep_handle *pevent, const char *buf, 6040 - unsigned long size, const char *sys) 6038 + enum tep_errno __pevent_parse_format(struct event_format **eventp, 6039 + struct tep_handle *pevent, const char *buf, 6040 + unsigned long size, const char *sys) 6041 6041 { 6042 6042 struct event_format *event; 6043 6043 int ret; ··· 6046 6046 6047 6047 *eventp = event = alloc_event(); 6048 6048 if (!event) 6049 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 6049 + return TEP_ERRNO__MEM_ALLOC_FAILED; 6050 6050 6051 6051 event->name = event_read_name(); 6052 6052 if (!event->name) { 6053 6053 /* Bad event? */ 6054 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 6054 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6055 6055 goto event_alloc_failed; 6056 6056 } 6057 6057 ··· 6064 6064 6065 6065 event->id = event_read_id(); 6066 6066 if (event->id < 0) { 6067 - ret = PEVENT_ERRNO__READ_ID_FAILED; 6067 + ret = TEP_ERRNO__READ_ID_FAILED; 6068 6068 /* 6069 6069 * This isn't an allocation error actually. 6070 6070 * But as the ID is critical, just bail out. ··· 6074 6074 6075 6075 event->system = strdup(sys); 6076 6076 if (!event->system) { 6077 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 6077 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6078 6078 goto event_alloc_failed; 6079 6079 } 6080 6080 ··· 6083 6083 6084 6084 ret = event_read_format(event); 6085 6085 if (ret < 0) { 6086 - ret = PEVENT_ERRNO__READ_FORMAT_FAILED; 6086 + ret = TEP_ERRNO__READ_FORMAT_FAILED; 6087 6087 goto event_parse_failed; 6088 6088 } 6089 6089 ··· 6098 6098 show_warning = 1; 6099 6099 6100 6100 if (ret < 0) { 6101 - ret = PEVENT_ERRNO__READ_PRINT_FAILED; 6101 + ret = TEP_ERRNO__READ_PRINT_FAILED; 6102 6102 goto event_parse_failed; 6103 6103 } 6104 6104 ··· 6112 6112 arg = alloc_arg(); 6113 6113 if (!arg) { 6114 6114 event->flags |= EVENT_FL_FAILED; 6115 - return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; 6115 + return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; 6116 6116 } 6117 6117 arg->type = PRINT_FIELD; 6118 6118 arg->field.name = strdup(field->name); 6119 6119 if (!arg->field.name) { 6120 6120 event->flags |= EVENT_FL_FAILED; 6121 6121 free_arg(arg); 6122 - return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; 6122 + return TEP_ERRNO__OLD_FTRACE_ARG_FAILED; 6123 6123 } 6124 6124 arg->field.field = field; 6125 6125 *list = arg; ··· 6142 6142 return ret; 6143 6143 } 6144 6144 6145 - static enum pevent_errno 6145 + static enum tep_errno 6146 6146 __pevent_parse_event(struct tep_handle *pevent, 6147 6147 struct event_format **eventp, 6148 6148 const char *buf, unsigned long size, ··· 6155 6155 return ret; 6156 6156 6157 6157 if (pevent && add_event(pevent, event)) { 6158 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 6158 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6159 6159 goto event_add_failed; 6160 6160 } 6161 6161 ··· 6185 6185 * 6186 6186 * /sys/kernel/debug/tracing/events/.../.../format 6187 6187 */ 6188 - enum pevent_errno tep_parse_format(struct tep_handle *pevent, 6189 - struct event_format **eventp, 6190 - const char *buf, 6191 - unsigned long size, const char *sys) 6188 + enum tep_errno tep_parse_format(struct tep_handle *pevent, 6189 + struct event_format **eventp, 6190 + const char *buf, 6191 + unsigned long size, const char *sys) 6192 6192 { 6193 6193 return __pevent_parse_event(pevent, eventp, buf, size, sys); 6194 6194 } ··· 6207 6207 * 6208 6208 * /sys/kernel/debug/tracing/events/.../.../format 6209 6209 */ 6210 - enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 6211 - unsigned long size, const char *sys) 6210 + enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 6211 + unsigned long size, const char *sys) 6212 6212 { 6213 6213 struct event_format *event = NULL; 6214 6214 return __pevent_parse_event(pevent, &event, buf, size, sys); ··· 6217 6217 #undef _PE 6218 6218 #define _PE(code, str) str 6219 6219 static const char * const pevent_error_str[] = { 6220 - PEVENT_ERRORS 6220 + TEP_ERRORS 6221 6221 }; 6222 6222 #undef _PE 6223 6223 6224 6224 int pevent_strerror(struct tep_handle *pevent __maybe_unused, 6225 - enum pevent_errno errnum, char *buf, size_t buflen) 6225 + enum tep_errno errnum, char *buf, size_t buflen) 6226 6226 { 6227 6227 int idx; 6228 6228 const char *msg; ··· 6232 6232 return 0; 6233 6233 } 6234 6234 6235 - if (errnum <= __PEVENT_ERRNO__START || 6236 - errnum >= __PEVENT_ERRNO__END) 6235 + if (errnum <= __TEP_ERRNO__START || 6236 + errnum >= __TEP_ERRNO__END) 6237 6237 return -1; 6238 6238 6239 - idx = errnum - __PEVENT_ERRNO__START - 1; 6239 + idx = errnum - __TEP_ERRNO__START - 1; 6240 6240 msg = pevent_error_str[idx]; 6241 6241 snprintf(buf, buflen, "%s", msg); 6242 6242 ··· 6517 6517 func_handle = calloc(1, sizeof(*func_handle)); 6518 6518 if (!func_handle) { 6519 6519 do_warning("Failed to allocate function handler"); 6520 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 6520 + return TEP_ERRNO__MEM_ALLOC_FAILED; 6521 6521 } 6522 6522 6523 6523 func_handle->ret_type = ret_type; ··· 6526 6526 if (!func_handle->name) { 6527 6527 do_warning("Failed to allocate function name"); 6528 6528 free(func_handle); 6529 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 6529 + return TEP_ERRNO__MEM_ALLOC_FAILED; 6530 6530 } 6531 6531 6532 6532 next_param = &(func_handle->params); ··· 6538 6538 6539 6539 if (type >= PEVENT_FUNC_ARG_MAX_TYPES) { 6540 6540 do_warning("Invalid argument type %d", type); 6541 - ret = PEVENT_ERRNO__INVALID_ARG_TYPE; 6541 + ret = TEP_ERRNO__INVALID_ARG_TYPE; 6542 6542 goto out_free; 6543 6543 } 6544 6544 6545 6545 param = malloc(sizeof(*param)); 6546 6546 if (!param) { 6547 6547 do_warning("Failed to allocate function param"); 6548 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 6548 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 6549 6549 goto out_free; 6550 6550 } 6551 6551 param->type = type; ··· 6654 6654 handle = calloc(1, sizeof(*handle)); 6655 6655 if (!handle) { 6656 6656 do_warning("Failed to allocate event handler"); 6657 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 6657 + return TEP_ERRNO__MEM_ALLOC_FAILED; 6658 6658 } 6659 6659 6660 6660 handle->id = id; ··· 6669 6669 free((void *)handle->event_name); 6670 6670 free((void *)handle->sys_name); 6671 6671 free(handle); 6672 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 6672 + return TEP_ERRNO__MEM_ALLOC_FAILED; 6673 6673 } 6674 6674 6675 6675 handle->func = func;
+24 -24
tools/lib/traceevent/event-parse.h
··· 379 379 TEP_DISABLE_PLUGINS = 1 << 2, 380 380 }; 381 381 382 - #define PEVENT_ERRORS \ 382 + #define TEP_ERRORS \ 383 383 _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \ 384 384 _PE(PARSE_EVENT_FAILED, "failed to parse event"), \ 385 385 _PE(READ_ID_FAILED, "failed to read event id"), \ ··· 411 411 _PE(FILTER_MISS, "record does not match to filter") 412 412 413 413 #undef _PE 414 - #define _PE(__code, __str) PEVENT_ERRNO__ ## __code 415 - enum pevent_errno { 416 - PEVENT_ERRNO__SUCCESS = 0, 417 - PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS, 414 + #define _PE(__code, __str) TEP_ERRNO__ ## __code 415 + enum tep_errno { 416 + TEP_ERRNO__SUCCESS = 0, 417 + TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS, 418 418 419 419 /* 420 420 * Choose an arbitrary negative big number not to clash with standard ··· 423 423 * 424 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 432 #undef _PE 433 433 ··· 642 642 int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, 643 643 int long_size); 644 644 645 - enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 646 - unsigned long size, const char *sys); 647 - enum pevent_errno tep_parse_format(struct tep_handle *pevent, 648 - struct event_format **eventp, 649 - const char *buf, 650 - unsigned long size, const char *sys); 645 + enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf, 646 + unsigned long size, const char *sys); 647 + enum tep_errno tep_parse_format(struct tep_handle *pevent, 648 + struct event_format **eventp, 649 + const char *buf, 650 + unsigned long size, const char *sys); 651 651 void pevent_free_format(struct event_format *event); 652 652 void pevent_free_format_field(struct format_field *field); 653 653 ··· 724 724 int size __maybe_unused, struct event_format *event); 725 725 void tep_event_info(struct trace_seq *s, struct event_format *event, 726 726 struct tep_record *record); 727 - int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, 727 + int pevent_strerror(struct tep_handle *pevent, enum tep_errno errnum, 728 728 char *buf, size_t buflen); 729 729 730 730 struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type); ··· 942 942 struct event_filter *pevent_filter_alloc(struct tep_handle *pevent); 943 943 944 944 /* for backward compatibility */ 945 - #define FILTER_NONE PEVENT_ERRNO__NO_FILTER 946 - #define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND 947 - #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS 948 - #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH 945 + #define FILTER_NONE TEP_ERRNO__NO_FILTER 946 + #define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND 947 + #define FILTER_MISS TEP_ERRNO__FILTER_MISS 948 + #define FILTER_MATCH TEP_ERRNO__FILTER_MATCH 949 949 950 950 enum filter_trivial_type { 951 951 FILTER_TRIVIAL_FALSE, ··· 953 953 FILTER_TRIVIAL_BOTH, 954 954 }; 955 955 956 - enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, 957 - const char *filter_str); 956 + enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter, 957 + const char *filter_str); 958 958 959 - enum pevent_errno pevent_filter_match(struct event_filter *filter, 960 - struct tep_record *record); 959 + enum tep_errno pevent_filter_match(struct event_filter *filter, 960 + struct tep_record *record); 961 961 962 - int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, 962 + int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err, 963 963 char *buf, size_t buflen); 964 964 965 965 int pevent_event_filtered(struct event_filter *filter,
+75 -75
tools/lib/traceevent/parse-filter.c
··· 268 268 !regexec(ereg, event->name, 0, NULL, 0); 269 269 } 270 270 271 - static enum pevent_errno 271 + static enum tep_errno 272 272 find_event(struct tep_handle *pevent, struct event_list **events, 273 273 char *sys_name, char *event_name) 274 274 { ··· 289 289 290 290 ret = asprintf(&reg, "^%s$", event_name); 291 291 if (ret < 0) 292 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 292 + return TEP_ERRNO__MEM_ALLOC_FAILED; 293 293 294 294 ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB); 295 295 free(reg); 296 296 297 297 if (ret) 298 - return PEVENT_ERRNO__INVALID_EVENT_NAME; 298 + return TEP_ERRNO__INVALID_EVENT_NAME; 299 299 300 300 if (sys_name) { 301 301 ret = asprintf(&reg, "^%s$", sys_name); 302 302 if (ret < 0) { 303 303 regfree(&ereg); 304 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 304 + return TEP_ERRNO__MEM_ALLOC_FAILED; 305 305 } 306 306 307 307 ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB); 308 308 free(reg); 309 309 if (ret) { 310 310 regfree(&ereg); 311 - return PEVENT_ERRNO__INVALID_EVENT_NAME; 311 + return TEP_ERRNO__INVALID_EVENT_NAME; 312 312 } 313 313 } 314 314 ··· 328 328 regfree(&sreg); 329 329 330 330 if (!match) 331 - return PEVENT_ERRNO__EVENT_NOT_FOUND; 331 + return TEP_ERRNO__EVENT_NOT_FOUND; 332 332 if (fail) 333 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 333 + return TEP_ERRNO__MEM_ALLOC_FAILED; 334 334 335 335 return 0; 336 336 } ··· 346 346 } 347 347 } 348 348 349 - static enum pevent_errno 349 + static enum tep_errno 350 350 create_arg_item(struct event_format *event, const char *token, 351 351 enum event_type type, struct filter_arg **parg, char *error_str) 352 352 { ··· 356 356 arg = allocate_arg(); 357 357 if (arg == NULL) { 358 358 show_error(error_str, "failed to allocate filter arg"); 359 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 359 + return TEP_ERRNO__MEM_ALLOC_FAILED; 360 360 } 361 361 362 362 switch (type) { ··· 370 370 if (!arg->value.str) { 371 371 free_arg(arg); 372 372 show_error(error_str, "failed to allocate string filter arg"); 373 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 373 + return TEP_ERRNO__MEM_ALLOC_FAILED; 374 374 } 375 375 break; 376 376 case EVENT_ITEM: ··· 402 402 default: 403 403 free_arg(arg); 404 404 show_error(error_str, "expected a value but found %s", token); 405 - return PEVENT_ERRNO__UNEXPECTED_TYPE; 405 + return TEP_ERRNO__UNEXPECTED_TYPE; 406 406 } 407 407 *parg = arg; 408 408 return 0; ··· 454 454 return arg; 455 455 } 456 456 457 - static enum pevent_errno 457 + static enum tep_errno 458 458 add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) 459 459 { 460 460 struct filter_arg *left; ··· 487 487 break; 488 488 default: 489 489 show_error(error_str, "Illegal rvalue"); 490 - return PEVENT_ERRNO__ILLEGAL_RVALUE; 490 + return TEP_ERRNO__ILLEGAL_RVALUE; 491 491 } 492 492 493 493 /* ··· 534 534 if (left->type != FILTER_ARG_FIELD) { 535 535 show_error(error_str, 536 536 "Illegal lvalue for string comparison"); 537 - return PEVENT_ERRNO__ILLEGAL_LVALUE; 537 + return TEP_ERRNO__ILLEGAL_LVALUE; 538 538 } 539 539 540 540 /* Make sure this is a valid string compare */ ··· 553 553 show_error(error_str, 554 554 "RegEx '%s' did not compute", 555 555 str); 556 - return PEVENT_ERRNO__INVALID_REGEX; 556 + return TEP_ERRNO__INVALID_REGEX; 557 557 } 558 558 break; 559 559 default: 560 560 show_error(error_str, 561 561 "Illegal comparison for string"); 562 - return PEVENT_ERRNO__ILLEGAL_STRING_CMP; 562 + return TEP_ERRNO__ILLEGAL_STRING_CMP; 563 563 } 564 564 565 565 op->type = FILTER_ARG_STR; ··· 568 568 op->str.val = strdup(str); 569 569 if (!op->str.val) { 570 570 show_error(error_str, "Failed to allocate string filter"); 571 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 571 + return TEP_ERRNO__MEM_ALLOC_FAILED; 572 572 } 573 573 /* 574 574 * Need a buffer to copy data for tests ··· 576 576 op->str.buffer = malloc(op->str.field->size + 1); 577 577 if (!op->str.buffer) { 578 578 show_error(error_str, "Failed to allocate string filter"); 579 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 579 + return TEP_ERRNO__MEM_ALLOC_FAILED; 580 580 } 581 581 /* Null terminate this buffer */ 582 582 op->str.buffer[op->str.field->size] = 0; ··· 595 595 case FILTER_CMP_NOT_REGEX: 596 596 show_error(error_str, 597 597 "Op not allowed with integers"); 598 - return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; 598 + return TEP_ERRNO__ILLEGAL_INTEGER_CMP; 599 599 600 600 default: 601 601 break; ··· 616 616 617 617 out_fail: 618 618 show_error(error_str, "Syntax error"); 619 - return PEVENT_ERRNO__SYNTAX_ERROR; 619 + return TEP_ERRNO__SYNTAX_ERROR; 620 620 } 621 621 622 622 static struct filter_arg * ··· 629 629 return arg; 630 630 } 631 631 632 - static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) 632 + static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg) 633 633 { 634 634 switch (op->type) { 635 635 case FILTER_ARG_EXP: ··· 648 648 /* left arg of compares must be a field */ 649 649 if (arg->type != FILTER_ARG_FIELD && 650 650 arg->type != FILTER_ARG_BOOLEAN) 651 - return PEVENT_ERRNO__INVALID_ARG_TYPE; 651 + return TEP_ERRNO__INVALID_ARG_TYPE; 652 652 op->num.left = arg; 653 653 break; 654 654 default: 655 - return PEVENT_ERRNO__INVALID_ARG_TYPE; 655 + return TEP_ERRNO__INVALID_ARG_TYPE; 656 656 } 657 657 return 0; 658 658 } ··· 765 765 FILTER_VAL_TRUE, 766 766 }; 767 767 768 - static enum pevent_errno 768 + static enum tep_errno 769 769 reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, 770 770 struct filter_arg *arg, char *error_str) 771 771 { ··· 775 775 if (parent->type != FILTER_ARG_OP && 776 776 arg->type != FILTER_ARG_OP) { 777 777 show_error(error_str, "can not reparent other than OP"); 778 - return PEVENT_ERRNO__REPARENT_NOT_OP; 778 + return TEP_ERRNO__REPARENT_NOT_OP; 779 779 } 780 780 781 781 /* Get the sibling */ ··· 787 787 other_child = old_child->op.right; 788 788 } else { 789 789 show_error(error_str, "Error in reparent op, find other child"); 790 - return PEVENT_ERRNO__REPARENT_FAILED; 790 + return TEP_ERRNO__REPARENT_FAILED; 791 791 } 792 792 793 793 /* Detach arg from old_child */ ··· 808 808 ptr = &parent->op.left; 809 809 else { 810 810 show_error(error_str, "Error in reparent op"); 811 - return PEVENT_ERRNO__REPARENT_FAILED; 811 + return TEP_ERRNO__REPARENT_FAILED; 812 812 } 813 813 814 814 *ptr = arg; ··· 817 817 return 0; 818 818 } 819 819 820 - /* Returns either filter_vals (success) or pevent_errno (failfure) */ 820 + /* Returns either filter_vals (success) or tep_errno (failfure) */ 821 821 static int test_arg(struct filter_arg *parent, struct filter_arg *arg, 822 822 char *error_str) 823 823 { ··· 912 912 return rval; 913 913 default: 914 914 show_error(error_str, "bad arg in filter tree"); 915 - return PEVENT_ERRNO__BAD_FILTER_ARG; 915 + return TEP_ERRNO__BAD_FILTER_ARG; 916 916 } 917 917 return FILTER_VAL_NORM; 918 918 } ··· 937 937 arg->boolean.value = ret == FILTER_VAL_TRUE; 938 938 } else { 939 939 show_error(error_str, "Failed to allocate filter arg"); 940 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 940 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 941 941 } 942 942 break; 943 943 ··· 952 952 return ret; 953 953 } 954 954 955 - static enum pevent_errno 955 + static enum tep_errno 956 956 process_filter(struct event_format *event, struct filter_arg **parg, 957 957 char *error_str, int not) 958 958 { ··· 966 966 enum filter_op_type btype; 967 967 enum filter_exp_type etype; 968 968 enum filter_cmp_type ctype; 969 - enum pevent_errno ret; 969 + enum tep_errno ret; 970 970 971 971 *parg = NULL; 972 972 ··· 1004 1004 case EVENT_DELIM: 1005 1005 if (*token == ',') { 1006 1006 show_error(error_str, "Illegal token ','"); 1007 - ret = PEVENT_ERRNO__ILLEGAL_TOKEN; 1007 + ret = TEP_ERRNO__ILLEGAL_TOKEN; 1008 1008 goto fail; 1009 1009 } 1010 1010 ··· 1012 1012 if (left_item) { 1013 1013 show_error(error_str, 1014 1014 "Open paren can not come after item"); 1015 - ret = PEVENT_ERRNO__INVALID_PAREN; 1015 + ret = TEP_ERRNO__INVALID_PAREN; 1016 1016 goto fail; 1017 1017 } 1018 1018 if (current_exp) { 1019 1019 show_error(error_str, 1020 1020 "Open paren can not come after expression"); 1021 - ret = PEVENT_ERRNO__INVALID_PAREN; 1021 + ret = TEP_ERRNO__INVALID_PAREN; 1022 1022 goto fail; 1023 1023 } 1024 1024 1025 1025 ret = process_filter(event, &arg, error_str, 0); 1026 - if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) { 1026 + if (ret != TEP_ERRNO__UNBALANCED_PAREN) { 1027 1027 if (ret == 0) { 1028 1028 show_error(error_str, 1029 1029 "Unbalanced number of '('"); 1030 - ret = PEVENT_ERRNO__UNBALANCED_PAREN; 1030 + ret = TEP_ERRNO__UNBALANCED_PAREN; 1031 1031 } 1032 1032 goto fail; 1033 1033 } ··· 1064 1064 else 1065 1065 *parg = current_exp; 1066 1066 free(token); 1067 - return PEVENT_ERRNO__UNBALANCED_PAREN; 1067 + return TEP_ERRNO__UNBALANCED_PAREN; 1068 1068 } 1069 1069 break; 1070 1070 ··· 1091 1091 case OP_NONE: 1092 1092 show_error(error_str, 1093 1093 "Unknown op token %s", token); 1094 - ret = PEVENT_ERRNO__UNKNOWN_TOKEN; 1094 + ret = TEP_ERRNO__UNKNOWN_TOKEN; 1095 1095 goto fail; 1096 1096 } 1097 1097 ··· 1179 1179 1180 1180 fail_alloc: 1181 1181 show_error(error_str, "failed to allocate filter arg"); 1182 - ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; 1182 + ret = TEP_ERRNO__MEM_ALLOC_FAILED; 1183 1183 goto fail; 1184 1184 fail_syntax: 1185 1185 show_error(error_str, "Syntax error"); 1186 - ret = PEVENT_ERRNO__SYNTAX_ERROR; 1186 + ret = TEP_ERRNO__SYNTAX_ERROR; 1187 1187 fail: 1188 1188 free_arg(current_op); 1189 1189 free_arg(current_exp); ··· 1192 1192 return ret; 1193 1193 } 1194 1194 1195 - static enum pevent_errno 1195 + static enum tep_errno 1196 1196 process_event(struct event_format *event, const char *filter_str, 1197 1197 struct filter_arg **parg, char *error_str) 1198 1198 { ··· 1208 1208 if (!*parg) { 1209 1209 *parg = allocate_arg(); 1210 1210 if (*parg == NULL) 1211 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 1211 + return TEP_ERRNO__MEM_ALLOC_FAILED; 1212 1212 1213 1213 (*parg)->type = FILTER_ARG_BOOLEAN; 1214 1214 (*parg)->boolean.value = FILTER_FALSE; ··· 1217 1217 return 0; 1218 1218 } 1219 1219 1220 - static enum pevent_errno 1220 + static enum tep_errno 1221 1221 filter_event(struct event_filter *filter, struct event_format *event, 1222 1222 const char *filter_str, char *error_str) 1223 1223 { 1224 1224 struct filter_type *filter_type; 1225 1225 struct filter_arg *arg; 1226 - enum pevent_errno ret; 1226 + enum tep_errno ret; 1227 1227 1228 1228 if (filter_str) { 1229 1229 ret = process_event(event, filter_str, &arg, error_str); ··· 1234 1234 /* just add a TRUE arg */ 1235 1235 arg = allocate_arg(); 1236 1236 if (arg == NULL) 1237 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 1237 + return TEP_ERRNO__MEM_ALLOC_FAILED; 1238 1238 1239 1239 arg->type = FILTER_ARG_BOOLEAN; 1240 1240 arg->boolean.value = FILTER_TRUE; ··· 1242 1242 1243 1243 filter_type = add_filter_type(filter, event->id); 1244 1244 if (filter_type == NULL) 1245 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 1245 + return TEP_ERRNO__MEM_ALLOC_FAILED; 1246 1246 1247 1247 if (filter_type->filter) 1248 1248 free_arg(filter_type->filter); ··· 1267 1267 * negative error code. Use pevent_filter_strerror() to see 1268 1268 * actual error message in case of error. 1269 1269 */ 1270 - enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, 1270 + enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter, 1271 1271 const char *filter_str) 1272 1272 { 1273 1273 struct tep_handle *pevent = filter->pevent; ··· 1279 1279 char *event_name = NULL; 1280 1280 char *sys_name = NULL; 1281 1281 char *sp; 1282 - enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */ 1282 + enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */ 1283 1283 int len; 1284 1284 int ret; 1285 1285 ··· 1305 1305 if (this_event == NULL) { 1306 1306 /* This can only happen when events is NULL, but still */ 1307 1307 free_events(events); 1308 - return PEVENT_ERRNO__MEM_ALLOC_FAILED; 1308 + return TEP_ERRNO__MEM_ALLOC_FAILED; 1309 1309 } 1310 1310 memcpy(this_event, filter_str, len); 1311 1311 this_event[len] = 0; ··· 1322 1322 /* This can only happen when events is NULL, but still */ 1323 1323 free_events(events); 1324 1324 free(this_event); 1325 - return PEVENT_ERRNO__FILTER_NOT_FOUND; 1325 + return TEP_ERRNO__FILTER_NOT_FOUND; 1326 1326 } 1327 1327 1328 1328 /* Find this event */ ··· 1379 1379 * 1380 1380 * Returns 0 if message was filled successfully, -1 if error 1381 1381 */ 1382 - int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, 1382 + int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err, 1383 1383 char *buf, size_t buflen) 1384 1384 { 1385 - if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END) 1385 + if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END) 1386 1386 return -1; 1387 1387 1388 1388 if (strlen(filter->error_buffer) > 0) { ··· 1697 1697 } 1698 1698 1699 1699 static int test_filter(struct event_format *event, struct filter_arg *arg, 1700 - struct tep_record *record, enum pevent_errno *err); 1700 + struct tep_record *record, enum tep_errno *err); 1701 1701 1702 1702 static const char * 1703 1703 get_comm(struct event_format *event, struct tep_record *record) ··· 1748 1748 1749 1749 static unsigned long long 1750 1750 get_arg_value(struct event_format *event, struct filter_arg *arg, 1751 - struct tep_record *record, enum pevent_errno *err); 1751 + struct tep_record *record, enum tep_errno *err); 1752 1752 1753 1753 static unsigned long long 1754 1754 get_exp_value(struct event_format *event, struct filter_arg *arg, 1755 - struct tep_record *record, enum pevent_errno *err) 1755 + struct tep_record *record, enum tep_errno *err) 1756 1756 { 1757 1757 unsigned long long lval, rval; 1758 1758 ··· 1800 1800 case FILTER_EXP_NOT: 1801 1801 default: 1802 1802 if (!*err) 1803 - *err = PEVENT_ERRNO__INVALID_EXP_TYPE; 1803 + *err = TEP_ERRNO__INVALID_EXP_TYPE; 1804 1804 } 1805 1805 return 0; 1806 1806 } 1807 1807 1808 1808 static unsigned long long 1809 1809 get_arg_value(struct event_format *event, struct filter_arg *arg, 1810 - struct tep_record *record, enum pevent_errno *err) 1810 + struct tep_record *record, enum tep_errno *err) 1811 1811 { 1812 1812 switch (arg->type) { 1813 1813 case FILTER_ARG_FIELD: ··· 1816 1816 case FILTER_ARG_VALUE: 1817 1817 if (arg->value.type != FILTER_NUMBER) { 1818 1818 if (!*err) 1819 - *err = PEVENT_ERRNO__NOT_A_NUMBER; 1819 + *err = TEP_ERRNO__NOT_A_NUMBER; 1820 1820 } 1821 1821 return arg->value.val; 1822 1822 ··· 1825 1825 1826 1826 default: 1827 1827 if (!*err) 1828 - *err = PEVENT_ERRNO__INVALID_ARG_TYPE; 1828 + *err = TEP_ERRNO__INVALID_ARG_TYPE; 1829 1829 } 1830 1830 return 0; 1831 1831 } 1832 1832 1833 1833 static int test_num(struct event_format *event, struct filter_arg *arg, 1834 - struct tep_record *record, enum pevent_errno *err) 1834 + struct tep_record *record, enum tep_errno *err) 1835 1835 { 1836 1836 unsigned long long lval, rval; 1837 1837 ··· 1866 1866 1867 1867 default: 1868 1868 if (!*err) 1869 - *err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; 1869 + *err = TEP_ERRNO__ILLEGAL_INTEGER_CMP; 1870 1870 return 0; 1871 1871 } 1872 1872 } ··· 1922 1922 } 1923 1923 1924 1924 static int test_str(struct event_format *event, struct filter_arg *arg, 1925 - struct tep_record *record, enum pevent_errno *err) 1925 + struct tep_record *record, enum tep_errno *err) 1926 1926 { 1927 1927 const char *val; 1928 1928 ··· 1947 1947 1948 1948 default: 1949 1949 if (!*err) 1950 - *err = PEVENT_ERRNO__ILLEGAL_STRING_CMP; 1950 + *err = TEP_ERRNO__ILLEGAL_STRING_CMP; 1951 1951 return 0; 1952 1952 } 1953 1953 } 1954 1954 1955 1955 static int test_op(struct event_format *event, struct filter_arg *arg, 1956 - struct tep_record *record, enum pevent_errno *err) 1956 + struct tep_record *record, enum tep_errno *err) 1957 1957 { 1958 1958 switch (arg->op.type) { 1959 1959 case FILTER_OP_AND: ··· 1969 1969 1970 1970 default: 1971 1971 if (!*err) 1972 - *err = PEVENT_ERRNO__INVALID_OP_TYPE; 1972 + *err = TEP_ERRNO__INVALID_OP_TYPE; 1973 1973 return 0; 1974 1974 } 1975 1975 } 1976 1976 1977 1977 static int test_filter(struct event_format *event, struct filter_arg *arg, 1978 - struct tep_record *record, enum pevent_errno *err) 1978 + struct tep_record *record, enum tep_errno *err) 1979 1979 { 1980 1980 if (*err) { 1981 1981 /* ··· 2009 2009 2010 2010 default: 2011 2011 if (!*err) 2012 - *err = PEVENT_ERRNO__INVALID_ARG_TYPE; 2012 + *err = TEP_ERRNO__INVALID_ARG_TYPE; 2013 2013 return 0; 2014 2014 } 2015 2015 } ··· 2039 2039 * @filter: filter struct with filter information 2040 2040 * @record: the record to test against the filter 2041 2041 * 2042 - * Returns: match result or error code (prefixed with PEVENT_ERRNO__) 2042 + * Returns: match result or error code (prefixed with TEP_ERRNO__) 2043 2043 * FILTER_MATCH - filter found for event and @record matches 2044 2044 * FILTER_MISS - filter found for event and @record does not match 2045 2045 * FILTER_NOT_FOUND - no filter found for @record's event 2046 2046 * NO_FILTER - if no filters exist 2047 2047 * otherwise - error occurred during test 2048 2048 */ 2049 - enum pevent_errno pevent_filter_match(struct event_filter *filter, 2050 - struct tep_record *record) 2049 + enum tep_errno pevent_filter_match(struct event_filter *filter, 2050 + struct tep_record *record) 2051 2051 { 2052 2052 struct tep_handle *pevent = filter->pevent; 2053 2053 struct filter_type *filter_type; 2054 2054 int event_id; 2055 2055 int ret; 2056 - enum pevent_errno err = 0; 2056 + enum tep_errno err = 0; 2057 2057 2058 2058 filter_init_error_buf(filter); 2059 2059 2060 2060 if (!filter->filters) 2061 - return PEVENT_ERRNO__NO_FILTER; 2061 + return TEP_ERRNO__NO_FILTER; 2062 2062 2063 2063 event_id = pevent_data_type(pevent, record); 2064 2064 2065 2065 filter_type = find_filter_type(filter, event_id); 2066 2066 if (!filter_type) 2067 - return PEVENT_ERRNO__FILTER_NOT_FOUND; 2067 + return TEP_ERRNO__FILTER_NOT_FOUND; 2068 2068 2069 2069 ret = test_filter(filter_type->event, filter_type->filter, record, &err); 2070 2070 if (err) 2071 2071 return err; 2072 2072 2073 - return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS; 2073 + return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS; 2074 2074 } 2075 2075 2076 2076 static char *op_to_str(struct event_filter *filter, struct filter_arg *arg)