From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932264AbdHVIUf (ORCPT ); Tue, 22 Aug 2017 04:20:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57998 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932077AbdHVIUb (ORCPT ); Tue, 22 Aug 2017 04:20:31 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A5E135F7BC Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Tue, 22 Aug 2017 10:20:28 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v2 01/19] perf, tools: Save max_x, max_y in xyarray Message-ID: <20170822082028.GC23985@krava> References: <20170811232634.30465-1-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170811232634.30465-1-andi@firstfloor.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 22 Aug 2017 08:20:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 11, 2017 at 04:26:16PM -0700, Andi Kleen wrote: > From: Andi Kleen > > Save the original array dimensions in xyarrays, so that users can retrieve them > later. Add some inline functions to access these fields. > > Signed-off-by: Andi Kleen > --- > tools/perf/util/xyarray.c | 2 ++ > tools/perf/util/xyarray.h | 12 ++++++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/tools/perf/util/xyarray.c b/tools/perf/util/xyarray.c > index 7251fdbabced..c8f415d9877b 100644 > --- a/tools/perf/util/xyarray.c > +++ b/tools/perf/util/xyarray.c > @@ -12,6 +12,8 @@ struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size) > xy->entry_size = entry_size; > xy->row_size = row_size; > xy->entries = xlen * ylen; > + xy->max_x = xlen; > + xy->max_y = ylen; > } > > return xy; > diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h > index 7f30af371b7e..785884158137 100644 > --- a/tools/perf/util/xyarray.h > +++ b/tools/perf/util/xyarray.h > @@ -7,6 +7,8 @@ struct xyarray { > size_t row_size; > size_t entry_size; > size_t entries; > + size_t max_x; > + size_t max_y; > char contents[]; > }; > > @@ -19,4 +21,14 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y) > return &xy->contents[x * xy->row_size + y * xy->entry_size]; > } > > +static inline int xy_max_y(struct xyarray *xy) > +{ > + return xy->max_x; > +} > + > +static inline int xy_max_x(struct xyarray *xy) > +{ > + return xy->max_y; > +} I think you should follow the standard naming and use xyarray__max_x and xyarray__max_y jirka