aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-10-13 21:17:06 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-10-13 21:17:06 -0400
commit21a1b1ac8d57c64e67809727b54d0e8c6112d877 (patch)
tree798ebe4f00194d001141ee077fbfc8a41facac01
parent361d4f6cb71c2cc7a0c379c62d3da96c42d6f445 (diff)
handle new "signed" field in format layout
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c64
1 files changed, 55 insertions, 9 deletions
diff --git a/parse-events.c b/parse-events.c
index 9b4960f..7541af2 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -917,8 +917,30 @@ int event_read_fields(struct event *event, struct format_field **fields)
917 if (read_expected(EVENT_OP, ";") < 0) 917 if (read_expected(EVENT_OP, ";") < 0)
918 goto fail_expect; 918 goto fail_expect;
919 919
920 if (read_expect_type(EVENT_NEWLINE, &token) < 0) 920 type = read_token(&token);
921 goto fail; 921 if (type != EVENT_NEWLINE) {
922 /* newer versions of the kernel have a "signed" type */
923 if (test_type_token(type, token, EVENT_ITEM, "signed"))
924 goto fail;
925
926 free_token(token);
927
928 if (read_expected(EVENT_OP, ":") < 0)
929 goto fail_expect;
930
931 if (read_expect_type(EVENT_ITEM, &token))
932 goto fail;
933
934 /* add signed type */
935
936 free_token(token);
937 if (read_expected(EVENT_OP, ";") < 0)
938 goto fail_expect;
939
940 if (read_expect_type(EVENT_NEWLINE, &token))
941 goto fail;
942 }
943
922 free_token(token); 944 free_token(token);
923 945
924 *fields = field; 946 *fields = field;
@@ -2952,10 +2974,11 @@ void print_args(struct print_arg *args)
2952 } 2974 }
2953} 2975}
2954 2976
2955static void parse_header_field(char *type, 2977static void parse_header_field(char *field,
2956 int *offset, int *size) 2978 int *offset, int *size)
2957{ 2979{
2958 char *token; 2980 char *token;
2981 int type;
2959 2982
2960 if (read_expected(EVENT_ITEM, "field") < 0) 2983 if (read_expected(EVENT_ITEM, "field") < 0)
2961 return; 2984 return;
@@ -2964,10 +2987,10 @@ static void parse_header_field(char *type,
2964 2987
2965 /* type */ 2988 /* type */
2966 if (read_expect_type(EVENT_ITEM, &token) < 0) 2989 if (read_expect_type(EVENT_ITEM, &token) < 0)
2967 return; 2990 goto fail;
2968 free_token(token); 2991 free_token(token);
2969 2992
2970 if (read_expected(EVENT_ITEM, type) < 0) 2993 if (read_expected(EVENT_ITEM, field) < 0)
2971 return; 2994 return;
2972 if (read_expected(EVENT_OP, ";") < 0) 2995 if (read_expected(EVENT_OP, ";") < 0)
2973 return; 2996 return;
@@ -2976,7 +2999,7 @@ static void parse_header_field(char *type,
2976 if (read_expected(EVENT_OP, ":") < 0) 2999 if (read_expected(EVENT_OP, ":") < 0)
2977 return; 3000 return;
2978 if (read_expect_type(EVENT_ITEM, &token) < 0) 3001 if (read_expect_type(EVENT_ITEM, &token) < 0)
2979 return; 3002 goto fail;
2980 *offset = atoi(token); 3003 *offset = atoi(token);
2981 free_token(token); 3004 free_token(token);
2982 if (read_expected(EVENT_OP, ";") < 0) 3005 if (read_expected(EVENT_OP, ";") < 0)
@@ -2986,13 +3009,36 @@ static void parse_header_field(char *type,
2986 if (read_expected(EVENT_OP, ":") < 0) 3009 if (read_expected(EVENT_OP, ":") < 0)
2987 return; 3010 return;
2988 if (read_expect_type(EVENT_ITEM, &token) < 0) 3011 if (read_expect_type(EVENT_ITEM, &token) < 0)
2989 return; 3012 goto fail;
2990 *size = atoi(token); 3013 *size = atoi(token);
2991 free_token(token); 3014 free_token(token);
2992 if (read_expected(EVENT_OP, ";") < 0) 3015 if (read_expected(EVENT_OP, ";") < 0)
2993 return; 3016 return;
2994 if (read_expect_type(EVENT_NEWLINE, &token) < 0) 3017 type = read_token(&token);
2995 return; 3018 if (type != EVENT_NEWLINE) {
3019 /* newer versions of the kernel have a "signed" type */
3020 if (type != EVENT_ITEM)
3021 goto fail;
3022
3023 if (strcmp(token, "signed") != 0)
3024 goto fail;
3025
3026 free_token(token);
3027
3028 if (read_expected(EVENT_OP, ":") < 0)
3029 return;
3030
3031 if (read_expect_type(EVENT_ITEM, &token))
3032 goto fail;
3033
3034 free_token(token);
3035 if (read_expected(EVENT_OP, ";") < 0)
3036 return;
3037
3038 if (read_expect_type(EVENT_NEWLINE, &token))
3039 goto fail;
3040 }
3041 fail:
2996 free_token(token); 3042 free_token(token);
2997} 3043}
2998 3044