diff options
author | Tzvetomir Stoyanov <tstoyanov@vmware.com> | 2018-11-30 10:44:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-12-17 12:55:52 -0500 |
commit | 477be10ca781bbee29d6a1da958d63d5c9a2d83b (patch) | |
tree | 2a9206086f7ae420e10983f107333c17200957e4 | |
parent | 239ca3e78609378a1ed5d9db1c7db629a71c2857 (diff) |
tools lib traceevent: Implement new API tep_get_ref()
This patch implements a new API of the tracevent library:
int tep_get_ref(struct tep_handle *tep);
The API returns the reference counter "ref_count" of the tep handler.
As "struct tep_handle" is internal only, its members cannot be accessed
by the library users, the API is used to get the reference counter.
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20181130154646.890615385@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 7 | ||||
-rw-r--r-- | tools/lib/traceevent/event-parse.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 2b5cb33046ce..d1e6ee3d43cf 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -6730,6 +6730,13 @@ void tep_ref(struct tep_handle *pevent) | |||
6730 | pevent->ref_count++; | 6730 | pevent->ref_count++; |
6731 | } | 6731 | } |
6732 | 6732 | ||
6733 | int tep_get_ref(struct tep_handle *tep) | ||
6734 | { | ||
6735 | if (tep) | ||
6736 | return tep->ref_count; | ||
6737 | return 0; | ||
6738 | } | ||
6739 | |||
6733 | void tep_free_format_field(struct tep_format_field *field) | 6740 | void tep_free_format_field(struct tep_format_field *field) |
6734 | { | 6741 | { |
6735 | free(field->type); | 6742 | free(field->type); |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 16bf4c890b6f..44ec26c72c2e 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -581,6 +581,7 @@ struct tep_handle *tep_alloc(void); | |||
581 | void tep_free(struct tep_handle *pevent); | 581 | void tep_free(struct tep_handle *pevent); |
582 | void tep_ref(struct tep_handle *pevent); | 582 | void tep_ref(struct tep_handle *pevent); |
583 | void tep_unref(struct tep_handle *pevent); | 583 | void tep_unref(struct tep_handle *pevent); |
584 | int tep_get_ref(struct tep_handle *tep); | ||
584 | 585 | ||
585 | /* access to the internal parser */ | 586 | /* access to the internal parser */ |
586 | void tep_buffer_init(const char *buf, unsigned long long size); | 587 | void tep_buffer_init(const char *buf, unsigned long long size); |