Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp251592rdg; Thu, 12 Oct 2023 04:56:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkiuH/KfSHwfH0n9romvBL1eB1MCHW6YcLHxIaNODVP/0VqjeU98YLsdpS5Lr3crhwIWbj X-Received: by 2002:a05:6a00:b84:b0:68c:49e4:bd71 with SMTP id g4-20020a056a000b8400b0068c49e4bd71mr27277356pfj.34.1697111812401; Thu, 12 Oct 2023 04:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111812; cv=none; d=google.com; s=arc-20160816; b=wAAnQhGR55dPchGChyGWGvIsLLbi9TQ0KynVPYqXU7IhgAu9GOjbGJVDsyUhT5zKJc z91YIWWRE/eOD4mS/9iNyaxGuGnbjLBT9M+c8n8nbrbHKDO/0P4Y1Y7oYq/z77F8qkFe dv7yWQVhjrOJA3JLsiiUUq/5kgYISFDnppqwqtAiW/QiPdEEE9nrnTm4ooVKg+GMOTAL 688TzJIWv8UuT3tRiiZbJS+QVQAPJ8PqvCYMiR2lAEjWovJFHPXAsooNeWFFP82pUma5 wwXtrX2i13BZzTqYU/a1aPftjVRWYi3q+FAPPYRWkHB39oBDCdlI3dUM2E8iy3S4yFiC xXNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=tJeFbBES5MAnI56ZwA8UjZ4JzKGBKZpeBVSXXYZDSx8=; fh=W3U2V5NWgOp/qb3+mq+iAX2Phz2PcGd1A8pr7VsL1jc=; b=dzLtBs9Au4LO9BQLNbcf3FgnR/gB5bZnkoAyhrIx5ohUcqS64R0xCkDMUuXGalrz/A bF0aQw7qnbnZrdO+yGlwhZiVF1n7tqqU/Bl5U97gY/psG1wG+rjFfVSCT2LK9vdHRlh0 2lD6O00GcO8jIvE/RxAl/byWyN/UKNNQvddfecbMpb2AHug/aFFaRbBelrLah+VBMbHE zMyL/uYyD2vFe51o76KKol01DCCeu99FgLv2gxE6X6k7ZI6fYUmjneEPINAVwSV51CCD JBHONjCIACVwJyua9VWhNbq+NP0kEgW0t2jH5nEqti5vV0zXiqg/gUtECphzdaTLbfHl iFmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YlWQgk0j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id dw8-20020a056a00368800b0069f456b74e9si12045045pfb.292.2023.10.12.04.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YlWQgk0j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DC9B8812670E; Thu, 12 Oct 2023 04:56:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347239AbjJLL4H (ORCPT + 99 others); Thu, 12 Oct 2023 07:56:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347237AbjJLLzp (ORCPT ); Thu, 12 Oct 2023 07:55:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C41276A7C; Thu, 12 Oct 2023 04:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697111626; x=1728647626; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=LnqL56wi3grFaEumVNjs3QvHBuvjmv7Ccggb/DBIQy4=; b=YlWQgk0jl91Jn6hczrXmhpfSkReGzile50pyyU+SXwfsbO0/JW5zsMml kRNNs69le8XLTmynHUeMbIP9PIGKWbkX9NxX9F09boBjZEitcPrSLsths JQsEzqWxvVCWahTTo38KQuxpiT97uil62OFlQA+RAIzQ/f3moauh3Qv5Z DMhengMMn7k+bbozkBblhEw2M9994f22TJggbAbPa11uRT7W+F7SpRpjx P+Ca1Nm+KS4IBz4DGBs+qE+8TZG/JTUfLWpeAnwKj6N35xWKGoHtHy5Xp IrWMjaly1OBXsEtPfJuElXzjyXkDsiqJqtZuLfz7uWJ1q/t18eT9ASIRy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="415949525" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="415949525" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 04:52:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870545678" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870545678" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.41.84]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 04:52:53 -0700 Message-ID: <5779887c-d712-40d2-963b-8c912b8cf5fc@intel.com> Date: Thu, 12 Oct 2023 14:52:51 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 4/7] perf pmu: Const-ify file APIs Content-Language: en-US To: Ian Rogers , Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Richter , Ravi Bangoria , Kajol Jain , Jing Zhang , Kan Liang , Yang Jihong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231007021326.4156714-1-irogers@google.com> <20231007021326.4156714-5-irogers@google.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <20231007021326.4156714-5-irogers@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:56:25 -0700 (PDT) On 7/10/23 05:13, Ian Rogers wrote: > File APIs don't alter the struct pmu so allow const ones to be passed. > > Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter > --- > tools/perf/util/pmu.c | 12 ++++++------ > tools/perf/util/pmu.h | 11 ++++++----- > tools/perf/util/python.c | 2 +- > 3 files changed, 13 insertions(+), 12 deletions(-) > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c > index 6e95b3d2c2e3..e11901c923d7 100644 > --- a/tools/perf/util/pmu.c > +++ b/tools/perf/util/pmu.c > @@ -575,7 +575,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, > return 0; > } > > -static inline bool pmu_alias_info_file(char *name) > +static inline bool pmu_alias_info_file(const char *name) > { > size_t len; > > @@ -1771,7 +1771,7 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu) > return !strcmp(pmu->name, "kprobe") || !strcmp(pmu->name, "uprobe"); > } > > -FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name) > +FILE *perf_pmu__open_file(const struct perf_pmu *pmu, const char *name) > { > char path[PATH_MAX]; > > @@ -1782,7 +1782,7 @@ FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name) > return fopen(path, "r"); > } > > -FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name) > +FILE *perf_pmu__open_file_at(const struct perf_pmu *pmu, int dirfd, const char *name) > { > int fd; > > @@ -1793,7 +1793,7 @@ FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name) > return fdopen(fd, "r"); > } > > -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, > +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, > ...) > { > va_list args; > @@ -1810,7 +1810,7 @@ int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, > return ret; > } > > -int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, > +int perf_pmu__scan_file_at(const struct perf_pmu *pmu, int dirfd, const char *name, > const char *fmt, ...) > { > va_list args; > @@ -1827,7 +1827,7 @@ int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, > return ret; > } > > -bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name) > +bool perf_pmu__file_exists(const struct perf_pmu *pmu, const char *name) > { > char path[PATH_MAX]; > > diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h > index 588c64e38d6b..24af7297b522 100644 > --- a/tools/perf/util/pmu.h > +++ b/tools/perf/util/pmu.h > @@ -222,14 +222,15 @@ bool pmu__name_match(const struct perf_pmu *pmu, const char *pmu_name); > */ > bool perf_pmu__is_software(const struct perf_pmu *pmu); > > -FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name); > -FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name); > +FILE *perf_pmu__open_file(const struct perf_pmu *pmu, const char *name); > +FILE *perf_pmu__open_file_at(const struct perf_pmu *pmu, int dirfd, const char *name); > > -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...) __scanf(3, 4); > -int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, > +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...) > + __scanf(3, 4); > +int perf_pmu__scan_file_at(const struct perf_pmu *pmu, int dirfd, const char *name, > const char *fmt, ...) __scanf(4, 5); > > -bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name); > +bool perf_pmu__file_exists(const struct perf_pmu *pmu, const char *name); > > int perf_pmu__test(void); > > diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c > index c29f5f0bb552..8761f51b5c7c 100644 > --- a/tools/perf/util/python.c > +++ b/tools/perf/util/python.c > @@ -98,7 +98,7 @@ struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused) > return NULL; > } > > -int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...) > +int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...) > { > return EOF; > }