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,7 +6035,7 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve ...@@ -6035,7 +6035,7 @@ 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)
{ {
...@@ -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,7 +6185,7 @@ __pevent_parse_event(struct tep_handle *pevent, ...@@ -6185,7 +6185,7 @@ __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)
...@@ -6207,7 +6207,7 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent, ...@@ -6207,7 +6207,7 @@ 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;
...@@ -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,9 +642,9 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s, ...@@ -642,9 +642,9 @@ 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);
...@@ -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,
......
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