diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-06 10:50:53 -0500 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-10 00:34:03 -0400 |
commit | 156b5f172a64103bcb13b6d26288388b9019caa3 (patch) | |
tree | e29141720bd9d0e4c722dd3c7dc8c62d5113db43 | |
parent | 7bffc23e56e92c14b787bf4d95249a32085bfed5 (diff) |
tracing: typecast sizeof and offsetof to unsigned int
Impact: fix compiler warnings
On x86_64 sizeof and offsetof are treated as long, where as on x86_32
they are int. This patch typecasts them to unsigned int to avoid
one arch giving warnings while the other does not.
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r-- | kernel/trace/trace_events.c | 15 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 10 | ||||
-rw-r--r-- | kernel/trace/trace_format.h | 12 |
3 files changed, 19 insertions, 18 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 4488d90e75ef..fa32ca320767 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -448,8 +448,9 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
448 | } | 448 | } |
449 | 449 | ||
450 | #undef FIELD | 450 | #undef FIELD |
451 | #define FIELD(type, name) \ | 451 | #define FIELD(type, name) \ |
452 | #type, #name, offsetof(typeof(field), name), sizeof(field.name) | 452 | #type, #name, (unsigned int)offsetof(typeof(field), name), \ |
453 | (unsigned int)sizeof(field.name) | ||
453 | 454 | ||
454 | static int trace_write_header(struct trace_seq *s) | 455 | static int trace_write_header(struct trace_seq *s) |
455 | { | 456 | { |
@@ -457,11 +458,11 @@ static int trace_write_header(struct trace_seq *s) | |||
457 | 458 | ||
458 | /* struct trace_entry */ | 459 | /* struct trace_entry */ |
459 | return trace_seq_printf(s, | 460 | return trace_seq_printf(s, |
460 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | 461 | "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" |
461 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | 462 | "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" |
462 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | 463 | "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" |
463 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | 464 | "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" |
464 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | 465 | "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" |
465 | "\n", | 466 | "\n", |
466 | FIELD(unsigned char, type), | 467 | FIELD(unsigned char, type), |
467 | FIELD(unsigned char, flags), | 468 | FIELD(unsigned char, flags), |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 0fb7be73e31c..7162ab49d05d 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -18,11 +18,11 @@ | |||
18 | #include "trace_format.h" | 18 | #include "trace_format.h" |
19 | 19 | ||
20 | #undef TRACE_FIELD_ZERO_CHAR | 20 | #undef TRACE_FIELD_ZERO_CHAR |
21 | #define TRACE_FIELD_ZERO_CHAR(item) \ | 21 | #define TRACE_FIELD_ZERO_CHAR(item) \ |
22 | ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ | 22 | ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ |
23 | "offset:%lu;\tsize:0;\n", \ | 23 | "offset:%u;\tsize:0;\n", \ |
24 | offsetof(typeof(field), item)); \ | 24 | (unsigned int)offsetof(typeof(field), item)); \ |
25 | if (!ret) \ | 25 | if (!ret) \ |
26 | return 0; | 26 | return 0; |
27 | 27 | ||
28 | 28 | ||
diff --git a/kernel/trace/trace_format.h b/kernel/trace/trace_format.h index 03f9a4c165ca..97e59a9c82ea 100644 --- a/kernel/trace/trace_format.h +++ b/kernel/trace/trace_format.h | |||
@@ -22,9 +22,9 @@ | |||
22 | #undef TRACE_FIELD | 22 | #undef TRACE_FIELD |
23 | #define TRACE_FIELD(type, item, assign) \ | 23 | #define TRACE_FIELD(type, item, assign) \ |
24 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | 24 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ |
25 | "offset:%lu;\tsize:%lu;\n", \ | 25 | "offset:%u;\tsize:%u;\n", \ |
26 | offsetof(typeof(field), item), \ | 26 | (unsigned int)offsetof(typeof(field), item), \ |
27 | sizeof(field.item)); \ | 27 | (unsigned int)sizeof(field.item)); \ |
28 | if (!ret) \ | 28 | if (!ret) \ |
29 | return 0; | 29 | return 0; |
30 | 30 | ||
@@ -32,9 +32,9 @@ | |||
32 | #undef TRACE_FIELD_SPECIAL | 32 | #undef TRACE_FIELD_SPECIAL |
33 | #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ | 33 | #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ |
34 | ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ | 34 | ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ |
35 | "offset:%lu;\tsize:%lu;\n", \ | 35 | "offset:%u;\tsize:%u;\n", \ |
36 | offsetof(typeof(field), item), \ | 36 | (unsigned int)offsetof(typeof(field), item), \ |
37 | sizeof(field.item)); \ | 37 | (unsigned int)sizeof(field.item)); \ |
38 | if (!ret) \ | 38 | if (!ret) \ |
39 | return 0; | 39 | return 0; |
40 | 40 | ||