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

tools lib traceevent: Rename pevent field APIs

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
APIs: pevent_free_format, pevent_free_format_field, pevent_get_field_raw,
pevent_get_field_val, pevent_get_common_field_val, pevent_get_any_field_val
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/20180808180702.821244942@goodmis.orgSigned-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dc05ebf3
...@@ -6166,7 +6166,7 @@ __pevent_parse_event(struct tep_handle *pevent, ...@@ -6166,7 +6166,7 @@ __pevent_parse_event(struct tep_handle *pevent,
return 0; return 0;
event_add_failed: event_add_failed:
pevent_free_format(event); tep_free_format(event);
return ret; return ret;
} }
...@@ -6263,7 +6263,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field, ...@@ -6263,7 +6263,7 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
} }
/** /**
* pevent_get_field_raw - return the raw pointer into the data field * tep_get_field_raw - return the raw pointer into the data field
* @s: The seq to print to on error * @s: The seq to print to on error
* @event: the event that the field is for * @event: the event that the field is for
* @name: The name of the field * @name: The name of the field
...@@ -6276,9 +6276,9 @@ int get_field_val(struct trace_seq *s, struct format_field *field, ...@@ -6276,9 +6276,9 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
* *
* On failure, it returns NULL. * On failure, it returns NULL.
*/ */
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, void *tep_get_field_raw(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
int *len, int err) int *len, int err)
{ {
struct format_field *field; struct format_field *field;
void *data = record->data; void *data = record->data;
...@@ -6313,7 +6313,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, ...@@ -6313,7 +6313,7 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
} }
/** /**
* pevent_get_field_val - find a field and return its value * tep_get_field_val - find a field and return its value
* @s: The seq to print to on error * @s: The seq to print to on error
* @event: the event that the field is for * @event: the event that the field is for
* @name: The name of the field * @name: The name of the field
...@@ -6323,9 +6323,9 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, ...@@ -6323,9 +6323,9 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
* *
* Returns 0 on success -1 on field not found. * Returns 0 on success -1 on field not found.
*/ */
int pevent_get_field_val(struct trace_seq *s, struct event_format *event, int tep_get_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
unsigned long long *val, int err) unsigned long long *val, int err)
{ {
struct format_field *field; struct format_field *field;
...@@ -6338,7 +6338,7 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, ...@@ -6338,7 +6338,7 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
} }
/** /**
* pevent_get_common_field_val - find a common field and return its value * tep_get_common_field_val - find a common field and return its value
* @s: The seq to print to on error * @s: The seq to print to on error
* @event: the event that the field is for * @event: the event that the field is for
* @name: The name of the field * @name: The name of the field
...@@ -6348,9 +6348,9 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event, ...@@ -6348,9 +6348,9 @@ int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
* *
* Returns 0 on success -1 on field not found. * Returns 0 on success -1 on field not found.
*/ */
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, int tep_get_common_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
unsigned long long *val, int err) unsigned long long *val, int err)
{ {
struct format_field *field; struct format_field *field;
...@@ -6363,7 +6363,7 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, ...@@ -6363,7 +6363,7 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
} }
/** /**
* pevent_get_any_field_val - find a any field and return its value * tep_get_any_field_val - find a any field and return its value
* @s: The seq to print to on error * @s: The seq to print to on error
* @event: the event that the field is for * @event: the event that the field is for
* @name: The name of the field * @name: The name of the field
...@@ -6373,9 +6373,9 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, ...@@ -6373,9 +6373,9 @@ int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
* *
* Returns 0 on success -1 on field not found. * Returns 0 on success -1 on field not found.
*/ */
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event, int tep_get_any_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
unsigned long long *val, int err) unsigned long long *val, int err)
{ {
struct format_field *field; struct format_field *field;
...@@ -6771,7 +6771,7 @@ void pevent_ref(struct tep_handle *pevent) ...@@ -6771,7 +6771,7 @@ void pevent_ref(struct tep_handle *pevent)
pevent->ref_count++; pevent->ref_count++;
} }
void pevent_free_format_field(struct format_field *field) void tep_free_format_field(struct format_field *field)
{ {
free(field->type); free(field->type);
if (field->alias != field->name) if (field->alias != field->name)
...@@ -6786,7 +6786,7 @@ static void free_format_fields(struct format_field *field) ...@@ -6786,7 +6786,7 @@ static void free_format_fields(struct format_field *field)
while (field) { while (field) {
next = field->next; next = field->next;
pevent_free_format_field(field); tep_free_format_field(field);
field = next; field = next;
} }
} }
...@@ -6797,7 +6797,7 @@ static void free_formats(struct format *format) ...@@ -6797,7 +6797,7 @@ static void free_formats(struct format *format)
free_format_fields(format->fields); free_format_fields(format->fields);
} }
void pevent_free_format(struct event_format *event) void tep_free_format(struct event_format *event)
{ {
free(event->name); free(event->name);
free(event->system); free(event->system);
...@@ -6883,7 +6883,7 @@ void tep_free(struct tep_handle *pevent) ...@@ -6883,7 +6883,7 @@ void tep_free(struct tep_handle *pevent)
} }
for (i = 0; i < pevent->nr_events; i++) for (i = 0; i < pevent->nr_events; i++)
pevent_free_format(pevent->events[i]); tep_free_format(pevent->events[i]);
while (pevent->handlers) { while (pevent->handlers) {
handle = pevent->handlers; handle = pevent->handlers;
......
...@@ -648,22 +648,22 @@ enum tep_errno tep_parse_format(struct tep_handle *pevent, ...@@ -648,22 +648,22 @@ 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 tep_free_format(struct event_format *event);
void pevent_free_format_field(struct format_field *field); void tep_free_format_field(struct format_field *field);
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, void *tep_get_field_raw(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
int *len, int err); int *len, int err);
int pevent_get_field_val(struct trace_seq *s, struct event_format *event, int tep_get_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
unsigned long long *val, int err); unsigned long long *val, int err);
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event, int tep_get_common_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record,
unsigned long long *val, int err);
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record, const char *name, struct tep_record *record,
unsigned long long *val, int err); unsigned long long *val, int err);
int tep_get_any_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record,
unsigned long long *val, int err);
int tep_print_num_field(struct trace_seq *s, const char *fmt, int tep_print_num_field(struct trace_seq *s, const char *fmt,
struct event_format *event, const char *name, struct event_format *event, const char *name,
......
...@@ -132,12 +132,12 @@ static int function_handler(struct trace_seq *s, struct tep_record *record, ...@@ -132,12 +132,12 @@ static int function_handler(struct trace_seq *s, struct tep_record *record,
const char *parent; const char *parent;
int index = 0; int index = 0;
if (pevent_get_field_val(s, event, "ip", record, &function, 1)) if (tep_get_field_val(s, event, "ip", record, &function, 1))
return trace_seq_putc(s, '!'); return trace_seq_putc(s, '!');
func = pevent_find_function(pevent, function); func = pevent_find_function(pevent, function);
if (pevent_get_field_val(s, event, "parent_ip", record, &pfunction, 1)) if (tep_get_field_val(s, event, "parent_ip", record, &pfunction, 1))
return trace_seq_putc(s, '!'); return trace_seq_putc(s, '!');
parent = pevent_find_function(pevent, pfunction); parent = pevent_find_function(pevent, pfunction);
......
...@@ -254,10 +254,10 @@ static int print_exit_reason(struct trace_seq *s, struct tep_record *record, ...@@ -254,10 +254,10 @@ static int print_exit_reason(struct trace_seq *s, struct tep_record *record,
unsigned long long val; unsigned long long val;
const char *reason; const char *reason;
if (pevent_get_field_val(s, event, field, record, &val, 1) < 0) if (tep_get_field_val(s, event, field, record, &val, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) if (tep_get_field_val(s, event, "isa", record, &isa, 0) < 0)
isa = 1; isa = 1;
reason = find_exit_reason(isa, val); reason = find_exit_reason(isa, val);
...@@ -278,8 +278,8 @@ static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record, ...@@ -278,8 +278,8 @@ static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record,
tep_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); tep_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1);
if (pevent_get_field_val(s, event, "info1", record, &info1, 0) >= 0 if (tep_get_field_val(s, event, "info1", record, &info1, 0) >= 0
&& pevent_get_field_val(s, event, "info2", record, &info2, 0) >= 0) && tep_get_field_val(s, event, "info2", record, &info2, 0) >= 0)
trace_seq_printf(s, " info %llx %llx", info1, info2); trace_seq_printf(s, " info %llx %llx", info1, info2);
return 0; return 0;
...@@ -299,22 +299,22 @@ static int kvm_emulate_insn_handler(struct trace_seq *s, ...@@ -299,22 +299,22 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,
uint8_t *insn; uint8_t *insn;
const char *disasm; const char *disasm;
if (pevent_get_field_val(s, event, "rip", record, &rip, 1) < 0) if (tep_get_field_val(s, event, "rip", record, &rip, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "csbase", record, &csbase, 1) < 0) if (tep_get_field_val(s, event, "csbase", record, &csbase, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "len", record, &len, 1) < 0) if (tep_get_field_val(s, event, "len", record, &len, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "flags", record, &flags, 1) < 0) if (tep_get_field_val(s, event, "flags", record, &flags, 1) < 0)
return -1; return -1;
if (pevent_get_field_val(s, event, "failed", record, &failed, 1) < 0) if (tep_get_field_val(s, event, "failed", record, &failed, 1) < 0)
return -1; return -1;
insn = pevent_get_field_raw(s, event, "insn", record, &llen, 1); insn = tep_get_field_raw(s, event, "insn", record, &llen, 1);
if (!insn) if (!insn)
return -1; return -1;
...@@ -379,7 +379,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record, ...@@ -379,7 +379,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
}; };
union kvm_mmu_page_role role; union kvm_mmu_page_role role;
if (pevent_get_field_val(s, event, "role", record, &val, 1) < 0) if (tep_get_field_val(s, event, "role", record, &val, 1) < 0)
return -1; return -1;
role.word = (int)val; role.word = (int)val;
...@@ -409,7 +409,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record, ...@@ -409,7 +409,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
tep_print_num_field(s, " root %u ", event, tep_print_num_field(s, " root %u ", event,
"root_count", record, 1); "root_count", record, 1);
if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0) if (tep_get_field_val(s, event, "unsync", record, &val, 1) < 0)
return -1; return -1;
trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0); trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0);
...@@ -422,12 +422,12 @@ static int kvm_mmu_get_page_handler(struct trace_seq *s, ...@@ -422,12 +422,12 @@ static int kvm_mmu_get_page_handler(struct trace_seq *s,
{ {
unsigned long long val; unsigned long long val;
if (pevent_get_field_val(s, event, "created", record, &val, 1) < 0) if (tep_get_field_val(s, event, "created", record, &val, 1) < 0)
return -1; return -1;
trace_seq_printf(s, "%s ", val ? "new" : "existing"); trace_seq_printf(s, "%s ", val ? "new" : "existing");
if (pevent_get_field_val(s, event, "gfn", record, &val, 1) < 0) if (tep_get_field_val(s, event, "gfn", record, &val, 1) < 0)
return -1; return -1;
trace_seq_printf(s, "sp gfn %llx ", val); trace_seq_printf(s, "sp gfn %llx ", val);
......
...@@ -71,7 +71,7 @@ static int sched_wakeup_handler(struct trace_seq *s, ...@@ -71,7 +71,7 @@ static int sched_wakeup_handler(struct trace_seq *s,
struct format_field *field; struct format_field *field;
unsigned long long val; unsigned long long val;
if (pevent_get_field_val(s, event, "pid", record, &val, 1)) if (tep_get_field_val(s, event, "pid", record, &val, 1))
return trace_seq_putc(s, '!'); return trace_seq_putc(s, '!');
field = tep_find_any_field(event, "comm"); field = tep_find_any_field(event, "comm");
...@@ -81,13 +81,13 @@ static int sched_wakeup_handler(struct trace_seq *s, ...@@ -81,13 +81,13 @@ static int sched_wakeup_handler(struct trace_seq *s,
} }
trace_seq_printf(s, "%lld", val); trace_seq_printf(s, "%lld", val);
if (pevent_get_field_val(s, event, "prio", record, &val, 0) == 0) if (tep_get_field_val(s, event, "prio", record, &val, 0) == 0)
trace_seq_printf(s, " [%lld]", val); trace_seq_printf(s, " [%lld]", val);
if (pevent_get_field_val(s, event, "success", record, &val, 1) == 0) if (tep_get_field_val(s, event, "success", record, &val, 1) == 0)
trace_seq_printf(s, " success=%lld", val); trace_seq_printf(s, " success=%lld", val);
if (pevent_get_field_val(s, event, "target_cpu", record, &val, 0) == 0) if (tep_get_field_val(s, event, "target_cpu", record, &val, 0) == 0)
trace_seq_printf(s, " CPU:%03llu", val); trace_seq_printf(s, " CPU:%03llu", val);
return 0; return 0;
...@@ -100,7 +100,7 @@ static int sched_switch_handler(struct trace_seq *s, ...@@ -100,7 +100,7 @@ static int sched_switch_handler(struct trace_seq *s,
struct format_field *field; struct format_field *field;
unsigned long long val; unsigned long long val;
if (pevent_get_field_val(s, event, "prev_pid", record, &val, 1)) if (tep_get_field_val(s, event, "prev_pid", record, &val, 1))
return trace_seq_putc(s, '!'); return trace_seq_putc(s, '!');
field = tep_find_any_field(event, "prev_comm"); field = tep_find_any_field(event, "prev_comm");
...@@ -110,15 +110,15 @@ static int sched_switch_handler(struct trace_seq *s, ...@@ -110,15 +110,15 @@ static int sched_switch_handler(struct trace_seq *s,
} }
trace_seq_printf(s, "%lld ", val); trace_seq_printf(s, "%lld ", val);
if (pevent_get_field_val(s, event, "prev_prio", record, &val, 0) == 0) if (tep_get_field_val(s, event, "prev_prio", record, &val, 0) == 0)
trace_seq_printf(s, "[%d] ", (int) val); trace_seq_printf(s, "[%d] ", (int) val);
if (pevent_get_field_val(s, event, "prev_state", record, &val, 0) == 0) if (tep_get_field_val(s, event, "prev_state", record, &val, 0) == 0)
write_state(s, val); write_state(s, val);
trace_seq_puts(s, " ==> "); trace_seq_puts(s, " ==> ");
if (pevent_get_field_val(s, event, "next_pid", record, &val, 1)) if (tep_get_field_val(s, event, "next_pid", record, &val, 1))
return trace_seq_putc(s, '!'); return trace_seq_putc(s, '!');
field = tep_find_any_field(event, "next_comm"); field = tep_find_any_field(event, "next_comm");
...@@ -128,7 +128,7 @@ static int sched_switch_handler(struct trace_seq *s, ...@@ -128,7 +128,7 @@ static int sched_switch_handler(struct trace_seq *s,
} }
trace_seq_printf(s, "%lld", val); trace_seq_printf(s, "%lld", val);
if (pevent_get_field_val(s, event, "next_prio", record, &val, 0) == 0) if (tep_get_field_val(s, event, "next_prio", record, &val, 0) == 0)
trace_seq_printf(s, " [%d]", (int) val); trace_seq_printf(s, " [%d]", (int) val);
return 0; return 0;
......
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