[tip:perf/core] perf bpf: Rename bpf config to program config

2015-11-28 Thread tip-bot for Wang Nan
Commit-ID:  0bb93490170477224f8bd4cc9ce8920517461643
Gitweb: http://git.kernel.org/tip/0bb93490170477224f8bd4cc9ce8920517461643
Author: Wang Nan 
AuthorDate: Fri, 27 Nov 2015 08:47:37 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 27 Nov 2015 22:00:46 -0300

perf bpf: Rename bpf config to program config

Following patches are going to introduce BPF object level configuration
to enable setting values into BPF maps. To avoid confusion, this patch
renames existing 'config' in bpf-loader.c to 'program config'. Following
patches would introduce 'object config'.

Signed-off-by: Wang Nan 
Cc: Alexei Starovoitov 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1448614067-197576-4-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/bpf-loader.c | 65 ++--
 tools/perf/util/bpf-loader.h |  2 +-
 2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 36544e5..540a7ef 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -120,7 +120,7 @@ bpf_prog_priv__clear(struct bpf_program *prog 
__maybe_unused,
 }
 
 static int
-config__exec(const char *value, struct perf_probe_event *pev)
+prog_config__exec(const char *value, struct perf_probe_event *pev)
 {
pev->uprobes = true;
pev->target = strdup(value);
@@ -130,7 +130,7 @@ config__exec(const char *value, struct perf_probe_event 
*pev)
 }
 
 static int
-config__module(const char *value, struct perf_probe_event *pev)
+prog_config__module(const char *value, struct perf_probe_event *pev)
 {
pev->uprobes = false;
pev->target = strdup(value);
@@ -140,8 +140,7 @@ config__module(const char *value, struct perf_probe_event 
*pev)
 }
 
 static int
-config__bool(const char *value,
-bool *pbool, bool invert)
+prog_config__bool(const char *value, bool *pbool, bool invert)
 {
int err;
bool bool_value;
@@ -158,17 +157,17 @@ config__bool(const char *value,
 }
 
 static int
-config__inlines(const char *value,
-   struct perf_probe_event *pev __maybe_unused)
+prog_config__inlines(const char *value,
+struct perf_probe_event *pev __maybe_unused)
 {
-   return config__bool(value, _conf.no_inlines, true);
+   return prog_config__bool(value, _conf.no_inlines, true);
 }
 
 static int
-config__force(const char *value,
- struct perf_probe_event *pev __maybe_unused)
+prog_config__force(const char *value,
+  struct perf_probe_event *pev __maybe_unused)
 {
-   return config__bool(value, _conf.force_add, false);
+   return prog_config__bool(value, _conf.force_add, false);
 }
 
 static struct {
@@ -176,58 +175,58 @@ static struct {
const char *usage;
const char *desc;
int (*func)(const char *, struct perf_probe_event *);
-} bpf_config_terms[] = {
+} bpf_prog_config_terms[] = {
{
.key= "exec",
.usage  = "exec=",
.desc   = "Set uprobe target",
-   .func   = config__exec,
+   .func   = prog_config__exec,
},
{
.key= "module",
.usage  = "module=",
.desc   = "Set kprobe module",
-   .func   = config__module,
+   .func   = prog_config__module,
},
{
.key= "inlines",
.usage  = "inlines=[yes|no]",
.desc   = "Probe at inline symbol",
-   .func   = config__inlines,
+   .func   = prog_config__inlines,
},
{
.key= "force",
.usage  = "force=[yes|no]  ",
.desc   = "Forcibly add events with existing name",
-   .func   = config__force,
+   .func   = prog_config__force,
},
 };
 
 static int
-do_config(const char *key, const char *value,
- struct perf_probe_event *pev)
+do_prog_config(const char *key, const char *value,
+  struct perf_probe_event *pev)
 {
unsigned int i;
 
pr_debug("config bpf program: %s=%s\n", key, value);
-   for (i = 0; i < ARRAY_SIZE(bpf_config_terms); i++)
-   if (strcmp(key, bpf_config_terms[i].key) == 0)
-   return bpf_config_terms[i].func(value, pev);
+   for (i = 0; i < ARRAY_SIZE(bpf_prog_config_terms); i++)
+   if (strcmp(key, bpf_prog_config_terms[i].key) == 0)
+   return bpf_prog_config_terms[i].func(value, pev);
 
-   pr_debug("BPF: ERROR: invalid config option in object: %s=%s\n",
+   pr_debug("BPF: ERROR: invalid program config option: %s=%s\n",
 key, value);
 
-   pr_debug("\nHint: Currently valid options are:\n");
-   for (i = 0; i < 

[tip:perf/core] perf bpf: Rename bpf config to program config

2015-11-28 Thread tip-bot for Wang Nan
Commit-ID:  0bb93490170477224f8bd4cc9ce8920517461643
Gitweb: http://git.kernel.org/tip/0bb93490170477224f8bd4cc9ce8920517461643
Author: Wang Nan 
AuthorDate: Fri, 27 Nov 2015 08:47:37 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 27 Nov 2015 22:00:46 -0300

perf bpf: Rename bpf config to program config

Following patches are going to introduce BPF object level configuration
to enable setting values into BPF maps. To avoid confusion, this patch
renames existing 'config' in bpf-loader.c to 'program config'. Following
patches would introduce 'object config'.

Signed-off-by: Wang Nan 
Cc: Alexei Starovoitov 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1448614067-197576-4-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/bpf-loader.c | 65 ++--
 tools/perf/util/bpf-loader.h |  2 +-
 2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 36544e5..540a7ef 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -120,7 +120,7 @@ bpf_prog_priv__clear(struct bpf_program *prog 
__maybe_unused,
 }
 
 static int
-config__exec(const char *value, struct perf_probe_event *pev)
+prog_config__exec(const char *value, struct perf_probe_event *pev)
 {
pev->uprobes = true;
pev->target = strdup(value);
@@ -130,7 +130,7 @@ config__exec(const char *value, struct perf_probe_event 
*pev)
 }
 
 static int
-config__module(const char *value, struct perf_probe_event *pev)
+prog_config__module(const char *value, struct perf_probe_event *pev)
 {
pev->uprobes = false;
pev->target = strdup(value);
@@ -140,8 +140,7 @@ config__module(const char *value, struct perf_probe_event 
*pev)
 }
 
 static int
-config__bool(const char *value,
-bool *pbool, bool invert)
+prog_config__bool(const char *value, bool *pbool, bool invert)
 {
int err;
bool bool_value;
@@ -158,17 +157,17 @@ config__bool(const char *value,
 }
 
 static int
-config__inlines(const char *value,
-   struct perf_probe_event *pev __maybe_unused)
+prog_config__inlines(const char *value,
+struct perf_probe_event *pev __maybe_unused)
 {
-   return config__bool(value, _conf.no_inlines, true);
+   return prog_config__bool(value, _conf.no_inlines, true);
 }
 
 static int
-config__force(const char *value,
- struct perf_probe_event *pev __maybe_unused)
+prog_config__force(const char *value,
+  struct perf_probe_event *pev __maybe_unused)
 {
-   return config__bool(value, _conf.force_add, false);
+   return prog_config__bool(value, _conf.force_add, false);
 }
 
 static struct {
@@ -176,58 +175,58 @@ static struct {
const char *usage;
const char *desc;
int (*func)(const char *, struct perf_probe_event *);
-} bpf_config_terms[] = {
+} bpf_prog_config_terms[] = {
{
.key= "exec",
.usage  = "exec=",
.desc   = "Set uprobe target",
-   .func   = config__exec,
+   .func   = prog_config__exec,
},
{
.key= "module",
.usage  = "module=",
.desc   = "Set kprobe module",
-   .func   = config__module,
+   .func   = prog_config__module,
},
{
.key= "inlines",
.usage  = "inlines=[yes|no]",
.desc   = "Probe at inline symbol",
-   .func   = config__inlines,
+   .func   = prog_config__inlines,
},
{
.key= "force",
.usage  = "force=[yes|no]  ",
.desc   = "Forcibly add events with existing name",
-   .func   = config__force,
+   .func   = prog_config__force,
},
 };
 
 static int
-do_config(const char *key, const char *value,
- struct perf_probe_event *pev)
+do_prog_config(const char *key, const char *value,
+  struct perf_probe_event *pev)
 {
unsigned int i;
 
pr_debug("config bpf program: %s=%s\n", key, value);
-   for (i = 0; i < ARRAY_SIZE(bpf_config_terms); i++)
-   if (strcmp(key, bpf_config_terms[i].key) == 0)
-   return bpf_config_terms[i].func(value, pev);
+   for (i = 0; i < ARRAY_SIZE(bpf_prog_config_terms); i++)
+   if (strcmp(key, bpf_prog_config_terms[i].key) == 0)
+   return bpf_prog_config_terms[i].func(value, pev);
 
-   pr_debug("BPF: ERROR: invalid config option in object: %s=%s\n",
+   pr_debug("BPF: ERROR: invalid