]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tools lib traceevent: Implement new API tep_get_ref()
authorTzvetomir Stoyanov <tstoyanov@vmware.com>
Fri, 30 Nov 2018 15:44:04 +0000 (10:44 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 17 Dec 2018 17:55:52 +0000 (14:55 -0300)
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>
tools/lib/traceevent/event-parse.c
tools/lib/traceevent/event-parse.h

index 2b5cb33046ce42f4cb377f2e9b35659a91011ee1..d1e6ee3d43cf69c11f36f3f2fcfceeb0a9bc2dce 100644 (file)
@@ -6730,6 +6730,13 @@ void tep_ref(struct tep_handle *pevent)
        pevent->ref_count++;
 }
 
+int tep_get_ref(struct tep_handle *tep)
+{
+       if (tep)
+               return tep->ref_count;
+       return 0;
+}
+
 void tep_free_format_field(struct tep_format_field *field)
 {
        free(field->type);
index 16bf4c890b6f7f4e47bf3b7bce0b9ead2470b344..44ec26c72c2e0cbf2933afb47ff3a574349d005d 100644 (file)
@@ -581,6 +581,7 @@ struct tep_handle *tep_alloc(void);
 void tep_free(struct tep_handle *pevent);
 void tep_ref(struct tep_handle *pevent);
 void tep_unref(struct tep_handle *pevent);
+int tep_get_ref(struct tep_handle *tep);
 
 /* access to the internal parser */
 void tep_buffer_init(const char *buf, unsigned long long size);