Commit d97f4ef1 authored by Tzvetomir Stoyanov (VMware)'s avatar Tzvetomir Stoyanov (VMware) Committed by Arnaldo Carvalho de Melo

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: default avatarTzvetomir 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.orgSigned-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6fed932e
...@@ -129,12 +129,12 @@ $(OUTPUT)liblockdep.a: $(LIB_IN) ...@@ -129,12 +129,12 @@ $(OUTPUT)liblockdep.a: $(LIB_IN)
tags: force tags: force
$(RM) tags $(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' --regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force TAGS: force
$(RM) TAGS $(RM) TAGS
find . -name '*.[ch]' | xargs etags \ find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install define do_install
$(print_install) \ $(print_install) \
......
...@@ -233,12 +233,12 @@ endef ...@@ -233,12 +233,12 @@ endef
tags: force tags: force
$(RM) tags $(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' --regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force TAGS: force
$(RM) TAGS $(RM) TAGS
find . -name '*.[ch]' | xargs etags \ find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' --regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install_mkdir define do_install_mkdir
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \ if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
......
...@@ -6035,9 +6035,9 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve ...@@ -6035,9 +6035,9 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve
* *
* /sys/kernel/debug/tracing/events/.../.../format * /sys/kernel/debug/tracing/events/.../.../format
*/ */
enum pevent_errno __pevent_parse_format(struct event_format **eventp, enum tep_errno __pevent_parse_format(struct event_format **eventp,
struct tep_handle *pevent, const char *buf, struct tep_handle *pevent, const char *buf,
unsigned long size, const char *sys) unsigned long size, const char *sys)
{ {
struct event_format *event; struct event_format *event;
int ret; int ret;
...@@ -6046,12 +6046,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6046,12 +6046,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
*eventp = event = alloc_event(); *eventp = event = alloc_event();
if (!event) if (!event)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
event->name = event_read_name(); event->name = event_read_name();
if (!event->name) { if (!event->name) {
/* Bad event? */ /* Bad event? */
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_alloc_failed; goto event_alloc_failed;
} }
...@@ -6064,7 +6064,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6064,7 +6064,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
event->id = event_read_id(); event->id = event_read_id();
if (event->id < 0) { if (event->id < 0) {
ret = PEVENT_ERRNO__READ_ID_FAILED; ret = TEP_ERRNO__READ_ID_FAILED;
/* /*
* This isn't an allocation error actually. * This isn't an allocation error actually.
* But as the ID is critical, just bail out. * But as the ID is critical, just bail out.
...@@ -6074,7 +6074,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6074,7 +6074,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
event->system = strdup(sys); event->system = strdup(sys);
if (!event->system) { if (!event->system) {
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_alloc_failed; goto event_alloc_failed;
} }
...@@ -6083,7 +6083,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6083,7 +6083,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
ret = event_read_format(event); ret = event_read_format(event);
if (ret < 0) { if (ret < 0) {
ret = PEVENT_ERRNO__READ_FORMAT_FAILED; ret = TEP_ERRNO__READ_FORMAT_FAILED;
goto event_parse_failed; goto event_parse_failed;
} }
...@@ -6098,7 +6098,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6098,7 +6098,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
show_warning = 1; show_warning = 1;
if (ret < 0) { if (ret < 0) {
ret = PEVENT_ERRNO__READ_PRINT_FAILED; ret = TEP_ERRNO__READ_PRINT_FAILED;
goto event_parse_failed; goto event_parse_failed;
} }
...@@ -6112,14 +6112,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6112,14 +6112,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
arg = alloc_arg(); arg = alloc_arg();
if (!arg) { if (!arg) {
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
} }
arg->type = PRINT_FIELD; arg->type = PRINT_FIELD;
arg->field.name = strdup(field->name); arg->field.name = strdup(field->name);
if (!arg->field.name) { if (!arg->field.name) {
event->flags |= EVENT_FL_FAILED; event->flags |= EVENT_FL_FAILED;
free_arg(arg); free_arg(arg);
return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED; return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
} }
arg->field.field = field; arg->field.field = field;
*list = arg; *list = arg;
...@@ -6142,7 +6142,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, ...@@ -6142,7 +6142,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
return ret; return ret;
} }
static enum pevent_errno static enum tep_errno
__pevent_parse_event(struct tep_handle *pevent, __pevent_parse_event(struct tep_handle *pevent,
struct event_format **eventp, struct event_format **eventp,
const char *buf, unsigned long size, const char *buf, unsigned long size,
...@@ -6155,7 +6155,7 @@ __pevent_parse_event(struct tep_handle *pevent, ...@@ -6155,7 +6155,7 @@ __pevent_parse_event(struct tep_handle *pevent,
return ret; return ret;
if (pevent && add_event(pevent, event)) { if (pevent && add_event(pevent, event)) {
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_add_failed; goto event_add_failed;
} }
...@@ -6185,10 +6185,10 @@ __pevent_parse_event(struct tep_handle *pevent, ...@@ -6185,10 +6185,10 @@ __pevent_parse_event(struct tep_handle *pevent,
* *
* /sys/kernel/debug/tracing/events/.../.../format * /sys/kernel/debug/tracing/events/.../.../format
*/ */
enum pevent_errno tep_parse_format(struct tep_handle *pevent, enum tep_errno tep_parse_format(struct tep_handle *pevent,
struct event_format **eventp, struct event_format **eventp,
const char *buf, const char *buf,
unsigned long size, const char *sys) unsigned long size, const char *sys)
{ {
return __pevent_parse_event(pevent, eventp, buf, size, sys); return __pevent_parse_event(pevent, eventp, buf, size, sys);
} }
...@@ -6207,8 +6207,8 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent, ...@@ -6207,8 +6207,8 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent,
* *
* /sys/kernel/debug/tracing/events/.../.../format * /sys/kernel/debug/tracing/events/.../.../format
*/ */
enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
unsigned long size, const char *sys) unsigned long size, const char *sys)
{ {
struct event_format *event = NULL; struct event_format *event = NULL;
return __pevent_parse_event(pevent, &event, buf, size, sys); return __pevent_parse_event(pevent, &event, buf, size, sys);
...@@ -6217,12 +6217,12 @@ enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, ...@@ -6217,12 +6217,12 @@ enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
#undef _PE #undef _PE
#define _PE(code, str) str #define _PE(code, str) str
static const char * const pevent_error_str[] = { static const char * const pevent_error_str[] = {
PEVENT_ERRORS TEP_ERRORS
}; };
#undef _PE #undef _PE
int pevent_strerror(struct tep_handle *pevent __maybe_unused, int pevent_strerror(struct tep_handle *pevent __maybe_unused,
enum pevent_errno errnum, char *buf, size_t buflen) enum tep_errno errnum, char *buf, size_t buflen)
{ {
int idx; int idx;
const char *msg; const char *msg;
...@@ -6232,11 +6232,11 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused, ...@@ -6232,11 +6232,11 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused,
return 0; return 0;
} }
if (errnum <= __PEVENT_ERRNO__START || if (errnum <= __TEP_ERRNO__START ||
errnum >= __PEVENT_ERRNO__END) errnum >= __TEP_ERRNO__END)
return -1; return -1;
idx = errnum - __PEVENT_ERRNO__START - 1; idx = errnum - __TEP_ERRNO__START - 1;
msg = pevent_error_str[idx]; msg = pevent_error_str[idx];
snprintf(buf, buflen, "%s", msg); snprintf(buf, buflen, "%s", msg);
...@@ -6517,7 +6517,7 @@ int pevent_register_print_function(struct tep_handle *pevent, ...@@ -6517,7 +6517,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
func_handle = calloc(1, sizeof(*func_handle)); func_handle = calloc(1, sizeof(*func_handle));
if (!func_handle) { if (!func_handle) {
do_warning("Failed to allocate function handler"); do_warning("Failed to allocate function handler");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
func_handle->ret_type = ret_type; func_handle->ret_type = ret_type;
...@@ -6526,7 +6526,7 @@ int pevent_register_print_function(struct tep_handle *pevent, ...@@ -6526,7 +6526,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
if (!func_handle->name) { if (!func_handle->name) {
do_warning("Failed to allocate function name"); do_warning("Failed to allocate function name");
free(func_handle); free(func_handle);
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
next_param = &(func_handle->params); next_param = &(func_handle->params);
...@@ -6538,14 +6538,14 @@ int pevent_register_print_function(struct tep_handle *pevent, ...@@ -6538,14 +6538,14 @@ int pevent_register_print_function(struct tep_handle *pevent,
if (type >= PEVENT_FUNC_ARG_MAX_TYPES) { if (type >= PEVENT_FUNC_ARG_MAX_TYPES) {
do_warning("Invalid argument type %d", type); do_warning("Invalid argument type %d", type);
ret = PEVENT_ERRNO__INVALID_ARG_TYPE; ret = TEP_ERRNO__INVALID_ARG_TYPE;
goto out_free; goto out_free;
} }
param = malloc(sizeof(*param)); param = malloc(sizeof(*param));
if (!param) { if (!param) {
do_warning("Failed to allocate function param"); do_warning("Failed to allocate function param");
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto out_free; goto out_free;
} }
param->type = type; param->type = type;
...@@ -6654,7 +6654,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id, ...@@ -6654,7 +6654,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id,
handle = calloc(1, sizeof(*handle)); handle = calloc(1, sizeof(*handle));
if (!handle) { if (!handle) {
do_warning("Failed to allocate event handler"); do_warning("Failed to allocate event handler");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
handle->id = id; handle->id = id;
...@@ -6669,7 +6669,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id, ...@@ -6669,7 +6669,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id,
free((void *)handle->event_name); free((void *)handle->event_name);
free((void *)handle->sys_name); free((void *)handle->sys_name);
free(handle); free(handle);
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
handle->func = func; handle->func = func;
......
...@@ -379,7 +379,7 @@ enum tep_flag { ...@@ -379,7 +379,7 @@ enum tep_flag {
TEP_DISABLE_PLUGINS = 1 << 2, TEP_DISABLE_PLUGINS = 1 << 2,
}; };
#define PEVENT_ERRORS \ #define TEP_ERRORS \
_PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \ _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \
_PE(PARSE_EVENT_FAILED, "failed to parse event"), \ _PE(PARSE_EVENT_FAILED, "failed to parse event"), \
_PE(READ_ID_FAILED, "failed to read event id"), \ _PE(READ_ID_FAILED, "failed to read event id"), \
...@@ -411,10 +411,10 @@ enum tep_flag { ...@@ -411,10 +411,10 @@ enum tep_flag {
_PE(FILTER_MISS, "record does not match to filter") _PE(FILTER_MISS, "record does not match to filter")
#undef _PE #undef _PE
#define _PE(__code, __str) PEVENT_ERRNO__ ## __code #define _PE(__code, __str) TEP_ERRNO__ ## __code
enum pevent_errno { enum tep_errno {
PEVENT_ERRNO__SUCCESS = 0, TEP_ERRNO__SUCCESS = 0,
PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS, TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS,
/* /*
* Choose an arbitrary negative big number not to clash with standard * Choose an arbitrary negative big number not to clash with standard
...@@ -423,11 +423,11 @@ enum pevent_errno { ...@@ -423,11 +423,11 @@ enum pevent_errno {
* *
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
*/ */
__PEVENT_ERRNO__START = -100000, __TEP_ERRNO__START = -100000,
PEVENT_ERRORS, TEP_ERRORS,
__PEVENT_ERRNO__END, __TEP_ERRNO__END,
}; };
#undef _PE #undef _PE
...@@ -642,12 +642,12 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, ...@@ -642,12 +642,12 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s,
int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size, int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size,
int long_size); int long_size);
enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf, enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
unsigned long size, const char *sys); unsigned long size, const char *sys);
enum pevent_errno tep_parse_format(struct tep_handle *pevent, enum tep_errno tep_parse_format(struct tep_handle *pevent,
struct event_format **eventp, struct event_format **eventp,
const char *buf, const char *buf,
unsigned long size, const char *sys); unsigned long size, const char *sys);
void pevent_free_format(struct event_format *event); void pevent_free_format(struct event_format *event);
void pevent_free_format_field(struct format_field *field); void pevent_free_format_field(struct format_field *field);
...@@ -724,7 +724,7 @@ void tep_print_fields(struct trace_seq *s, void *data, ...@@ -724,7 +724,7 @@ void tep_print_fields(struct trace_seq *s, void *data,
int size __maybe_unused, struct event_format *event); int size __maybe_unused, struct event_format *event);
void tep_event_info(struct trace_seq *s, struct event_format *event, void tep_event_info(struct trace_seq *s, struct event_format *event,
struct tep_record *record); struct tep_record *record);
int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum, int pevent_strerror(struct tep_handle *pevent, enum tep_errno errnum,
char *buf, size_t buflen); char *buf, size_t buflen);
struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type); struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type);
...@@ -942,10 +942,10 @@ struct event_filter { ...@@ -942,10 +942,10 @@ struct event_filter {
struct event_filter *pevent_filter_alloc(struct tep_handle *pevent); struct event_filter *pevent_filter_alloc(struct tep_handle *pevent);
/* for backward compatibility */ /* for backward compatibility */
#define FILTER_NONE PEVENT_ERRNO__NO_FILTER #define FILTER_NONE TEP_ERRNO__NO_FILTER
#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND #define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND
#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS #define FILTER_MISS TEP_ERRNO__FILTER_MISS
#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH #define FILTER_MATCH TEP_ERRNO__FILTER_MATCH
enum filter_trivial_type { enum filter_trivial_type {
FILTER_TRIVIAL_FALSE, FILTER_TRIVIAL_FALSE,
...@@ -953,13 +953,13 @@ enum filter_trivial_type { ...@@ -953,13 +953,13 @@ enum filter_trivial_type {
FILTER_TRIVIAL_BOTH, FILTER_TRIVIAL_BOTH,
}; };
enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter,
const char *filter_str); const char *filter_str);
enum pevent_errno pevent_filter_match(struct event_filter *filter, enum tep_errno pevent_filter_match(struct event_filter *filter,
struct tep_record *record); struct tep_record *record);
int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err,
char *buf, size_t buflen); char *buf, size_t buflen);
int pevent_event_filtered(struct event_filter *filter, int pevent_event_filtered(struct event_filter *filter,
......
...@@ -268,7 +268,7 @@ static int event_match(struct event_format *event, ...@@ -268,7 +268,7 @@ static int event_match(struct event_format *event,
!regexec(ereg, event->name, 0, NULL, 0); !regexec(ereg, event->name, 0, NULL, 0);
} }
static enum pevent_errno static enum tep_errno
find_event(struct tep_handle *pevent, struct event_list **events, find_event(struct tep_handle *pevent, struct event_list **events,
char *sys_name, char *event_name) char *sys_name, char *event_name)
{ {
...@@ -289,26 +289,26 @@ find_event(struct tep_handle *pevent, struct event_list **events, ...@@ -289,26 +289,26 @@ find_event(struct tep_handle *pevent, struct event_list **events,
ret = asprintf(&reg, "^%s$", event_name); ret = asprintf(&reg, "^%s$", event_name);
if (ret < 0) if (ret < 0)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB); ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB);
free(reg); free(reg);
if (ret) if (ret)
return PEVENT_ERRNO__INVALID_EVENT_NAME; return TEP_ERRNO__INVALID_EVENT_NAME;
if (sys_name) { if (sys_name) {
ret = asprintf(&reg, "^%s$", sys_name); ret = asprintf(&reg, "^%s$", sys_name);
if (ret < 0) { if (ret < 0) {
regfree(&ereg); regfree(&ereg);
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB); ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB);
free(reg); free(reg);
if (ret) { if (ret) {
regfree(&ereg); regfree(&ereg);
return PEVENT_ERRNO__INVALID_EVENT_NAME; return TEP_ERRNO__INVALID_EVENT_NAME;
} }
} }
...@@ -328,9 +328,9 @@ find_event(struct tep_handle *pevent, struct event_list **events, ...@@ -328,9 +328,9 @@ find_event(struct tep_handle *pevent, struct event_list **events,
regfree(&sreg); regfree(&sreg);
if (!match) if (!match)
return PEVENT_ERRNO__EVENT_NOT_FOUND; return TEP_ERRNO__EVENT_NOT_FOUND;
if (fail) if (fail)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
return 0; return 0;
} }
...@@ -346,7 +346,7 @@ static void free_events(struct event_list *events) ...@@ -346,7 +346,7 @@ static void free_events(struct event_list *events)
} }
} }
static enum pevent_errno static enum tep_errno
create_arg_item(struct event_format *event, const char *token, create_arg_item(struct event_format *event, const char *token,
enum event_type type, struct filter_arg **parg, char *error_str) enum event_type type, struct filter_arg **parg, char *error_str)
{ {
...@@ -356,7 +356,7 @@ create_arg_item(struct event_format *event, const char *token, ...@@ -356,7 +356,7 @@ create_arg_item(struct event_format *event, const char *token,
arg = allocate_arg(); arg = allocate_arg();
if (arg == NULL) { if (arg == NULL) {
show_error(error_str, "failed to allocate filter arg"); show_error(error_str, "failed to allocate filter arg");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
switch (type) { switch (type) {
...@@ -370,7 +370,7 @@ create_arg_item(struct event_format *event, const char *token, ...@@ -370,7 +370,7 @@ create_arg_item(struct event_format *event, const char *token,
if (!arg->value.str) { if (!arg->value.str) {
free_arg(arg); free_arg(arg);
show_error(error_str, "failed to allocate string filter arg"); show_error(error_str, "failed to allocate string filter arg");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
break; break;
case EVENT_ITEM: case EVENT_ITEM:
...@@ -402,7 +402,7 @@ create_arg_item(struct event_format *event, const char *token, ...@@ -402,7 +402,7 @@ create_arg_item(struct event_format *event, const char *token,
default: default:
free_arg(arg); free_arg(arg);
show_error(error_str, "expected a value but found %s", token); show_error(error_str, "expected a value but found %s", token);
return PEVENT_ERRNO__UNEXPECTED_TYPE; return TEP_ERRNO__UNEXPECTED_TYPE;
} }
*parg = arg; *parg = arg;
return 0; return 0;
...@@ -454,7 +454,7 @@ create_arg_cmp(enum filter_cmp_type ctype) ...@@ -454,7 +454,7 @@ create_arg_cmp(enum filter_cmp_type ctype)
return arg; return arg;
} }
static enum pevent_errno static enum tep_errno
add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
{ {
struct filter_arg *left; struct filter_arg *left;
...@@ -487,7 +487,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -487,7 +487,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
break; break;
default: default:
show_error(error_str, "Illegal rvalue"); show_error(error_str, "Illegal rvalue");
return PEVENT_ERRNO__ILLEGAL_RVALUE; return TEP_ERRNO__ILLEGAL_RVALUE;
} }
/* /*
...@@ -534,7 +534,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -534,7 +534,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
if (left->type != FILTER_ARG_FIELD) { if (left->type != FILTER_ARG_FIELD) {
show_error(error_str, show_error(error_str,
"Illegal lvalue for string comparison"); "Illegal lvalue for string comparison");
return PEVENT_ERRNO__ILLEGAL_LVALUE; return TEP_ERRNO__ILLEGAL_LVALUE;
} }
/* Make sure this is a valid string compare */ /* Make sure this is a valid string compare */
...@@ -553,13 +553,13 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -553,13 +553,13 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
show_error(error_str, show_error(error_str,
"RegEx '%s' did not compute", "RegEx '%s' did not compute",
str); str);
return PEVENT_ERRNO__INVALID_REGEX; return TEP_ERRNO__INVALID_REGEX;
} }
break; break;
default: default:
show_error(error_str, show_error(error_str,
"Illegal comparison for string"); "Illegal comparison for string");
return PEVENT_ERRNO__ILLEGAL_STRING_CMP; return TEP_ERRNO__ILLEGAL_STRING_CMP;
} }
op->type = FILTER_ARG_STR; op->type = FILTER_ARG_STR;
...@@ -568,7 +568,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -568,7 +568,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
op->str.val = strdup(str); op->str.val = strdup(str);
if (!op->str.val) { if (!op->str.val) {
show_error(error_str, "Failed to allocate string filter"); show_error(error_str, "Failed to allocate string filter");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
/* /*
* Need a buffer to copy data for tests * Need a buffer to copy data for tests
...@@ -576,7 +576,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -576,7 +576,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
op->str.buffer = malloc(op->str.field->size + 1); op->str.buffer = malloc(op->str.field->size + 1);
if (!op->str.buffer) { if (!op->str.buffer) {
show_error(error_str, "Failed to allocate string filter"); show_error(error_str, "Failed to allocate string filter");
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
/* Null terminate this buffer */ /* Null terminate this buffer */
op->str.buffer[op->str.field->size] = 0; op->str.buffer[op->str.field->size] = 0;
...@@ -595,7 +595,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -595,7 +595,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
case FILTER_CMP_NOT_REGEX: case FILTER_CMP_NOT_REGEX:
show_error(error_str, show_error(error_str,
"Op not allowed with integers"); "Op not allowed with integers");
return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; return TEP_ERRNO__ILLEGAL_INTEGER_CMP;
default: default:
break; break;
...@@ -616,7 +616,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str) ...@@ -616,7 +616,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
out_fail: out_fail:
show_error(error_str, "Syntax error"); show_error(error_str, "Syntax error");
return PEVENT_ERRNO__SYNTAX_ERROR; return TEP_ERRNO__SYNTAX_ERROR;
} }
static struct filter_arg * static struct filter_arg *
...@@ -629,7 +629,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b) ...@@ -629,7 +629,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b)
return arg; return arg;
} }
static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg)
{ {
switch (op->type) { switch (op->type) {
case FILTER_ARG_EXP: case FILTER_ARG_EXP:
...@@ -648,11 +648,11 @@ static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg) ...@@ -648,11 +648,11 @@ static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg)
/* left arg of compares must be a field */ /* left arg of compares must be a field */
if (arg->type != FILTER_ARG_FIELD && if (arg->type != FILTER_ARG_FIELD &&
arg->type != FILTER_ARG_BOOLEAN) arg->type != FILTER_ARG_BOOLEAN)
return PEVENT_ERRNO__INVALID_ARG_TYPE; return TEP_ERRNO__INVALID_ARG_TYPE;
op->num.left = arg; op->num.left = arg;
break; break;
default: default:
return PEVENT_ERRNO__INVALID_ARG_TYPE; return TEP_ERRNO__INVALID_ARG_TYPE;
} }
return 0; return 0;
} }
...@@ -765,7 +765,7 @@ enum filter_vals { ...@@ -765,7 +765,7 @@ enum filter_vals {
FILTER_VAL_TRUE, FILTER_VAL_TRUE,
}; };
static enum pevent_errno static enum tep_errno
reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
struct filter_arg *arg, char *error_str) struct filter_arg *arg, char *error_str)
{ {
...@@ -775,7 +775,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, ...@@ -775,7 +775,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
if (parent->type != FILTER_ARG_OP && if (parent->type != FILTER_ARG_OP &&
arg->type != FILTER_ARG_OP) { arg->type != FILTER_ARG_OP) {
show_error(error_str, "can not reparent other than OP"); show_error(error_str, "can not reparent other than OP");
return PEVENT_ERRNO__REPARENT_NOT_OP; return TEP_ERRNO__REPARENT_NOT_OP;
} }
/* Get the sibling */ /* Get the sibling */
...@@ -787,7 +787,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, ...@@ -787,7 +787,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
other_child = old_child->op.right; other_child = old_child->op.right;
} else { } else {
show_error(error_str, "Error in reparent op, find other child"); show_error(error_str, "Error in reparent op, find other child");
return PEVENT_ERRNO__REPARENT_FAILED; return TEP_ERRNO__REPARENT_FAILED;
} }
/* Detach arg from old_child */ /* Detach arg from old_child */
...@@ -808,7 +808,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, ...@@ -808,7 +808,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
ptr = &parent->op.left; ptr = &parent->op.left;
else { else {
show_error(error_str, "Error in reparent op"); show_error(error_str, "Error in reparent op");
return PEVENT_ERRNO__REPARENT_FAILED; return TEP_ERRNO__REPARENT_FAILED;
} }
*ptr = arg; *ptr = arg;
...@@ -817,7 +817,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child, ...@@ -817,7 +817,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
return 0; return 0;
} }
/* Returns either filter_vals (success) or pevent_errno (failfure) */ /* Returns either filter_vals (success) or tep_errno (failfure) */
static int test_arg(struct filter_arg *parent, struct filter_arg *arg, static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
char *error_str) char *error_str)
{ {
...@@ -912,7 +912,7 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg, ...@@ -912,7 +912,7 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
return rval; return rval;
default: default:
show_error(error_str, "bad arg in filter tree"); show_error(error_str, "bad arg in filter tree");
return PEVENT_ERRNO__BAD_FILTER_ARG; return TEP_ERRNO__BAD_FILTER_ARG;
} }
return FILTER_VAL_NORM; return FILTER_VAL_NORM;
} }
...@@ -937,7 +937,7 @@ static int collapse_tree(struct filter_arg *arg, ...@@ -937,7 +937,7 @@ static int collapse_tree(struct filter_arg *arg,
arg->boolean.value = ret == FILTER_VAL_TRUE; arg->boolean.value = ret == FILTER_VAL_TRUE;
} else { } else {
show_error(error_str, "Failed to allocate filter arg"); show_error(error_str, "Failed to allocate filter arg");
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
} }
break; break;
...@@ -952,7 +952,7 @@ static int collapse_tree(struct filter_arg *arg, ...@@ -952,7 +952,7 @@ static int collapse_tree(struct filter_arg *arg,
return ret; return ret;
} }
static enum pevent_errno static enum tep_errno
process_filter(struct event_format *event, struct filter_arg **parg, process_filter(struct event_format *event, struct filter_arg **parg,
char *error_str, int not) char *error_str, int not)
{ {
...@@ -966,7 +966,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -966,7 +966,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
enum filter_op_type btype; enum filter_op_type btype;
enum filter_exp_type etype; enum filter_exp_type etype;
enum filter_cmp_type ctype; enum filter_cmp_type ctype;
enum pevent_errno ret; enum tep_errno ret;
*parg = NULL; *parg = NULL;
...@@ -1004,7 +1004,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1004,7 +1004,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
case EVENT_DELIM: case EVENT_DELIM:
if (*token == ',') { if (*token == ',') {
show_error(error_str, "Illegal token ','"); show_error(error_str, "Illegal token ','");
ret = PEVENT_ERRNO__ILLEGAL_TOKEN; ret = TEP_ERRNO__ILLEGAL_TOKEN;
goto fail; goto fail;
} }
...@@ -1012,22 +1012,22 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1012,22 +1012,22 @@ process_filter(struct event_format *event, struct filter_arg **parg,
if (left_item) { if (left_item) {
show_error(error_str, show_error(error_str,
"Open paren can not come after item"); "Open paren can not come after item");
ret = PEVENT_ERRNO__INVALID_PAREN; ret = TEP_ERRNO__INVALID_PAREN;
goto fail; goto fail;
} }
if (current_exp) { if (current_exp) {
show_error(error_str, show_error(error_str,
"Open paren can not come after expression"); "Open paren can not come after expression");
ret = PEVENT_ERRNO__INVALID_PAREN; ret = TEP_ERRNO__INVALID_PAREN;
goto fail; goto fail;
} }
ret = process_filter(event, &arg, error_str, 0); ret = process_filter(event, &arg, error_str, 0);
if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) { if (ret != TEP_ERRNO__UNBALANCED_PAREN) {
if (ret == 0) { if (ret == 0) {
show_error(error_str, show_error(error_str,
"Unbalanced number of '('"); "Unbalanced number of '('");
ret = PEVENT_ERRNO__UNBALANCED_PAREN; ret = TEP_ERRNO__UNBALANCED_PAREN;
} }
goto fail; goto fail;
} }
...@@ -1064,7 +1064,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1064,7 +1064,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
else else
*parg = current_exp; *parg = current_exp;
free(token); free(token);
return PEVENT_ERRNO__UNBALANCED_PAREN; return TEP_ERRNO__UNBALANCED_PAREN;
} }
break; break;
...@@ -1091,7 +1091,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1091,7 +1091,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
case OP_NONE: case OP_NONE:
show_error(error_str, show_error(error_str,
"Unknown op token %s", token); "Unknown op token %s", token);
ret = PEVENT_ERRNO__UNKNOWN_TOKEN; ret = TEP_ERRNO__UNKNOWN_TOKEN;
goto fail; goto fail;
} }
...@@ -1179,11 +1179,11 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1179,11 +1179,11 @@ process_filter(struct event_format *event, struct filter_arg **parg,
fail_alloc: fail_alloc:
show_error(error_str, "failed to allocate filter arg"); show_error(error_str, "failed to allocate filter arg");
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED; ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto fail; goto fail;
fail_syntax: fail_syntax:
show_error(error_str, "Syntax error"); show_error(error_str, "Syntax error");
ret = PEVENT_ERRNO__SYNTAX_ERROR; ret = TEP_ERRNO__SYNTAX_ERROR;
fail: fail:
free_arg(current_op); free_arg(current_op);
free_arg(current_exp); free_arg(current_exp);
...@@ -1192,7 +1192,7 @@ process_filter(struct event_format *event, struct filter_arg **parg, ...@@ -1192,7 +1192,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
return ret; return ret;
} }
static enum pevent_errno static enum tep_errno
process_event(struct event_format *event, const char *filter_str, process_event(struct event_format *event, const char *filter_str,
struct filter_arg **parg, char *error_str) struct filter_arg **parg, char *error_str)
{ {
...@@ -1208,7 +1208,7 @@ process_event(struct event_format *event, const char *filter_str, ...@@ -1208,7 +1208,7 @@ process_event(struct event_format *event, const char *filter_str,
if (!*parg) { if (!*parg) {
*parg = allocate_arg(); *parg = allocate_arg();
if (*parg == NULL) if (*parg == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
(*parg)->type = FILTER_ARG_BOOLEAN; (*parg)->type = FILTER_ARG_BOOLEAN;
(*parg)->boolean.value = FILTER_FALSE; (*parg)->boolean.value = FILTER_FALSE;
...@@ -1217,13 +1217,13 @@ process_event(struct event_format *event, const char *filter_str, ...@@ -1217,13 +1217,13 @@ process_event(struct event_format *event, const char *filter_str,
return 0; return 0;
} }
static enum pevent_errno static enum tep_errno
filter_event(struct event_filter *filter, struct event_format *event, filter_event(struct event_filter *filter, struct event_format *event,
const char *filter_str, char *error_str) const char *filter_str, char *error_str)
{ {
struct filter_type *filter_type; struct filter_type *filter_type;
struct filter_arg *arg; struct filter_arg *arg;
enum pevent_errno ret; enum tep_errno ret;
if (filter_str) { if (filter_str) {
ret = process_event(event, filter_str, &arg, error_str); ret = process_event(event, filter_str, &arg, error_str);
...@@ -1234,7 +1234,7 @@ filter_event(struct event_filter *filter, struct event_format *event, ...@@ -1234,7 +1234,7 @@ filter_event(struct event_filter *filter, struct event_format *event,
/* just add a TRUE arg */ /* just add a TRUE arg */
arg = allocate_arg(); arg = allocate_arg();
if (arg == NULL) if (arg == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
arg->type = FILTER_ARG_BOOLEAN; arg->type = FILTER_ARG_BOOLEAN;
arg->boolean.value = FILTER_TRUE; arg->boolean.value = FILTER_TRUE;
...@@ -1242,7 +1242,7 @@ filter_event(struct event_filter *filter, struct event_format *event, ...@@ -1242,7 +1242,7 @@ filter_event(struct event_filter *filter, struct event_format *event,
filter_type = add_filter_type(filter, event->id); filter_type = add_filter_type(filter, event->id);
if (filter_type == NULL) if (filter_type == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
if (filter_type->filter) if (filter_type->filter)
free_arg(filter_type->filter); free_arg(filter_type->filter);
...@@ -1267,7 +1267,7 @@ static void filter_init_error_buf(struct event_filter *filter) ...@@ -1267,7 +1267,7 @@ static void filter_init_error_buf(struct event_filter *filter)
* negative error code. Use pevent_filter_strerror() to see * negative error code. Use pevent_filter_strerror() to see
* actual error message in case of error. * actual error message in case of error.
*/ */
enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter,
const char *filter_str) const char *filter_str)
{ {
struct tep_handle *pevent = filter->pevent; struct tep_handle *pevent = filter->pevent;
...@@ -1279,7 +1279,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, ...@@ -1279,7 +1279,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
char *event_name = NULL; char *event_name = NULL;
char *sys_name = NULL; char *sys_name = NULL;
char *sp; char *sp;
enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */ enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */
int len; int len;
int ret; int ret;
...@@ -1305,7 +1305,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, ...@@ -1305,7 +1305,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
if (this_event == NULL) { if (this_event == NULL) {
/* This can only happen when events is NULL, but still */ /* This can only happen when events is NULL, but still */
free_events(events); free_events(events);
return PEVENT_ERRNO__MEM_ALLOC_FAILED; return TEP_ERRNO__MEM_ALLOC_FAILED;
} }
memcpy(this_event, filter_str, len); memcpy(this_event, filter_str, len);
this_event[len] = 0; this_event[len] = 0;
...@@ -1322,7 +1322,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter, ...@@ -1322,7 +1322,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
/* This can only happen when events is NULL, but still */ /* This can only happen when events is NULL, but still */
free_events(events); free_events(events);
free(this_event); free(this_event);
return PEVENT_ERRNO__FILTER_NOT_FOUND; return TEP_ERRNO__FILTER_NOT_FOUND;
} }
/* Find this event */ /* Find this event */
...@@ -1379,10 +1379,10 @@ static void free_filter_type(struct filter_type *filter_type) ...@@ -1379,10 +1379,10 @@ static void free_filter_type(struct filter_type *filter_type)
* *
* Returns 0 if message was filled successfully, -1 if error * Returns 0 if message was filled successfully, -1 if error
*/ */
int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err, int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err,
char *buf, size_t buflen) char *buf, size_t buflen)
{ {
if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END) if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END)
return -1; return -1;
if (strlen(filter->error_buffer) > 0) { if (strlen(filter->error_buffer) > 0) {
...@@ -1697,7 +1697,7 @@ int pevent_filter_event_has_trivial(struct event_filter *filter, ...@@ -1697,7 +1697,7 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
} }
static int test_filter(struct event_format *event, struct filter_arg *arg, static int test_filter(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err); struct tep_record *record, enum tep_errno *err);
static const char * static const char *
get_comm(struct event_format *event, struct tep_record *record) get_comm(struct event_format *event, struct tep_record *record)
...@@ -1748,11 +1748,11 @@ get_value(struct event_format *event, ...@@ -1748,11 +1748,11 @@ get_value(struct event_format *event,
static unsigned long long static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg, get_arg_value(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err); struct tep_record *record, enum tep_errno *err);
static unsigned long long static unsigned long long
get_exp_value(struct event_format *event, struct filter_arg *arg, get_exp_value(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
unsigned long long lval, rval; unsigned long long lval, rval;
...@@ -1800,14 +1800,14 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, ...@@ -1800,14 +1800,14 @@ get_exp_value(struct event_format *event, struct filter_arg *arg,
case FILTER_EXP_NOT: case FILTER_EXP_NOT:
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__INVALID_EXP_TYPE; *err = TEP_ERRNO__INVALID_EXP_TYPE;
} }
return 0; return 0;
} }
static unsigned long long static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg, get_arg_value(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
switch (arg->type) { switch (arg->type) {
case FILTER_ARG_FIELD: case FILTER_ARG_FIELD:
...@@ -1816,7 +1816,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, ...@@ -1816,7 +1816,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg,
case FILTER_ARG_VALUE: case FILTER_ARG_VALUE:
if (arg->value.type != FILTER_NUMBER) { if (arg->value.type != FILTER_NUMBER) {
if (!*err) if (!*err)
*err = PEVENT_ERRNO__NOT_A_NUMBER; *err = TEP_ERRNO__NOT_A_NUMBER;
} }
return arg->value.val; return arg->value.val;
...@@ -1825,13 +1825,13 @@ get_arg_value(struct event_format *event, struct filter_arg *arg, ...@@ -1825,13 +1825,13 @@ get_arg_value(struct event_format *event, struct filter_arg *arg,
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__INVALID_ARG_TYPE; *err = TEP_ERRNO__INVALID_ARG_TYPE;
} }
return 0; return 0;
} }
static int test_num(struct event_format *event, struct filter_arg *arg, static int test_num(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
unsigned long long lval, rval; unsigned long long lval, rval;
...@@ -1866,7 +1866,7 @@ static int test_num(struct event_format *event, struct filter_arg *arg, ...@@ -1866,7 +1866,7 @@ static int test_num(struct event_format *event, struct filter_arg *arg,
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP; *err = TEP_ERRNO__ILLEGAL_INTEGER_CMP;
return 0; return 0;
} }
} }
...@@ -1922,7 +1922,7 @@ static const char *get_field_str(struct filter_arg *arg, struct tep_record *reco ...@@ -1922,7 +1922,7 @@ static const char *get_field_str(struct filter_arg *arg, struct tep_record *reco
} }
static int test_str(struct event_format *event, struct filter_arg *arg, static int test_str(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
const char *val; const char *val;
...@@ -1947,13 +1947,13 @@ static int test_str(struct event_format *event, struct filter_arg *arg, ...@@ -1947,13 +1947,13 @@ static int test_str(struct event_format *event, struct filter_arg *arg,
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__ILLEGAL_STRING_CMP; *err = TEP_ERRNO__ILLEGAL_STRING_CMP;
return 0; return 0;
} }
} }
static int test_op(struct event_format *event, struct filter_arg *arg, static int test_op(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
switch (arg->op.type) { switch (arg->op.type) {
case FILTER_OP_AND: case FILTER_OP_AND:
...@@ -1969,13 +1969,13 @@ static int test_op(struct event_format *event, struct filter_arg *arg, ...@@ -1969,13 +1969,13 @@ static int test_op(struct event_format *event, struct filter_arg *arg,
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__INVALID_OP_TYPE; *err = TEP_ERRNO__INVALID_OP_TYPE;
return 0; return 0;
} }
} }
static int test_filter(struct event_format *event, struct filter_arg *arg, static int test_filter(struct event_format *event, struct filter_arg *arg,
struct tep_record *record, enum pevent_errno *err) struct tep_record *record, enum tep_errno *err)
{ {
if (*err) { if (*err) {
/* /*
...@@ -2009,7 +2009,7 @@ static int test_filter(struct event_format *event, struct filter_arg *arg, ...@@ -2009,7 +2009,7 @@ static int test_filter(struct event_format *event, struct filter_arg *arg,
default: default:
if (!*err) if (!*err)
*err = PEVENT_ERRNO__INVALID_ARG_TYPE; *err = TEP_ERRNO__INVALID_ARG_TYPE;
return 0; return 0;
} }
} }
...@@ -2039,38 +2039,38 @@ int pevent_event_filtered(struct event_filter *filter, int event_id) ...@@ -2039,38 +2039,38 @@ int pevent_event_filtered(struct event_filter *filter, int event_id)
* @filter: filter struct with filter information * @filter: filter struct with filter information
* @record: the record to test against the filter * @record: the record to test against the filter
* *
* Returns: match result or error code (prefixed with PEVENT_ERRNO__) * Returns: match result or error code (prefixed with TEP_ERRNO__)
* FILTER_MATCH - filter found for event and @record matches * FILTER_MATCH - filter found for event and @record matches
* FILTER_MISS - filter found for event and @record does not match * FILTER_MISS - filter found for event and @record does not match
* FILTER_NOT_FOUND - no filter found for @record's event * FILTER_NOT_FOUND - no filter found for @record's event
* NO_FILTER - if no filters exist * NO_FILTER - if no filters exist
* otherwise - error occurred during test * otherwise - error occurred during test
*/ */
enum pevent_errno pevent_filter_match(struct event_filter *filter, enum tep_errno pevent_filter_match(struct event_filter *filter,
struct tep_record *record) struct tep_record *record)
{ {
struct tep_handle *pevent = filter->pevent; struct tep_handle *pevent = filter->pevent;
struct filter_type *filter_type; struct filter_type *filter_type;
int event_id; int event_id;
int ret; int ret;
enum pevent_errno err = 0; enum tep_errno err = 0;
filter_init_error_buf(filter); filter_init_error_buf(filter);
if (!filter->filters) if (!filter->filters)
return PEVENT_ERRNO__NO_FILTER; return TEP_ERRNO__NO_FILTER;
event_id = pevent_data_type(pevent, record); event_id = pevent_data_type(pevent, record);
filter_type = find_filter_type(filter, event_id); filter_type = find_filter_type(filter, event_id);
if (!filter_type) if (!filter_type)
return PEVENT_ERRNO__FILTER_NOT_FOUND; return TEP_ERRNO__FILTER_NOT_FOUND;
ret = test_filter(filter_type->event, filter_type->filter, record, &err); ret = test_filter(filter_type->event, filter_type->filter, record, &err);
if (err) if (err)
return err; return err;
return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS; return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS;
} }
static char *op_to_str(struct event_filter *filter, struct filter_arg *arg) static char *op_to_str(struct event_filter *filter, struct filter_arg *arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment