plugin_cfg80211.c 969 B

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