Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D95DCDB47E for ; Thu, 12 Oct 2023 11:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tCRXLr3w152B2kNR8mx2XfSY9VBAf0hewPuCsmR3gR8=; b=QOBAJvc1U2pzAA TaIHW9hxEoyfalQ3fJzsK4pzy7umVUiyVtUuFyD0N8/IIApGytPJQoo0st1v40FW3hfUgOcZ0TnmV 1snLlcGGcaaufmxTYffN4o1zOcO0q4HYZPKloaJ17zqUrdrNJ3lgfxhoeu08W8QgqUdTfC6GRN0zj AQNX+Q0eZb/twiv5NfSPFvChq5ANnppRlxgd1oIA0MagZsGnbK5+VEkNxI5bTIXL9YKKlTIIlKDQS NwQrgC3sv3YAl4p5lLFIcv7XhoxPxsDacpP7Y76rwZD41sRBeWcahpXhPrZDfcVnm0RP1XuQKrDom kdFsVfeNBH4RSIL7vQog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qquFw-000tzH-0Y; Thu, 12 Oct 2023 11:53:32 +0000 Received: from mgamail.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qquFQ-000thL-18 for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2023 11:53:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697111580; x=1728647580; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=LnqL56wi3grFaEumVNjs3QvHBuvjmv7Ccggb/DBIQy4=; b=UzWB5PIyYAIWp0fgdw9bDRiqJkP5Q4fZueVNTPx0PxY7KafXYHgRxdi/ hvzp4GByaKTywa5mabVzQv9EL5rvFB/kaqQZxs3BLGimgbCfb0wJEMveg /BqAHOGGBhLiWnCYjS6ufg4y/m+de6xflYh0lmryemL3tzFtTEKVoVK0j QfYRMBEdUs6X2c8qXcTOGluVRAOAXREcxrrLGpdXCJysQ0UKbMunoDyIw gexeET1jespiLn9SIlOElQLr185bthJsrbW5Uij9ojgquHDTNCFPwqxfa sNB5+aMQ3iqEY59Y3Ow6oZhS+HcldrUzGDm2g4jxCL5dy9KNuO73odWmk A==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="415949530" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="415949530" 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_045300_438556_8E4BBD3B X-CRM114-Status: GOOD ( 15.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel