Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf expr: Add expr_ prefix for parse_ctx and parse_id

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 <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
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 <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
aecce63e 04ed4ccb

+17 -17
+2 -2
tools/perf/tests/expr.c
··· 6 6 #include <string.h> 7 7 #include <linux/zalloc.h> 8 8 9 - static int test(struct parse_ctx *ctx, const char *e, double val2) 9 + static int test(struct expr_parse_ctx *ctx, const char *e, double val2) 10 10 { 11 11 double val; 12 12 ··· 22 22 const char **other; 23 23 double val; 24 24 int i, ret; 25 - struct parse_ctx ctx; 25 + struct expr_parse_ctx ctx; 26 26 int num_other; 27 27 28 28 expr__ctx_init(&ctx);
+5 -5
tools/perf/util/expr.c
··· 11 11 #endif 12 12 13 13 /* Caller must make sure id is allocated */ 14 - void expr__add_id(struct parse_ctx *ctx, const char *name, double val) 14 + void expr__add_id(struct expr_parse_ctx *ctx, const char *name, double val) 15 15 { 16 16 int idx; 17 17 ··· 21 21 ctx->ids[idx].val = val; 22 22 } 23 23 24 - void expr__ctx_init(struct parse_ctx *ctx) 24 + void expr__ctx_init(struct expr_parse_ctx *ctx) 25 25 { 26 26 ctx->num_ids = 0; 27 27 } 28 28 29 29 static int 30 - __expr__parse(double *val, struct parse_ctx *ctx, const char *expr, 30 + __expr__parse(double *val, struct expr_parse_ctx *ctx, const char *expr, 31 31 int start) 32 32 { 33 33 YY_BUFFER_STATE buffer; ··· 52 52 return ret; 53 53 } 54 54 55 - int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr) 55 + int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr) 56 56 { 57 57 return __expr__parse(final_val, ctx, expr, EXPR_PARSE) ? -1 : 0; 58 58 } ··· 75 75 int *num_other) 76 76 { 77 77 int err, i = 0, j = 0; 78 - struct parse_ctx ctx; 78 + struct expr_parse_ctx ctx; 79 79 80 80 expr__ctx_init(&ctx); 81 81 err = __expr__parse(NULL, &ctx, expr, EXPR_OTHER);
+6 -6
tools/perf/util/expr.h
··· 5 5 #define EXPR_MAX_OTHER 20 6 6 #define MAX_PARSE_ID EXPR_MAX_OTHER 7 7 8 - struct parse_id { 8 + struct expr_parse_id { 9 9 const char *name; 10 10 double val; 11 11 }; 12 12 13 - struct parse_ctx { 13 + struct expr_parse_ctx { 14 14 int num_ids; 15 - struct parse_id ids[MAX_PARSE_ID]; 15 + struct expr_parse_id ids[MAX_PARSE_ID]; 16 16 }; 17 17 18 - void expr__ctx_init(struct parse_ctx *ctx); 19 - void expr__add_id(struct parse_ctx *ctx, const char *id, double val); 20 - int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr); 18 + void expr__ctx_init(struct expr_parse_ctx *ctx); 19 + void expr__add_id(struct expr_parse_ctx *ctx, const char *id, double val); 20 + int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr); 21 21 int expr__find_other(const char *expr, const char *one, const char ***other, 22 22 int *num_other); 23 23
+3 -3
tools/perf/util/expr.y
··· 15 15 %define api.pure full 16 16 17 17 %parse-param { double *final_val } 18 - %parse-param { struct parse_ctx *ctx } 18 + %parse-param { struct expr_parse_ctx *ctx } 19 19 %parse-param {void *scanner} 20 20 %lex-param {void* scanner} 21 21 ··· 39 39 40 40 %{ 41 41 static void expr_error(double *final_val __maybe_unused, 42 - struct parse_ctx *ctx __maybe_unused, 42 + struct expr_parse_ctx *ctx __maybe_unused, 43 43 void *scanner, 44 44 const char *s) 45 45 { 46 46 pr_debug("%s\n", s); 47 47 } 48 48 49 - static int lookup_id(struct parse_ctx *ctx, char *id, double *val) 49 + static int lookup_id(struct expr_parse_ctx *ctx, char *id, double *val) 50 50 { 51 51 int i; 52 52
+1 -1
tools/perf/util/stat-shadow.c
··· 729 729 struct runtime_stat *st) 730 730 { 731 731 print_metric_t print_metric = out->print_metric; 732 - struct parse_ctx pctx; 732 + struct expr_parse_ctx pctx; 733 733 double ratio, scale; 734 734 int i; 735 735 void *ctxp = out->ctx;