18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: LGPL-2.1
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _PARSE_EVENTS_INT_H
88c2ecf20Sopenharmony_ci#define _PARSE_EVENTS_INT_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct tep_cmdline;
118c2ecf20Sopenharmony_cistruct cmdline_list;
128c2ecf20Sopenharmony_cistruct func_map;
138c2ecf20Sopenharmony_cistruct func_list;
148c2ecf20Sopenharmony_cistruct event_handler;
158c2ecf20Sopenharmony_cistruct func_resolver;
168c2ecf20Sopenharmony_cistruct tep_plugins_dir;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define __hidden __attribute__((visibility ("hidden")))
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct tep_handle {
218c2ecf20Sopenharmony_ci	int ref_count;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	int header_page_ts_offset;
248c2ecf20Sopenharmony_ci	int header_page_ts_size;
258c2ecf20Sopenharmony_ci	int header_page_size_offset;
268c2ecf20Sopenharmony_ci	int header_page_size_size;
278c2ecf20Sopenharmony_ci	int header_page_data_offset;
288c2ecf20Sopenharmony_ci	int header_page_data_size;
298c2ecf20Sopenharmony_ci	int header_page_overwrite;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	enum tep_endian file_bigendian;
328c2ecf20Sopenharmony_ci	enum tep_endian host_bigendian;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	int old_format;
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	int cpus;
378c2ecf20Sopenharmony_ci	int long_size;
388c2ecf20Sopenharmony_ci	int page_size;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	struct tep_cmdline *cmdlines;
418c2ecf20Sopenharmony_ci	struct cmdline_list *cmdlist;
428c2ecf20Sopenharmony_ci	int cmdline_count;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	struct func_map *func_map;
458c2ecf20Sopenharmony_ci	struct func_resolver *func_resolver;
468c2ecf20Sopenharmony_ci	struct func_list *funclist;
478c2ecf20Sopenharmony_ci	unsigned int func_count;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	struct printk_map *printk_map;
508c2ecf20Sopenharmony_ci	struct printk_list *printklist;
518c2ecf20Sopenharmony_ci	unsigned int printk_count;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	struct tep_event **events;
548c2ecf20Sopenharmony_ci	int nr_events;
558c2ecf20Sopenharmony_ci	struct tep_event **sort_events;
568c2ecf20Sopenharmony_ci	enum tep_event_sort_type last_type;
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	int type_offset;
598c2ecf20Sopenharmony_ci	int type_size;
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	int pid_offset;
628c2ecf20Sopenharmony_ci	int pid_size;
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	int pc_offset;
658c2ecf20Sopenharmony_ci	int pc_size;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	int flags_offset;
688c2ecf20Sopenharmony_ci	int flags_size;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	int ld_offset;
718c2ecf20Sopenharmony_ci	int ld_size;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci	int test_filters;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	int flags;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	struct tep_format_field *bprint_ip_field;
788c2ecf20Sopenharmony_ci	struct tep_format_field *bprint_fmt_field;
798c2ecf20Sopenharmony_ci	struct tep_format_field *bprint_buf_field;
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	struct event_handler *handlers;
828c2ecf20Sopenharmony_ci	struct tep_function_handler *func_handlers;
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	/* cache */
858c2ecf20Sopenharmony_ci	struct tep_event *last_event;
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	struct tep_plugins_dir *plugins_dir;
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_cienum tep_print_parse_type {
918c2ecf20Sopenharmony_ci	PRINT_FMT_STRING,
928c2ecf20Sopenharmony_ci	PRINT_FMT_ARG_DIGIT,
938c2ecf20Sopenharmony_ci	PRINT_FMT_ARG_POINTER,
948c2ecf20Sopenharmony_ci	PRINT_FMT_ARG_STRING,
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistruct tep_print_parse {
988c2ecf20Sopenharmony_ci	struct tep_print_parse	*next;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	char				*format;
1018c2ecf20Sopenharmony_ci	int				ls;
1028c2ecf20Sopenharmony_ci	enum tep_print_parse_type	type;
1038c2ecf20Sopenharmony_ci	struct tep_print_arg		*arg;
1048c2ecf20Sopenharmony_ci	struct tep_print_arg		*len_as_arg;
1058c2ecf20Sopenharmony_ci};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_civoid free_tep_event(struct tep_event *event);
1088c2ecf20Sopenharmony_civoid free_tep_format_field(struct tep_format_field *field);
1098c2ecf20Sopenharmony_civoid free_tep_plugin_paths(struct tep_handle *tep);
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ciunsigned short data2host2(struct tep_handle *tep, unsigned short data);
1128c2ecf20Sopenharmony_ciunsigned int data2host4(struct tep_handle *tep, unsigned int data);
1138c2ecf20Sopenharmony_ciunsigned long long data2host8(struct tep_handle *tep, unsigned long long data);
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* access to the internal parser */
1168c2ecf20Sopenharmony_ciint peek_char(void);
1178c2ecf20Sopenharmony_civoid init_input_buf(const char *buf, unsigned long long size);
1188c2ecf20Sopenharmony_ciunsigned long long get_input_buf_ptr(void);
1198c2ecf20Sopenharmony_ciconst char *get_input_buf(void);
1208c2ecf20Sopenharmony_cienum tep_event_type read_token(char **tok);
1218c2ecf20Sopenharmony_civoid free_token(char *tok);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#endif /* _PARSE_EVENTS_INT_H */
124