Skip to content

Commit d97f4ef

Browse files
tzstoyanovacmel
authored andcommitted
tools lib traceevent, tools lib lockdep: Rename 'enum pevent_errno' to 'enum tep_errno'
In order to make libtraceevent into a proper library, variables, data structures and functions require a unique prefix to prevent name space conflicts. That prefix will be "tep_" and not "pevent_". This changes 'enum pevent_errno' to 'enum tep_errno'. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Cc: linux-trace-devel@vger.kernel.org Link: http://lkml.kernel.org/r/20180808180701.770475059@goodmis.org Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 6fed932 commit d97f4ef

5 files changed

Lines changed: 133 additions & 133 deletions

File tree

‎tools/lib/lockdep/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ $(OUTPUT)liblockdep.a: $(LIB_IN)
129129
tags: force
130130
$(RM) tags
131131
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
132-
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
132+
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
133133

134134
TAGS: force
135135
$(RM) TAGS
136136
find . -name '*.[ch]' | xargs etags \
137-
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
137+
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
138138

139139
define do_install
140140
$(print_install) \

‎tools/lib/traceevent/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ endef
233233
tags: force
234234
$(RM) tags
235235
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
236-
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
236+
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
237237

238238
TAGS: force
239239
$(RM) TAGS
240240
find . -name '*.[ch]' | xargs etags \
241-
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
241+
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
242242

243243
define do_install_mkdir
244244
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \

