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)
tags: force
$(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force
$(RM) TAGS
find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install
$(print_install) \
......
......@@ -233,12 +233,12 @@ endef
tags: force
$(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force
$(RM) TAGS
find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install_mkdir
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
......
......@@ -6035,9 +6035,9 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve
*
* /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;
......@@ -6046,12 +6046,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
*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;
}
......@@ -6064,7 +6064,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
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.
......@@ -6074,7 +6074,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
event->system = strdup(sys);
if (!event->system) {
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_alloc_failed;
}
......@@ -6083,7 +6083,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
ret = event_read_format(event);
if (ret < 0) {
ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
ret = TEP_ERRNO__READ_FORMAT_FAILED;
goto event_parse_failed;
}
......@@ -6098,7 +6098,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
show_warning = 1;
if (ret < 0) {
ret = PEVENT_ERRNO__READ_PRINT_FAILED;
ret = TEP_ERRNO__READ_PRINT_FAILED;
goto event_parse_failed;
}
......@@ -6112,14 +6112,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
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;
......@@ -6142,7 +6142,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
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,
......@@ -6155,7 +6155,7 @@ __pevent_parse_event(struct tep_handle *pevent,
return ret;
if (pevent && add_event(pevent, event)) {
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto event_add_failed;
}
......@@ -6185,10 +6185,10 @@ __pevent_parse_event(struct tep_handle *pevent,
*
* /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);
}
......@@ -6207,8 +6207,8 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent,
*
* /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);
......@@ -6217,12 +6217,12 @@ enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
#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;
......@@ -6232,11 +6232,11 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused,
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);
......@@ -6517,7 +6517,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
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;
......@@ -6526,7 +6526,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
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);
......@@ -6538,14 +6538,14 @@ int pevent_register_print_function(struct tep_handle *pevent,
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;
......@@ -6654,7 +6654,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id,
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;
......@@ -6669,7 +6669,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int 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;
......
......@@ -379,7 +379,7 @@ enum tep_flag {
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"), \
......@@ -411,10 +411,10 @@ enum tep_flag {
_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
......@@ -423,11 +423,11 @@ enum pevent_errno {
*
* 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
......@@ -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 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);
......@@ -724,7 +724,7 @@ void tep_print_fields(struct trace_seq *s, void *data,
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);
......@@ -942,10 +942,10 @@ struct event_filter {
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,
......@@ -953,13 +953,13 @@ enum filter_trivial_type {
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,
......
This diff is collapsed.
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