From: Steven Rostedt <rostedt@goodmis.org>
To: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/8] tools/perf,tools/lib/traceevent: Make traceevent APIs more consistent
Date: Tue, 26 Mar 2019 15:43:18 -0400 [thread overview]
Message-ID: <20190326154318.70716fbb@gandalf.local.home> (raw)
In-Reply-To: <20190326154328.28718-2-tstoyanov@vmware.com>
On Tue, 26 Mar 2019 17:43:21 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
> Rename some traceevent APIs for consistency:
>
> tep_pid_is_registered() to tep_is_pid_registered()
> tep_file_bigendian() to tep_is_file_bigendian()
> to make the names and return values consistent with other tep_is_... APIs
>
> tep_data_lat_fmt() to tep_data_latency_format()
> to make the name more descriptive
>
> tep_host_bigendian() to tep_is_bigendian()
> tep_set_host_bigendian() to tep_set_local_bigendian()
> tep_is_host_bigendian() to tep_is_local_bigendian()
> "host" can be confused with VMs, and "local" is about the local
> machine. All tep_is_..._bigendian(struct tep_handle *tep) APIs return
> the saved data in the tep handle, while tep_is_bigendian() returns
> the running machine's endianness.
>
> All tep_is_... functions are modified to return bool value, instead of int.
Much nicer ;-)
>
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
> tools/lib/traceevent/event-parse-api.c | 44 +++++++++++++-------------
> tools/lib/traceevent/event-parse.c | 26 +++++++--------
> tools/lib/traceevent/event-parse.h | 16 +++++-----
> tools/lib/traceevent/plugin_kvm.c | 4 +--
> tools/perf/util/trace-event-read.c | 2 +-
> tools/perf/util/trace-event.c | 4 +--
> 6 files changed, 48 insertions(+), 48 deletions(-)
>
> diff --git a/tools/lib/traceevent/event-parse-api.c b/tools/lib/traceevent/event-parse-api.c
> index 2ac8b44854ce..46670bb87051 100644
> --- a/tools/lib/traceevent/event-parse-api.c
> +++ b/tools/lib/traceevent/event-parse-api.c
> @@ -88,7 +88,7 @@ void tep_clear_flag(struct tep_handle *tep, enum tep_flag flag)
> bool tep_test_flag(struct tep_handle *tep, enum tep_flag flag)
> {
> if (tep)
> - return (tep->flags & flag);
> + return !!(tep->flags & flag);
This isn't needed. The fact hat this returns "bool", the compiler will
handle thins the same regardless.
> return false;
> }
>
> @@ -306,14 +306,14 @@ void tep_set_host_bigendian(struct tep_handle *pevent, enum tep_endian endian)
> * tep_is_latency_format - get if the latency output format is configured
> * @pevent: a handle to the tep_handle
> *
> - * This gets if the latency output format is configured
> - * If @pevent is NULL, 0 is returned.
> + * This returns true if the latency output format is configured
> + * If @pevent is NULL, false is returned.
> */
> -int tep_is_latency_format(struct tep_handle *pevent)
> +bool tep_is_latency_format(struct tep_handle *pevent)
> {
> if (pevent)
> - return pevent->latency_format;
> - return 0;
> + return !!(pevent->latency_format);
Same here.
> + return false;
> }
>
> /**
The rest looks good.
-- Steve
next prev parent reply other threads:[~2019-03-26 19:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 15:43 [PATCH 0/8] Cleanup traceevent API and make it more consistent Tzvetomir Stoyanov
2019-03-26 15:43 ` [PATCH 1/8] tools/perf,tools/lib/traceevent: Make traceevent APIs " Tzvetomir Stoyanov
2019-03-26 19:43 ` Steven Rostedt [this message]
2019-03-26 15:43 ` [PATCH 2/8] tools/lib/traceevent: Add counter to track parsing failures Tzvetomir Stoyanov
2019-03-26 19:48 ` Steven Rostedt
2019-03-26 15:43 ` [PATCH 3/8] tools/lib/traceevent: Remove tep filter trivial APIs Tzvetomir Stoyanov
2019-03-26 19:50 ` Steven Rostedt
2019-03-26 15:43 ` [PATCH 4/8] tools/lib/traceevent: rename input arguments of libtraceevent APIs from pevent to tep Tzvetomir Stoyanov
2019-03-26 19:57 ` Steven Rostedt
2019-03-26 19:58 ` Steven Rostedt
2019-03-26 15:43 ` [PATCH 5/8] tools/perf,tools/lib/traceevent: rename "pevent" member of struct tep_event to "tep" Tzvetomir Stoyanov
2019-03-26 15:43 ` [PATCH 6/8] tools/perf,tools/lib/traceevent: rename "pevent" member of struct tep_event_filter " Tzvetomir Stoyanov
2019-03-26 15:43 ` [PATCH 7/8] tools/lib/traceevent: rename input arguments and local variables of libtraceevent from pevent to tep Tzvetomir Stoyanov
2019-03-26 15:43 ` [PATCH 8/8] tools/lib/traceevent: remove call to exit() from tep_filter_add_filter_str() Tzvetomir Stoyanov
2019-03-26 20:02 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190326154318.70716fbb@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tstoyanov@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).