perf tools: Add vdso__new()
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 22 Jul 2014 13:17:56 +0000 (16:17 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 23 Jul 2014 20:34:47 +0000 (17:34 -0300)
This is preparation for adding support for compat VDSOs.

Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406035081-14301-48-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/vdso.c

index fdaccaf..946d927 100644 (file)
@@ -121,6 +121,20 @@ void vdso__exit(struct machine *machine)
        zfree(&machine->vdso_info);
 }
 
+static struct dso *vdso__new(struct machine *machine, const char *short_name,
+                            const char *long_name)
+{
+       struct dso *dso;
+
+       dso = dso__new(short_name);
+       if (dso != NULL) {
+               dsos__add(&machine->user_dsos, dso);
+               dso__set_long_name(dso, long_name, false);
+       }
+
+       return dso;
+}
+
 struct dso *vdso__dso_findnew(struct machine *machine)
 {
        struct vdso_info *vdso_info;
@@ -141,11 +155,7 @@ struct dso *vdso__dso_findnew(struct machine *machine)
                if (!file)
                        return NULL;
 
-               dso = dso__new(VDSO__MAP_NAME);
-               if (dso != NULL) {
-                       dsos__add(&machine->user_dsos, dso);
-                       dso__set_long_name(dso, file, false);
-               }
+               dso = vdso__new(machine, VDSO__MAP_NAME, file);
        }
 
        return dso;