[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170413112020.8c98e0a082ad821a43d968c3@kernel.org>
Date: Thu, 13 Apr 2017 11:20:20 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: pc@...ibm.com
Cc: LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
David Ahern <dsahern@...il.com>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>
Subject: Re: [PATCH v5] Allow user probes on versioned symbols.
Hi Paul,
On Wed, 12 Apr 2017 09:41:51 -0500
Paul Clarke <pc@...ibm.com> wrote:
> @@ -396,8 +407,26 @@ static void symbols__sort_by_name(struct rb_root *symbols,
> }
> }
>
> +int symbol__match_symbol_name(const char *name, const char *str,
> + enum symbols_tag_includes includes)
> +{
> + const char *versioning;
> +
> + if (includes == SYMBOLS_TAG__INCLUDE_DEFAULT_ONLY &&
> + (versioning = strstr(name,"@@"))) {
> +
> + unsigned int len = strlen(str);
> + if (len < versioning - name)
> + len = versioning - name;
> +
> + return arch__compare_symbol_names_n(name, str, len);
> + } else
> + return arch__compare_symbol_names(name, str);
> +}
> +
> static struct symbol *symbols__find_by_name(struct rb_root *symbols,
> - const char *name)
> + const char *name,
> + unsigned int includes)
Here, you might miss replacing this 'unsigned int' with enum.
(actually, enum is equal to int, not unsigned int)
[SNIP]
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 5245d2f..67b017e 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -348,8 +348,19 @@ void arch__sym_update(struct symbol *s, GElf_Sym *sym);
> #define SYMBOL_A 0
> #define SYMBOL_B 1
>
> +int arch__compare_symbol_names(const char *namea, const char *nameb);
> +int arch__compare_symbol_names_n(const char *namea, const char *nameb,
> + unsigned int n);
> int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);
>
> +enum symbols_tag_includes {
> + SYMBOLS_TAG__INCLUDE_NONE,
> + SYMBOLS_TAG__INCLUDE_DEFAULT_ONLY
> +};
BTW, would we need such 's' for plural and third person singular for type name?
And also, you should use enum type name for prefix so that other developers
easily find the definition of enumeration, e.g.
enum symbol_tag_include {
SYMBOL_TAG_INCLUDE__NONE = 0,
SYMBOL_TAG_INCLUDE__DEFAULT_ONLY
};
Thank you,
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists