From: Jiri Olsa Date: Tue, 3 Dec 2013 13:09:18 +0000 (+0100) Subject: tools lib traceevent: Add traceevent_host_bigendian function X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=91a058ad3856b0a37cb21250eb4c478d0297a1a3;p=openwrt%2Fstaging%2Fblogic.git tools lib traceevent: Add traceevent_host_bigendian function Adding traceevent_host_bigendian function to get host endianity. It's used in following patches. Signed-off-by: Jiri Olsa Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/1386076182-14484-5-git-send-email-jolsa@redhat.com Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index a28886066bcc..54273c0ec544 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h @@ -23,6 +23,7 @@ #include #include #include +#include #ifndef __maybe_unused #define __maybe_unused __attribute__((unused)) @@ -527,6 +528,15 @@ __data2host8(struct pevent *pevent, unsigned long long data) __data2host8(pevent, __val); \ }) +static inline int traceevent_host_bigendian(void) +{ + unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 }; + unsigned int val; + + memcpy(&val, str, 4); + return val == 0x01020304; +} + /* taken from kernel/trace/trace.h */ enum trace_flag_type { TRACE_FLAG_IRQS_OFF = 0x01,