212-byteshift_portability.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <nbd@nbd.name>
  3. Date: Fri, 7 Jul 2017 17:03:16 +0200
  4. Subject: linux-3.6: fix portability of some includes files in tools/ used on the host
  5. lede-commit: 6040b1d29ab1f047c5e49b748abcb6a3196add28
  6. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7. ---
  8. tools/include/tools/be_byteshift.h | 4 ++++
  9. tools/include/tools/le_byteshift.h | 4 ++++
  10. tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
  11. 3 files changed, 30 insertions(+)
  12. create mode 100644 tools/include/tools/linux_types.h
  13. --- a/tools/include/tools/be_byteshift.h
  14. +++ b/tools/include/tools/be_byteshift.h
  15. @@ -2,6 +2,10 @@
  16. #ifndef _TOOLS_BE_BYTESHIFT_H
  17. #define _TOOLS_BE_BYTESHIFT_H
  18. +#ifndef __linux__
  19. +#include "linux_types.h"
  20. +#endif
  21. +
  22. #include <stdint.h>
  23. static inline uint16_t __get_unaligned_be16(const uint8_t *p)
  24. --- a/tools/include/tools/le_byteshift.h
  25. +++ b/tools/include/tools/le_byteshift.h
  26. @@ -2,6 +2,10 @@
  27. #ifndef _TOOLS_LE_BYTESHIFT_H
  28. #define _TOOLS_LE_BYTESHIFT_H
  29. +#ifndef __linux__
  30. +#include "linux_types.h"
  31. +#endif
  32. +
  33. #include <stdint.h>
  34. static inline uint16_t __get_unaligned_le16(const uint8_t *p)
  35. --- /dev/null
  36. +++ b/tools/include/tools/linux_types.h
  37. @@ -0,0 +1,22 @@
  38. +#ifndef __LINUX_TYPES_H
  39. +#define __LINUX_TYPES_H
  40. +
  41. +#include <stdint.h>
  42. +
  43. +typedef uint8_t __u8;
  44. +typedef uint8_t __be8;
  45. +typedef uint8_t __le8;
  46. +
  47. +typedef uint16_t __u16;
  48. +typedef uint16_t __be16;
  49. +typedef uint16_t __le16;
  50. +
  51. +typedef uint32_t __u32;
  52. +typedef uint32_t __be32;
  53. +typedef uint32_t __le32;
  54. +
  55. +typedef uint64_t __u64;
  56. +typedef uint64_t __be64;
  57. +typedef uint64_t __le64;
  58. +
  59. +#endif