From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753058AbbC0OhX (ORCPT ); Fri, 27 Mar 2015 10:37:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44509 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751025AbbC0OhV (ORCPT ); Fri, 27 Mar 2015 10:37:21 -0400 Date: Fri, 27 Mar 2015 11:37:14 -0300 From: Arnaldo Carvalho de Melo To: Borislav Petkov Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, Adrian Hunter , David Ahern , Don Zickus , Frederic Weisbecker , Namhyung Kim , Stephane Eranian Subject: Re: [PATCH 14/25] perf symbols: Save DSO loading errno to better report errors Message-ID: <20150327143714.GC6291@redhat.com> References: <1427213980-9015-1-git-send-email-acme@kernel.org> <1427213980-9015-15-git-send-email-acme@kernel.org> <20150327103243.GA18931@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150327103243.GA18931@pd.tnic> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Mar 27, 2015 at 11:32:43AM +0100, Borislav Petkov escreveu: > On Tue, Mar 24, 2015 at 01:19:29PM -0300, Arnaldo Carvalho de Melo wrote: > > + /* > > + * This must have a same ordering as the enum dso_load_errno. > > + */ > > + static const char *dso_load__error_str[] = { > > + "Internal tools/perf/ library error", > > + "Invalid ELF file", > > + "Can not read build id", > > + "Mismatching build id", > > + "Decompression failure", > > + }; > > You could define this str array by using the dso_load_errno defines so > that they're always in sync: > > static const char *dso_load__error_str[] = { > [DSO_LOAD_ERRNO__INTERNAL_ERROR - __DSO_LOAD_ERRNO__START] = "Internal tools/perf/ library error", > [DSO_LOAD_ERRNO__INVALID_ELF - __DSO_LOAD_ERRNO__START] = "Invalid ELF file", > ... > > and even use a small macro to hide the __DSO_LOAD_ERRNO__START thing. Right, good idea, I'll change both this and the code that was used as a template. - Arnaldo