[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130718123940.GA1092@krava.brq.redhat.com>
Date: Thu, 18 Jul 2013 14:39:40 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: linux-kernel@...r.kernel.org,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Namhyung Kim <namhyung@...nel.org>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andi Kleen <ak@...ux.intel.com>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH 08/23] perf tools: Introduce perf data file version CHECK
macro
On Wed, Jul 17, 2013 at 04:42:50PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jul 17, 2013 at 07:49:48PM +0200, Jiri Olsa escreveu:
> > Introducing perf data file version CHECK macro, so the check
> > is easily extensible for new versions.
> >
> > Signed-off-by: Jiri Olsa <jolsa@...hat.com>
> > Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
> > Cc: Frederic Weisbecker <fweisbec@...il.com>
> > Cc: Ingo Molnar <mingo@...e.hu>
> > Cc: Namhyung Kim <namhyung@...nel.org>
> > Cc: Paul Mackerras <paulus@...ba.org>
> > Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> > Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> > Cc: Andi Kleen <ak@...ux.intel.com>
> > Cc: David Ahern <dsahern@...il.com>
> > ---
> > tools/perf/util/header.c | 27 ++++++++++++++++-----------
> > 1 file changed, 16 insertions(+), 11 deletions(-)
> >
> > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> > index f558f83..4ebe4a1 100644
> > --- a/tools/perf/util/header.c
> > +++ b/tools/perf/util/header.c
> > @@ -2493,18 +2493,23 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz,
> > * - encode endianness of file
> > */
> >
> > - /* check magic number with one endianness */
> > - if (magic == __perf_magic2)
> > - return 0;
> > -
> > - /* check magic number with opposite endianness */
> > - if (magic != __perf_magic2_sw)
> > - return -1;
> > +#define CHECK(__m, __v) \
> > +do { \
> > + /* check magic number with one endianness */ \
> > + if (magic == __m) \
> > + goto v ## __v; \
> > + /* check magic number with opposite endianness */ \
> > + if (magic != __m ## _sw) \
> > + break; \
> > + ph->needs_swap = true; \
> > + v ## __v: \
> > + ph->version = __v; \
> > + return 0; \
> > +} while (0)
>
> Ouch, why not:
>
> #define PERF_CHECK_VERSION(__m, __v)
> /* check magic number with one endianness */ \
> if (magic == __m) { \
> ph->version = __v; \
> return 0; \
> /* check magic number with opposite endianness */ \
> } else if (magic == __m ## _sw) { \
> ph->needs_swap = true; \
> }
ok, will change
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists