From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753384AbbDTToX (ORCPT ); Mon, 20 Apr 2015 15:44:23 -0400 Received: from mail.kernel.org ([198.145.29.136]:35175 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbbDTToU (ORCPT ); Mon, 20 Apr 2015 15:44:20 -0400 Date: Mon, 20 Apr 2015 16:44:11 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern Subject: Re: [PATCH 3/7] perf tools: Move TUI-specific fields to struct hist_entry_tui Message-ID: <20150420194411.GI11111@kernel.org> References: <1429534850-13526-1-git-send-email-namhyung@kernel.org> <1429534850-13526-4-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429534850-13526-4-git-send-email-namhyung@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Apr 20, 2015 at 10:00:46PM +0900, Namhyung Kim escreveu: > +++ b/tools/perf/ui/browsers/hists.c > @@ -61,7 +61,7 @@ static int hist_browser__get_folding(struct hist_browser *browser) > rb_entry(nd, struct hist_entry, rb_node); > if (he->ms.unfolded) > - unfolded_rows += he->nr_rows; > + unfolded_rows += he->tui.nr_rows; To avoid all these changes, I wonder if we can't use unamed structs in addition to the unnamed union? Like this what is done in include/net/sock.h, struct sock_common, and here: [root@zoo ~]# cat unnamed_struct_union.c #include #include struct hist_entry { union { struct /* tui */ { int nr_rows; int row_offset; /* other fields */ }; struct /* diff */ { bool computed; /* other fields */ }; }; }; int main(int argc, char *argv[]) { struct hist_entry he = { .nr_rows = 11, .row_offset = 19, }; printf("he.nr_rows=%d, he.row_offset=%d\n", he.nr_rows, he.row_offset); } [root@zoo ~]# make unnamed_struct_union cc unnamed_struct_union.c -o unnamed_struct_union [root@zoo ~]# ./unnamed_struct_union he.nr_rows=11, he.row_offset=19 [root@zoo ~]# - Arnaldo