linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: tzvmware@gmail.com
Cc: linux-trace-devel@vger.kernel.org,
	"Tzvetomir Stoyanov" <tstoyanov@vmware.com>
Subject: Re: [PATCH v3] tools/lib/traceevent, tools/perf: Move struct tep_handler definition in a local header file
Date: Mon, 8 Oct 2018 15:52:55 -0400	[thread overview]
Message-ID: <20181008155255.0ea2ef49@gandalf.local.home> (raw)
In-Reply-To: <20181008125500.8349-1-tzvmware@gmail.com>

On Mon,  8 Oct 2018 15:55:00 +0300
tzvmware@gmail.com wrote:

> +++ b/tools/lib/traceevent/event-parse-api.c
> @@ -0,0 +1,275 @@
> +// SPDX-License-Identifier: LGPL-2.1
> +/*
> + * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
> + *
> + */
> +
> +#include "event-parse.h"
> +#include "event-parse-local.h"
> +#include "event-utils.h"
> +
> +/**
> + * tep_get_first_event - returns the first event in the events array
> + * @pevent: a handle to the tep_handle

I'm fixing up the @pevent to @tep here and below.

> + *
> + * This returns pointer to the first element of the events array
> + * If @pevent is NULL, NULL is returned.
> + */
> +struct tep_event_format *tep_get_first_event(struct tep_handle *tep)
> +{
> +	if (tep && tep->events)
> +		return tep->events[0];
> +
> +	return NULL;
> +}
> +
> +/**
> + * tep_get_events_count - get the number of defined events
> + * @pevent: a handle to the tep_handle
> + *
> + * This returns number of elements in event array
> + * If @pevent is NULL, 0 is returned.
> + */
> +int tep_get_events_count(struct tep_handle *tep)
> +{
> +	if (tep)
> +		return tep->nr_events;
> +	return 0;
> +}
> +
> +/**
> + * tep_set_flag - set event parser flag
> + * @pevent: a handle to the tep_handle
> + * @flag: flag, or combination of flags to be set
> + * can be any combination from enum tep_flag
> + *
> + * This sets a flag or mbination of flags  from enum tep_flag
> + */
> +void tep_set_flag(struct tep_handle *tep, int flag)
> +{
> +	if (tep)
> +		tep->flags |= flag;
> +}
> +
> +unsigned short __tep_data2host2(struct tep_handle *pevent, unsigned short data)
> +{
> +	unsigned short swap;
> +
> +	if (!pevent || pevent->host_bigendian == pevent->file_bigendian)
> +		return data;
> +
> +	swap = ((data & 0xffULL) << 8) |
> +		((data & (0xffULL << 8)) >> 8);
> +
> +	return swap;
> +}
> +



> -#define tep_data2host2(pevent, ptr)		__tep_data2host2(pevent, *(unsigned short *)(ptr))
> -#define tep_data2host4(pevent, ptr)		__tep_data2host4(pevent, *(unsigned int *)(ptr))
> -#define tep_data2host8(pevent, ptr)					\
> +#define tep_data2host2(pevent, ptr)	\
> +	__tep_data2host2(pevent, *(unsigned short *)(ptr))
> +#define tep_data2host4(pevent, ptr)	\
> +	__tep_data2host4(pevent, *(unsigned int *)(ptr))

One thing I hate about checkpatch.pl is it's authoritarian "over 80
chars".

Most of the time I ignore it. I think to myself, "does it look better
with or without that line break" and if I think the line break just
makes it worse to read, I ignore it.

I'm putting these back to single lines.

Note, this is the one reason I haven't pushed using checkpatch.pl,
because some of the suggestions are just wrong.

-- Steve

      reply	other threads:[~2018-10-09  3:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20181005091709.2bd7abe8@gandalf.local.home>
2018-10-05 13:31 ` [PATCH v2] tools/lib/traceevent, tools/perf: Move struct tep_handler definition in a local header file tzvmware
2018-10-05 16:31   ` Steven Rostedt
2018-10-05 21:13     ` Steven Rostedt
2018-10-08 12:55       ` [PATCH v3] " tzvmware
2018-10-08 19:52         ` Steven Rostedt [this message]

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=20181008155255.0ea2ef49@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tstoyanov@vmware.com \
    --cc=tzvmware@gmail.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).