diff options
| author | Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> | 2018-09-19 14:56:47 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-09-19 16:14:58 -0400 |
| commit | f25d9e09e9354bded677d21b51a7b1879cfa02a8 (patch) | |
| tree | df1f68c0740d7071887f7c1ac12c6836a640d3eb | |
| parent | bb39ccb204cc2e8135660b9cb768ffcf242bf33e (diff) | |
tools lib traceevent: Rename enum event_{sort_}type to enum tep_event_{sort_}type
In order to make libtraceevent into a proper library, variables, data
structures and functions require a unique prefix to prevent name space
conflicts. That prefix will be "tep_". This renames enum event_type to
enum tep_event_type, enum event_sort_type to enum tep_event_sort_type
and add prefix TEP_ to all enum's members
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lkml.kernel.org/r/20180919185722.961022207@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/lib/traceevent/event-parse.c | 488 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.h | 34 | ||||
| -rw-r--r-- | tools/lib/traceevent/parse-filter.c | 36 |
3 files changed, 279 insertions, 279 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 508c89365c90..1696dd9534bc 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
| @@ -770,12 +770,12 @@ static int add_event(struct tep_handle *pevent, struct tep_event_format *event) | |||
| 770 | return 0; | 770 | return 0; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | static int event_item_type(enum event_type type) | 773 | static int event_item_type(enum tep_event_type type) |
| 774 | { | 774 | { |
| 775 | switch (type) { | 775 | switch (type) { |
| 776 | case EVENT_ITEM ... EVENT_SQUOTE: | 776 | case TEP_EVENT_ITEM ... TEP_EVENT_SQUOTE: |
| 777 | return 1; | 777 | return 1; |
| 778 | case EVENT_ERROR ... EVENT_DELIM: | 778 | case TEP_EVENT_ERROR ... TEP_EVENT_DELIM: |
| 779 | default: | 779 | default: |
| 780 | return 0; | 780 | return 0; |
| 781 | } | 781 | } |
| @@ -863,24 +863,24 @@ static void free_arg(struct print_arg *arg) | |||
| 863 | free(arg); | 863 | free(arg); |
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | static enum event_type get_type(int ch) | 866 | static enum tep_event_type get_type(int ch) |
| 867 | { | 867 | { |
| 868 | if (ch == '\n') | 868 | if (ch == '\n') |
| 869 | return EVENT_NEWLINE; | 869 | return TEP_EVENT_NEWLINE; |
| 870 | if (isspace(ch)) | 870 | if (isspace(ch)) |
| 871 | return EVENT_SPACE; | 871 | return TEP_EVENT_SPACE; |
| 872 | if (isalnum(ch) || ch == '_') | 872 | if (isalnum(ch) || ch == '_') |
| 873 | return EVENT_ITEM; | 873 | return TEP_EVENT_ITEM; |
| 874 | if (ch == '\'') | 874 | if (ch == '\'') |
| 875 | return EVENT_SQUOTE; | 875 | return TEP_EVENT_SQUOTE; |
| 876 | if (ch == '"') | 876 | if (ch == '"') |
| 877 | return EVENT_DQUOTE; | 877 | return TEP_EVENT_DQUOTE; |
| 878 | if (!isprint(ch)) | 878 | if (!isprint(ch)) |
| 879 | return EVENT_NONE; | 879 | return TEP_EVENT_NONE; |
| 880 | if (ch == '(' || ch == ')' || ch == ',') | 880 | if (ch == '(' || ch == ')' || ch == ',') |
| 881 | return EVENT_DELIM; | 881 | return TEP_EVENT_DELIM; |
| 882 | 882 | ||
| 883 | return EVENT_OP; | 883 | return TEP_EVENT_OP; |
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | static int __read_char(void) | 886 | static int __read_char(void) |
| @@ -928,38 +928,38 @@ static int extend_token(char **tok, char *buf, int size) | |||
| 928 | return 0; | 928 | return 0; |
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | static enum event_type force_token(const char *str, char **tok); | 931 | static enum tep_event_type force_token(const char *str, char **tok); |
| 932 | 932 | ||
| 933 | static enum event_type __read_token(char **tok) | 933 | static enum tep_event_type __read_token(char **tok) |
| 934 | { | 934 | { |
| 935 | char buf[BUFSIZ]; | 935 | char buf[BUFSIZ]; |
| 936 | int ch, last_ch, quote_ch, next_ch; | 936 | int ch, last_ch, quote_ch, next_ch; |
| 937 | int i = 0; | 937 | int i = 0; |
| 938 | int tok_size = 0; | 938 | int tok_size = 0; |
| 939 | enum event_type type; | 939 | enum tep_event_type type; |
| 940 | 940 | ||
| 941 | *tok = NULL; | 941 | *tok = NULL; |
| 942 | 942 | ||
| 943 | 943 | ||
| 944 | ch = __read_char(); | 944 | ch = __read_char(); |
| 945 | if (ch < 0) | 945 | if (ch < 0) |
| 946 | return EVENT_NONE; | 946 | return TEP_EVENT_NONE; |
| 947 | 947 | ||
| 948 | type = get_type(ch); | 948 | type = get_type(ch); |
| 949 | if (type == EVENT_NONE) | 949 | if (type == TEP_EVENT_NONE) |
| 950 | return type; | 950 | return type; |
| 951 | 951 | ||
| 952 | buf[i++] = ch; | 952 | buf[i++] = ch; |
| 953 | 953 | ||
| 954 | switch (type) { | 954 | switch (type) { |
| 955 | case EVENT_NEWLINE: | 955 | case TEP_EVENT_NEWLINE: |
| 956 | case EVENT_DELIM: | 956 | case TEP_EVENT_DELIM: |
| 957 | if (asprintf(tok, "%c", ch) < 0) | 957 | if (asprintf(tok, "%c", ch) < 0) |
| 958 | return EVENT_ERROR; | 958 | return TEP_EVENT_ERROR; |
| 959 | 959 | ||
| 960 | return type; | 960 | return type; |
| 961 | 961 | ||
| 962 | case EVENT_OP: | 962 | case TEP_EVENT_OP: |
| 963 | switch (ch) { | 963 | switch (ch) { |
| 964 | case '-': | 964 | case '-': |
| 965 | next_ch = __peek_char(); | 965 | next_ch = __peek_char(); |
| @@ -1002,8 +1002,8 @@ static enum event_type __read_token(char **tok) | |||
| 1002 | buf[i++] = __read_char(); | 1002 | buf[i++] = __read_char(); |
| 1003 | goto out; | 1003 | goto out; |
| 1004 | 1004 | ||
| 1005 | case EVENT_DQUOTE: | 1005 | case TEP_EVENT_DQUOTE: |
| 1006 | case EVENT_SQUOTE: | 1006 | case TEP_EVENT_SQUOTE: |
| 1007 | /* don't keep quotes */ | 1007 | /* don't keep quotes */ |
| 1008 | i--; | 1008 | i--; |
| 1009 | quote_ch = ch; | 1009 | quote_ch = ch; |
| @@ -1015,7 +1015,7 @@ static enum event_type __read_token(char **tok) | |||
| 1015 | tok_size += BUFSIZ; | 1015 | tok_size += BUFSIZ; |
| 1016 | 1016 | ||
| 1017 | if (extend_token(tok, buf, tok_size) < 0) | 1017 | if (extend_token(tok, buf, tok_size) < 0) |
| 1018 | return EVENT_NONE; | 1018 | return TEP_EVENT_NONE; |
| 1019 | i = 0; | 1019 | i = 0; |
| 1020 | } | 1020 | } |
| 1021 | last_ch = ch; | 1021 | last_ch = ch; |
| @@ -1032,7 +1032,7 @@ static enum event_type __read_token(char **tok) | |||
| 1032 | * For strings (double quotes) check the next token. | 1032 | * For strings (double quotes) check the next token. |
| 1033 | * If it is another string, concatinate the two. | 1033 | * If it is another string, concatinate the two. |
| 1034 | */ | 1034 | */ |
| 1035 | if (type == EVENT_DQUOTE) { | 1035 | if (type == TEP_EVENT_DQUOTE) { |
| 1036 | unsigned long long save_input_buf_ptr = input_buf_ptr; | 1036 | unsigned long long save_input_buf_ptr = input_buf_ptr; |
| 1037 | 1037 | ||
| 1038 | do { | 1038 | do { |
| @@ -1045,8 +1045,8 @@ static enum event_type __read_token(char **tok) | |||
| 1045 | 1045 | ||
| 1046 | goto out; | 1046 | goto out; |
| 1047 | 1047 | ||
| 1048 | case EVENT_ERROR ... EVENT_SPACE: | 1048 | case TEP_EVENT_ERROR ... TEP_EVENT_SPACE: |
| 1049 | case EVENT_ITEM: | 1049 | case TEP_EVENT_ITEM: |
| 1050 | default: | 1050 | default: |
| 1051 | break; | 1051 | break; |
| 1052 | } | 1052 | } |
| @@ -1057,7 +1057,7 @@ static enum event_type __read_token(char **tok) | |||
| 1057 | tok_size += BUFSIZ; | 1057 | tok_size += BUFSIZ; |
| 1058 | 1058 | ||
| 1059 | if (extend_token(tok, buf, tok_size) < 0) | 1059 | if (extend_token(tok, buf, tok_size) < 0) |
| 1060 | return EVENT_NONE; | 1060 | return TEP_EVENT_NONE; |
| 1061 | i = 0; | 1061 | i = 0; |
| 1062 | } | 1062 | } |
| 1063 | ch = __read_char(); | 1063 | ch = __read_char(); |
| @@ -1067,9 +1067,9 @@ static enum event_type __read_token(char **tok) | |||
| 1067 | out: | 1067 | out: |
| 1068 | buf[i] = 0; | 1068 | buf[i] = 0; |
| 1069 | if (extend_token(tok, buf, tok_size + i + 1) < 0) | 1069 | if (extend_token(tok, buf, tok_size + i + 1) < 0) |
| 1070 | return EVENT_NONE; | 1070 | return TEP_EVENT_NONE; |
| 1071 | 1071 | ||
| 1072 | if (type == EVENT_ITEM) { | 1072 | if (type == TEP_EVENT_ITEM) { |
| 1073 | /* | 1073 | /* |
| 1074 | * Older versions of the kernel has a bug that | 1074 | * Older versions of the kernel has a bug that |
| 1075 | * creates invalid symbols and will break the mac80211 | 1075 | * creates invalid symbols and will break the mac80211 |
| @@ -1096,12 +1096,12 @@ static enum event_type __read_token(char **tok) | |||
| 1096 | return type; | 1096 | return type; |
| 1097 | } | 1097 | } |
| 1098 | 1098 | ||
| 1099 | static enum event_type force_token(const char *str, char **tok) | 1099 | static enum tep_event_type force_token(const char *str, char **tok) |
| 1100 | { | 1100 | { |
| 1101 | const char *save_input_buf; | 1101 | const char *save_input_buf; |
| 1102 | unsigned long long save_input_buf_ptr; | 1102 | unsigned long long save_input_buf_ptr; |
| 1103 | unsigned long long save_input_buf_siz; | 1103 | unsigned long long save_input_buf_siz; |
| 1104 | enum event_type type; | 1104 | enum tep_event_type type; |
| 1105 | 1105 | ||
| 1106 | /* save off the current input pointers */ | 1106 | /* save off the current input pointers */ |
| 1107 | save_input_buf = input_buf; | 1107 | save_input_buf = input_buf; |
| @@ -1126,13 +1126,13 @@ static void free_token(char *tok) | |||
| 1126 | free(tok); | 1126 | free(tok); |
| 1127 | } | 1127 | } |
| 1128 | 1128 | ||
| 1129 | static enum event_type read_token(char **tok) | 1129 | static enum tep_event_type read_token(char **tok) |
| 1130 | { | 1130 | { |
| 1131 | enum event_type type; | 1131 | enum tep_event_type type; |
| 1132 | 1132 | ||
| 1133 | for (;;) { | 1133 | for (;;) { |
| 1134 | type = __read_token(tok); | 1134 | type = __read_token(tok); |
| 1135 | if (type != EVENT_SPACE) | 1135 | if (type != TEP_EVENT_SPACE) |
| 1136 | return type; | 1136 | return type; |
| 1137 | 1137 | ||
| 1138 | free_token(*tok); | 1138 | free_token(*tok); |
| @@ -1140,7 +1140,7 @@ static enum event_type read_token(char **tok) | |||
| 1140 | 1140 | ||
| 1141 | /* not reached */ | 1141 | /* not reached */ |
| 1142 | *tok = NULL; | 1142 | *tok = NULL; |
| 1143 | return EVENT_NONE; | 1143 | return TEP_EVENT_NONE; |
| 1144 | } | 1144 | } |
| 1145 | 1145 | ||
| 1146 | /** | 1146 | /** |
| @@ -1152,7 +1152,7 @@ static enum event_type read_token(char **tok) | |||
| 1152 | * | 1152 | * |
| 1153 | * Returns the token type. | 1153 | * Returns the token type. |
| 1154 | */ | 1154 | */ |
| 1155 | enum event_type tep_read_token(char **tok) | 1155 | enum tep_event_type tep_read_token(char **tok) |
| 1156 | { | 1156 | { |
| 1157 | return read_token(tok); | 1157 | return read_token(tok); |
| 1158 | } | 1158 | } |
| @@ -1167,13 +1167,13 @@ void tep_free_token(char *token) | |||
| 1167 | } | 1167 | } |
| 1168 | 1168 | ||
| 1169 | /* no newline */ | 1169 | /* no newline */ |
| 1170 | static enum event_type read_token_item(char **tok) | 1170 | static enum tep_event_type read_token_item(char **tok) |
| 1171 | { | 1171 | { |
| 1172 | enum event_type type; | 1172 | enum tep_event_type type; |
| 1173 | 1173 | ||
| 1174 | for (;;) { | 1174 | for (;;) { |
| 1175 | type = __read_token(tok); | 1175 | type = __read_token(tok); |
| 1176 | if (type != EVENT_SPACE && type != EVENT_NEWLINE) | 1176 | if (type != TEP_EVENT_SPACE && type != TEP_EVENT_NEWLINE) |
| 1177 | return type; | 1177 | return type; |
| 1178 | free_token(*tok); | 1178 | free_token(*tok); |
| 1179 | *tok = NULL; | 1179 | *tok = NULL; |
| @@ -1181,10 +1181,10 @@ static enum event_type read_token_item(char **tok) | |||
| 1181 | 1181 | ||
| 1182 | /* not reached */ | 1182 | /* not reached */ |
| 1183 | *tok = NULL; | 1183 | *tok = NULL; |
| 1184 | return EVENT_NONE; | 1184 | return TEP_EVENT_NONE; |
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
| 1187 | static int test_type(enum event_type type, enum event_type expect) | 1187 | static int test_type(enum tep_event_type type, enum tep_event_type expect) |
| 1188 | { | 1188 | { |
| 1189 | if (type != expect) { | 1189 | if (type != expect) { |
| 1190 | do_warning("Error: expected type %d but read %d", | 1190 | do_warning("Error: expected type %d but read %d", |
| @@ -1194,8 +1194,8 @@ static int test_type(enum event_type type, enum event_type expect) | |||
| 1194 | return 0; | 1194 | return 0; |
| 1195 | } | 1195 | } |
| 1196 | 1196 | ||
| 1197 | static int test_type_token(enum event_type type, const char *token, | 1197 | static int test_type_token(enum tep_event_type type, const char *token, |
| 1198 | enum event_type expect, const char *expect_tok) | 1198 | enum tep_event_type expect, const char *expect_tok) |
| 1199 | { | 1199 | { |
| 1200 | if (type != expect) { | 1200 | if (type != expect) { |
| 1201 | do_warning("Error: expected type %d but read %d", | 1201 | do_warning("Error: expected type %d but read %d", |
| @@ -1211,9 +1211,9 @@ static int test_type_token(enum event_type type, const char *token, | |||
| 1211 | return 0; | 1211 | return 0; |
| 1212 | } | 1212 | } |
| 1213 | 1213 | ||
| 1214 | static int __read_expect_type(enum event_type expect, char **tok, int newline_ok) | 1214 | static int __read_expect_type(enum tep_event_type expect, char **tok, int newline_ok) |
| 1215 | { | 1215 | { |
| 1216 | enum event_type type; | 1216 | enum tep_event_type type; |
| 1217 | 1217 | ||
| 1218 | if (newline_ok) | 1218 | if (newline_ok) |
| 1219 | type = read_token(tok); | 1219 | type = read_token(tok); |
| @@ -1222,15 +1222,15 @@ static int __read_expect_type(enum event_type expect, char **tok, int newline_ok | |||
| 1222 | return test_type(type, expect); | 1222 | return test_type(type, expect); |
| 1223 | } | 1223 | } |
| 1224 | 1224 | ||
| 1225 | static int read_expect_type(enum event_type expect, char **tok) | 1225 | static int read_expect_type(enum tep_event_type expect, char **tok) |
| 1226 | { | 1226 | { |
| 1227 | return __read_expect_type(expect, tok, 1); | 1227 | return __read_expect_type(expect, tok, 1); |
| 1228 | } | 1228 | } |
| 1229 | 1229 | ||
| 1230 | static int __read_expected(enum event_type expect, const char *str, | 1230 | static int __read_expected(enum tep_event_type expect, const char *str, |
| 1231 | int newline_ok) | 1231 | int newline_ok) |
| 1232 | { | 1232 | { |
| 1233 | enum event_type type; | 1233 | enum tep_event_type type; |
| 1234 | char *token; | 1234 | char *token; |
| 1235 | int ret; | 1235 | int ret; |
| 1236 | 1236 | ||
| @@ -1246,12 +1246,12 @@ static int __read_expected(enum event_type expect, const char *str, | |||
| 1246 | return ret; | 1246 | return ret; |
| 1247 | } | 1247 | } |
| 1248 | 1248 | ||
| 1249 | static int read_expected(enum event_type expect, const char *str) | 1249 | static int read_expected(enum tep_event_type expect, const char *str) |
| 1250 | { | 1250 | { |
| 1251 | return __read_expected(expect, str, 1); | 1251 | return __read_expected(expect, str, 1); |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | static int read_expected_item(enum event_type expect, const char *str) | 1254 | static int read_expected_item(enum tep_event_type expect, const char *str) |
| 1255 | { | 1255 | { |
| 1256 | return __read_expected(expect, str, 0); | 1256 | return __read_expected(expect, str, 0); |
| 1257 | } | 1257 | } |
| @@ -1260,13 +1260,13 @@ static char *event_read_name(void) | |||
| 1260 | { | 1260 | { |
| 1261 | char *token; | 1261 | char *token; |
| 1262 | 1262 | ||
| 1263 | if (read_expected(EVENT_ITEM, "name") < 0) | 1263 | if (read_expected(TEP_EVENT_ITEM, "name") < 0) |
| 1264 | return NULL; | 1264 | return NULL; |
| 1265 | 1265 | ||
| 1266 | if (read_expected(EVENT_OP, ":") < 0) | 1266 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1267 | return NULL; | 1267 | return NULL; |
| 1268 | 1268 | ||
| 1269 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1269 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 1270 | goto fail; | 1270 | goto fail; |
| 1271 | 1271 | ||
| 1272 | return token; | 1272 | return token; |
| @@ -1281,13 +1281,13 @@ static int event_read_id(void) | |||
| 1281 | char *token; | 1281 | char *token; |
| 1282 | int id; | 1282 | int id; |
| 1283 | 1283 | ||
| 1284 | if (read_expected_item(EVENT_ITEM, "ID") < 0) | 1284 | if (read_expected_item(TEP_EVENT_ITEM, "ID") < 0) |
| 1285 | return -1; | 1285 | return -1; |
| 1286 | 1286 | ||
| 1287 | if (read_expected(EVENT_OP, ":") < 0) | 1287 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1288 | return -1; | 1288 | return -1; |
| 1289 | 1289 | ||
| 1290 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1290 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 1291 | goto fail; | 1291 | goto fail; |
| 1292 | 1292 | ||
| 1293 | id = strtoul(token, NULL, 0); | 1293 | id = strtoul(token, NULL, 0); |
| @@ -1357,7 +1357,7 @@ static unsigned int type_size(const char *name) | |||
| 1357 | static int event_read_fields(struct tep_event_format *event, struct tep_format_field **fields) | 1357 | static int event_read_fields(struct tep_event_format *event, struct tep_format_field **fields) |
| 1358 | { | 1358 | { |
| 1359 | struct tep_format_field *field = NULL; | 1359 | struct tep_format_field *field = NULL; |
| 1360 | enum event_type type; | 1360 | enum tep_event_type type; |
| 1361 | char *token; | 1361 | char *token; |
| 1362 | char *last_token; | 1362 | char *last_token; |
| 1363 | int count = 0; | 1363 | int count = 0; |
| @@ -1366,14 +1366,14 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1366 | unsigned int size_dynamic = 0; | 1366 | unsigned int size_dynamic = 0; |
| 1367 | 1367 | ||
| 1368 | type = read_token(&token); | 1368 | type = read_token(&token); |
| 1369 | if (type == EVENT_NEWLINE) { | 1369 | if (type == TEP_EVENT_NEWLINE) { |
| 1370 | free_token(token); | 1370 | free_token(token); |
| 1371 | return count; | 1371 | return count; |
| 1372 | } | 1372 | } |
| 1373 | 1373 | ||
| 1374 | count++; | 1374 | count++; |
| 1375 | 1375 | ||
| 1376 | if (test_type_token(type, token, EVENT_ITEM, "field")) | 1376 | if (test_type_token(type, token, TEP_EVENT_ITEM, "field")) |
| 1377 | goto fail; | 1377 | goto fail; |
| 1378 | free_token(token); | 1378 | free_token(token); |
| 1379 | 1379 | ||
| @@ -1383,16 +1383,16 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1383 | * Just ignore it. | 1383 | * Just ignore it. |
| 1384 | */ | 1384 | */ |
| 1385 | if (event->flags & EVENT_FL_ISFTRACE && | 1385 | if (event->flags & EVENT_FL_ISFTRACE && |
| 1386 | type == EVENT_ITEM && strcmp(token, "special") == 0) { | 1386 | type == TEP_EVENT_ITEM && strcmp(token, "special") == 0) { |
| 1387 | free_token(token); | 1387 | free_token(token); |
| 1388 | type = read_token(&token); | 1388 | type = read_token(&token); |
| 1389 | } | 1389 | } |
| 1390 | 1390 | ||
| 1391 | if (test_type_token(type, token, EVENT_OP, ":") < 0) | 1391 | if (test_type_token(type, token, TEP_EVENT_OP, ":") < 0) |
| 1392 | goto fail; | 1392 | goto fail; |
| 1393 | 1393 | ||
| 1394 | free_token(token); | 1394 | free_token(token); |
| 1395 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 1395 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 1396 | goto fail; | 1396 | goto fail; |
| 1397 | 1397 | ||
| 1398 | last_token = token; | 1398 | last_token = token; |
| @@ -1406,14 +1406,14 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1406 | /* read the rest of the type */ | 1406 | /* read the rest of the type */ |
| 1407 | for (;;) { | 1407 | for (;;) { |
| 1408 | type = read_token(&token); | 1408 | type = read_token(&token); |
| 1409 | if (type == EVENT_ITEM || | 1409 | if (type == TEP_EVENT_ITEM || |
| 1410 | (type == EVENT_OP && strcmp(token, "*") == 0) || | 1410 | (type == TEP_EVENT_OP && strcmp(token, "*") == 0) || |
| 1411 | /* | 1411 | /* |
| 1412 | * Some of the ftrace fields are broken and have | 1412 | * Some of the ftrace fields are broken and have |
| 1413 | * an illegal "." in them. | 1413 | * an illegal "." in them. |
| 1414 | */ | 1414 | */ |
| 1415 | (event->flags & EVENT_FL_ISFTRACE && | 1415 | (event->flags & EVENT_FL_ISFTRACE && |
| 1416 | type == EVENT_OP && strcmp(token, ".") == 0)) { | 1416 | type == TEP_EVENT_OP && strcmp(token, ".") == 0)) { |
| 1417 | 1417 | ||
| 1418 | if (strcmp(token, "*") == 0) | 1418 | if (strcmp(token, "*") == 0) |
| 1419 | field->flags |= TEP_FIELD_IS_POINTER; | 1419 | field->flags |= TEP_FIELD_IS_POINTER; |
| @@ -1446,11 +1446,11 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1446 | } | 1446 | } |
| 1447 | field->name = field->alias = last_token; | 1447 | field->name = field->alias = last_token; |
| 1448 | 1448 | ||
| 1449 | if (test_type(type, EVENT_OP)) | 1449 | if (test_type(type, TEP_EVENT_OP)) |
| 1450 | goto fail; | 1450 | goto fail; |
| 1451 | 1451 | ||
| 1452 | if (strcmp(token, "[") == 0) { | 1452 | if (strcmp(token, "[") == 0) { |
| 1453 | enum event_type last_type = type; | 1453 | enum tep_event_type last_type = type; |
| 1454 | char *brackets = token; | 1454 | char *brackets = token; |
| 1455 | char *new_brackets; | 1455 | char *new_brackets; |
| 1456 | int len; | 1456 | int len; |
| @@ -1459,14 +1459,14 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1459 | 1459 | ||
| 1460 | type = read_token(&token); | 1460 | type = read_token(&token); |
| 1461 | 1461 | ||
| 1462 | if (type == EVENT_ITEM) | 1462 | if (type == TEP_EVENT_ITEM) |
| 1463 | field->arraylen = strtoul(token, NULL, 0); | 1463 | field->arraylen = strtoul(token, NULL, 0); |
| 1464 | else | 1464 | else |
| 1465 | field->arraylen = 0; | 1465 | field->arraylen = 0; |
| 1466 | 1466 | ||
| 1467 | while (strcmp(token, "]") != 0) { | 1467 | while (strcmp(token, "]") != 0) { |
| 1468 | if (last_type == EVENT_ITEM && | 1468 | if (last_type == TEP_EVENT_ITEM && |
| 1469 | type == EVENT_ITEM) | 1469 | type == TEP_EVENT_ITEM) |
| 1470 | len = 2; | 1470 | len = 2; |
| 1471 | else | 1471 | else |
| 1472 | len = 1; | 1472 | len = 1; |
| @@ -1487,7 +1487,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1487 | field->arraylen = strtoul(token, NULL, 0); | 1487 | field->arraylen = strtoul(token, NULL, 0); |
| 1488 | free_token(token); | 1488 | free_token(token); |
| 1489 | type = read_token(&token); | 1489 | type = read_token(&token); |
| 1490 | if (type == EVENT_NONE) { | 1490 | if (type == TEP_EVENT_NONE) { |
| 1491 | do_warning_event(event, "failed to find token"); | 1491 | do_warning_event(event, "failed to find token"); |
| 1492 | goto fail; | 1492 | goto fail; |
| 1493 | } | 1493 | } |
| @@ -1510,7 +1510,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1510 | * If the next token is not an OP, then it is of | 1510 | * If the next token is not an OP, then it is of |
| 1511 | * the format: type [] item; | 1511 | * the format: type [] item; |
| 1512 | */ | 1512 | */ |
| 1513 | if (type == EVENT_ITEM) { | 1513 | if (type == TEP_EVENT_ITEM) { |
| 1514 | char *new_type; | 1514 | char *new_type; |
| 1515 | new_type = realloc(field->type, | 1515 | new_type = realloc(field->type, |
| 1516 | strlen(field->type) + | 1516 | strlen(field->type) + |
| @@ -1550,60 +1550,60 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f | |||
| 1550 | if (field_is_long(field)) | 1550 | if (field_is_long(field)) |
| 1551 | field->flags |= TEP_FIELD_IS_LONG; | 1551 | field->flags |= TEP_FIELD_IS_LONG; |
| 1552 | 1552 | ||
| 1553 | if (test_type_token(type, token, EVENT_OP, ";")) | 1553 | if (test_type_token(type, token, TEP_EVENT_OP, ";")) |
| 1554 | goto fail; | 1554 | goto fail; |
| 1555 | free_token(token); | 1555 | free_token(token); |
| 1556 | 1556 | ||
| 1557 | if (read_expected(EVENT_ITEM, "offset") < 0) | 1557 | if (read_expected(TEP_EVENT_ITEM, "offset") < 0) |
| 1558 | goto fail_expect; | 1558 | goto fail_expect; |
| 1559 | 1559 | ||
| 1560 | if (read_expected(EVENT_OP, ":") < 0) | 1560 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1561 | goto fail_expect; | 1561 | goto fail_expect; |
| 1562 | 1562 | ||
| 1563 | if (read_expect_type(EVENT_ITEM, &token)) | 1563 | if (read_expect_type(TEP_EVENT_ITEM, &token)) |
| 1564 | goto fail; | 1564 | goto fail; |
| 1565 | field->offset = strtoul(token, NULL, 0); | 1565 | field->offset = strtoul(token, NULL, 0); |
| 1566 | free_token(token); | 1566 | free_token(token); |
| 1567 | 1567 | ||
| 1568 | if (read_expected(EVENT_OP, ";") < 0) | 1568 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 1569 | goto fail_expect; | 1569 | goto fail_expect; |
| 1570 | 1570 | ||
| 1571 | if (read_expected(EVENT_ITEM, "size") < 0) | 1571 | if (read_expected(TEP_EVENT_ITEM, "size") < 0) |
| 1572 | goto fail_expect; | 1572 | goto fail_expect; |
| 1573 | 1573 | ||
| 1574 | if (read_expected(EVENT_OP, ":") < 0) | 1574 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1575 | goto fail_expect; | 1575 | goto fail_expect; |
| 1576 | 1576 | ||
| 1577 | if (read_expect_type(EVENT_ITEM, &token)) | 1577 | if (read_expect_type(TEP_EVENT_ITEM, &token)) |
| 1578 | goto fail; | 1578 | goto fail; |
| 1579 | field->size = strtoul(token, NULL, 0); | 1579 | field->size = strtoul(token, NULL, 0); |
| 1580 | free_token(token); | 1580 | free_token(token); |
| 1581 | 1581 | ||
| 1582 | if (read_expected(EVENT_OP, ";") < 0) | 1582 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 1583 | goto fail_expect; | 1583 | goto fail_expect; |
| 1584 | 1584 | ||
| 1585 | type = read_token(&token); | 1585 | type = read_token(&token); |
| 1586 | if (type != EVENT_NEWLINE) { | 1586 | if (type != TEP_EVENT_NEWLINE) { |
| 1587 | /* newer versions of the kernel have a "signed" type */ | 1587 | /* newer versions of the kernel have a "signed" type */ |
| 1588 | if (test_type_token(type, token, EVENT_ITEM, "signed")) | 1588 | if (test_type_token(type, token, TEP_EVENT_ITEM, "signed")) |
| 1589 | goto fail; | 1589 | goto fail; |
| 1590 | 1590 | ||
| 1591 | free_token(token); | 1591 | free_token(token); |
| 1592 | 1592 | ||
| 1593 | if (read_expected(EVENT_OP, ":") < 0) | 1593 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1594 | goto fail_expect; | 1594 | goto fail_expect; |
| 1595 | 1595 | ||
| 1596 | if (read_expect_type(EVENT_ITEM, &token)) | 1596 | if (read_expect_type(TEP_EVENT_ITEM, &token)) |
| 1597 | goto fail; | 1597 | goto fail; |
| 1598 | 1598 | ||
| 1599 | if (strtoul(token, NULL, 0)) | 1599 | if (strtoul(token, NULL, 0)) |
| 1600 | field->flags |= TEP_FIELD_IS_SIGNED; | 1600 | field->flags |= TEP_FIELD_IS_SIGNED; |
| 1601 | 1601 | ||
| 1602 | free_token(token); | 1602 | free_token(token); |
| 1603 | if (read_expected(EVENT_OP, ";") < 0) | 1603 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 1604 | goto fail_expect; | 1604 | goto fail_expect; |
| 1605 | 1605 | ||
| 1606 | if (read_expect_type(EVENT_NEWLINE, &token)) | 1606 | if (read_expect_type(TEP_EVENT_NEWLINE, &token)) |
| 1607 | goto fail; | 1607 | goto fail; |
| 1608 | } | 1608 | } |
| 1609 | 1609 | ||
| @@ -1646,13 +1646,13 @@ static int event_read_format(struct tep_event_format *event) | |||
| 1646 | char *token; | 1646 | char *token; |
| 1647 | int ret; | 1647 | int ret; |
| 1648 | 1648 | ||
| 1649 | if (read_expected_item(EVENT_ITEM, "format") < 0) | 1649 | if (read_expected_item(TEP_EVENT_ITEM, "format") < 0) |
| 1650 | return -1; | 1650 | return -1; |
| 1651 | 1651 | ||
| 1652 | if (read_expected(EVENT_OP, ":") < 0) | 1652 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 1653 | return -1; | 1653 | return -1; |
| 1654 | 1654 | ||
| 1655 | if (read_expect_type(EVENT_NEWLINE, &token)) | 1655 | if (read_expect_type(TEP_EVENT_NEWLINE, &token)) |
| 1656 | goto fail; | 1656 | goto fail; |
| 1657 | free_token(token); | 1657 | free_token(token); |
| 1658 | 1658 | ||
| @@ -1673,14 +1673,14 @@ static int event_read_format(struct tep_event_format *event) | |||
| 1673 | return -1; | 1673 | return -1; |
| 1674 | } | 1674 | } |
| 1675 | 1675 | ||
| 1676 | static enum event_type | 1676 | static enum tep_event_type |
| 1677 | process_arg_token(struct tep_event_format *event, struct print_arg *arg, | 1677 | process_arg_token(struct tep_event_format *event, struct print_arg *arg, |
| 1678 | char **tok, enum event_type type); | 1678 | char **tok, enum tep_event_type type); |
| 1679 | 1679 | ||
| 1680 | static enum event_type | 1680 | static enum tep_event_type |
| 1681 | process_arg(struct tep_event_format *event, struct print_arg *arg, char **tok) | 1681 | process_arg(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 1682 | { | 1682 | { |
| 1683 | enum event_type type; | 1683 | enum tep_event_type type; |
| 1684 | char *token; | 1684 | char *token; |
| 1685 | 1685 | ||
| 1686 | type = read_token(&token); | 1686 | type = read_token(&token); |
| @@ -1689,32 +1689,32 @@ process_arg(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 1689 | return process_arg_token(event, arg, tok, type); | 1689 | return process_arg_token(event, arg, tok, type); |
| 1690 | } | 1690 | } |
| 1691 | 1691 | ||
| 1692 | static enum event_type | 1692 | static enum tep_event_type |
| 1693 | process_op(struct tep_event_format *event, struct print_arg *arg, char **tok); | 1693 | process_op(struct tep_event_format *event, struct print_arg *arg, char **tok); |
| 1694 | 1694 | ||
| 1695 | /* | 1695 | /* |
| 1696 | * For __print_symbolic() and __print_flags, we need to completely | 1696 | * For __print_symbolic() and __print_flags, we need to completely |
| 1697 | * evaluate the first argument, which defines what to print next. | 1697 | * evaluate the first argument, which defines what to print next. |
| 1698 | */ | 1698 | */ |
| 1699 | static enum event_type | 1699 | static enum tep_event_type |
| 1700 | process_field_arg(struct tep_event_format *event, struct print_arg *arg, char **tok) | 1700 | process_field_arg(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 1701 | { | 1701 | { |
| 1702 | enum event_type type; | 1702 | enum tep_event_type type; |
| 1703 | 1703 | ||
| 1704 | type = process_arg(event, arg, tok); | 1704 | type = process_arg(event, arg, tok); |
| 1705 | 1705 | ||
| 1706 | while (type == EVENT_OP) { | 1706 | while (type == TEP_EVENT_OP) { |
| 1707 | type = process_op(event, arg, tok); | 1707 | type = process_op(event, arg, tok); |
| 1708 | } | 1708 | } |
| 1709 | 1709 | ||
| 1710 | return type; | 1710 | return type; |
| 1711 | } | 1711 | } |
| 1712 | 1712 | ||
| 1713 | static enum event_type | 1713 | static enum tep_event_type |
| 1714 | process_cond(struct tep_event_format *event, struct print_arg *top, char **tok) | 1714 | process_cond(struct tep_event_format *event, struct print_arg *top, char **tok) |
| 1715 | { | 1715 | { |
| 1716 | struct print_arg *arg, *left, *right; | 1716 | struct print_arg *arg, *left, *right; |
| 1717 | enum event_type type; | 1717 | enum tep_event_type type; |
| 1718 | char *token = NULL; | 1718 | char *token = NULL; |
| 1719 | 1719 | ||
| 1720 | arg = alloc_arg(); | 1720 | arg = alloc_arg(); |
| @@ -1737,16 +1737,16 @@ process_cond(struct tep_event_format *event, struct print_arg *top, char **tok) | |||
| 1737 | type = process_arg(event, left, &token); | 1737 | type = process_arg(event, left, &token); |
| 1738 | 1738 | ||
| 1739 | again: | 1739 | again: |
| 1740 | if (type == EVENT_ERROR) | 1740 | if (type == TEP_EVENT_ERROR) |
| 1741 | goto out_free; | 1741 | goto out_free; |
| 1742 | 1742 | ||
| 1743 | /* Handle other operations in the arguments */ | 1743 | /* Handle other operations in the arguments */ |
| 1744 | if (type == EVENT_OP && strcmp(token, ":") != 0) { | 1744 | if (type == TEP_EVENT_OP && strcmp(token, ":") != 0) { |
| 1745 | type = process_op(event, left, &token); | 1745 | type = process_op(event, left, &token); |
| 1746 | goto again; | 1746 | goto again; |
| 1747 | } | 1747 | } |
| 1748 | 1748 | ||
| 1749 | if (test_type_token(type, token, EVENT_OP, ":")) | 1749 | if (test_type_token(type, token, TEP_EVENT_OP, ":")) |
| 1750 | goto out_free; | 1750 | goto out_free; |
| 1751 | 1751 | ||
| 1752 | arg->op.op = token; | 1752 | arg->op.op = token; |
| @@ -1763,14 +1763,14 @@ out_free: | |||
| 1763 | top->op.right = NULL; | 1763 | top->op.right = NULL; |
| 1764 | free_token(token); | 1764 | free_token(token); |
| 1765 | free_arg(arg); | 1765 | free_arg(arg); |
| 1766 | return EVENT_ERROR; | 1766 | return TEP_EVENT_ERROR; |
| 1767 | } | 1767 | } |
| 1768 | 1768 | ||
| 1769 | static enum event_type | 1769 | static enum tep_event_type |
| 1770 | process_array(struct tep_event_format *event, struct print_arg *top, char **tok) | 1770 | process_array(struct tep_event_format *event, struct print_arg *top, char **tok) |
| 1771 | { | 1771 | { |
| 1772 | struct print_arg *arg; | 1772 | struct print_arg *arg; |
| 1773 | enum event_type type; | 1773 | enum tep_event_type type; |
| 1774 | char *token = NULL; | 1774 | char *token = NULL; |
| 1775 | 1775 | ||
| 1776 | arg = alloc_arg(); | 1776 | arg = alloc_arg(); |
| @@ -1778,12 +1778,12 @@ process_array(struct tep_event_format *event, struct print_arg *top, char **tok) | |||
| 1778 | do_warning_event(event, "%s: not enough memory!", __func__); | 1778 | do_warning_event(event, "%s: not enough memory!", __func__); |
| 1779 | /* '*tok' is set to top->op.op. No need to free. */ | 1779 | /* '*tok' is set to top->op.op. No need to free. */ |
| 1780 | *tok = NULL; | 1780 | *tok = NULL; |
| 1781 | return EVENT_ERROR; | 1781 | return TEP_EVENT_ERROR; |
| 1782 | } | 1782 | } |
| 1783 | 1783 | ||
| 1784 | *tok = NULL; | 1784 | *tok = NULL; |
| 1785 | type = process_arg(event, arg, &token); | 1785 | type = process_arg(event, arg, &token); |
| 1786 | if (test_type_token(type, token, EVENT_OP, "]")) | 1786 | if (test_type_token(type, token, TEP_EVENT_OP, "]")) |
| 1787 | goto out_free; | 1787 | goto out_free; |
| 1788 | 1788 | ||
| 1789 | top->op.right = arg; | 1789 | top->op.right = arg; |
| @@ -1797,7 +1797,7 @@ process_array(struct tep_event_format *event, struct print_arg *top, char **tok) | |||
| 1797 | out_free: | 1797 | out_free: |
| 1798 | free_token(token); | 1798 | free_token(token); |
| 1799 | free_arg(arg); | 1799 | free_arg(arg); |
| 1800 | return EVENT_ERROR; | 1800 | return TEP_EVENT_ERROR; |
| 1801 | } | 1801 | } |
| 1802 | 1802 | ||
| 1803 | static int get_op_prio(char *op) | 1803 | static int get_op_prio(char *op) |
| @@ -1868,11 +1868,11 @@ static int set_op_prio(struct print_arg *arg) | |||
| 1868 | } | 1868 | } |
| 1869 | 1869 | ||
| 1870 | /* Note, *tok does not get freed, but will most likely be saved */ | 1870 | /* Note, *tok does not get freed, but will most likely be saved */ |
| 1871 | static enum event_type | 1871 | static enum tep_event_type |
| 1872 | process_op(struct tep_event_format *event, struct print_arg *arg, char **tok) | 1872 | process_op(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 1873 | { | 1873 | { |
| 1874 | struct print_arg *left, *right = NULL; | 1874 | struct print_arg *left, *right = NULL; |
| 1875 | enum event_type type; | 1875 | enum tep_event_type type; |
| 1876 | char *token; | 1876 | char *token; |
| 1877 | 1877 | ||
| 1878 | /* the op is passed in via tok */ | 1878 | /* the op is passed in via tok */ |
| @@ -1974,7 +1974,7 @@ process_op(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 1974 | 1974 | ||
| 1975 | /* could just be a type pointer */ | 1975 | /* could just be a type pointer */ |
| 1976 | if ((strcmp(arg->op.op, "*") == 0) && | 1976 | if ((strcmp(arg->op.op, "*") == 0) && |
| 1977 | type == EVENT_DELIM && (strcmp(token, ")") == 0)) { | 1977 | type == TEP_EVENT_DELIM && (strcmp(token, ")") == 0)) { |
| 1978 | char *new_atom; | 1978 | char *new_atom; |
| 1979 | 1979 | ||
| 1980 | if (left->type != PRINT_ATOM) { | 1980 | if (left->type != PRINT_ATOM) { |
| @@ -2000,7 +2000,7 @@ process_op(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2000 | goto out_warn_free; | 2000 | goto out_warn_free; |
| 2001 | 2001 | ||
| 2002 | type = process_arg_token(event, right, tok, type); | 2002 | type = process_arg_token(event, right, tok, type); |
| 2003 | if (type == EVENT_ERROR) { | 2003 | if (type == TEP_EVENT_ERROR) { |
| 2004 | free_arg(right); | 2004 | free_arg(right); |
| 2005 | /* token was freed in process_arg_token() via *tok */ | 2005 | /* token was freed in process_arg_token() via *tok */ |
| 2006 | token = NULL; | 2006 | token = NULL; |
| @@ -2047,7 +2047,7 @@ process_op(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2047 | goto out_free; | 2047 | goto out_free; |
| 2048 | } | 2048 | } |
| 2049 | 2049 | ||
| 2050 | if (type == EVENT_OP && strcmp(*tok, ":") != 0) { | 2050 | if (type == TEP_EVENT_OP && strcmp(*tok, ":") != 0) { |
| 2051 | int prio; | 2051 | int prio; |
| 2052 | 2052 | ||
| 2053 | /* higher prios need to be closer to the root */ | 2053 | /* higher prios need to be closer to the root */ |
| @@ -2066,21 +2066,21 @@ out_warn_free: | |||
| 2066 | out_free: | 2066 | out_free: |
| 2067 | free_token(token); | 2067 | free_token(token); |
| 2068 | *tok = NULL; | 2068 | *tok = NULL; |
| 2069 | return EVENT_ERROR; | 2069 | return TEP_EVENT_ERROR; |
| 2070 | } | 2070 | } |
| 2071 | 2071 | ||
| 2072 | static enum event_type | 2072 | static enum tep_event_type |
| 2073 | process_entry(struct tep_event_format *event __maybe_unused, struct print_arg *arg, | 2073 | process_entry(struct tep_event_format *event __maybe_unused, struct print_arg *arg, |
| 2074 | char **tok) | 2074 | char **tok) |
| 2075 | { | 2075 | { |
| 2076 | enum event_type type; | 2076 | enum tep_event_type type; |
| 2077 | char *field; | 2077 | char *field; |
| 2078 | char *token; | 2078 | char *token; |
| 2079 | 2079 | ||
| 2080 | if (read_expected(EVENT_OP, "->") < 0) | 2080 | if (read_expected(TEP_EVENT_OP, "->") < 0) |
| 2081 | goto out_err; | 2081 | goto out_err; |
| 2082 | 2082 | ||
| 2083 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 2083 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 2084 | goto out_free; | 2084 | goto out_free; |
| 2085 | field = token; | 2085 | field = token; |
| 2086 | 2086 | ||
| @@ -2106,14 +2106,14 @@ process_entry(struct tep_event_format *event __maybe_unused, struct print_arg *a | |||
| 2106 | free_token(token); | 2106 | free_token(token); |
| 2107 | out_err: | 2107 | out_err: |
| 2108 | *tok = NULL; | 2108 | *tok = NULL; |
| 2109 | return EVENT_ERROR; | 2109 | return TEP_EVENT_ERROR; |
| 2110 | } | 2110 | } |
| 2111 | 2111 | ||
| 2112 | static int alloc_and_process_delim(struct tep_event_format *event, char *next_token, | 2112 | static int alloc_and_process_delim(struct tep_event_format *event, char *next_token, |
| 2113 | struct print_arg **print_arg) | 2113 | struct print_arg **print_arg) |
| 2114 | { | 2114 | { |
| 2115 | struct print_arg *field; | 2115 | struct print_arg *field; |
| 2116 | enum event_type type; | 2116 | enum tep_event_type type; |
| 2117 | char *token; | 2117 | char *token; |
| 2118 | int ret = 0; | 2118 | int ret = 0; |
| 2119 | 2119 | ||
| @@ -2126,7 +2126,7 @@ static int alloc_and_process_delim(struct tep_event_format *event, char *next_to | |||
| 2126 | 2126 | ||
| 2127 | type = process_arg(event, field, &token); | 2127 | type = process_arg(event, field, &token); |
| 2128 | 2128 | ||
| 2129 | if (test_type_token(type, token, EVENT_DELIM, next_token)) { | 2129 | if (test_type_token(type, token, TEP_EVENT_DELIM, next_token)) { |
| 2130 | errno = EINVAL; | 2130 | errno = EINVAL; |
| 2131 | ret = -1; | 2131 | ret = -1; |
| 2132 | free_arg(field); | 2132 | free_arg(field); |
| @@ -2443,10 +2443,10 @@ static char *arg_eval (struct print_arg *arg) | |||
| 2443 | return NULL; | 2443 | return NULL; |
| 2444 | } | 2444 | } |
| 2445 | 2445 | ||
| 2446 | static enum event_type | 2446 | static enum tep_event_type |
| 2447 | process_fields(struct tep_event_format *event, struct print_flag_sym **list, char **tok) | 2447 | process_fields(struct tep_event_format *event, struct print_flag_sym **list, char **tok) |
| 2448 | { | 2448 | { |
| 2449 | enum event_type type; | 2449 | enum tep_event_type type; |
| 2450 | struct print_arg *arg = NULL; | 2450 | struct print_arg *arg = NULL; |
| 2451 | struct print_flag_sym *field; | 2451 | struct print_flag_sym *field; |
| 2452 | char *token = *tok; | 2452 | char *token = *tok; |
| @@ -2455,7 +2455,7 @@ process_fields(struct tep_event_format *event, struct print_flag_sym **list, cha | |||
| 2455 | do { | 2455 | do { |
| 2456 | free_token(token); | 2456 | free_token(token); |
| 2457 | type = read_token_item(&token); | 2457 | type = read_token_item(&token); |
| 2458 | if (test_type_token(type, token, EVENT_OP, "{")) | 2458 | if (test_type_token(type, token, TEP_EVENT_OP, "{")) |
| 2459 | break; | 2459 | break; |
| 2460 | 2460 | ||
| 2461 | arg = alloc_arg(); | 2461 | arg = alloc_arg(); |
| @@ -2465,13 +2465,13 @@ process_fields(struct tep_event_format *event, struct print_flag_sym **list, cha | |||
| 2465 | free_token(token); | 2465 | free_token(token); |
| 2466 | type = process_arg(event, arg, &token); | 2466 | type = process_arg(event, arg, &token); |
| 2467 | 2467 | ||
| 2468 | if (type == EVENT_OP) | 2468 | if (type == TEP_EVENT_OP) |
| 2469 | type = process_op(event, arg, &token); | 2469 | type = process_op(event, arg, &token); |
| 2470 | 2470 | ||
| 2471 | if (type == EVENT_ERROR) | 2471 | if (type == TEP_EVENT_ERROR) |
| 2472 | goto out_free; | 2472 | goto out_free; |
| 2473 | 2473 | ||
| 2474 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 2474 | if (test_type_token(type, token, TEP_EVENT_DELIM, ",")) |
| 2475 | goto out_free; | 2475 | goto out_free; |
| 2476 | 2476 | ||
| 2477 | field = calloc(1, sizeof(*field)); | 2477 | field = calloc(1, sizeof(*field)); |
| @@ -2492,7 +2492,7 @@ process_fields(struct tep_event_format *event, struct print_flag_sym **list, cha | |||
| 2492 | 2492 | ||
| 2493 | free_token(token); | 2493 | free_token(token); |
| 2494 | type = process_arg(event, arg, &token); | 2494 | type = process_arg(event, arg, &token); |
| 2495 | if (test_type_token(type, token, EVENT_OP, "}")) | 2495 | if (test_type_token(type, token, TEP_EVENT_OP, "}")) |
| 2496 | goto out_free_field; | 2496 | goto out_free_field; |
| 2497 | 2497 | ||
| 2498 | value = arg_eval(arg); | 2498 | value = arg_eval(arg); |
| @@ -2509,7 +2509,7 @@ process_fields(struct tep_event_format *event, struct print_flag_sym **list, cha | |||
| 2509 | 2509 | ||
| 2510 | free_token(token); | 2510 | free_token(token); |
| 2511 | type = read_token_item(&token); | 2511 | type = read_token_item(&token); |
| 2512 | } while (type == EVENT_DELIM && strcmp(token, ",") == 0); | 2512 | } while (type == TEP_EVENT_DELIM && strcmp(token, ",") == 0); |
| 2513 | 2513 | ||
| 2514 | *tok = token; | 2514 | *tok = token; |
| 2515 | return type; | 2515 | return type; |
| @@ -2521,14 +2521,14 @@ out_free: | |||
| 2521 | free_token(token); | 2521 | free_token(token); |
| 2522 | *tok = NULL; | 2522 | *tok = NULL; |
| 2523 | 2523 | ||
| 2524 | return EVENT_ERROR; | 2524 | return TEP_EVENT_ERROR; |
| 2525 | } | 2525 | } |
| 2526 | 2526 | ||
| 2527 | static enum event_type | 2527 | static enum tep_event_type |
| 2528 | process_flags(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2528 | process_flags(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2529 | { | 2529 | { |
| 2530 | struct print_arg *field; | 2530 | struct print_arg *field; |
| 2531 | enum event_type type; | 2531 | enum tep_event_type type; |
| 2532 | char *token = NULL; | 2532 | char *token = NULL; |
| 2533 | 2533 | ||
| 2534 | memset(arg, 0, sizeof(*arg)); | 2534 | memset(arg, 0, sizeof(*arg)); |
| @@ -2543,10 +2543,10 @@ process_flags(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2543 | type = process_field_arg(event, field, &token); | 2543 | type = process_field_arg(event, field, &token); |
| 2544 | 2544 | ||
| 2545 | /* Handle operations in the first argument */ | 2545 | /* Handle operations in the first argument */ |
| 2546 | while (type == EVENT_OP) | 2546 | while (type == TEP_EVENT_OP) |
| 2547 | type = process_op(event, field, &token); | 2547 | type = process_op(event, field, &token); |
| 2548 | 2548 | ||
| 2549 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 2549 | if (test_type_token(type, token, TEP_EVENT_DELIM, ",")) |
| 2550 | goto out_free_field; | 2550 | goto out_free_field; |
| 2551 | free_token(token); | 2551 | free_token(token); |
| 2552 | 2552 | ||
| @@ -2558,11 +2558,11 @@ process_flags(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2558 | type = read_token_item(&token); | 2558 | type = read_token_item(&token); |
| 2559 | } | 2559 | } |
| 2560 | 2560 | ||
| 2561 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 2561 | if (test_type_token(type, token, TEP_EVENT_DELIM, ",")) |
| 2562 | goto out_free; | 2562 | goto out_free; |
| 2563 | 2563 | ||
| 2564 | type = process_fields(event, &arg->flags.flags, &token); | 2564 | type = process_fields(event, &arg->flags.flags, &token); |
| 2565 | if (test_type_token(type, token, EVENT_DELIM, ")")) | 2565 | if (test_type_token(type, token, TEP_EVENT_DELIM, ")")) |
| 2566 | goto out_free; | 2566 | goto out_free; |
| 2567 | 2567 | ||
| 2568 | free_token(token); | 2568 | free_token(token); |
| @@ -2574,14 +2574,14 @@ out_free_field: | |||
| 2574 | out_free: | 2574 | out_free: |
| 2575 | free_token(token); | 2575 | free_token(token); |
| 2576 | *tok = NULL; | 2576 | *tok = NULL; |
| 2577 | return EVENT_ERROR; | 2577 | return TEP_EVENT_ERROR; |
| 2578 | } | 2578 | } |
| 2579 | 2579 | ||
| 2580 | static enum event_type | 2580 | static enum tep_event_type |
| 2581 | process_symbols(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2581 | process_symbols(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2582 | { | 2582 | { |
| 2583 | struct print_arg *field; | 2583 | struct print_arg *field; |
| 2584 | enum event_type type; | 2584 | enum tep_event_type type; |
| 2585 | char *token = NULL; | 2585 | char *token = NULL; |
| 2586 | 2586 | ||
| 2587 | memset(arg, 0, sizeof(*arg)); | 2587 | memset(arg, 0, sizeof(*arg)); |
| @@ -2595,13 +2595,13 @@ process_symbols(struct tep_event_format *event, struct print_arg *arg, char **to | |||
| 2595 | 2595 | ||
| 2596 | type = process_field_arg(event, field, &token); | 2596 | type = process_field_arg(event, field, &token); |
| 2597 | 2597 | ||
| 2598 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 2598 | if (test_type_token(type, token, TEP_EVENT_DELIM, ",")) |
| 2599 | goto out_free_field; | 2599 | goto out_free_field; |
| 2600 | 2600 | ||
| 2601 | arg->symbol.field = field; | 2601 | arg->symbol.field = field; |
| 2602 | 2602 | ||
| 2603 | type = process_fields(event, &arg->symbol.symbols, &token); | 2603 | type = process_fields(event, &arg->symbol.symbols, &token); |
| 2604 | if (test_type_token(type, token, EVENT_DELIM, ")")) | 2604 | if (test_type_token(type, token, TEP_EVENT_DELIM, ")")) |
| 2605 | goto out_free; | 2605 | goto out_free; |
| 2606 | 2606 | ||
| 2607 | free_token(token); | 2607 | free_token(token); |
| @@ -2613,10 +2613,10 @@ out_free_field: | |||
| 2613 | out_free: | 2613 | out_free: |
| 2614 | free_token(token); | 2614 | free_token(token); |
| 2615 | *tok = NULL; | 2615 | *tok = NULL; |
| 2616 | return EVENT_ERROR; | 2616 | return TEP_EVENT_ERROR; |
| 2617 | } | 2617 | } |
| 2618 | 2618 | ||
| 2619 | static enum event_type | 2619 | static enum tep_event_type |
| 2620 | process_hex_common(struct tep_event_format *event, struct print_arg *arg, | 2620 | process_hex_common(struct tep_event_format *event, struct print_arg *arg, |
| 2621 | char **tok, enum print_arg_type type) | 2621 | char **tok, enum print_arg_type type) |
| 2622 | { | 2622 | { |
| @@ -2636,23 +2636,23 @@ free_field: | |||
| 2636 | arg->hex.field = NULL; | 2636 | arg->hex.field = NULL; |
| 2637 | out: | 2637 | out: |
| 2638 | *tok = NULL; | 2638 | *tok = NULL; |
| 2639 | return EVENT_ERROR; | 2639 | return TEP_EVENT_ERROR; |
| 2640 | } | 2640 | } |
| 2641 | 2641 | ||
| 2642 | static enum event_type | 2642 | static enum tep_event_type |
| 2643 | process_hex(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2643 | process_hex(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2644 | { | 2644 | { |
| 2645 | return process_hex_common(event, arg, tok, PRINT_HEX); | 2645 | return process_hex_common(event, arg, tok, PRINT_HEX); |
| 2646 | } | 2646 | } |
| 2647 | 2647 | ||
| 2648 | static enum event_type | 2648 | static enum tep_event_type |
| 2649 | process_hex_str(struct tep_event_format *event, struct print_arg *arg, | 2649 | process_hex_str(struct tep_event_format *event, struct print_arg *arg, |
| 2650 | char **tok) | 2650 | char **tok) |
| 2651 | { | 2651 | { |
| 2652 | return process_hex_common(event, arg, tok, PRINT_HEX_STR); | 2652 | return process_hex_common(event, arg, tok, PRINT_HEX_STR); |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | static enum event_type | 2655 | static enum tep_event_type |
| 2656 | process_int_array(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2656 | process_int_array(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2657 | { | 2657 | { |
| 2658 | memset(arg, 0, sizeof(*arg)); | 2658 | memset(arg, 0, sizeof(*arg)); |
| @@ -2677,14 +2677,14 @@ free_field: | |||
| 2677 | arg->int_array.field = NULL; | 2677 | arg->int_array.field = NULL; |
| 2678 | out: | 2678 | out: |
| 2679 | *tok = NULL; | 2679 | *tok = NULL; |
| 2680 | return EVENT_ERROR; | 2680 | return TEP_EVENT_ERROR; |
| 2681 | } | 2681 | } |
| 2682 | 2682 | ||
| 2683 | static enum event_type | 2683 | static enum tep_event_type |
| 2684 | process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2684 | process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2685 | { | 2685 | { |
| 2686 | struct tep_format_field *field; | 2686 | struct tep_format_field *field; |
| 2687 | enum event_type type; | 2687 | enum tep_event_type type; |
| 2688 | char *token; | 2688 | char *token; |
| 2689 | 2689 | ||
| 2690 | memset(arg, 0, sizeof(*arg)); | 2690 | memset(arg, 0, sizeof(*arg)); |
| @@ -2696,7 +2696,7 @@ process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, cha | |||
| 2696 | */ | 2696 | */ |
| 2697 | type = read_token(&token); | 2697 | type = read_token(&token); |
| 2698 | *tok = token; | 2698 | *tok = token; |
| 2699 | if (type != EVENT_ITEM) | 2699 | if (type != TEP_EVENT_ITEM) |
| 2700 | goto out_free; | 2700 | goto out_free; |
| 2701 | 2701 | ||
| 2702 | /* Find the field */ | 2702 | /* Find the field */ |
| @@ -2708,13 +2708,13 @@ process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, cha | |||
| 2708 | arg->dynarray.field = field; | 2708 | arg->dynarray.field = field; |
| 2709 | arg->dynarray.index = 0; | 2709 | arg->dynarray.index = 0; |
| 2710 | 2710 | ||
| 2711 | if (read_expected(EVENT_DELIM, ")") < 0) | 2711 | if (read_expected(TEP_EVENT_DELIM, ")") < 0) |
| 2712 | goto out_free; | 2712 | goto out_free; |
| 2713 | 2713 | ||
| 2714 | free_token(token); | 2714 | free_token(token); |
| 2715 | type = read_token_item(&token); | 2715 | type = read_token_item(&token); |
| 2716 | *tok = token; | 2716 | *tok = token; |
| 2717 | if (type != EVENT_OP || strcmp(token, "[") != 0) | 2717 | if (type != TEP_EVENT_OP || strcmp(token, "[") != 0) |
| 2718 | return type; | 2718 | return type; |
| 2719 | 2719 | ||
| 2720 | free_token(token); | 2720 | free_token(token); |
| @@ -2722,14 +2722,14 @@ process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, cha | |||
| 2722 | if (!arg) { | 2722 | if (!arg) { |
| 2723 | do_warning_event(event, "%s: not enough memory!", __func__); | 2723 | do_warning_event(event, "%s: not enough memory!", __func__); |
| 2724 | *tok = NULL; | 2724 | *tok = NULL; |
| 2725 | return EVENT_ERROR; | 2725 | return TEP_EVENT_ERROR; |
| 2726 | } | 2726 | } |
| 2727 | 2727 | ||
| 2728 | type = process_arg(event, arg, &token); | 2728 | type = process_arg(event, arg, &token); |
| 2729 | if (type == EVENT_ERROR) | 2729 | if (type == TEP_EVENT_ERROR) |
| 2730 | goto out_free_arg; | 2730 | goto out_free_arg; |
| 2731 | 2731 | ||
| 2732 | if (!test_type_token(type, token, EVENT_OP, "]")) | 2732 | if (!test_type_token(type, token, TEP_EVENT_OP, "]")) |
| 2733 | goto out_free_arg; | 2733 | goto out_free_arg; |
| 2734 | 2734 | ||
| 2735 | free_token(token); | 2735 | free_token(token); |
| @@ -2741,18 +2741,18 @@ process_dynamic_array(struct tep_event_format *event, struct print_arg *arg, cha | |||
| 2741 | out_free: | 2741 | out_free: |
| 2742 | free_token(token); | 2742 | free_token(token); |
| 2743 | *tok = NULL; | 2743 | *tok = NULL; |
| 2744 | return EVENT_ERROR; | 2744 | return TEP_EVENT_ERROR; |
| 2745 | } | 2745 | } |
| 2746 | 2746 | ||
| 2747 | static enum event_type | 2747 | static enum tep_event_type |
| 2748 | process_dynamic_array_len(struct tep_event_format *event, struct print_arg *arg, | 2748 | process_dynamic_array_len(struct tep_event_format *event, struct print_arg *arg, |
| 2749 | char **tok) | 2749 | char **tok) |
| 2750 | { | 2750 | { |
| 2751 | struct tep_format_field *field; | 2751 | struct tep_format_field *field; |
| 2752 | enum event_type type; | 2752 | enum tep_event_type type; |
| 2753 | char *token; | 2753 | char *token; |
| 2754 | 2754 | ||
| 2755 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 2755 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 2756 | goto out_free; | 2756 | goto out_free; |
| 2757 | 2757 | ||
| 2758 | arg->type = PRINT_DYNAMIC_ARRAY_LEN; | 2758 | arg->type = PRINT_DYNAMIC_ARRAY_LEN; |
| @@ -2765,7 +2765,7 @@ process_dynamic_array_len(struct tep_event_format *event, struct print_arg *arg, | |||
| 2765 | arg->dynarray.field = field; | 2765 | arg->dynarray.field = field; |
| 2766 | arg->dynarray.index = 0; | 2766 | arg->dynarray.index = 0; |
| 2767 | 2767 | ||
| 2768 | if (read_expected(EVENT_DELIM, ")") < 0) | 2768 | if (read_expected(TEP_EVENT_DELIM, ")") < 0) |
| 2769 | goto out_err; | 2769 | goto out_err; |
| 2770 | 2770 | ||
| 2771 | type = read_token(&token); | 2771 | type = read_token(&token); |
| @@ -2777,28 +2777,28 @@ process_dynamic_array_len(struct tep_event_format *event, struct print_arg *arg, | |||
| 2777 | free_token(token); | 2777 | free_token(token); |
| 2778 | out_err: | 2778 | out_err: |
| 2779 | *tok = NULL; | 2779 | *tok = NULL; |
| 2780 | return EVENT_ERROR; | 2780 | return TEP_EVENT_ERROR; |
| 2781 | } | 2781 | } |
| 2782 | 2782 | ||
| 2783 | static enum event_type | 2783 | static enum tep_event_type |
| 2784 | process_paren(struct tep_event_format *event, struct print_arg *arg, char **tok) | 2784 | process_paren(struct tep_event_format *event, struct print_arg *arg, char **tok) |
| 2785 | { | 2785 | { |
| 2786 | struct print_arg *item_arg; | 2786 | struct print_arg *item_arg; |
| 2787 | enum event_type type; | 2787 | enum tep_event_type type; |
| 2788 | char *token; | 2788 | char *token; |
| 2789 | 2789 | ||
| 2790 | type = process_arg(event, arg, &token); | 2790 | type = process_arg(event, arg, &token); |
| 2791 | 2791 | ||
| 2792 | if (type == EVENT_ERROR) | 2792 | if (type == TEP_EVENT_ERROR) |
| 2793 | goto out_free; | 2793 | goto out_free; |
| 2794 | 2794 | ||
| 2795 | if (type == EVENT_OP) | 2795 | if (type == TEP_EVENT_OP) |
| 2796 | type = process_op(event, arg, &token); | 2796 | type = process_op(event, arg, &token); |
| 2797 | 2797 | ||
| 2798 | if (type == EVENT_ERROR) | 2798 | if (type == TEP_EVENT_ERROR) |
| 2799 | goto out_free; | 2799 | goto out_free; |
| 2800 | 2800 | ||
| 2801 | if (test_type_token(type, token, EVENT_DELIM, ")")) | 2801 | if (test_type_token(type, token, TEP_EVENT_DELIM, ")")) |
| 2802 | goto out_free; | 2802 | goto out_free; |
| 2803 | 2803 | ||
| 2804 | free_token(token); | 2804 | free_token(token); |
| @@ -2809,7 +2809,7 @@ process_paren(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2809 | * this was a typecast. | 2809 | * this was a typecast. |
| 2810 | */ | 2810 | */ |
| 2811 | if (event_item_type(type) || | 2811 | if (event_item_type(type) || |
| 2812 | (type == EVENT_DELIM && strcmp(token, "(") == 0)) { | 2812 | (type == TEP_EVENT_DELIM && strcmp(token, "(") == 0)) { |
| 2813 | 2813 | ||
| 2814 | /* make this a typecast and contine */ | 2814 | /* make this a typecast and contine */ |
| 2815 | 2815 | ||
| @@ -2839,25 +2839,25 @@ process_paren(struct tep_event_format *event, struct print_arg *arg, char **tok) | |||
| 2839 | out_free: | 2839 | out_free: |
| 2840 | free_token(token); | 2840 | free_token(token); |
| 2841 | *tok = NULL; | 2841 | *tok = NULL; |
| 2842 | return EVENT_ERROR; | 2842 | return TEP_EVENT_ERROR; |
| 2843 | } | 2843 | } |
| 2844 | 2844 | ||
| 2845 | 2845 | ||
| 2846 | static enum event_type | 2846 | static enum tep_event_type |
| 2847 | process_str(struct tep_event_format *event __maybe_unused, struct print_arg *arg, | 2847 | process_str(struct tep_event_format *event __maybe_unused, struct print_arg *arg, |
| 2848 | char **tok) | 2848 | char **tok) |
| 2849 | { | 2849 | { |
| 2850 | enum event_type type; | 2850 | enum tep_event_type type; |
| 2851 | char *token; | 2851 | char *token; |
| 2852 | 2852 | ||
| 2853 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 2853 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 2854 | goto out_free; | 2854 | goto out_free; |
| 2855 | 2855 | ||
| 2856 | arg->type = PRINT_STRING; | 2856 | arg->type = PRINT_STRING; |
| 2857 | arg->string.string = token; | 2857 | arg->string.string = token; |
| 2858 | arg->string.offset = -1; | 2858 | arg->string.offset = -1; |
| 2859 | 2859 | ||
| 2860 | if (read_expected(EVENT_DELIM, ")") < 0) | 2860 | if (read_expected(TEP_EVENT_DELIM, ")") < 0) |
| 2861 | goto out_err; | 2861 | goto out_err; |
| 2862 | 2862 | ||
| 2863 | type = read_token(&token); | 2863 | type = read_token(&token); |
| @@ -2869,24 +2869,24 @@ process_str(struct tep_event_format *event __maybe_unused, struct print_arg *arg | |||
| 2869 | free_token(token); | 2869 | free_token(token); |
| 2870 | out_err: | 2870 | out_err: |
| 2871 | *tok = NULL; | 2871 | *tok = NULL; |
| 2872 | return EVENT_ERROR; | 2872 | return TEP_EVENT_ERROR; |
| 2873 | } | 2873 | } |
| 2874 | 2874 | ||
| 2875 | static enum event_type | 2875 | static enum tep_event_type |
| 2876 | process_bitmask(struct tep_event_format *event __maybe_unused, struct print_arg *arg, | 2876 | process_bitmask(struct tep_event_format *event __maybe_unused, struct print_arg *arg, |
| 2877 | char **tok) | 2877 | char **tok) |
| 2878 | { | 2878 | { |
| 2879 | enum event_type type; | 2879 | enum tep_event_type type; |
| 2880 | char *token; | 2880 | char *token; |
| 2881 | 2881 | ||
| 2882 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 2882 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 2883 | goto out_free; | 2883 | goto out_free; |
| 2884 | 2884 | ||
| 2885 | arg->type = PRINT_BITMASK; | 2885 | arg->type = PRINT_BITMASK; |
| 2886 | arg->bitmask.bitmask = token; | 2886 | arg->bitmask.bitmask = token; |
| 2887 | arg->bitmask.offset = -1; | 2887 | arg->bitmask.offset = -1; |
| 2888 | 2888 | ||
| 2889 | if (read_expected(EVENT_DELIM, ")") < 0) | 2889 | if (read_expected(TEP_EVENT_DELIM, ")") < 0) |
| 2890 | goto out_err; | 2890 | goto out_err; |
| 2891 | 2891 | ||
| 2892 | type = read_token(&token); | 2892 | type = read_token(&token); |
| @@ -2898,7 +2898,7 @@ process_bitmask(struct tep_event_format *event __maybe_unused, struct print_arg | |||
| 2898 | free_token(token); | 2898 | free_token(token); |
| 2899 | out_err: | 2899 | out_err: |
| 2900 | *tok = NULL; | 2900 | *tok = NULL; |
| 2901 | return EVENT_ERROR; | 2901 | return TEP_EVENT_ERROR; |
| 2902 | } | 2902 | } |
| 2903 | 2903 | ||
| 2904 | static struct tep_function_handler * | 2904 | static struct tep_function_handler * |
| @@ -2933,13 +2933,13 @@ static void remove_func_handler(struct tep_handle *pevent, char *func_name) | |||
| 2933 | } | 2933 | } |
| 2934 | } | 2934 | } |
| 2935 | 2935 | ||
| 2936 | static enum event_type | 2936 | static enum tep_event_type |
| 2937 | process_func_handler(struct tep_event_format *event, struct tep_function_handler *func, | 2937 | process_func_handler(struct tep_event_format *event, struct tep_function_handler *func, |
| 2938 | struct print_arg *arg, char **tok) | 2938 | struct print_arg *arg, char **tok) |
| 2939 | { | 2939 | { |
| 2940 | struct print_arg **next_arg; | 2940 | struct print_arg **next_arg; |
| 2941 | struct print_arg *farg; | 2941 | struct print_arg *farg; |
| 2942 | enum event_type type; | 2942 | enum tep_event_type type; |
| 2943 | char *token; | 2943 | char *token; |
| 2944 | int i; | 2944 | int i; |
| 2945 | 2945 | ||
| @@ -2954,12 +2954,12 @@ process_func_handler(struct tep_event_format *event, struct tep_function_handler | |||
| 2954 | if (!farg) { | 2954 | if (!farg) { |
| 2955 | do_warning_event(event, "%s: not enough memory!", | 2955 | do_warning_event(event, "%s: not enough memory!", |
| 2956 | __func__); | 2956 | __func__); |
| 2957 | return EVENT_ERROR; | 2957 | return TEP_EVENT_ERROR; |
| 2958 | } | 2958 | } |
| 2959 | 2959 | ||
| 2960 | type = process_arg(event, farg, &token); | 2960 | type = process_arg(event, farg, &token); |
| 2961 | if (i < (func->nr_args - 1)) { | 2961 | if (i < (func->nr_args - 1)) { |
| 2962 | if (type != EVENT_DELIM || strcmp(token, ",") != 0) { | 2962 | if (type != TEP_EVENT_DELIM || strcmp(token, ",") != 0) { |
| 2963 | do_warning_event(event, | 2963 | do_warning_event(event, |
| 2964 | "Error: function '%s()' expects %d arguments but event %s only uses %d", | 2964 | "Error: function '%s()' expects %d arguments but event %s only uses %d", |
| 2965 | func->name, func->nr_args, | 2965 | func->name, func->nr_args, |
| @@ -2967,7 +2967,7 @@ process_func_handler(struct tep_event_format *event, struct tep_function_handler | |||
| 2967 | goto err; | 2967 | goto err; |
| 2968 | } | 2968 | } |
| 2969 | } else { | 2969 | } else { |
| 2970 | if (type != EVENT_DELIM || strcmp(token, ")") != 0) { | 2970 | if (type != TEP_EVENT_DELIM || strcmp(token, ")") != 0) { |
| 2971 | do_warning_event(event, | 2971 | do_warning_event(event, |
| 2972 | "Error: function '%s()' only expects %d arguments but event %s has more", | 2972 | "Error: function '%s()' only expects %d arguments but event %s has more", |
| 2973 | func->name, func->nr_args, event->name); | 2973 | func->name, func->nr_args, event->name); |
| @@ -2988,10 +2988,10 @@ process_func_handler(struct tep_event_format *event, struct tep_function_handler | |||
| 2988 | err: | 2988 | err: |
| 2989 | free_arg(farg); | 2989 | free_arg(farg); |
| 2990 | free_token(token); | 2990 | free_token(token); |
| 2991 | return EVENT_ERROR; | 2991 | return TEP_EVENT_ERROR; |
| 2992 | } | 2992 | } |
| 2993 | 2993 | ||
| 2994 | static enum event_type | 2994 | static enum tep_event_type |
| 2995 | process_function(struct tep_event_format *event, struct print_arg *arg, | 2995 | process_function(struct tep_event_format *event, struct print_arg *arg, |
| 2996 | char *token, char **tok) | 2996 | char *token, char **tok) |
| 2997 | { | 2997 | { |
| @@ -3044,12 +3044,12 @@ process_function(struct tep_event_format *event, struct print_arg *arg, | |||
| 3044 | 3044 | ||
| 3045 | do_warning_event(event, "function %s not defined", token); | 3045 | do_warning_event(event, "function %s not defined", token); |
| 3046 | free_token(token); | 3046 | free_token(token); |
| 3047 | return EVENT_ERROR; | 3047 | return TEP_EVENT_ERROR; |
| 3048 | } | 3048 | } |
| 3049 | 3049 | ||
| 3050 | static enum event_type | 3050 | static enum tep_event_type |
| 3051 | process_arg_token(struct tep_event_format *event, struct print_arg *arg, | 3051 | process_arg_token(struct tep_event_format *event, struct print_arg *arg, |
| 3052 | char **tok, enum event_type type) | 3052 | char **tok, enum tep_event_type type) |
| 3053 | { | 3053 | { |
| 3054 | char *token; | 3054 | char *token; |
| 3055 | char *atom; | 3055 | char *atom; |
| @@ -3057,7 +3057,7 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3057 | token = *tok; | 3057 | token = *tok; |
| 3058 | 3058 | ||
| 3059 | switch (type) { | 3059 | switch (type) { |
| 3060 | case EVENT_ITEM: | 3060 | case TEP_EVENT_ITEM: |
| 3061 | if (strcmp(token, "REC") == 0) { | 3061 | if (strcmp(token, "REC") == 0) { |
| 3062 | free_token(token); | 3062 | free_token(token); |
| 3063 | type = process_entry(event, arg, &token); | 3063 | type = process_entry(event, arg, &token); |
| @@ -3071,7 +3071,7 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3071 | * If the next token is a parenthesis, then this | 3071 | * If the next token is a parenthesis, then this |
| 3072 | * is a function. | 3072 | * is a function. |
| 3073 | */ | 3073 | */ |
| 3074 | if (type == EVENT_DELIM && strcmp(token, "(") == 0) { | 3074 | if (type == TEP_EVENT_DELIM && strcmp(token, "(") == 0) { |
| 3075 | free_token(token); | 3075 | free_token(token); |
| 3076 | token = NULL; | 3076 | token = NULL; |
| 3077 | /* this will free atom. */ | 3077 | /* this will free atom. */ |
| @@ -3079,7 +3079,7 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3079 | break; | 3079 | break; |
| 3080 | } | 3080 | } |
| 3081 | /* atoms can be more than one token long */ | 3081 | /* atoms can be more than one token long */ |
| 3082 | while (type == EVENT_ITEM) { | 3082 | while (type == TEP_EVENT_ITEM) { |
| 3083 | char *new_atom; | 3083 | char *new_atom; |
| 3084 | new_atom = realloc(atom, | 3084 | new_atom = realloc(atom, |
| 3085 | strlen(atom) + strlen(token) + 2); | 3085 | strlen(atom) + strlen(token) + 2); |
| @@ -3087,7 +3087,7 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3087 | free(atom); | 3087 | free(atom); |
| 3088 | *tok = NULL; | 3088 | *tok = NULL; |
| 3089 | free_token(token); | 3089 | free_token(token); |
| 3090 | return EVENT_ERROR; | 3090 | return TEP_EVENT_ERROR; |
| 3091 | } | 3091 | } |
| 3092 | atom = new_atom; | 3092 | atom = new_atom; |
| 3093 | strcat(atom, " "); | 3093 | strcat(atom, " "); |
| @@ -3100,19 +3100,19 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3100 | arg->atom.atom = atom; | 3100 | arg->atom.atom = atom; |
| 3101 | break; | 3101 | break; |
| 3102 | 3102 | ||
| 3103 | case EVENT_DQUOTE: | 3103 | case TEP_EVENT_DQUOTE: |
| 3104 | case EVENT_SQUOTE: | 3104 | case TEP_EVENT_SQUOTE: |
| 3105 | arg->type = PRINT_ATOM; | 3105 | arg->type = PRINT_ATOM; |
| 3106 | arg->atom.atom = token; | 3106 | arg->atom.atom = token; |
| 3107 | type = read_token_item(&token); | 3107 | type = read_token_item(&token); |
| 3108 | break; | 3108 | break; |
| 3109 | case EVENT_DELIM: | 3109 | case TEP_EVENT_DELIM: |
| 3110 | if (strcmp(token, "(") == 0) { | 3110 | if (strcmp(token, "(") == 0) { |
| 3111 | free_token(token); | 3111 | free_token(token); |
| 3112 | type = process_paren(event, arg, &token); | 3112 | type = process_paren(event, arg, &token); |
| 3113 | break; | 3113 | break; |
| 3114 | } | 3114 | } |
| 3115 | case EVENT_OP: | 3115 | case TEP_EVENT_OP: |
| 3116 | /* handle single ops */ | 3116 | /* handle single ops */ |
| 3117 | arg->type = PRINT_OP; | 3117 | arg->type = PRINT_OP; |
| 3118 | arg->op.op = token; | 3118 | arg->op.op = token; |
| @@ -3120,16 +3120,16 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3120 | type = process_op(event, arg, &token); | 3120 | type = process_op(event, arg, &token); |
| 3121 | 3121 | ||
| 3122 | /* On error, the op is freed */ | 3122 | /* On error, the op is freed */ |
| 3123 | if (type == EVENT_ERROR) | 3123 | if (type == TEP_EVENT_ERROR) |
| 3124 | arg->op.op = NULL; | 3124 | arg->op.op = NULL; |
| 3125 | 3125 | ||
| 3126 | /* return error type if errored */ | 3126 | /* return error type if errored */ |
| 3127 | break; | 3127 | break; |
| 3128 | 3128 | ||
| 3129 | case EVENT_ERROR ... EVENT_NEWLINE: | 3129 | case TEP_EVENT_ERROR ... TEP_EVENT_NEWLINE: |
| 3130 | default: | 3130 | default: |
| 3131 | do_warning_event(event, "unexpected type %d", type); | 3131 | do_warning_event(event, "unexpected type %d", type); |
| 3132 | return EVENT_ERROR; | 3132 | return TEP_EVENT_ERROR; |
| 3133 | } | 3133 | } |
| 3134 | *tok = token; | 3134 | *tok = token; |
| 3135 | 3135 | ||
| @@ -3138,13 +3138,13 @@ process_arg_token(struct tep_event_format *event, struct print_arg *arg, | |||
| 3138 | 3138 | ||
| 3139 | static int event_read_print_args(struct tep_event_format *event, struct print_arg **list) | 3139 | static int event_read_print_args(struct tep_event_format *event, struct print_arg **list) |
| 3140 | { | 3140 | { |
| 3141 | enum event_type type = EVENT_ERROR; | 3141 | enum tep_event_type type = TEP_EVENT_ERROR; |
| 3142 | struct print_arg *arg; | 3142 | struct print_arg *arg; |
| 3143 | char *token; | 3143 | char *token; |
| 3144 | int args = 0; | 3144 | int args = 0; |
| 3145 | 3145 | ||
| 3146 | do { | 3146 | do { |
| 3147 | if (type == EVENT_NEWLINE) { | 3147 | if (type == TEP_EVENT_NEWLINE) { |
| 3148 | type = read_token_item(&token); | 3148 | type = read_token_item(&token); |
| 3149 | continue; | 3149 | continue; |
| 3150 | } | 3150 | } |
| @@ -3158,7 +3158,7 @@ static int event_read_print_args(struct tep_event_format *event, struct print_ar | |||
| 3158 | 3158 | ||
| 3159 | type = process_arg(event, arg, &token); | 3159 | type = process_arg(event, arg, &token); |
| 3160 | 3160 | ||
| 3161 | if (type == EVENT_ERROR) { | 3161 | if (type == TEP_EVENT_ERROR) { |
| 3162 | free_token(token); | 3162 | free_token(token); |
| 3163 | free_arg(arg); | 3163 | free_arg(arg); |
| 3164 | return -1; | 3164 | return -1; |
| @@ -3167,10 +3167,10 @@ static int event_read_print_args(struct tep_event_format *event, struct print_ar | |||
| 3167 | *list = arg; | 3167 | *list = arg; |
| 3168 | args++; | 3168 | args++; |
| 3169 | 3169 | ||
| 3170 | if (type == EVENT_OP) { | 3170 | if (type == TEP_EVENT_OP) { |
| 3171 | type = process_op(event, arg, &token); | 3171 | type = process_op(event, arg, &token); |
| 3172 | free_token(token); | 3172 | free_token(token); |
| 3173 | if (type == EVENT_ERROR) { | 3173 | if (type == TEP_EVENT_ERROR) { |
| 3174 | *list = NULL; | 3174 | *list = NULL; |
| 3175 | free_arg(arg); | 3175 | free_arg(arg); |
| 3176 | return -1; | 3176 | return -1; |
| @@ -3179,16 +3179,16 @@ static int event_read_print_args(struct tep_event_format *event, struct print_ar | |||
| 3179 | continue; | 3179 | continue; |
| 3180 | } | 3180 | } |
| 3181 | 3181 | ||
| 3182 | if (type == EVENT_DELIM && strcmp(token, ",") == 0) { | 3182 | if (type == TEP_EVENT_DELIM && strcmp(token, ",") == 0) { |
| 3183 | free_token(token); | 3183 | free_token(token); |
| 3184 | *list = arg; | 3184 | *list = arg; |
| 3185 | list = &arg->next; | 3185 | list = &arg->next; |
| 3186 | continue; | 3186 | continue; |
| 3187 | } | 3187 | } |
| 3188 | break; | 3188 | break; |
| 3189 | } while (type != EVENT_NONE); | 3189 | } while (type != TEP_EVENT_NONE); |
| 3190 | 3190 | ||
| 3191 | if (type != EVENT_NONE && type != EVENT_ERROR) | 3191 | if (type != TEP_EVENT_NONE && type != TEP_EVENT_ERROR) |
| 3192 | free_token(token); | 3192 | free_token(token); |
| 3193 | 3193 | ||
| 3194 | return args; | 3194 | return args; |
| @@ -3196,20 +3196,20 @@ static int event_read_print_args(struct tep_event_format *event, struct print_ar | |||
| 3196 | 3196 | ||
| 3197 | static int event_read_print(struct tep_event_format *event) | 3197 | static int event_read_print(struct tep_event_format *event) |
| 3198 | { | 3198 | { |
| 3199 | enum event_type type; | 3199 | enum tep_event_type type; |
| 3200 | char *token; | 3200 | char *token; |
| 3201 | int ret; | 3201 | int ret; |
| 3202 | 3202 | ||
| 3203 | if (read_expected_item(EVENT_ITEM, "print") < 0) | 3203 | if (read_expected_item(TEP_EVENT_ITEM, "print") < 0) |
| 3204 | return -1; | 3204 | return -1; |
| 3205 | 3205 | ||
| 3206 | if (read_expected(EVENT_ITEM, "fmt") < 0) | 3206 | if (read_expected(TEP_EVENT_ITEM, "fmt") < 0) |
| 3207 | return -1; | 3207 | return -1; |
| 3208 | 3208 | ||
| 3209 | if (read_expected(EVENT_OP, ":") < 0) | 3209 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 3210 | return -1; | 3210 | return -1; |
| 3211 | 3211 | ||
| 3212 | if (read_expect_type(EVENT_DQUOTE, &token) < 0) | 3212 | if (read_expect_type(TEP_EVENT_DQUOTE, &token) < 0) |
| 3213 | goto fail; | 3213 | goto fail; |
| 3214 | 3214 | ||
| 3215 | concat: | 3215 | concat: |
| @@ -3219,11 +3219,11 @@ static int event_read_print(struct tep_event_format *event) | |||
| 3219 | /* ok to have no arg */ | 3219 | /* ok to have no arg */ |
| 3220 | type = read_token_item(&token); | 3220 | type = read_token_item(&token); |
| 3221 | 3221 | ||
| 3222 | if (type == EVENT_NONE) | 3222 | if (type == TEP_EVENT_NONE) |
| 3223 | return 0; | 3223 | return 0; |
| 3224 | 3224 | ||
| 3225 | /* Handle concatenation of print lines */ | 3225 | /* Handle concatenation of print lines */ |
| 3226 | if (type == EVENT_DQUOTE) { | 3226 | if (type == TEP_EVENT_DQUOTE) { |
| 3227 | char *cat; | 3227 | char *cat; |
| 3228 | 3228 | ||
| 3229 | if (asprintf(&cat, "%s%s", event->print_fmt.format, token) < 0) | 3229 | if (asprintf(&cat, "%s%s", event->print_fmt.format, token) < 0) |
| @@ -3235,7 +3235,7 @@ static int event_read_print(struct tep_event_format *event) | |||
| 3235 | goto concat; | 3235 | goto concat; |
| 3236 | } | 3236 | } |
| 3237 | 3237 | ||
| 3238 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 3238 | if (test_type_token(type, token, TEP_EVENT_DELIM, ",")) |
| 3239 | goto fail; | 3239 | goto fail; |
| 3240 | 3240 | ||
| 3241 | free_token(token); | 3241 | free_token(token); |
| @@ -5617,7 +5617,7 @@ static int events_system_cmp(const void *a, const void *b) | |||
| 5617 | return events_id_cmp(a, b); | 5617 | return events_id_cmp(a, b); |
| 5618 | } | 5618 | } |
| 5619 | 5619 | ||
| 5620 | struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum event_sort_type sort_type) | 5620 | struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type sort_type) |
| 5621 | { | 5621 | { |
| 5622 | struct tep_event_format **events; | 5622 | struct tep_event_format **events; |
| 5623 | int (*sort)(const void *a, const void *b); | 5623 | int (*sort)(const void *a, const void *b); |
| @@ -5638,20 +5638,20 @@ struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum event_ | |||
| 5638 | pevent->sort_events = events; | 5638 | pevent->sort_events = events; |
| 5639 | 5639 | ||
| 5640 | /* the internal events are sorted by id */ | 5640 | /* the internal events are sorted by id */ |
| 5641 | if (sort_type == EVENT_SORT_ID) { | 5641 | if (sort_type == TEP_EVENT_SORT_ID) { |
| 5642 | pevent->last_type = sort_type; | 5642 | pevent->last_type = sort_type; |
| 5643 | return events; | 5643 | return events; |
| 5644 | } | 5644 | } |
| 5645 | } | 5645 | } |
| 5646 | 5646 | ||
| 5647 | switch (sort_type) { | 5647 | switch (sort_type) { |
| 5648 | case EVENT_SORT_ID: | 5648 | case TEP_EVENT_SORT_ID: |
| 5649 | sort = events_id_cmp; | 5649 | sort = events_id_cmp; |
| 5650 | break; | 5650 | break; |
| 5651 | case EVENT_SORT_NAME: | 5651 | case TEP_EVENT_SORT_NAME: |
| 5652 | sort = events_name_cmp; | 5652 | sort = events_name_cmp; |
| 5653 | break; | 5653 | break; |
| 5654 | case EVENT_SORT_SYSTEM: | 5654 | case TEP_EVENT_SORT_SYSTEM: |
| 5655 | sort = events_system_cmp; | 5655 | sort = events_system_cmp; |
| 5656 | break; | 5656 | break; |
| 5657 | default: | 5657 | default: |
| @@ -5834,13 +5834,13 @@ static void parse_header_field(const char *field, | |||
| 5834 | save_input_buf_ptr = input_buf_ptr; | 5834 | save_input_buf_ptr = input_buf_ptr; |
| 5835 | save_input_buf_siz = input_buf_siz; | 5835 | save_input_buf_siz = input_buf_siz; |
| 5836 | 5836 | ||
| 5837 | if (read_expected(EVENT_ITEM, "field") < 0) | 5837 | if (read_expected(TEP_EVENT_ITEM, "field") < 0) |
| 5838 | return; | 5838 | return; |
| 5839 | if (read_expected(EVENT_OP, ":") < 0) | 5839 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 5840 | return; | 5840 | return; |
| 5841 | 5841 | ||
| 5842 | /* type */ | 5842 | /* type */ |
| 5843 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 5843 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 5844 | goto fail; | 5844 | goto fail; |
| 5845 | free_token(token); | 5845 | free_token(token); |
| 5846 | 5846 | ||
| @@ -5848,42 +5848,42 @@ static void parse_header_field(const char *field, | |||
| 5848 | * If this is not a mandatory field, then test it first. | 5848 | * If this is not a mandatory field, then test it first. |
| 5849 | */ | 5849 | */ |
| 5850 | if (mandatory) { | 5850 | if (mandatory) { |
| 5851 | if (read_expected(EVENT_ITEM, field) < 0) | 5851 | if (read_expected(TEP_EVENT_ITEM, field) < 0) |
| 5852 | return; | 5852 | return; |
| 5853 | } else { | 5853 | } else { |
| 5854 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 5854 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 5855 | goto fail; | 5855 | goto fail; |
| 5856 | if (strcmp(token, field) != 0) | 5856 | if (strcmp(token, field) != 0) |
| 5857 | goto discard; | 5857 | goto discard; |
| 5858 | free_token(token); | 5858 | free_token(token); |
| 5859 | } | 5859 | } |
| 5860 | 5860 | ||
| 5861 | if (read_expected(EVENT_OP, ";") < 0) | 5861 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 5862 | return; | 5862 | return; |
| 5863 | if (read_expected(EVENT_ITEM, "offset") < 0) | 5863 | if (read_expected(TEP_EVENT_ITEM, "offset") < 0) |
| 5864 | return; | 5864 | return; |
| 5865 | if (read_expected(EVENT_OP, ":") < 0) | 5865 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 5866 | return; | 5866 | return; |
| 5867 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 5867 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 5868 | goto fail; | 5868 | goto fail; |
| 5869 | *offset = atoi(token); | 5869 | *offset = atoi(token); |
| 5870 | free_token(token); | 5870 | free_token(token); |
| 5871 | if (read_expected(EVENT_OP, ";") < 0) | 5871 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 5872 | return; | 5872 | return; |
| 5873 | if (read_expected(EVENT_ITEM, "size") < 0) | 5873 | if (read_expected(TEP_EVENT_ITEM, "size") < 0) |
| 5874 | return; | 5874 | return; |
| 5875 | if (read_expected(EVENT_OP, ":") < 0) | 5875 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 5876 | return; | 5876 | return; |
| 5877 | if (read_expect_type(EVENT_ITEM, &token) < 0) | 5877 | if (read_expect_type(TEP_EVENT_ITEM, &token) < 0) |
| 5878 | goto fail; | 5878 | goto fail; |
| 5879 | *size = atoi(token); | 5879 | *size = atoi(token); |
| 5880 | free_token(token); | 5880 | free_token(token); |
| 5881 | if (read_expected(EVENT_OP, ";") < 0) | 5881 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 5882 | return; | 5882 | return; |
| 5883 | type = read_token(&token); | 5883 | type = read_token(&token); |
| 5884 | if (type != EVENT_NEWLINE) { | 5884 | if (type != TEP_EVENT_NEWLINE) { |
| 5885 | /* newer versions of the kernel have a "signed" type */ | 5885 | /* newer versions of the kernel have a "signed" type */ |
| 5886 | if (type != EVENT_ITEM) | 5886 | if (type != TEP_EVENT_ITEM) |
| 5887 | goto fail; | 5887 | goto fail; |
| 5888 | 5888 | ||
| 5889 | if (strcmp(token, "signed") != 0) | 5889 | if (strcmp(token, "signed") != 0) |
| @@ -5891,17 +5891,17 @@ static void parse_header_field(const char *field, | |||
| 5891 | 5891 | ||
| 5892 | free_token(token); | 5892 | free_token(token); |
| 5893 | 5893 | ||
| 5894 | if (read_expected(EVENT_OP, ":") < 0) | 5894 | if (read_expected(TEP_EVENT_OP, ":") < 0) |
| 5895 | return; | 5895 | return; |
| 5896 | 5896 | ||
| 5897 | if (read_expect_type(EVENT_ITEM, &token)) | 5897 | if (read_expect_type(TEP_EVENT_ITEM, &token)) |
| 5898 | goto fail; | 5898 | goto fail; |
| 5899 | 5899 | ||
| 5900 | free_token(token); | 5900 | free_token(token); |
| 5901 | if (read_expected(EVENT_OP, ";") < 0) | 5901 | if (read_expected(TEP_EVENT_OP, ";") < 0) |
| 5902 | return; | 5902 | return; |
| 5903 | 5903 | ||
| 5904 | if (read_expect_type(EVENT_NEWLINE, &token)) | 5904 | if (read_expect_type(TEP_EVENT_NEWLINE, &token)) |
| 5905 | goto fail; | 5905 | goto fail; |
| 5906 | } | 5906 | } |
| 5907 | fail: | 5907 | fail: |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index f1e1baee8cbd..10aaeda34c6b 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
| @@ -301,22 +301,22 @@ enum { | |||
| 301 | EVENT_FL_FAILED = 0x80000000 | 301 | EVENT_FL_FAILED = 0x80000000 |
| 302 | }; | 302 | }; |
| 303 | 303 | ||
| 304 | enum event_sort_type { | 304 | enum tep_event_sort_type { |
| 305 | EVENT_SORT_ID, | 305 | TEP_EVENT_SORT_ID, |
| 306 | EVENT_SORT_NAME, | 306 | TEP_EVENT_SORT_NAME, |
| 307 | EVENT_SORT_SYSTEM, | 307 | TEP_EVENT_SORT_SYSTEM, |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | enum event_type { | 310 | enum tep_event_type { |
| 311 | EVENT_ERROR, | 311 | TEP_EVENT_ERROR, |
| 312 | EVENT_NONE, | 312 | TEP_EVENT_NONE, |
| 313 | EVENT_SPACE, | 313 | TEP_EVENT_SPACE, |
| 314 | EVENT_NEWLINE, | 314 | TEP_EVENT_NEWLINE, |
| 315 | EVENT_OP, | 315 | TEP_EVENT_OP, |
| 316 | EVENT_DELIM, | 316 | TEP_EVENT_DELIM, |
| 317 | EVENT_ITEM, | 317 | TEP_EVENT_ITEM, |
| 318 | EVENT_DQUOTE, | 318 | TEP_EVENT_DQUOTE, |
| 319 | EVENT_SQUOTE, | 319 | TEP_EVENT_SQUOTE, |
| 320 | }; | 320 | }; |
| 321 | 321 | ||
| 322 | typedef unsigned long long (*tep_func_handler)(struct trace_seq *s, | 322 | typedef unsigned long long (*tep_func_handler)(struct trace_seq *s, |
| @@ -454,7 +454,7 @@ struct tep_handle { | |||
| 454 | struct tep_event_format **events; | 454 | struct tep_event_format **events; |
| 455 | int nr_events; | 455 | int nr_events; |
| 456 | struct tep_event_format **sort_events; | 456 | struct tep_event_format **sort_events; |
| 457 | enum event_sort_type last_type; | 457 | enum tep_event_sort_type last_type; |
| 458 | 458 | ||
| 459 | int type_offset; | 459 | int type_offset; |
| 460 | int type_size; | 460 | int type_size; |
| @@ -685,7 +685,7 @@ void tep_event_info(struct trace_seq *s, struct tep_event_format *event, | |||
| 685 | int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum, | 685 | int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum, |
| 686 | char *buf, size_t buflen); | 686 | char *buf, size_t buflen); |
| 687 | 687 | ||
| 688 | struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum event_sort_type); | 688 | struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type); |
| 689 | struct tep_format_field **tep_event_common_fields(struct tep_event_format *event); | 689 | struct tep_format_field **tep_event_common_fields(struct tep_event_format *event); |
| 690 | struct tep_format_field **tep_event_fields(struct tep_event_format *event); | 690 | struct tep_format_field **tep_event_fields(struct tep_event_format *event); |
| 691 | 691 | ||
| @@ -756,7 +756,7 @@ void tep_unref(struct tep_handle *pevent); | |||
| 756 | 756 | ||
| 757 | /* access to the internal parser */ | 757 | /* access to the internal parser */ |
| 758 | void tep_buffer_init(const char *buf, unsigned long long size); | 758 | void tep_buffer_init(const char *buf, unsigned long long size); |
| 759 | enum event_type tep_read_token(char **tok); | 759 | enum tep_event_type tep_read_token(char **tok); |
| 760 | void tep_free_token(char *token); | 760 | void tep_free_token(char *token); |
| 761 | int tep_peek_char(void); | 761 | int tep_peek_char(void); |
| 762 | const char *tep_get_input_buf(void); | 762 | const char *tep_get_input_buf(void); |
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c index dcd97acbbc49..153e248de75b 100644 --- a/tools/lib/traceevent/parse-filter.c +++ b/tools/lib/traceevent/parse-filter.c | |||
| @@ -61,15 +61,15 @@ static void free_token(char *token) | |||
| 61 | tep_free_token(token); | 61 | tep_free_token(token); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static enum event_type read_token(char **tok) | 64 | static enum tep_event_type read_token(char **tok) |
| 65 | { | 65 | { |
| 66 | enum event_type type; | 66 | enum tep_event_type type; |
| 67 | char *token = NULL; | 67 | char *token = NULL; |
| 68 | 68 | ||
| 69 | do { | 69 | do { |
| 70 | free_token(token); | 70 | free_token(token); |
| 71 | type = tep_read_token(&token); | 71 | type = tep_read_token(&token); |
| 72 | } while (type == EVENT_NEWLINE || type == EVENT_SPACE); | 72 | } while (type == TEP_EVENT_NEWLINE || type == TEP_EVENT_SPACE); |
| 73 | 73 | ||
| 74 | /* If token is = or ! check to see if the next char is ~ */ | 74 | /* If token is = or ! check to see if the next char is ~ */ |
| 75 | if (token && | 75 | if (token && |
| @@ -79,7 +79,7 @@ static enum event_type read_token(char **tok) | |||
| 79 | *tok = malloc(3); | 79 | *tok = malloc(3); |
| 80 | if (*tok == NULL) { | 80 | if (*tok == NULL) { |
| 81 | free_token(token); | 81 | free_token(token); |
| 82 | return EVENT_ERROR; | 82 | return TEP_EVENT_ERROR; |
| 83 | } | 83 | } |
| 84 | sprintf(*tok, "%c%c", *token, '~'); | 84 | sprintf(*tok, "%c%c", *token, '~'); |
| 85 | free_token(token); | 85 | free_token(token); |
| @@ -334,7 +334,7 @@ static void free_events(struct event_list *events) | |||
| 334 | 334 | ||
| 335 | static enum tep_errno | 335 | static enum tep_errno |
| 336 | create_arg_item(struct tep_event_format *event, const char *token, | 336 | create_arg_item(struct tep_event_format *event, const char *token, |
| 337 | enum event_type type, struct filter_arg **parg, char *error_str) | 337 | enum tep_event_type type, struct filter_arg **parg, char *error_str) |
| 338 | { | 338 | { |
| 339 | struct tep_format_field *field; | 339 | struct tep_format_field *field; |
| 340 | struct filter_arg *arg; | 340 | struct filter_arg *arg; |
| @@ -347,11 +347,11 @@ create_arg_item(struct tep_event_format *event, const char *token, | |||
| 347 | 347 | ||
| 348 | switch (type) { | 348 | switch (type) { |
| 349 | 349 | ||
| 350 | case EVENT_SQUOTE: | 350 | case TEP_EVENT_SQUOTE: |
| 351 | case EVENT_DQUOTE: | 351 | case TEP_EVENT_DQUOTE: |
| 352 | arg->type = FILTER_ARG_VALUE; | 352 | arg->type = FILTER_ARG_VALUE; |
| 353 | arg->value.type = | 353 | arg->value.type = |
| 354 | type == EVENT_DQUOTE ? FILTER_STRING : FILTER_CHAR; | 354 | type == TEP_EVENT_DQUOTE ? FILTER_STRING : FILTER_CHAR; |
| 355 | arg->value.str = strdup(token); | 355 | arg->value.str = strdup(token); |
| 356 | if (!arg->value.str) { | 356 | if (!arg->value.str) { |
| 357 | free_arg(arg); | 357 | free_arg(arg); |
| @@ -359,7 +359,7 @@ create_arg_item(struct tep_event_format *event, const char *token, | |||
| 359 | return TEP_ERRNO__MEM_ALLOC_FAILED; | 359 | return TEP_ERRNO__MEM_ALLOC_FAILED; |
| 360 | } | 360 | } |
| 361 | break; | 361 | break; |
| 362 | case EVENT_ITEM: | 362 | case TEP_EVENT_ITEM: |
| 363 | /* if it is a number, then convert it */ | 363 | /* if it is a number, then convert it */ |
| 364 | if (isdigit(token[0])) { | 364 | if (isdigit(token[0])) { |
| 365 | arg->type = FILTER_ARG_VALUE; | 365 | arg->type = FILTER_ARG_VALUE; |
| @@ -942,7 +942,7 @@ static enum tep_errno | |||
| 942 | process_filter(struct tep_event_format *event, struct filter_arg **parg, | 942 | process_filter(struct tep_event_format *event, struct filter_arg **parg, |
| 943 | char *error_str, int not) | 943 | char *error_str, int not) |
| 944 | { | 944 | { |
| 945 | enum event_type type; | 945 | enum tep_event_type type; |
| 946 | char *token = NULL; | 946 | char *token = NULL; |
| 947 | struct filter_arg *current_op = NULL; | 947 | struct filter_arg *current_op = NULL; |
| 948 | struct filter_arg *current_exp = NULL; | 948 | struct filter_arg *current_exp = NULL; |
| @@ -960,9 +960,9 @@ process_filter(struct tep_event_format *event, struct filter_arg **parg, | |||
| 960 | free(token); | 960 | free(token); |
| 961 | type = read_token(&token); | 961 | type = read_token(&token); |
| 962 | switch (type) { | 962 | switch (type) { |
| 963 | case EVENT_SQUOTE: | 963 | case TEP_EVENT_SQUOTE: |
| 964 | case EVENT_DQUOTE: | 964 | case TEP_EVENT_DQUOTE: |
| 965 | case EVENT_ITEM: | 965 | case TEP_EVENT_ITEM: |
| 966 | ret = create_arg_item(event, token, type, &arg, error_str); | 966 | ret = create_arg_item(event, token, type, &arg, error_str); |
| 967 | if (ret < 0) | 967 | if (ret < 0) |
| 968 | goto fail; | 968 | goto fail; |
| @@ -987,7 +987,7 @@ process_filter(struct tep_event_format *event, struct filter_arg **parg, | |||
| 987 | arg = NULL; | 987 | arg = NULL; |
| 988 | break; | 988 | break; |
| 989 | 989 | ||
| 990 | case EVENT_DELIM: | 990 | case TEP_EVENT_DELIM: |
| 991 | if (*token == ',') { | 991 | if (*token == ',') { |
| 992 | show_error(error_str, "Illegal token ','"); | 992 | show_error(error_str, "Illegal token ','"); |
| 993 | ret = TEP_ERRNO__ILLEGAL_TOKEN; | 993 | ret = TEP_ERRNO__ILLEGAL_TOKEN; |
| @@ -1054,7 +1054,7 @@ process_filter(struct tep_event_format *event, struct filter_arg **parg, | |||
| 1054 | } | 1054 | } |
| 1055 | break; | 1055 | break; |
| 1056 | 1056 | ||
| 1057 | case EVENT_OP: | 1057 | case TEP_EVENT_OP: |
| 1058 | op_type = process_op(token, &btype, &ctype, &etype); | 1058 | op_type = process_op(token, &btype, &ctype, &etype); |
| 1059 | 1059 | ||
| 1060 | /* All expect a left arg except for NOT */ | 1060 | /* All expect a left arg except for NOT */ |
| @@ -1139,14 +1139,14 @@ process_filter(struct tep_event_format *event, struct filter_arg **parg, | |||
| 1139 | if (ret < 0) | 1139 | if (ret < 0) |
| 1140 | goto fail_syntax; | 1140 | goto fail_syntax; |
| 1141 | break; | 1141 | break; |
| 1142 | case EVENT_NONE: | 1142 | case TEP_EVENT_NONE: |
| 1143 | break; | 1143 | break; |
| 1144 | case EVENT_ERROR: | 1144 | case TEP_EVENT_ERROR: |
| 1145 | goto fail_alloc; | 1145 | goto fail_alloc; |
| 1146 | default: | 1146 | default: |
| 1147 | goto fail_syntax; | 1147 | goto fail_syntax; |
| 1148 | } | 1148 | } |
| 1149 | } while (type != EVENT_NONE); | 1149 | } while (type != TEP_EVENT_NONE); |
| 1150 | 1150 | ||
| 1151 | if (!current_op && !current_exp) | 1151 | if (!current_op && !current_exp) |
| 1152 | goto fail_syntax; | 1152 | goto fail_syntax; |
