Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3538986ybz; Mon, 20 Apr 2020 04:57:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJcwdWGKFVD967gz5jpm5UmaIhuNkOVlgPyydYQxn5ZFbHiOKBdfpd67pxburMCAAcB4TIk X-Received: by 2002:a50:fa49:: with SMTP id c9mr14404536edq.9.1587383833801; Mon, 20 Apr 2020 04:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587383833; cv=none; d=google.com; s=arc-20160816; b=qIr3Ov+FuKzsmCZYPVG6Yig32LcSRDimWV/uxt5D23Exe26Iro/Li/vZcmJnc7Jgdq 7qoQXRoyn+1b0FTqdChBvtdOr7+W9AF8Jtsz05vek3M4YANIJoXH0m6IfZ3irXv1Zhqr RFj5155QLb9WGDm4emM5hzw4O9JnOZ8rXlPWj5mI8BhlVv1mxlLljcVBJ+CM7Bamw7o8 hnRl4rsJDRSwk8HwpKYP+gktCjALDh3PftSd5N7mIqa1AeEzR2K8ToKlTwLkONvJm9Xs uN/3xpxmCgcL1t+FCfE5oeuG1s7BfSbG+ILAY3O3rEs2sAFhp1CUNhAdgzF3vM/Fg59X PXNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WZfgfwpfCRLogvHF25WrSVqdRr127dsMgjeb25fCnyA=; b=bzPDCuy337Yinj1kvm7FjJiZQkHf3OBIGci8QxA75245u21M8HCaAbV7PXMhw+k0/O NEhMFHIZI5i+W72Wzig40looFUCtCKiVr4GV77T4qWOVyPNhWtakHOOYnK1bpFYWSBYH qgDsXcfhRWpQxkIvbCfPFsOfR8ql4uwx7FrsqX3pHROhxgm0t/cavA2AG62JAW8qR0db cbXH6RzoG/v0VG2hcdpOLn1NuPQ8LGqSCnTC9aSedj7ez6OWhMBvwES6IeumrzOou4kO W3yHE/M5ANXPbAq8K6X++upXFeXryMUlrA/4X5oha4RHMulpFXIyVt4FMNjftkpW/u/+ MX4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bHfiqdDK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si402998ejh.437.2020.04.20.04.56.50; Mon, 20 Apr 2020 04:57:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bHfiqdDK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726611AbgDTLzR (ORCPT + 99 others); Mon, 20 Apr 2020 07:55:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726893AbgDTLzO (ORCPT ); Mon, 20 Apr 2020 07:55:14 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A316821D94; Mon, 20 Apr 2020 11:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587383713; bh=6KKSQV6faZ745OFDvokah3grYP2cw2qu7+02fvjxjD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHfiqdDKRXH5Q3e1QJx4+xcS9Bxq2CALxGivVp6wh1PXGCNLEZSg2ImPyZEK+AtP/ DwWuKEJBxyklocYIYNpA3swrHqeZk93ahQ0BiXG/wDQuk7imBZ9TLOVZQTBE8I3OlS EywAoF14MVzEGBc6uontYp5yJjWAy86CLWpGqjOM= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Andi Kleen , Anju T Sudhakar , Benjamin Herrenschmidt , Greg Kroah-Hartman , Jin Yao , Joe Mario , Kajol Jain , Kan Liang , Madhavan Srinivasan , Mamatha Inamdar , Mark Rutland , Michael Ellerman , Michael Petlan , Paul Mackerras , Peter Zijlstra , Ravi Bangoria , Sukadev Bhattiprolu , linuxppc-dev@lists.ozlabs.org, Arnaldo Carvalho de Melo Subject: [PATCH 21/60] perf expr: Add expr_ prefix for parse_ctx and parse_id Date: Mon, 20 Apr 2020 08:52:37 -0300 Message-Id: <20200420115316.18781-22-acme@kernel.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200420115316.18781-1-acme@kernel.org> References: <20200420115316.18781-1-acme@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa Adding expr_ prefix for parse_ctx and parse_id, to straighten out the expr* namespace. There's no functional change. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Anju T Sudhakar Cc: Benjamin Herrenschmidt Cc: Greg Kroah-Hartman Cc: Jin Yao Cc: Joe Mario Cc: Kajol Jain Cc: Kan Liang Cc: Madhavan Srinivasan Cc: Mamatha Inamdar Cc: Mark Rutland Cc: Michael Ellerman Cc: Michael Petlan Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Sukadev Bhattiprolu Cc: Thomas Gleixner Cc: linuxppc-dev@lists.ozlabs.org Link: http://lore.kernel.org/lkml/20200401203340.31402-2-kjain@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/expr.c | 4 ++-- tools/perf/util/expr.c | 10 +++++----- tools/perf/util/expr.h | 12 ++++++------ tools/perf/util/expr.y | 6 +++--- tools/perf/util/stat-shadow.c | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c index 28313e59d6f6..ea10fc4412c4 100644 --- a/tools/perf/tests/expr.c +++ b/tools/perf/tests/expr.c @@ -6,7 +6,7 @@ #include #include -static int test(struct parse_ctx *ctx, const char *e, double val2) +static int test(struct expr_parse_ctx *ctx, const char *e, double val2) { double val; @@ -22,7 +22,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) const char **other; double val; int i, ret; - struct parse_ctx ctx; + struct expr_parse_ctx ctx; int num_other; expr__ctx_init(&ctx); diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index fd192ddf93c1..c8ccc548a585 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -11,7 +11,7 @@ extern int expr_debug; #endif /* Caller must make sure id is allocated */ -void expr__add_id(struct parse_ctx *ctx, const char *name, double val) +void expr__add_id(struct expr_parse_ctx *ctx, const char *name, double val) { int idx; @@ -21,13 +21,13 @@ void expr__add_id(struct parse_ctx *ctx, const char *name, double val) ctx->ids[idx].val = val; } -void expr__ctx_init(struct parse_ctx *ctx) +void expr__ctx_init(struct expr_parse_ctx *ctx) { ctx->num_ids = 0; } static int -__expr__parse(double *val, struct parse_ctx *ctx, const char *expr, +__expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr, int start) { YY_BUFFER_STATE buffer; @@ -52,7 +52,7 @@ __expr__parse(double *val, struct parse_ctx *ctx, const char *expr, return ret; } -int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr) +int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr) { return __expr__parse(final_val, ctx, expr, EXPR_PARSE) ? -1 : 0; } @@ -75,7 +75,7 @@ int expr__find_other(const char *expr, const char *one, const char ***other, int *num_other) { int err, i = 0, j = 0; - struct parse_ctx ctx; + struct expr_parse_ctx ctx; expr__ctx_init(&ctx); err = __expr__parse(NULL, &ctx, expr, EXPR_OTHER); diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h index 9377538f4097..b9e53f2b5844 100644 --- a/tools/perf/util/expr.h +++ b/tools/perf/util/expr.h @@ -5,19 +5,19 @@ #define EXPR_MAX_OTHER 20 #define MAX_PARSE_ID EXPR_MAX_OTHER -struct parse_id { +struct expr_parse_id { const char *name; double val; }; -struct parse_ctx { +struct expr_parse_ctx { int num_ids; - struct parse_id ids[MAX_PARSE_ID]; + struct expr_parse_id ids[MAX_PARSE_ID]; }; -void expr__ctx_init(struct parse_ctx *ctx); -void expr__add_id(struct parse_ctx *ctx, const char *id, double val); -int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr); +void expr__ctx_init(struct expr_parse_ctx *ctx); +void expr__add_id(struct expr_parse_ctx *ctx, const char *id, double val); +int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr); int expr__find_other(const char *expr, const char *one, const char ***other, int *num_other); diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index 4720cbe79357..cd17486c1c5d 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -15,7 +15,7 @@ %define api.pure full %parse-param { double *final_val } -%parse-param { struct parse_ctx *ctx } +%parse-param { struct expr_parse_ctx *ctx } %parse-param {void *scanner} %lex-param {void* scanner} @@ -39,14 +39,14 @@ %{ static void expr_error(double *final_val __maybe_unused, - struct parse_ctx *ctx __maybe_unused, + struct expr_parse_ctx *ctx __maybe_unused, void *scanner, const char *s) { pr_debug("%s\n", s); } -static int lookup_id(struct parse_ctx *ctx, char *id, double *val) +static int lookup_id(struct expr_parse_ctx *ctx, char *id, double *val) { int i; diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index 03ecb8cd0eec..1ad5c5be7e97 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -729,7 +729,7 @@ static void generic_metric(struct perf_stat_config *config, struct runtime_stat *st) { print_metric_t print_metric = out->print_metric; - struct parse_ctx pctx; + struct expr_parse_ctx pctx; double ratio, scale; int i; void *ctxp = out->ctx; -- 2.21.1