diff options
Diffstat (limited to 'parse-events.c')
-rw-r--r-- | parse-events.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/parse-events.c b/parse-events.c index 818be40..49cde00 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -503,9 +503,9 @@ void pevent_print_printk(struct pevent *pevent) | |||
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | static struct event *alloc_event(void) | 506 | static struct event_format *alloc_event(void) |
507 | { | 507 | { |
508 | struct event *event; | 508 | struct event_format *event; |
509 | 509 | ||
510 | event = malloc_or_die(sizeof(*event)); | 510 | event = malloc_or_die(sizeof(*event)); |
511 | memset(event, 0, sizeof(*event)); | 511 | memset(event, 0, sizeof(*event)); |
@@ -525,7 +525,7 @@ enum event_type { | |||
525 | EVENT_SQUOTE, | 525 | EVENT_SQUOTE, |
526 | }; | 526 | }; |
527 | 527 | ||
528 | static void add_event(struct pevent *pevent, struct event *event) | 528 | static void add_event(struct pevent *pevent, struct event_format *event) |
529 | { | 529 | { |
530 | event->next = pevent->event_list; | 530 | event->next = pevent->event_list; |
531 | pevent->event_list = event; | 531 | pevent->event_list = event; |
@@ -966,7 +966,7 @@ static int field_is_dynamic(struct format_field *field) | |||
966 | return 0; | 966 | return 0; |
967 | } | 967 | } |
968 | 968 | ||
969 | static int event_read_fields(struct event *event, struct format_field **fields) | 969 | static int event_read_fields(struct event_format *event, struct format_field **fields) |
970 | { | 970 | { |
971 | struct format_field *field = NULL; | 971 | struct format_field *field = NULL; |
972 | enum event_type type; | 972 | enum event_type type; |
@@ -1190,7 +1190,7 @@ fail_expect: | |||
1190 | return -1; | 1190 | return -1; |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | static int event_read_format(struct event *event) | 1193 | static int event_read_format(struct event_format *event) |
1194 | { | 1194 | { |
1195 | char *token; | 1195 | char *token; |
1196 | int ret; | 1196 | int ret; |
@@ -1223,11 +1223,11 @@ static int event_read_format(struct event *event) | |||
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | static enum event_type | 1225 | static enum event_type |
1226 | process_arg_token(struct event *event, struct print_arg *arg, | 1226 | process_arg_token(struct event_format *event, struct print_arg *arg, |
1227 | char **tok, enum event_type type); | 1227 | char **tok, enum event_type type); |
1228 | 1228 | ||
1229 | static enum event_type | 1229 | static enum event_type |
1230 | process_arg(struct event *event, struct print_arg *arg, char **tok) | 1230 | process_arg(struct event_format *event, struct print_arg *arg, char **tok) |
1231 | { | 1231 | { |
1232 | enum event_type type; | 1232 | enum event_type type; |
1233 | char *token; | 1233 | char *token; |
@@ -1239,7 +1239,7 @@ process_arg(struct event *event, struct print_arg *arg, char **tok) | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | static enum event_type | 1241 | static enum event_type |
1242 | process_cond(struct event *event, struct print_arg *top, char **tok) | 1242 | process_cond(struct event_format *event, struct print_arg *top, char **tok) |
1243 | { | 1243 | { |
1244 | struct print_arg *arg, *left, *right; | 1244 | struct print_arg *arg, *left, *right; |
1245 | enum event_type type; | 1245 | enum event_type type; |
@@ -1279,7 +1279,7 @@ out_free: | |||
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | static enum event_type | 1281 | static enum event_type |
1282 | process_array(struct event *event, struct print_arg *top, char **tok) | 1282 | process_array(struct event_format *event, struct print_arg *top, char **tok) |
1283 | { | 1283 | { |
1284 | struct print_arg *arg; | 1284 | struct print_arg *arg; |
1285 | enum event_type type; | 1285 | enum event_type type; |
@@ -1372,7 +1372,7 @@ static void set_op_prio(struct print_arg *arg) | |||
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | static enum event_type | 1374 | static enum event_type |
1375 | process_op(struct event *event, struct print_arg *arg, char **tok) | 1375 | process_op(struct event_format *event, struct print_arg *arg, char **tok) |
1376 | { | 1376 | { |
1377 | struct print_arg *left, *right = NULL; | 1377 | struct print_arg *left, *right = NULL; |
1378 | enum event_type type; | 1378 | enum event_type type; |
@@ -1505,7 +1505,7 @@ process_op(struct event *event, struct print_arg *arg, char **tok) | |||
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | static enum event_type | 1507 | static enum event_type |
1508 | process_entry(struct event *event __unused, struct print_arg *arg, | 1508 | process_entry(struct event_format *event __unused, struct print_arg *arg, |
1509 | char **tok) | 1509 | char **tok) |
1510 | { | 1510 | { |
1511 | enum event_type type; | 1511 | enum event_type type; |
@@ -1770,7 +1770,7 @@ static char *arg_eval (struct print_arg *arg) | |||
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | static enum event_type | 1772 | static enum event_type |
1773 | process_fields(struct event *event, struct print_flag_sym **list, char **tok) | 1773 | process_fields(struct event_format *event, struct print_flag_sym **list, char **tok) |
1774 | { | 1774 | { |
1775 | enum event_type type; | 1775 | enum event_type type; |
1776 | struct print_arg *arg = NULL; | 1776 | struct print_arg *arg = NULL; |
@@ -1825,7 +1825,7 @@ out_free: | |||
1825 | } | 1825 | } |
1826 | 1826 | ||
1827 | static enum event_type | 1827 | static enum event_type |
1828 | process_flags(struct event *event, struct print_arg *arg, char **tok) | 1828 | process_flags(struct event_format *event, struct print_arg *arg, char **tok) |
1829 | { | 1829 | { |
1830 | struct print_arg *field; | 1830 | struct print_arg *field; |
1831 | enum event_type type; | 1831 | enum event_type type; |
@@ -1868,7 +1868,7 @@ out_free: | |||
1868 | } | 1868 | } |
1869 | 1869 | ||
1870 | static enum event_type | 1870 | static enum event_type |
1871 | process_symbols(struct event *event, struct print_arg *arg, char **tok) | 1871 | process_symbols(struct event_format *event, struct print_arg *arg, char **tok) |
1872 | { | 1872 | { |
1873 | struct print_arg *field; | 1873 | struct print_arg *field; |
1874 | enum event_type type; | 1874 | enum event_type type; |
@@ -1902,7 +1902,7 @@ out_free: | |||
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | static enum event_type | 1904 | static enum event_type |
1905 | process_dynamic_array(struct event *event, struct print_arg *arg, char **tok) | 1905 | process_dynamic_array(struct event_format *event, struct print_arg *arg, char **tok) |
1906 | { | 1906 | { |
1907 | struct format_field *field; | 1907 | struct format_field *field; |
1908 | enum event_type type; | 1908 | enum event_type type; |
@@ -1959,7 +1959,7 @@ out_free: | |||
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | static enum event_type | 1961 | static enum event_type |
1962 | process_paren(struct event *event, struct print_arg *arg, char **tok) | 1962 | process_paren(struct event_format *event, struct print_arg *arg, char **tok) |
1963 | { | 1963 | { |
1964 | struct print_arg *item_arg; | 1964 | struct print_arg *item_arg; |
1965 | enum event_type type; | 1965 | enum event_type type; |
@@ -2012,7 +2012,7 @@ process_paren(struct event *event, struct print_arg *arg, char **tok) | |||
2012 | 2012 | ||
2013 | 2013 | ||
2014 | static enum event_type | 2014 | static enum event_type |
2015 | process_str(struct event *event __unused, struct print_arg *arg, char **tok) | 2015 | process_str(struct event_format *event __unused, struct print_arg *arg, char **tok) |
2016 | { | 2016 | { |
2017 | enum event_type type; | 2017 | enum event_type type; |
2018 | char *token; | 2018 | char *token; |
@@ -2040,7 +2040,7 @@ fail: | |||
2040 | } | 2040 | } |
2041 | 2041 | ||
2042 | static enum event_type | 2042 | static enum event_type |
2043 | process_arg_token(struct event *event, struct print_arg *arg, | 2043 | process_arg_token(struct event_format *event, struct print_arg *arg, |
2044 | char **tok, enum event_type type) | 2044 | char **tok, enum event_type type) |
2045 | { | 2045 | { |
2046 | char *token; | 2046 | char *token; |
@@ -2117,7 +2117,7 @@ process_arg_token(struct event *event, struct print_arg *arg, | |||
2117 | return type; | 2117 | return type; |
2118 | } | 2118 | } |
2119 | 2119 | ||
2120 | static int event_read_print_args(struct event *event, struct print_arg **list) | 2120 | static int event_read_print_args(struct event_format *event, struct print_arg **list) |
2121 | { | 2121 | { |
2122 | enum event_type type = EVENT_ERROR; | 2122 | enum event_type type = EVENT_ERROR; |
2123 | struct print_arg *arg; | 2123 | struct print_arg *arg; |
@@ -2165,7 +2165,7 @@ static int event_read_print_args(struct event *event, struct print_arg **list) | |||
2165 | return args; | 2165 | return args; |
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | static int event_read_print(struct event *event) | 2168 | static int event_read_print(struct event_format *event) |
2169 | { | 2169 | { |
2170 | enum event_type type; | 2170 | enum event_type type; |
2171 | char *token; | 2171 | char *token; |
@@ -2233,7 +2233,7 @@ static int event_read_print(struct event *event) | |||
2233 | * This only searchs the common fields and not all field. | 2233 | * This only searchs the common fields and not all field. |
2234 | */ | 2234 | */ |
2235 | struct format_field * | 2235 | struct format_field * |
2236 | pevent_find_common_field(struct event *event, const char *name) | 2236 | pevent_find_common_field(struct event_format *event, const char *name) |
2237 | { | 2237 | { |
2238 | struct format_field *format; | 2238 | struct format_field *format; |
2239 | 2239 | ||
@@ -2255,7 +2255,7 @@ pevent_find_common_field(struct event *event, const char *name) | |||
2255 | * This does not search common fields. | 2255 | * This does not search common fields. |
2256 | */ | 2256 | */ |
2257 | struct format_field * | 2257 | struct format_field * |
2258 | pevent_find_field(struct event *event, const char *name) | 2258 | pevent_find_field(struct event_format *event, const char *name) |
2259 | { | 2259 | { |
2260 | struct format_field *format; | 2260 | struct format_field *format; |
2261 | 2261 | ||
@@ -2278,7 +2278,7 @@ pevent_find_field(struct event *event, const char *name) | |||
2278 | * the non-common ones if a common one was not found. | 2278 | * the non-common ones if a common one was not found. |
2279 | */ | 2279 | */ |
2280 | struct format_field * | 2280 | struct format_field * |
2281 | pevent_find_any_field(struct event *event, const char *name) | 2281 | pevent_find_any_field(struct event_format *event, const char *name) |
2282 | { | 2282 | { |
2283 | struct format_field *format; | 2283 | struct format_field *format; |
2284 | 2284 | ||
@@ -2345,7 +2345,7 @@ int pevent_read_number_field(struct format_field *field, const void *data, | |||
2345 | static int get_common_info(struct pevent *pevent, | 2345 | static int get_common_info(struct pevent *pevent, |
2346 | const char *type, int *offset, int *size) | 2346 | const char *type, int *offset, int *size) |
2347 | { | 2347 | { |
2348 | struct event *event; | 2348 | struct event_format *event; |
2349 | struct format_field *field; | 2349 | struct format_field *field; |
2350 | 2350 | ||
2351 | /* | 2351 | /* |
@@ -2427,9 +2427,9 @@ static int parse_common_lock_depth(struct pevent *pevent, void *data) | |||
2427 | * | 2427 | * |
2428 | * Returns an event that has a given @id. | 2428 | * Returns an event that has a given @id. |
2429 | */ | 2429 | */ |
2430 | struct event *pevent_find_event(struct pevent *pevent, int id) | 2430 | struct event_format *pevent_find_event(struct pevent *pevent, int id) |
2431 | { | 2431 | { |
2432 | struct event *event; | 2432 | struct event_format *event; |
2433 | 2433 | ||
2434 | for (event = pevent->event_list; event; event = event->next) { | 2434 | for (event = pevent->event_list; event; event = event->next) { |
2435 | if (event->id == id) | 2435 | if (event->id == id) |
@@ -2447,11 +2447,11 @@ struct event *pevent_find_event(struct pevent *pevent, int id) | |||
2447 | * This returns an event with a given @name and under the system | 2447 | * This returns an event with a given @name and under the system |
2448 | * @sys. If @sys is NULL the first event with @name is returned. | 2448 | * @sys. If @sys is NULL the first event with @name is returned. |
2449 | */ | 2449 | */ |
2450 | struct event * | 2450 | struct event_format * |
2451 | pevent_find_event_by_name(struct pevent *pevent, | 2451 | pevent_find_event_by_name(struct pevent *pevent, |
2452 | const char *sys, const char *name) | 2452 | const char *sys, const char *name) |
2453 | { | 2453 | { |
2454 | struct event *event; | 2454 | struct event_format *event; |
2455 | 2455 | ||
2456 | for (event = pevent->event_list; event; event = event->next) { | 2456 | for (event = pevent->event_list; event; event = event->next) { |
2457 | if (strcmp(event->name, name) == 0) { | 2457 | if (strcmp(event->name, name) == 0) { |
@@ -2465,7 +2465,7 @@ pevent_find_event_by_name(struct pevent *pevent, | |||
2465 | } | 2465 | } |
2466 | 2466 | ||
2467 | static unsigned long long | 2467 | static unsigned long long |
2468 | eval_num_arg(void *data, int size, struct event *event, struct print_arg *arg) | 2468 | eval_num_arg(void *data, int size, struct event_format *event, struct print_arg *arg) |
2469 | { | 2469 | { |
2470 | struct pevent *pevent = event->pevent; | 2470 | struct pevent *pevent = event->pevent; |
2471 | unsigned long long val = 0; | 2471 | unsigned long long val = 0; |
@@ -2655,7 +2655,7 @@ static unsigned long long eval_flag(const char *flag) | |||
2655 | } | 2655 | } |
2656 | 2656 | ||
2657 | static void print_str_arg(struct trace_seq *s, void *data, int size, | 2657 | static void print_str_arg(struct trace_seq *s, void *data, int size, |
2658 | struct event *event, struct print_arg *arg) | 2658 | struct event_format *event, struct print_arg *arg) |
2659 | { | 2659 | { |
2660 | struct pevent *pevent = event->pevent; | 2660 | struct pevent *pevent = event->pevent; |
2661 | struct print_flag_sym *flag; | 2661 | struct print_flag_sym *flag; |
@@ -2761,7 +2761,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
2761 | } | 2761 | } |
2762 | } | 2762 | } |
2763 | 2763 | ||
2764 | static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struct event *event) | 2764 | static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struct event_format *event) |
2765 | { | 2765 | { |
2766 | struct pevent *pevent = event->pevent; | 2766 | struct pevent *pevent = event->pevent; |
2767 | struct format_field *field, *ip_field; | 2767 | struct format_field *field, *ip_field; |
@@ -2881,7 +2881,7 @@ static void free_args(struct print_arg *args) | |||
2881 | } | 2881 | } |
2882 | 2882 | ||
2883 | static char * | 2883 | static char * |
2884 | get_bprint_format(void *data, int size __unused, struct event *event) | 2884 | get_bprint_format(void *data, int size __unused, struct event_format *event) |
2885 | { | 2885 | { |
2886 | struct pevent *pevent = event->pevent; | 2886 | struct pevent *pevent = event->pevent; |
2887 | unsigned long long addr; | 2887 | unsigned long long addr; |
@@ -2928,7 +2928,7 @@ get_bprint_format(void *data, int size __unused, struct event *event) | |||
2928 | return format; | 2928 | return format; |
2929 | } | 2929 | } |
2930 | 2930 | ||
2931 | static void pretty_print(struct trace_seq *s, void *data, int size, struct event *event) | 2931 | static void pretty_print(struct trace_seq *s, void *data, int size, struct event_format *event) |
2932 | { | 2932 | { |
2933 | struct pevent *pevent = event->pevent; | 2933 | struct pevent *pevent = event->pevent; |
2934 | struct print_fmt *print_fmt = &event->print_fmt; | 2934 | struct print_fmt *print_fmt = &event->print_fmt; |
@@ -3169,7 +3169,7 @@ int pevent_data_type(struct pevent *pevent, struct record *rec) | |||
3169 | * | 3169 | * |
3170 | * This returns the event form a given @type; | 3170 | * This returns the event form a given @type; |
3171 | */ | 3171 | */ |
3172 | struct event *pevent_data_event_from_type(struct pevent *pevent, int type) | 3172 | struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type) |
3173 | { | 3173 | { |
3174 | return pevent_find_event(pevent, type); | 3174 | return pevent_find_event(pevent, type); |
3175 | } | 3175 | } |
@@ -3214,7 +3214,7 @@ const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid) | |||
3214 | * This parses the raw @data using the given @event information and | 3214 | * This parses the raw @data using the given @event information and |
3215 | * writes the print format into the trace_seq. | 3215 | * writes the print format into the trace_seq. |
3216 | */ | 3216 | */ |
3217 | void pevent_event_info(struct trace_seq *s, struct event *event, | 3217 | void pevent_event_info(struct trace_seq *s, struct event_format *event, |
3218 | int cpu, void *data, int size, unsigned long long nsecs) | 3218 | int cpu, void *data, int size, unsigned long long nsecs) |
3219 | { | 3219 | { |
3220 | if (event->handler) | 3220 | if (event->handler) |
@@ -3229,7 +3229,7 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
3229 | int cpu, void *data, int size, unsigned long long nsecs) | 3229 | int cpu, void *data, int size, unsigned long long nsecs) |
3230 | { | 3230 | { |
3231 | static char *spaces = " "; /* 20 spaces */ | 3231 | static char *spaces = " "; /* 20 spaces */ |
3232 | struct event *event; | 3232 | struct event_format *event; |
3233 | unsigned long secs; | 3233 | unsigned long secs; |
3234 | unsigned long usecs; | 3234 | unsigned long usecs; |
3235 | const char *comm; | 3235 | const char *comm; |
@@ -3276,8 +3276,8 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
3276 | 3276 | ||
3277 | static int events_id_cmp(const void *a, const void *b) | 3277 | static int events_id_cmp(const void *a, const void *b) |
3278 | { | 3278 | { |
3279 | struct event * const * ea = a; | 3279 | struct event_format * const * ea = a; |
3280 | struct event * const * eb = b; | 3280 | struct event_format * const * eb = b; |
3281 | 3281 | ||
3282 | if ((*ea)->id < (*eb)->id) | 3282 | if ((*ea)->id < (*eb)->id) |
3283 | return -1; | 3283 | return -1; |
@@ -3290,8 +3290,8 @@ static int events_id_cmp(const void *a, const void *b) | |||
3290 | 3290 | ||
3291 | static int events_name_cmp(const void *a, const void *b) | 3291 | static int events_name_cmp(const void *a, const void *b) |
3292 | { | 3292 | { |
3293 | struct event * const * ea = a; | 3293 | struct event_format * const * ea = a; |
3294 | struct event * const * eb = b; | 3294 | struct event_format * const * eb = b; |
3295 | int res; | 3295 | int res; |
3296 | 3296 | ||
3297 | res = strcmp((*ea)->name, (*eb)->name); | 3297 | res = strcmp((*ea)->name, (*eb)->name); |
@@ -3307,8 +3307,8 @@ static int events_name_cmp(const void *a, const void *b) | |||
3307 | 3307 | ||
3308 | static int events_system_cmp(const void *a, const void *b) | 3308 | static int events_system_cmp(const void *a, const void *b) |
3309 | { | 3309 | { |
3310 | struct event * const * ea = a; | 3310 | struct event_format * const * ea = a; |
3311 | struct event * const * eb = b; | 3311 | struct event_format * const * eb = b; |
3312 | int res; | 3312 | int res; |
3313 | 3313 | ||
3314 | res = strcmp((*ea)->system, (*eb)->system); | 3314 | res = strcmp((*ea)->system, (*eb)->system); |
@@ -3322,10 +3322,10 @@ static int events_system_cmp(const void *a, const void *b) | |||
3322 | return events_id_cmp(a, b); | 3322 | return events_id_cmp(a, b); |
3323 | } | 3323 | } |
3324 | 3324 | ||
3325 | struct event **pevent_list_events(struct pevent *pevent, enum event_sort_type sort_type) | 3325 | struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type sort_type) |
3326 | { | 3326 | { |
3327 | struct event **events; | 3327 | struct event_format **events; |
3328 | struct event *event; | 3328 | struct event_format *event; |
3329 | int (*sort)(const void *a, const void *b); | 3329 | int (*sort)(const void *a, const void *b); |
3330 | int i = 0; | 3330 | int i = 0; |
3331 | 3331 | ||
@@ -3564,7 +3564,7 @@ int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long siz | |||
3564 | int pevent_parse_event(struct pevent *pevent, | 3564 | int pevent_parse_event(struct pevent *pevent, |
3565 | char *buf, unsigned long size, char *sys) | 3565 | char *buf, unsigned long size, char *sys) |
3566 | { | 3566 | { |
3567 | struct event *event; | 3567 | struct event_format *event; |
3568 | int ret; | 3568 | int ret; |
3569 | 3569 | ||
3570 | init_input_buf(buf, size); | 3570 | init_input_buf(buf, size); |
@@ -3657,7 +3657,7 @@ int pevent_register_event_handler(struct pevent *pevent, | |||
3657 | int id, char *sys_name, char *event_name, | 3657 | int id, char *sys_name, char *event_name, |
3658 | pevent_event_handler_func func) | 3658 | pevent_event_handler_func func) |
3659 | { | 3659 | { |
3660 | struct event *event; | 3660 | struct event_format *event; |
3661 | 3661 | ||
3662 | if (id >= 0) { | 3662 | if (id >= 0) { |
3663 | /* search by id */ | 3663 | /* search by id */ |
@@ -3701,7 +3701,7 @@ static void free_formats(struct format *format) | |||
3701 | /* IMPLEMENT ME */ | 3701 | /* IMPLEMENT ME */ |
3702 | } | 3702 | } |
3703 | 3703 | ||
3704 | static void free_event(struct event *event) | 3704 | static void free_event(struct event_format *event) |
3705 | { | 3705 | { |
3706 | free(event->name); | 3706 | free(event->name); |
3707 | free(event->system); | 3707 | free(event->system); |
@@ -3718,7 +3718,7 @@ static void free_event(struct event *event) | |||
3718 | */ | 3718 | */ |
3719 | void pevent_free(struct pevent *pevent) | 3719 | void pevent_free(struct pevent *pevent) |
3720 | { | 3720 | { |
3721 | struct event *event, *next_event; | 3721 | struct event_format *event, *next_event; |
3722 | 3722 | ||
3723 | free(pevent->cmdlines); | 3723 | free(pevent->cmdlines); |
3724 | free(pevent->cmdlist); | 3724 | free(pevent->cmdlist); |