plugin_cfg80211.c 957 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <inttypes.h>
  4. #include <endian.h>
  5. #include "event-parse.h"
  6. /*
  7. * From glibc endian.h, for older systems where it is not present, e.g.: RHEL5,
  8. * Fedora6.
  9. */
  10. #ifndef le16toh
  11. # if __BYTE_ORDER == __LITTLE_ENDIAN
  12. # define le16toh(x) (x)
  13. # else
  14. # define le16toh(x) __bswap_16 (x)
  15. # endif
  16. #endif
  17. static unsigned long long
  18. process___le16_to_cpup(struct trace_seq *s, unsigned long long *args)
  19. {
  20. uint16_t *val = (uint16_t *) (unsigned long) args[0];
  21. return val ? (long long) le16toh(*val) : 0;
  22. }
  23. int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
  24. {
  25. pevent_register_print_function(pevent,
  26. process___le16_to_cpup,
  27. PEVENT_FUNC_ARG_INT,
  28. "__le16_to_cpup",
  29. PEVENT_FUNC_ARG_PTR,
  30. PEVENT_FUNC_ARG_VOID);
  31. return 0;
  32. }
  33. void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
  34. {
  35. pevent_unregister_print_function(pevent, process___le16_to_cpup,
  36. "__le16_to_cpup");
  37. }