‎tools/lib/traceevent/event-parse.c‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6035,9 +6035,9 @@ static int find_event_handle(struct tep_handle *pevent, struct event_format *eve
60356035
*
60366036
* /sys/kernel/debug/tracing/events/.../.../format
60376037
*/
6038-
enum pevent_errno __pevent_parse_format(struct event_format **eventp,
6039-
struct tep_handle *pevent, const char *buf,
6040-
unsigned long size, const char *sys)
6038+
enum tep_errno __pevent_parse_format(struct event_format **eventp,
6039+
struct tep_handle *pevent, const char *buf,
6040+
unsigned long size, const char *sys)
60416041
{
60426042
struct event_format *event;
60436043
int ret;
@@ -6046,12 +6046,12 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
60466046

60476047
*eventp = event = alloc_event();
60486048
if (!event)
6049-
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
6049+
return TEP_ERRNO__MEM_ALLOC_FAILED;
60506050

60516051
event->name = event_read_name();
60526052
if (!event->name) {
60536053
/* Bad event? */
6054-
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
6054+
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
60556055
goto event_alloc_failed;
60566056
}
60576057

@@ -6064,7 +6064,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
60646064

60656065
event->id = event_read_id();
60666066
if (event->id < 0) {
6067-
ret = PEVENT_ERRNO__READ_ID_FAILED;
6067+
ret = TEP_ERRNO__READ_ID_FAILED;
60686068
/*
60696069
* This isn't an allocation error actually.
60706070
* But as the ID is critical, just bail out.
@@ -6074,7 +6074,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
60746074

60756075
event->system = strdup(sys);
60766076
if (!event->system) {
6077-
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
6077+
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
60786078
goto event_alloc_failed;
60796079
}
60806080

@@ -6083,7 +6083,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
60836083

60846084
ret = event_read_format(event);
60856085
if (ret < 0) {
6086-
ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
6086+
ret = TEP_ERRNO__READ_FORMAT_FAILED;
60876087
goto event_parse_failed;
60886088
}
60896089

@@ -6098,7 +6098,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
60986098
show_warning = 1;
60996099

61006100
if (ret < 0) {
6101-
ret = PEVENT_ERRNO__READ_PRINT_FAILED;
6101+
ret = TEP_ERRNO__READ_PRINT_FAILED;
61026102
goto event_parse_failed;
61036103
}
61046104

@@ -6112,14 +6112,14 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
61126112
arg = alloc_arg();
61136113
if (!arg) {
61146114
event->flags |= EVENT_FL_FAILED;
6115-
return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED;
6115+
return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
61166116
}
61176117
arg->type = PRINT_FIELD;
61186118
arg->field.name = strdup(field->name);
61196119
if (!arg->field.name) {
61206120
event->flags |= EVENT_FL_FAILED;
61216121
free_arg(arg);
6122-
return PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED;
6122+
return TEP_ERRNO__OLD_FTRACE_ARG_FAILED;
61236123
}
61246124
arg->field.field = field;
61256125
*list = arg;
@@ -6142,7 +6142,7 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp,
61426142
return ret;
61436143
}
61446144

6145-
static enum pevent_errno
6145+
static enum tep_errno
61466146
__pevent_parse_event(struct tep_handle *pevent,
61476147
struct event_format **eventp,
61486148
const char *buf, unsigned long size,
@@ -6155,7 +6155,7 @@ __pevent_parse_event(struct tep_handle *pevent,
61556155
return ret;
61566156

61576157
if (pevent && add_event(pevent, event)) {
6158-
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
6158+
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
61596159
goto event_add_failed;
61606160
}
61616161

@@ -6185,10 +6185,10 @@ __pevent_parse_event(struct tep_handle *pevent,
61856185
*
61866186
* /sys/kernel/debug/tracing/events/.../.../format
61876187
*/
6188-
enum pevent_errno tep_parse_format(struct tep_handle *pevent,
6189-
struct event_format **eventp,
6190-
const char *buf,
6191-
unsigned long size, const char *sys)
6188+
enum tep_errno tep_parse_format(struct tep_handle *pevent,
6189+
struct event_format **eventp,
6190+
const char *buf,
6191+
unsigned long size, const char *sys)
61926192
{
61936193
return __pevent_parse_event(pevent, eventp, buf, size, sys);
61946194
}
@@ -6207,8 +6207,8 @@ enum pevent_errno tep_parse_format(struct tep_handle *pevent,
62076207
*
62086208
* /sys/kernel/debug/tracing/events/.../.../format
62096209
*/
6210-
enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
6211-
unsigned long size, const char *sys)
6210+
enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
6211+
unsigned long size, const char *sys)
62126212
{
62136213
struct event_format *event = NULL;
62146214
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,
62176217
#undef _PE
62186218
#define _PE(code, str) str
62196219
static const char * const pevent_error_str[] = {
6220-
PEVENT_ERRORS
6220+
TEP_ERRORS
62216221
};
62226222
#undef _PE
62236223

62246224
int pevent_strerror(struct tep_handle *pevent __maybe_unused,
6225-
enum pevent_errno errnum, char *buf, size_t buflen)
6225+
enum tep_errno errnum, char *buf, size_t buflen)
62266226
{
62276227
int idx;
62286228
const char *msg;
@@ -6232,11 +6232,11 @@ int pevent_strerror(struct tep_handle *pevent __maybe_unused,
62326232
return 0;
62336233
}
62346234

6235-
if (errnum <= __PEVENT_ERRNO__START ||
6236-
errnum >= __PEVENT_ERRNO__END)
6235+
if (errnum <= __TEP_ERRNO__START ||
6236+
errnum >= __TEP_ERRNO__END)
62376237
return -1;
62386238

6239-
idx = errnum - __PEVENT_ERRNO__START - 1;
6239+
idx = errnum - __TEP_ERRNO__START - 1;
62406240
msg = pevent_error_str[idx];
62416241
snprintf(buf, buflen, "%s", msg);
62426242

@@ -6517,7 +6517,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
65176517
func_handle = calloc(1, sizeof(*func_handle));
65186518
if (!func_handle) {
65196519
do_warning("Failed to allocate function handler");
6520-
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
6520+
return TEP_ERRNO__MEM_ALLOC_FAILED;
65216521
}
65226522

65236523
func_handle->ret_type = ret_type;
@@ -6526,7 +6526,7 @@ int pevent_register_print_function(struct tep_handle *pevent,
65266526
if (!func_handle->name) {
65276527
do_warning("Failed to allocate function name");
65286528
free(func_handle);
6529-
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
6529+
return TEP_ERRNO__MEM_ALLOC_FAILED;
65306530
}
65316531

65326532
next_param = &(func_handle->params);
@@ -6538,14 +6538,14 @@ int pevent_register_print_function(struct tep_handle *pevent,
65386538

65396539
if (type >= PEVENT_FUNC_ARG_MAX_TYPES) {
65406540
do_warning("Invalid argument type %d", type);
6541-
ret = PEVENT_ERRNO__INVALID_ARG_TYPE;
6541+
ret = TEP_ERRNO__INVALID_ARG_TYPE;
65426542
goto out_free;
65436543
}
65446544

65456545
param = malloc(sizeof(*param));
65466546
if (!param) {
65476547
do_warning("Failed to allocate function param");
6548-
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
6548+
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
65496549
goto out_free;
65506550
}
65516551
param->type = type;
@@ -6654,7 +6654,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id,
66546654
handle = calloc(1, sizeof(*handle));
66556655
if (!handle) {
66566656
do_warning("Failed to allocate event handler");
6657-
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
6657+
return TEP_ERRNO__MEM_ALLOC_FAILED;
66586658
}
66596659

66606660
handle->id = id;
@@ -6669,7 +6669,7 @@ int pevent_register_event_handler(struct tep_handle *pevent, int id,
66696669
free((void *)handle->event_name);
66706670
free((void *)handle->sys_name);
66716671
free(handle);
6672-
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
6672+
return TEP_ERRNO__MEM_ALLOC_FAILED;
66736673
}
66746674

66756675
handle->func = func;

‎tools/lib/traceevent/event-parse.h‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ enum tep_flag {
379379
TEP_DISABLE_PLUGINS = 1 << 2,
380380
};
381381

382-
#define PEVENT_ERRORS \
382+
#define TEP_ERRORS \
383383
_PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \
384384
_PE(PARSE_EVENT_FAILED, "failed to parse event"), \
385385
_PE(READ_ID_FAILED, "failed to read event id"), \
@@ -411,10 +411,10 @@ enum tep_flag {
411411
_PE(FILTER_MISS, "record does not match to filter")
412412

413413
#undef _PE
414-
#define _PE(__code, __str) PEVENT_ERRNO__ ## __code
415-
enum pevent_errno {
416-
PEVENT_ERRNO__SUCCESS = 0,
417-
PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS,
414+
#define _PE(__code, __str) TEP_ERRNO__ ## __code
415+
enum tep_errno {
416+
TEP_ERRNO__SUCCESS = 0,
417+
TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS,
418418

419419
/*
420420
* Choose an arbitrary negative big number not to clash with standard
@@ -423,11 +423,11 @@ enum pevent_errno {
423423
*
424424
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
425425
*/
426-
__PEVENT_ERRNO__START = -100000,
426+
__TEP_ERRNO__START = -100000,
427427

428-
PEVENT_ERRORS,
428+
TEP_ERRORS,
429429

430-
__PEVENT_ERRNO__END,
430+
__TEP_ERRNO__END,
431431
};
432432
#undef _PE
433433

@@ -642,12 +642,12 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s,
642642
int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size,
643643
int long_size);
644644

645-
enum pevent_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
646-
unsigned long size, const char *sys);
647-
enum pevent_errno tep_parse_format(struct tep_handle *pevent,
648-
struct event_format **eventp,
649-
const char *buf,
650-
unsigned long size, const char *sys);
645+
enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
646+
unsigned long size, const char *sys);
647+
enum tep_errno tep_parse_format(struct tep_handle *pevent,
648+
struct event_format **eventp,
649+
const char *buf,
650+
unsigned long size, const char *sys);
651651
void pevent_free_format(struct event_format *event);
652652
void pevent_free_format_field(struct format_field *field);
653653

@@ -724,7 +724,7 @@ void tep_print_fields(struct trace_seq *s, void *data,
724724
int size __maybe_unused, struct event_format *event);
725725
void tep_event_info(struct trace_seq *s, struct event_format *event,
726726
struct tep_record *record);
727-
int pevent_strerror(struct tep_handle *pevent, enum pevent_errno errnum,
727+
int pevent_strerror(struct tep_handle *pevent, enum tep_errno errnum,
728728
char *buf, size_t buflen);
729729

730730
struct event_format **pevent_list_events(struct tep_handle *pevent, enum event_sort_type);
@@ -942,24 +942,24 @@ struct event_filter {
942942
struct event_filter *pevent_filter_alloc(struct tep_handle *pevent);
943943

944944
/* for backward compatibility */
945-
#define FILTER_NONE PEVENT_ERRNO__NO_FILTER
946-
#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND
947-
#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS
948-
#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH
945+
#define FILTER_NONE TEP_ERRNO__NO_FILTER
946+
#define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND
947+
#define FILTER_MISS TEP_ERRNO__FILTER_MISS
948+
#define FILTER_MATCH TEP_ERRNO__FILTER_MATCH
949949

950950
enum filter_trivial_type {
951951
FILTER_TRIVIAL_FALSE,
952952
FILTER_TRIVIAL_TRUE,
953953
FILTER_TRIVIAL_BOTH,
954954
};
955955

956-
enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
957-
const char *filter_str);
956+
enum tep_errno pevent_filter_add_filter_str(struct event_filter *filter,
957+
const char *filter_str);
958958

959-
enum pevent_errno pevent_filter_match(struct event_filter *filter,
960-
struct tep_record *record);
959+
enum tep_errno pevent_filter_match(struct event_filter *filter,
960+
struct tep_record *record);
961961

962-
int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err,
962+
int pevent_filter_strerror(struct event_filter *filter, enum tep_errno err,
963963
char *buf, size_t buflen);
964964

965965
int pevent_event_filtered(struct event_filter *filter,

0 commit comments

Comments
 (0)