perf tools: Fix usage of __ in parse_events_term struct

In tools/perf we use a convention where __ separates the struct name
from the function name for functions that operate on a struct instance.

Fix this usage by removing it from the struct parse_events_term and fix
also its associated functions.
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
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/n/tip-h6vkql4jr7dv0096f1s6hldm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 08aa9cce
...@@ -464,10 +464,10 @@ static int test__checkevent_pmu_events(struct perf_evlist *evlist) ...@@ -464,10 +464,10 @@ static int test__checkevent_pmu_events(struct perf_evlist *evlist)
static int test__checkterms_simple(struct list_head *terms) static int test__checkterms_simple(struct list_head *terms)
{ {
struct parse_events__term *term; struct parse_events_term *term;
/* config=10 */ /* config=10 */
term = list_entry(terms->next, struct parse_events__term, list); term = list_entry(terms->next, struct parse_events_term, list);
TEST_ASSERT_VAL("wrong type term", TEST_ASSERT_VAL("wrong type term",
term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG); term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG);
TEST_ASSERT_VAL("wrong type val", TEST_ASSERT_VAL("wrong type val",
...@@ -476,7 +476,7 @@ static int test__checkterms_simple(struct list_head *terms) ...@@ -476,7 +476,7 @@ static int test__checkterms_simple(struct list_head *terms)
TEST_ASSERT_VAL("wrong config", !term->config); TEST_ASSERT_VAL("wrong config", !term->config);
/* config1 */ /* config1 */
term = list_entry(term->list.next, struct parse_events__term, list); term = list_entry(term->list.next, struct parse_events_term, list);
TEST_ASSERT_VAL("wrong type term", TEST_ASSERT_VAL("wrong type term",
term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1); term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1);
TEST_ASSERT_VAL("wrong type val", TEST_ASSERT_VAL("wrong type val",
...@@ -485,7 +485,7 @@ static int test__checkterms_simple(struct list_head *terms) ...@@ -485,7 +485,7 @@ static int test__checkterms_simple(struct list_head *terms)
TEST_ASSERT_VAL("wrong config", !term->config); TEST_ASSERT_VAL("wrong config", !term->config);
/* config2=3 */ /* config2=3 */
term = list_entry(term->list.next, struct parse_events__term, list); term = list_entry(term->list.next, struct parse_events_term, list);
TEST_ASSERT_VAL("wrong type term", TEST_ASSERT_VAL("wrong type term",
term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2); term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2);
TEST_ASSERT_VAL("wrong type val", TEST_ASSERT_VAL("wrong type val",
...@@ -494,7 +494,7 @@ static int test__checkterms_simple(struct list_head *terms) ...@@ -494,7 +494,7 @@ static int test__checkterms_simple(struct list_head *terms)
TEST_ASSERT_VAL("wrong config", !term->config); TEST_ASSERT_VAL("wrong config", !term->config);
/* umask=1*/ /* umask=1*/
term = list_entry(term->list.next, struct parse_events__term, list); term = list_entry(term->list.next, struct parse_events_term, list);
TEST_ASSERT_VAL("wrong type term", TEST_ASSERT_VAL("wrong type term",
term->type_term == PARSE_EVENTS__TERM_TYPE_USER); term->type_term == PARSE_EVENTS__TERM_TYPE_USER);
TEST_ASSERT_VAL("wrong type val", TEST_ASSERT_VAL("wrong type val",
......
...@@ -22,7 +22,7 @@ static struct test_format { ...@@ -22,7 +22,7 @@ static struct test_format {
#define TEST_FORMATS_CNT (sizeof(test_formats) / sizeof(struct test_format)) #define TEST_FORMATS_CNT (sizeof(test_formats) / sizeof(struct test_format))
/* Simulated users input. */ /* Simulated users input. */
static struct parse_events__term test_terms[] = { static struct parse_events_term test_terms[] = {
{ {
.config = (char *) "krava01", .config = (char *) "krava01",
.val.num = 15, .val.num = 15,
...@@ -78,7 +78,7 @@ static struct parse_events__term test_terms[] = { ...@@ -78,7 +78,7 @@ static struct parse_events__term test_terms[] = {
.type_term = PARSE_EVENTS__TERM_TYPE_USER, .type_term = PARSE_EVENTS__TERM_TYPE_USER,
}, },
}; };
#define TERMS_CNT (sizeof(test_terms) / sizeof(struct parse_events__term)) #define TERMS_CNT (sizeof(test_terms) / sizeof(struct parse_events_term))
/* /*
* Prepare format directory data, exported by kernel * Prepare format directory data, exported by kernel
......
...@@ -534,7 +534,7 @@ int parse_events_add_breakpoint(struct list_head **list, int *idx, ...@@ -534,7 +534,7 @@ int parse_events_add_breakpoint(struct list_head **list, int *idx,
} }
static int config_term(struct perf_event_attr *attr, static int config_term(struct perf_event_attr *attr,
struct parse_events__term *term) struct parse_events_term *term)
{ {
#define CHECK_TYPE_VAL(type) \ #define CHECK_TYPE_VAL(type) \
do { \ do { \
...@@ -579,7 +579,7 @@ do { \ ...@@ -579,7 +579,7 @@ do { \
static int config_attr(struct perf_event_attr *attr, static int config_attr(struct perf_event_attr *attr,
struct list_head *head, int fail) struct list_head *head, int fail)
{ {
struct parse_events__term *term; struct parse_events_term *term;
list_for_each_entry(term, head, list) list_for_each_entry(term, head, list)
if (config_term(attr, term) && fail) if (config_term(attr, term) && fail)
...@@ -605,14 +605,14 @@ int parse_events_add_numeric(struct list_head **list, int *idx, ...@@ -605,14 +605,14 @@ int parse_events_add_numeric(struct list_head **list, int *idx,
return add_event(list, idx, &attr, NULL); return add_event(list, idx, &attr, NULL);
} }
static int parse_events__is_name_term(struct parse_events__term *term) static int parse_events__is_name_term(struct parse_events_term *term)
{ {
return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME;
} }
static char *pmu_event_name(struct list_head *head_terms) static char *pmu_event_name(struct list_head *head_terms)
{ {
struct parse_events__term *term; struct parse_events_term *term;
list_for_each_entry(term, head_terms, list) list_for_each_entry(term, head_terms, list)
if (parse_events__is_name_term(term)) if (parse_events__is_name_term(term))
...@@ -1162,16 +1162,16 @@ void print_events(const char *event_glob, bool name_only) ...@@ -1162,16 +1162,16 @@ void print_events(const char *event_glob, bool name_only)
print_tracepoint_events(NULL, NULL, name_only); print_tracepoint_events(NULL, NULL, name_only);
} }
int parse_events__is_hardcoded_term(struct parse_events__term *term) int parse_events__is_hardcoded_term(struct parse_events_term *term)
{ {
return term->type_term != PARSE_EVENTS__TERM_TYPE_USER; return term->type_term != PARSE_EVENTS__TERM_TYPE_USER;
} }
static int new_term(struct parse_events__term **_term, int type_val, static int new_term(struct parse_events_term **_term, int type_val,
int type_term, char *config, int type_term, char *config,
char *str, u64 num) char *str, u64 num)
{ {
struct parse_events__term *term; struct parse_events_term *term;
term = zalloc(sizeof(*term)); term = zalloc(sizeof(*term));
if (!term) if (!term)
...@@ -1197,21 +1197,21 @@ static int new_term(struct parse_events__term **_term, int type_val, ...@@ -1197,21 +1197,21 @@ static int new_term(struct parse_events__term **_term, int type_val,
return 0; return 0;
} }
int parse_events__term_num(struct parse_events__term **term, int parse_events_term__num(struct parse_events_term **term,
int type_term, char *config, u64 num) int type_term, char *config, u64 num)
{ {
return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term, return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term,
config, NULL, num); config, NULL, num);
} }
int parse_events__term_str(struct parse_events__term **term, int parse_events_term__str(struct parse_events_term **term,
int type_term, char *config, char *str) int type_term, char *config, char *str)
{ {
return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term, return new_term(term, PARSE_EVENTS__TERM_TYPE_STR, type_term,
config, str, 0); config, str, 0);
} }
int parse_events__term_sym_hw(struct parse_events__term **term, int parse_events_term__sym_hw(struct parse_events_term **term,
char *config, unsigned idx) char *config, unsigned idx)
{ {
struct event_symbol *sym; struct event_symbol *sym;
...@@ -1229,8 +1229,8 @@ int parse_events__term_sym_hw(struct parse_events__term **term, ...@@ -1229,8 +1229,8 @@ int parse_events__term_sym_hw(struct parse_events__term **term,
(char *) "event", (char *) sym->symbol, 0); (char *) "event", (char *) sym->symbol, 0);
} }
int parse_events__term_clone(struct parse_events__term **new, int parse_events_term__clone(struct parse_events_term **new,
struct parse_events__term *term) struct parse_events_term *term)
{ {
return new_term(new, term->type_val, term->type_term, term->config, return new_term(new, term->type_val, term->type_term, term->config,
term->val.str, term->val.num); term->val.str, term->val.num);
...@@ -1238,7 +1238,7 @@ int parse_events__term_clone(struct parse_events__term **new, ...@@ -1238,7 +1238,7 @@ int parse_events__term_clone(struct parse_events__term **new,
void parse_events__free_terms(struct list_head *terms) void parse_events__free_terms(struct list_head *terms)
{ {
struct parse_events__term *term, *h; struct parse_events_term *term, *h;
list_for_each_entry_safe(term, h, terms, list) list_for_each_entry_safe(term, h, terms, list)
free(term); free(term);
......
...@@ -50,7 +50,7 @@ enum { ...@@ -50,7 +50,7 @@ enum {
PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
}; };
struct parse_events__term { struct parse_events_term {
char *config; char *config;
union { union {
char *str; char *str;
...@@ -70,15 +70,15 @@ struct parse_events_data__terms { ...@@ -70,15 +70,15 @@ struct parse_events_data__terms {
struct list_head *terms; struct list_head *terms;
}; };
int parse_events__is_hardcoded_term(struct parse_events__term *term); int parse_events__is_hardcoded_term(struct parse_events_term *term);
int parse_events__term_num(struct parse_events__term **_term, int parse_events_term__num(struct parse_events_term **_term,
int type_term, char *config, u64 num); int type_term, char *config, u64 num);
int parse_events__term_str(struct parse_events__term **_term, int parse_events_term__str(struct parse_events_term **_term,
int type_term, char *config, char *str); int type_term, char *config, char *str);
int parse_events__term_sym_hw(struct parse_events__term **term, int parse_events_term__sym_hw(struct parse_events_term **term,
char *config, unsigned idx); char *config, unsigned idx);
int parse_events__term_clone(struct parse_events__term **new, int parse_events_term__clone(struct parse_events_term **new,
struct parse_events__term *term); struct parse_events_term *term);
void parse_events__free_terms(struct list_head *terms); void parse_events__free_terms(struct list_head *terms);
int parse_events__modifier_event(struct list_head *list, char *str, bool add); int parse_events__modifier_event(struct list_head *list, char *str, bool add);
int parse_events__modifier_group(struct list_head *list, char *event_mod); int parse_events__modifier_group(struct list_head *list, char *event_mod);
......
...@@ -68,7 +68,7 @@ do { \ ...@@ -68,7 +68,7 @@ do { \
char *str; char *str;
u64 num; u64 num;
struct list_head *head; struct list_head *head;
struct parse_events__term *term; struct parse_events_term *term;
} }
%% %%
...@@ -315,7 +315,7 @@ event_config: ...@@ -315,7 +315,7 @@ event_config:
event_config ',' event_term event_config ',' event_term
{ {
struct list_head *head = $1; struct list_head *head = $1;
struct parse_events__term *term = $3; struct parse_events_term *term = $3;
ABORT_ON(!head); ABORT_ON(!head);
list_add_tail(&term->list, head); list_add_tail(&term->list, head);
...@@ -325,7 +325,7 @@ event_config ',' event_term ...@@ -325,7 +325,7 @@ event_config ',' event_term
event_term event_term
{ {
struct list_head *head = malloc(sizeof(*head)); struct list_head *head = malloc(sizeof(*head));
struct parse_events__term *term = $1; struct parse_events_term *term = $1;
ABORT_ON(!head); ABORT_ON(!head);
INIT_LIST_HEAD(head); INIT_LIST_HEAD(head);
...@@ -336,70 +336,70 @@ event_term ...@@ -336,70 +336,70 @@ event_term
event_term: event_term:
PE_NAME '=' PE_NAME PE_NAME '=' PE_NAME
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_str(&term, PARSE_EVENTS__TERM_TYPE_USER, ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
$1, $3)); $1, $3));
$$ = term; $$ = term;
} }
| |
PE_NAME '=' PE_VALUE PE_NAME '=' PE_VALUE
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER, ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
$1, $3)); $1, $3));
$$ = term; $$ = term;
} }
| |
PE_NAME '=' PE_VALUE_SYM_HW PE_NAME '=' PE_VALUE_SYM_HW
{ {
struct parse_events__term *term; struct parse_events_term *term;
int config = $3 & 255; int config = $3 & 255;
ABORT_ON(parse_events__term_sym_hw(&term, $1, config)); ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
$$ = term; $$ = term;
} }
| |
PE_NAME PE_NAME
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER, ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
$1, 1)); $1, 1));
$$ = term; $$ = term;
} }
| |
PE_VALUE_SYM_HW PE_VALUE_SYM_HW
{ {
struct parse_events__term *term; struct parse_events_term *term;
int config = $1 & 255; int config = $1 & 255;
ABORT_ON(parse_events__term_sym_hw(&term, NULL, config)); ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
$$ = term; $$ = term;
} }
| |
PE_TERM '=' PE_NAME PE_TERM '=' PE_NAME
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_str(&term, (int)$1, NULL, $3)); ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3));
$$ = term; $$ = term;
} }
| |
PE_TERM '=' PE_VALUE PE_TERM '=' PE_VALUE
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_num(&term, (int)$1, NULL, $3)); ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3));
$$ = term; $$ = term;
} }
| |
PE_TERM PE_TERM
{ {
struct parse_events__term *term; struct parse_events_term *term;
ABORT_ON(parse_events__term_num(&term, (int)$1, NULL, 1)); ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1));
$$ = term; $$ = term;
} }
......
...@@ -175,12 +175,12 @@ static int pmu_aliases(char *name, struct list_head *head) ...@@ -175,12 +175,12 @@ static int pmu_aliases(char *name, struct list_head *head)
static int pmu_alias_terms(struct perf_pmu__alias *alias, static int pmu_alias_terms(struct perf_pmu__alias *alias,
struct list_head *terms) struct list_head *terms)
{ {
struct parse_events__term *term, *clone; struct parse_events_term *term, *clone;
LIST_HEAD(list); LIST_HEAD(list);
int ret; int ret;
list_for_each_entry(term, &alias->terms, list) { list_for_each_entry(term, &alias->terms, list) {
ret = parse_events__term_clone(&clone, term); ret = parse_events_term__clone(&clone, term);
if (ret) { if (ret) {
parse_events__free_terms(&list); parse_events__free_terms(&list);
return ret; return ret;
...@@ -403,7 +403,7 @@ static __u64 pmu_format_value(unsigned long *format, __u64 value) ...@@ -403,7 +403,7 @@ static __u64 pmu_format_value(unsigned long *format, __u64 value)
*/ */
static int pmu_config_term(struct list_head *formats, static int pmu_config_term(struct list_head *formats,
struct perf_event_attr *attr, struct perf_event_attr *attr,
struct parse_events__term *term) struct parse_events_term *term)
{ {
struct perf_pmu__format *format; struct perf_pmu__format *format;
__u64 *vp; __u64 *vp;
...@@ -450,7 +450,7 @@ int perf_pmu__config_terms(struct list_head *formats, ...@@ -450,7 +450,7 @@ int perf_pmu__config_terms(struct list_head *formats,
struct perf_event_attr *attr, struct perf_event_attr *attr,
struct list_head *head_terms) struct list_head *head_terms)
{ {
struct parse_events__term *term; struct parse_events_term *term;
list_for_each_entry(term, head_terms, list) list_for_each_entry(term, head_terms, list)
if (pmu_config_term(formats, attr, term)) if (pmu_config_term(formats, attr, term))
...@@ -472,7 +472,7 @@ int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, ...@@ -472,7 +472,7 @@ int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
} }
static struct perf_pmu__alias *pmu_find_alias(struct perf_pmu *pmu, static struct perf_pmu__alias *pmu_find_alias(struct perf_pmu *pmu,
struct parse_events__term *term) struct parse_events_term *term)
{ {
struct perf_pmu__alias *alias; struct perf_pmu__alias *alias;
char *name; char *name;
...@@ -507,7 +507,7 @@ static struct perf_pmu__alias *pmu_find_alias(struct perf_pmu *pmu, ...@@ -507,7 +507,7 @@ static struct perf_pmu__alias *pmu_find_alias(struct perf_pmu *pmu,
*/ */
int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms) int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms)
{ {
struct parse_events__term *term, *h; struct parse_events_term *term, *h;
struct perf_pmu__alias *alias; struct perf_pmu__alias *alias;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment