tracing: Use a struct alignof to determine trace event field alignment
[linux-2.6-microblaze.git] / include / trace / stages / stage4_event_fields.h
index c3790ec..80d34f3 100644 (file)
@@ -2,16 +2,18 @@
 
 /* Stage 4 definitions for creating trace events */
 
+#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b)))
+
 #undef __field_ext
 #define __field_ext(_type, _item, _filter_type) {                      \
        .type = #_type, .name = #_item,                                 \
-       .size = sizeof(_type), .align = __alignof__(_type),             \
+       .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type),       \
        .is_signed = is_signed_type(_type), .filter_type = _filter_type },
 
 #undef __field_struct_ext
 #define __field_struct_ext(_type, _item, _filter_type) {               \
        .type = #_type, .name = #_item,                                 \
-       .size = sizeof(_type), .align = __alignof__(_type),             \
+       .size = sizeof(_type), .align = ALIGN_STRUCTFIELD(_type),       \
        0, .filter_type = _filter_type },
 
 #undef __field
@@ -23,7 +25,7 @@
 #undef __array
 #define __array(_type, _item, _len) {                                  \
        .type = #_type"["__stringify(_len)"]", .name = #_item,          \
-       .size = sizeof(_type[_len]), .align = __alignof__(_type),       \
+       .size = sizeof(_type[_len]), .align = ALIGN_STRUCTFIELD(_type), \
        .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER },
 
 #undef __dynamic_array