RE: [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps()
From: åæéå / HIRAMATUïMASAMI
Date: Thu Sep 10 2015 - 08:57:10 EST
>From: Namhyung Kim [mailto:namhyung@xxxxxxxxx] On Behalf Of Namhyung Kim
>
>The init/exit_symbols_maps() functions are to setup and cleanup
>necessary info for probe events. But they need to be called from out of
>the probe code now, so this patch exports them.
>
>However the names are too generic, so change them to have 'probe'. :)
Changing name is OK, but why are they exposed??
Thanks,
>
>Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
>Cc: Wang Nan <wangnan0@xxxxxxxxxx>
>Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
>---
> tools/perf/util/probe-event.c | 24 ++++++++++++------------
> tools/perf/util/probe-event.h | 2 ++
> 2 files changed, 14 insertions(+), 12 deletions(-)
>
>diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>index 3d7d60cc6f16..64e15cba7223 100644
>--- a/tools/perf/util/probe-event.c
>+++ b/tools/perf/util/probe-event.c
>@@ -71,7 +71,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
> static struct machine *host_machine;
>
> /* Initialize symbol maps and path of vmlinux/modules */
>-static int init_symbol_maps(bool user_only)
>+int init_probe_symbol_maps(bool user_only)
> {
> int ret;
>
>@@ -101,7 +101,7 @@ out:
> return ret;
> }
>
>-static void exit_symbol_maps(void)
>+void exit_probe_symbol_maps(void)
> {
> if (host_machine) {
> machine__delete(host_machine);
>@@ -859,11 +859,11 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
> {
> int ret;
>
>- ret = init_symbol_maps(user);
>+ ret = init_probe_symbol_maps(user);
> if (ret < 0)
> return ret;
> ret = __show_line_range(lr, module, user);
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>@@ -941,7 +941,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
> int i, ret = 0;
> struct debuginfo *dinfo;
>
>- ret = init_symbol_maps(pevs->uprobes);
>+ ret = init_probe_symbol_maps(pevs->uprobes);
> if (ret < 0)
> return ret;
>
>@@ -958,7 +958,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
>
> debuginfo__delete(dinfo);
> out:
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
> return ret;
> }
>
>@@ -2262,7 +2262,7 @@ int show_perf_probe_events(struct strfilter *filter)
>
> setup_pager();
>
>- ret = init_symbol_maps(false);
>+ ret = init_probe_symbol_maps(false);
> if (ret < 0)
> return ret;
>
>@@ -2278,7 +2278,7 @@ int show_perf_probe_events(struct strfilter *filter)
> close(kp_fd);
> if (up_fd > 0)
> close(up_fd);
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>@@ -2746,7 +2746,7 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> {
> int i, ret;
>
>- ret = init_symbol_maps(pevs->uprobes);
>+ ret = init_probe_symbol_maps(pevs->uprobes);
> if (ret < 0)
> return ret;
>
>@@ -2795,7 +2795,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> clear_perf_probe_event(&pevs[i]);
> }
>
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
> }
>
> int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
>@@ -2867,7 +2867,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
> struct map *map;
> int ret;
>
>- ret = init_symbol_maps(user);
>+ ret = init_probe_symbol_maps(user);
> if (ret < 0)
> return ret;
>
>@@ -2897,7 +2897,7 @@ end:
> if (user) {
> map__put(map);
> }
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
>index 9bcea36359f2..ba926c30f8cd 100644
>--- a/tools/perf/util/probe-event.h
>+++ b/tools/perf/util/probe-event.h
>@@ -110,6 +110,8 @@ struct variable_list {
> };
>
> struct map;
>+int init_probe_symbol_maps(bool user_only);
>+void exit_probe_symbol_maps(void);
>
> /* Command string to events */
> extern int parse_perf_probe_command(const char *cmd,
>--
>2.5.0
N§²æ¸yú²X¬¶ÇvØ)Þ{.nÇ·¥{±êX§¶¡Ü}©²ÆzÚj:+v¨¾«êZ+Êzf£¢·h§~Ûÿû®w¥¢¸?¨è&¢)ßfùy§m
á«a¶Úÿ0¶ìå