exporting pmu data from perf_event_open.c

Vince Weaver <[email protected]> Tue, 13 May 2014 14:51:35 -0400 (EDT)
Newsgroups org.kernel.vger.trinity
Message-ID <alpine.DEB.2.10.1405131441100.24957@vincent-weaver-1.umelst.maine.edu>
I just finished syncing perf_fuzzer against the Trinity 1.4 codebase.

It was a bit of a pain, but I guess still worth doing in order to
keep perf_event_open.c shared.

I was wondering if you'd consider a patch like the following.
It exports the perf_event_open() pmus structure, that way perf_fuzzer can 
pretty-print the pmu names.  It would save a lot of code duplication.

I could always just make this change in my local tree, but it's nice
having perf_event_open.c the same in both projects.

Signed-off-by: Vince Weaver <[email protected]>

diff --git a/syscalls/perf_event_open.c b/syscalls/perf_event_open.c
index c4ccafd..3783382 100644
--- a/syscalls/perf_event_open.c
+++ b/syscalls/perf_event_open.c
@@ -44,9 +44,9 @@ struct pmu_type {
 	struct generic_event_type *generic_events;
 };
 
-static int num_pmus=0;
-
-static struct pmu_type *pmus=NULL;
+/* Not static so other tools can access the PMU data */
+int num_pmus=0;
+struct pmu_type *pmus=NULL;
 
 
 #define FIELD_UNKNOWN	0