Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef PARSE_CTX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define PARSE_CTX_H 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) // There are fixes that need to land upstream before we can use libbpf's headers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) // for now use our copy uncoditionally, since the data structures at this point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) // are exactly the same, no problem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) //#ifdef HAVE_LIBBPF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) //#include <bpf/hashmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) //#else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "util/hashmap.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) //#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct metric_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct expr_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	char		*id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	struct expr_id	*parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct expr_parse_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	struct hashmap	 ids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	struct expr_id	*parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct expr_id_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		double val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 			const char *metric_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 			const char *metric_expr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 			bool counted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		} ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		struct expr_id	*parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	bool is_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct expr_scanner_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	int start_token;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	int runtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void expr__ctx_init(struct expr_parse_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void expr__ctx_clear(struct expr_parse_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void expr__del_id(struct expr_parse_ctx *ctx, const char *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int expr__add_id(struct expr_parse_ctx *ctx, const char *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int expr__add_id_val(struct expr_parse_ctx *ctx, const char *id, double val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int expr__add_ref(struct expr_parse_ctx *ctx, struct metric_ref *ref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int expr__get_id(struct expr_parse_ctx *ctx, const char *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		 struct expr_id_data **data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int expr__resolve_id(struct expr_parse_ctx *ctx, const char *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		     struct expr_id_data **datap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int expr__parse(double *final_val, struct expr_parse_ctx *ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		const char *expr, int runtime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int expr__find_other(const char *expr, const char *one,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		struct expr_parse_ctx *ids, int runtime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif