212-byteshift_portability.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  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 <[email protected]>
  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. diff --git a/tools/include/tools/be_byteshift.h b/tools/include/tools/be_byteshift.h
  14. index 84c17d836578..ed9932e97bd4 100644
  15. --- a/tools/include/tools/be_byteshift.h
  16. +++ b/tools/include/tools/be_byteshift.h
  17. @@ -1,6 +1,10 @@
  18. #ifndef _TOOLS_BE_BYTESHIFT_H
  19. #define _TOOLS_BE_BYTESHIFT_H
  20. +#ifndef __linux__
  21. +#include "linux_types.h"
  22. +#endif
  23. +
  24. #include <stdint.h>
  25. static inline uint16_t __get_unaligned_be16(const uint8_t *p)
  26. diff --git a/tools/include/tools/le_byteshift.h b/tools/include/tools/le_byteshift.h
  27. index 8fe9f2488ec7..2e387b5226d9 100644
  28. --- a/tools/include/tools/le_byteshift.h
  29. +++ b/tools/include/tools/le_byteshift.h
  30. @@ -1,6 +1,10 @@
  31. #ifndef _TOOLS_LE_BYTESHIFT_H
  32. #define _TOOLS_LE_BYTESHIFT_H
  33. +#ifndef __linux__
  34. +#include "linux_types.h"
  35. +#endif
  36. +
  37. #include <stdint.h>
  38. static inline uint16_t __get_unaligned_le16(const uint8_t *p)
  39. diff --git a/tools/include/tools/linux_types.h b/tools/include/tools/linux_types.h
  40. new file mode 100644
  41. index 000000000000..f07ef8293ebc
  42. --- /dev/null
  43. +++ b/tools/include/tools/linux_types.h
  44. @@ -0,0 +1,22 @@
  45. +#ifndef __LINUX_TYPES_H
  46. +#define __LINUX_TYPES_H
  47. +
  48. +#include <stdint.h>
  49. +
  50. +typedef uint8_t __u8;
  51. +typedef uint8_t __be8;
  52. +typedef uint8_t __le8;
  53. +
  54. +typedef uint16_t __u16;
  55. +typedef uint16_t __be16;
  56. +typedef uint16_t __le16;
  57. +
  58. +typedef uint32_t __u32;
  59. +typedef uint32_t __be32;
  60. +typedef uint32_t __le32;
  61. +
  62. +typedef uint64_t __u64;
  63. +typedef uint64_t __be64;
  64. +typedef uint64_t __le64;
  65. +
  66. +#endif
  67. --
  68. 2.11.0