From: Adrian Hunter Date: Tue, 22 Jul 2014 13:17:56 +0000 (+0300) Subject: perf tools: Add vdso__new() X-Git-Tag: v3.17-rc1~135^2~1^2~10 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4f71f2a0abe8b2a76669a4608a62f5020a64205a;p=karo-tx-linux.git perf tools: Add vdso__new() This is preparation for adding support for compat VDSOs. Reviewed-by: Jiri Olsa Signed-off-by: Adrian Hunter Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1406035081-14301-48-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index fdaccaf67371..946d927765c6 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c @@ -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;