*
* /sys/kernel/debug/tracing/events/.../.../format
*/
-enum pevent_errno __pevent_parse_format(struct event_format **eventp,
- struct tep_handle *pevent, const char *buf,
- unsigned long size, const char *sys)
+enum tep_errno __pevent_parse_format(struct event_format **eventp,
+ struct tep_handle *pevent, const char *buf,
+ unsigned long size, const char *sys)
{
struct event_format *event;
int ret;
*eventp = event = alloc_event();
if (!event)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
event->name = event_read_name();
if (!event->name) {
/* Bad event? */
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_alloc_failed;
}
event->id = event_read_id();
if (event->id < 0) {
- ret = PEVENT_ERRNO__READ_ID_FAILED;
+ ret = TEP_ERRNO__READ_ID_FAILED;
/*
* This isn't an allocation error actually.
* But as the ID is critical, just bail out.
event->system = strdup(sys);
if (!event->system) {
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_alloc_failed;
}
ret = event_read_format(event);
if (ret < 0) {
- ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
+ ret = TEP_ERRNO__READ_FORMAT_FAILED;
goto event_parse_failed;
}
show_warning = 1;
if (ret < 0) {
- ret = PEVENT_ERRNO__READ_PRINT_FAILED;
+ ret = TEP_ERRNO__READ_PRINT_FAILED;
goto event_parse_failed;
}
arg = alloc_arg();
if (!arg) {
event->flags |= EVENT_FL_FAILED;
- return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED;
+ return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
}
arg->type = PRINT_FIELD;
arg->field.name = strdup(field->name);
if (!arg->field.name) {
event->flags |= EVENT_FL_FAILED;
free_arg(arg);
- return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED;
+ return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
}
arg->field.field = field;
*list = arg;
return ret;
}
-static enum pevent_errno
+static enum tep_errno
__pevent_parse_event(struct tep_handle *pevent,
struct event_format **eventp,
const char *buf, unsigned long size,
return ret;
if (pevent && add_event(pevent, event)) {
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_add_failed;
}
*
* /sys/kernel/debug/tracing/events/.../.../format
*/
-enum pevent_errno tep_parse_format(struct tep_handle *pevent,
- struct event_format **eventp,
- const char *buf,
- unsigned long size, const char *sys)
+enum tep_errno tep_parse_format(struct tep_handle *pevent,
+ struct event_format **eventp,
+ const char *buf,
+ unsigned long size, const char *sys)
{
return __pevent_parse_event(pevent, eventp, buf, size, sys);
}
*
* /sys/kernel/debug/tracing/events/.../.../format
*/
-enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
- unsigned long size, const char *sys)
+enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
+ unsigned long size, const char *sys)
{
struct event_format *event = NULL;
return __pevent_parse_event(pevent, &event, buf, size, sys);
#undef _PE
#define _PE(code, str) str
static const char * const pevent_error_str[] = {
- PEVENT_ERRORS
+ TEP_ERRORS
};
#undef _PE
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;
const char *msg;
return 0;
}
- if (errnum <= __PEVENT_ERRNO__START ||
- errnum >= __PEVENT_ERRNO__END)
+ if (errnum <= __TEP_ERRNO__START ||
+ errnum >= __TEP_ERRNO__END)
return -1;
- idx = errnum - __PEVENT_ERRNO__START - 1;
+ idx = errnum - __TEP_ERRNO__START - 1;
msg = pevent_error_str[idx];
snprintf(buf, buflen, "%s", msg);
func_handle = calloc(1, sizeof(*func_handle));
if (!func_handle) {
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;
if (!func_handle->name) {
do_warning("Failed to allocate function name");
free(func_handle);
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
next_param = &(func_handle->params);
if (type >= PEVENT_FUNC_ARG_MAX_TYPES) {
do_warning("Invalid argument type %d", type);
- ret = PEVENT_ERRNO__INVALID_ARG_TYPE;
+ ret = TEP_ERRNO__INVALID_ARG_TYPE;
goto out_free;
}
param = malloc(sizeof(*param));
if (!param) {
do_warning("Failed to allocate function param");
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto out_free;
}
param->type = type;
handle = calloc(1, sizeof(*handle));
if (!handle) {
do_warning("Failed to allocate event handler");
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
handle->id = id;
free((void *)handle->event_name);
free((void *)handle->sys_name);
free(handle);
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
handle->func = func;
TEP_DISABLE_PLUGINS = 1 << 2,
};
-#define PEVENT_ERRORS \
+#define TEP_ERRORS \
_PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \
_PE(PARSE_EVENT_FAILED, "failed to parse event"), \
_PE(READ_ID_FAILED, "failed to read event id"), \
_PE(FILTER_MISS, "record does not match to filter")
#undef _PE
-#define _PE(__code, __str) PEVENT_ERRNO__ ## __code
-enum pevent_errno {
- PEVENT_ERRNO__SUCCESS = 0,
- PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS,
+#define _PE(__code, __str) TEP_ERRNO__ ## __code
+enum tep_errno {
+ TEP_ERRNO__SUCCESS = 0,
+ TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS,
/*
* Choose an arbitrary negative big number not to clash with standard
*
* 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
int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size,
int long_size);
-enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
- unsigned long size, const char *sys);
-enum pevent_errno tep_parse_format(struct tep_handle *pevent,
- struct event_format **eventp,
- const char *buf,
- unsigned long size, const char *sys);
+enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
+ unsigned long size, const char *sys);
+enum tep_errno tep_parse_format(struct tep_handle *pevent,
+ struct event_format **eventp,
+ const char *buf,
+ unsigned long size, const char *sys);
void pevent_free_format(struct event_format *event);
void pevent_free_format_field(struct format_field *field);
int size __maybe_unused, struct event_format *event);
void tep_event_info(struct trace_seq *s, struct event_format *event,
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);
struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type);
struct event_filter *pevent_filter_alloc(struct tep_handle *pevent);
/* for backward compatibility */
-#define FILTER_NONE PEVENT_ERRNO__NO_FILTER
-#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND
-#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS
-#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH
+#define FILTER_NONE TEP_ERRNO__NO_FILTER
+#define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND
+#define FILTER_MISS TEP_ERRNO__FILTER_MISS
+#define FILTER_MATCH TEP_ERRNO__FILTER_MATCH
enum filter_trivial_type {
FILTER_TRIVIAL_FALSE,
FILTER_TRIVIAL_BOTH,
};
-enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
- const char *filter_str);
+enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter,
+ const char *filter_str);
-enum pevent_errno pevent_filter_match(struct event_filter *filter,
- struct tep_record *record);
+enum tep_errno pevent_filter_match(struct event_filter *filter,
+ 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);
int pevent_event_filtered(struct event_filter *filter,
!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,
char *sys_name, char *event_name)
{
ret = asprintf(®, "^%s$", event_name);
if (ret < 0)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB);
free(reg);
if (ret)
- return PEVENT_ERRNO__INVALID_EVENT_NAME;
+ return TEP_ERRNO__INVALID_EVENT_NAME;
if (sys_name) {
ret = asprintf(®, "^%s$", sys_name);
if (ret < 0) {
regfree(&ereg);
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB);
free(reg);
if (ret) {
regfree(&ereg);
- return PEVENT_ERRNO__INVALID_EVENT_NAME;
+ return TEP_ERRNO__INVALID_EVENT_NAME;
}
}
regfree(&sreg);
if (!match)
- return PEVENT_ERRNO__EVENT_NOT_FOUND;
+ return TEP_ERRNO__EVENT_NOT_FOUND;
if (fail)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
return 0;
}
}
}
-static enum pevent_errno
+static enum tep_errno
create_arg_item(struct event_format *event, const char *token,
enum event_type type, struct filter_arg **parg, char *error_str)
{
arg = allocate_arg();
if (arg == NULL) {
show_error(error_str, "failed to allocate filter arg");
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
switch (type) {
if (!arg->value.str) {
free_arg(arg);
show_error(error_str, "failed to allocate string filter arg");
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
break;
case EVENT_ITEM:
default:
free_arg(arg);
show_error(error_str, "expected a value but found %s", token);
- return PEVENT_ERRNO__UNEXPECTED_TYPE;
+ return TEP_ERRNO__UNEXPECTED_TYPE;
}
*parg = arg;
return 0;
return arg;
}
-static enum pevent_errno
+static enum tep_errno
add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
{
struct filter_arg *left;
break;
default:
show_error(error_str, "Illegal rvalue");
- return PEVENT_ERRNO__ILLEGAL_RVALUE;
+ return TEP_ERRNO__ILLEGAL_RVALUE;
}
/*
if (left->type != FILTER_ARG_FIELD) {
show_error(error_str,
"Illegal lvalue for string comparison");
- return PEVENT_ERRNO__ILLEGAL_LVALUE;
+ return TEP_ERRNO__ILLEGAL_LVALUE;
}
/* Make sure this is a valid string compare */
show_error(error_str,
"RegEx '%s' did not compute",
str);
- return PEVENT_ERRNO__INVALID_REGEX;
+ return TEP_ERRNO__INVALID_REGEX;
}
break;
default:
show_error(error_str,
"Illegal comparison for string");
- return PEVENT_ERRNO__ILLEGAL_STRING_CMP;
+ return TEP_ERRNO__ILLEGAL_STRING_CMP;
}
op->type = FILTER_ARG_STR;
op->str.val = strdup(str);
if (!op->str.val) {
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
op->str.buffer = malloc(op->str.field->size + 1);
if (!op->str.buffer) {
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 */
op->str.buffer[op->str.field->size] = 0;
case FILTER_CMP_NOT_REGEX:
show_error(error_str,
"Op not allowed with integers");
- return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
+ return TEP_ERRNO__ILLEGAL_INTEGER_CMP;
default:
break;
out_fail:
show_error(error_str, "Syntax error");
- return PEVENT_ERRNO__SYNTAX_ERROR;
+ return TEP_ERRNO__SYNTAX_ERROR;
}
static struct filter_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) {
case FILTER_ARG_EXP:
/* left arg of compares must be a field */
if (arg->type != FILTER_ARG_FIELD &&
arg->type != FILTER_ARG_BOOLEAN)
- return PEVENT_ERRNO__INVALID_ARG_TYPE;
+ return TEP_ERRNO__INVALID_ARG_TYPE;
op->num.left = arg;
break;
default:
- return PEVENT_ERRNO__INVALID_ARG_TYPE;
+ return TEP_ERRNO__INVALID_ARG_TYPE;
}
return 0;
}
FILTER_VAL_TRUE,
};
-static enum pevent_errno
+static enum tep_errno
reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
struct filter_arg *arg, char *error_str)
{
if (parent->type != FILTER_ARG_OP &&
arg->type != FILTER_ARG_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 */
other_child = old_child->op.right;
} else {
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 */
ptr = &parent->op.left;
else {
show_error(error_str, "Error in reparent op");
- return PEVENT_ERRNO__REPARENT_FAILED;
+ return TEP_ERRNO__REPARENT_FAILED;
}
*ptr = arg;
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,
char *error_str)
{
return rval;
default:
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;
}
arg->boolean.value = ret == FILTER_VAL_TRUE;
} else {
show_error(error_str, "Failed to allocate filter arg");
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
}
break;
return ret;
}
-static enum pevent_errno
+static enum tep_errno
process_filter(struct event_format *event, struct filter_arg **parg,
char *error_str, int not)
{
enum filter_op_type btype;
enum filter_exp_type etype;
enum filter_cmp_type ctype;
- enum pevent_errno ret;
+ enum tep_errno ret;
*parg = NULL;
case EVENT_DELIM:
if (*token == ',') {
show_error(error_str, "Illegal token ','");
- ret = PEVENT_ERRNO__ILLEGAL_TOKEN;
+ ret = TEP_ERRNO__ILLEGAL_TOKEN;
goto fail;
}
if (left_item) {
show_error(error_str,
"Open paren can not come after item");
- ret = PEVENT_ERRNO__INVALID_PAREN;
+ ret = TEP_ERRNO__INVALID_PAREN;
goto fail;
}
if (current_exp) {
show_error(error_str,
"Open paren can not come after expression");
- ret = PEVENT_ERRNO__INVALID_PAREN;
+ ret = TEP_ERRNO__INVALID_PAREN;
goto fail;
}
ret = process_filter(event, &arg, error_str, 0);
- if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) {
+ if (ret != TEP_ERRNO__UNBALANCED_PAREN) {
if (ret == 0) {
show_error(error_str,
"Unbalanced number of '('");
- ret = PEVENT_ERRNO__UNBALANCED_PAREN;
+ ret = TEP_ERRNO__UNBALANCED_PAREN;
}
goto fail;
}
else
*parg = current_exp;
free(token);
- return PEVENT_ERRNO__UNBALANCED_PAREN;
+ return TEP_ERRNO__UNBALANCED_PAREN;
}
break;
case OP_NONE:
show_error(error_str,
"Unknown op token %s", token);
- ret = PEVENT_ERRNO__UNKNOWN_TOKEN;
+ ret = TEP_ERRNO__UNKNOWN_TOKEN;
goto fail;
}
fail_alloc:
show_error(error_str, "failed to allocate filter arg");
- ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto fail;
fail_syntax:
show_error(error_str, "Syntax error");
- ret = PEVENT_ERRNO__SYNTAX_ERROR;
+ ret = TEP_ERRNO__SYNTAX_ERROR;
fail:
free_arg(current_op);
free_arg(current_exp);
return ret;
}
-static enum pevent_errno
+static enum tep_errno
process_event(struct event_format *event, const char *filter_str,
struct filter_arg **parg, char *error_str)
{
if (!*parg) {
*parg = allocate_arg();
if (*parg == NULL)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
(*parg)->type = FILTER_ARG_BOOLEAN;
(*parg)->boolean.value = FILTER_FALSE;
return 0;
}
-static enum pevent_errno
+static enum tep_errno
filter_event(struct event_filter *filter, struct event_format *event,
const char *filter_str, char *error_str)
{
struct filter_type *filter_type;
struct filter_arg *arg;
- enum pevent_errno ret;
+ enum tep_errno ret;
if (filter_str) {
ret = process_event(event, filter_str, &arg, error_str);
/* just add a TRUE arg */
arg = allocate_arg();
if (arg == NULL)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
arg->type = FILTER_ARG_BOOLEAN;
arg->boolean.value = FILTER_TRUE;
filter_type = add_filter_type(filter, event->id);
if (filter_type == NULL)
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
if (filter_type->filter)
free_arg(filter_type->filter);
* negative error code. Use pevent_filter_strerror() to see
* 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)
{
struct tep_handle *pevent = filter->pevent;
char *event_name = NULL;
char *sys_name = NULL;
char *sp;
- enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */
+ enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */
int len;
int ret;
if (this_event == NULL) {
/* This can only happen when events is NULL, but still */
free_events(events);
- return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+ return TEP_ERRNO__MEM_ALLOC_FAILED;
}
memcpy(this_event, filter_str, len);
this_event[len] = 0;
/* This can only happen when events is NULL, but still */
free_events(events);
free(this_event);
- return PEVENT_ERRNO__FILTER_NOT_FOUND;
+ return TEP_ERRNO__FILTER_NOT_FOUND;
}
/* Find this event */
*
* 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)
{
- if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END)
+ if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END)
return -1;
if (strlen(filter->error_buffer) > 0) {
}
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 *
get_comm(struct event_format *event, struct tep_record *record)
static unsigned long long
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
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;
case FILTER_EXP_NOT:
default:
if (!*err)
- *err = PEVENT_ERRNO__INVALID_EXP_TYPE;
+ *err = TEP_ERRNO__INVALID_EXP_TYPE;
}
return 0;
}
static unsigned long long
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) {
case FILTER_ARG_FIELD:
case FILTER_ARG_VALUE:
if (arg->value.type != FILTER_NUMBER) {
if (!*err)
- *err = PEVENT_ERRNO__NOT_A_NUMBER;
+ *err = TEP_ERRNO__NOT_A_NUMBER;
}
return arg->value.val;
default:
if (!*err)
- *err = PEVENT_ERRNO__INVALID_ARG_TYPE;
+ *err = TEP_ERRNO__INVALID_ARG_TYPE;
}
return 0;
}
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;
default:
if (!*err)
- *err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
+ *err = TEP_ERRNO__ILLEGAL_INTEGER_CMP;
return 0;
}
}
}
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;
default:
if (!*err)
- *err = PEVENT_ERRNO__ILLEGAL_STRING_CMP;
+ *err = TEP_ERRNO__ILLEGAL_STRING_CMP;
return 0;
}
}
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) {
case FILTER_OP_AND:
default:
if (!*err)
- *err = PEVENT_ERRNO__INVALID_OP_TYPE;
+ *err = TEP_ERRNO__INVALID_OP_TYPE;
return 0;
}
}
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) {
/*
default:
if (!*err)
- *err = PEVENT_ERRNO__INVALID_ARG_TYPE;
+ *err = TEP_ERRNO__INVALID_ARG_TYPE;
return 0;
}
}
* @filter: filter struct with filter information
* @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_MISS - filter found for event and @record does not match
* FILTER_NOT_FOUND - no filter found for @record's event
* NO_FILTER - if no filters exist
* otherwise - error occurred during test
*/
-enum pevent_errno pevent_filter_match(struct event_filter *filter,
- struct tep_record *record)
+enum tep_errno pevent_filter_match(struct event_filter *filter,
+ struct tep_record *record)
{
struct tep_handle *pevent = filter->pevent;
struct filter_type *filter_type;
int event_id;
int ret;
- enum pevent_errno err = 0;
+ enum tep_errno err = 0;
filter_init_error_buf(filter);
if (!filter->filters)
- return PEVENT_ERRNO__NO_FILTER;
+ return TEP_ERRNO__NO_FILTER;
event_id = pevent_data_type(pevent, record);
filter_type = find_filter_type(filter, event_id);
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);
if (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)