0001
0002 #include <stdio.h>
0003 #include <string.h>
0004 #include <inttypes.h>
0005 #include <endian.h>
0006 #include "event-parse.h"
0007
0008
0009
0010
0011
0012 #ifndef le16toh
0013 # if __BYTE_ORDER == __LITTLE_ENDIAN
0014 # define le16toh(x) (x)
0015 # else
0016 # define le16toh(x) __bswap_16 (x)
0017 # endif
0018 #endif
0019
0020
0021 static unsigned long long
0022 process___le16_to_cpup(struct trace_seq *s, unsigned long long *args)
0023 {
0024 uint16_t *val = (uint16_t *) (unsigned long) args[0];
0025 return val ? (long long) le16toh(*val) : 0;
0026 }
0027
0028 int TEP_PLUGIN_LOADER(struct tep_handle *tep)
0029 {
0030 tep_register_print_function(tep,
0031 process___le16_to_cpup,
0032 TEP_FUNC_ARG_INT,
0033 "__le16_to_cpup",
0034 TEP_FUNC_ARG_PTR,
0035 TEP_FUNC_ARG_VOID);
0036 return 0;
0037 }
0038
0039 void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
0040 {
0041 tep_unregister_print_function(tep, process___le16_to_cpup,
0042 "__le16_to_cpup");
0043 }