tools lib traceevent, perf tools: Move struct tep_handler definition in a local header file
As traceevent is going to be transferred into a proper library, its local data should be protected from the library users. This patch encapsulates struct tep_handler into a local header, not visible outside of the library. It implements also a bunch of new APIs, which library users can use to access tep_handler members. Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: linux trace devel <linux-trace-devel@vger.kernel.org> Cc: tzvetomir stoyanov <tstoyanov@vmware.com> Link: http://lkml.kernel.org/r/20181005122225.522155df@gandalf.local.home Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
bbbab191c2
commit
bb3dd7e7c4
@@ -37,10 +37,11 @@ static int get_common_field(struct scripting_context *context,
|
||||
struct tep_format_field *field;
|
||||
|
||||
if (!*size) {
|
||||
if (!pevent->events)
|
||||
|
||||
event = tep_get_first_event(pevent);
|
||||
if (!event)
|
||||
return 0;
|
||||
|
||||
event = pevent->events[0];
|
||||
field = tep_find_common_field(event, type);
|
||||
if (!field)
|
||||
return 0;
|
||||
@@ -193,25 +194,29 @@ struct tep_event_format *trace_find_next_event(struct tep_handle *pevent,
|
||||
struct tep_event_format *event)
|
||||
{
|
||||
static int idx;
|
||||
int events_count;
|
||||
struct tep_event_format *all_events;
|
||||
|
||||
if (!pevent || !pevent->events)
|
||||
all_events = tep_get_first_event(pevent);
|
||||
events_count = tep_get_events_count(pevent);
|
||||
if (!pevent || !all_events || events_count < 1)
|
||||
return NULL;
|
||||
|
||||
if (!event) {
|
||||
idx = 0;
|
||||
return pevent->events[0];
|
||||
return all_events;
|
||||
}
|
||||
|
||||
if (idx < pevent->nr_events && event == pevent->events[idx]) {
|
||||
if (idx < events_count && event == (all_events + idx)) {
|
||||
idx++;
|
||||
if (idx == pevent->nr_events)
|
||||
if (idx == events_count)
|
||||
return NULL;
|
||||
return pevent->events[idx];
|
||||
return (all_events + idx);
|
||||
}
|
||||
|
||||
for (idx = 1; idx < pevent->nr_events; idx++) {
|
||||
if (event == pevent->events[idx - 1])
|
||||
return pevent->events[idx];
|
||||
for (idx = 1; idx < events_count; idx++) {
|
||||
if (event == (all_events + (idx - 1)))
|
||||
return (all_events + idx);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -241,7 +241,7 @@ static int read_header_files(struct tep_handle *pevent)
|
||||
* The commit field in the page is of type long,
|
||||
* use that instead, since it represents the kernel.
|
||||
*/
|
||||
tep_set_long_size(pevent, pevent->header_page_size_size);
|
||||
tep_set_long_size(pevent, tep_get_header_page_size(pevent));
|
||||
}
|
||||
free(header_page);
|
||||
|
||||
|
Reference in New Issue
Block a user