1 /* SPDX-License-Identifier: GPL-2.0 */
5 // There are fixes that need to land upstream before we can use libbpf's headers,
6 // for now use our copy uncoditionally, since the data structures at this point
7 // are exactly the same, no problem.
8 //#ifdef HAVE_LIBBPF_SUPPORT
9 //#include <bpf/hashmap.h>
11 #include "util/hashmap.h"
18 struct expr_id
*parent
;
21 struct expr_parse_ctx
{
23 struct expr_id
*parent
;
28 struct expr_scanner_ctx
{
33 void expr__ctx_init(struct expr_parse_ctx
*ctx
);
34 void expr__ctx_clear(struct expr_parse_ctx
*ctx
);
35 void expr__del_id(struct expr_parse_ctx
*ctx
, const char *id
);
36 int expr__add_id(struct expr_parse_ctx
*ctx
, const char *id
);
37 int expr__add_id_val(struct expr_parse_ctx
*ctx
, const char *id
, double val
);
38 int expr__add_ref(struct expr_parse_ctx
*ctx
, struct metric_ref
*ref
);
39 int expr__get_id(struct expr_parse_ctx
*ctx
, const char *id
,
40 struct expr_id_data
**data
);
41 int expr__resolve_id(struct expr_parse_ctx
*ctx
, const char *id
,
42 struct expr_id_data
**datap
);
43 int expr__parse(double *final_val
, struct expr_parse_ctx
*ctx
,
44 const char *expr
, int runtime
);
45 int expr__find_other(const char *expr
, const char *one
,
46 struct expr_parse_ctx
*ids
, int runtime
);
48 double expr_id_data__value(const struct expr_id_data
*data
);
49 struct expr_id
*expr_id_data__parent(struct expr_id_data
*data
);