summaryrefslogtreecommitdiffstats
path: root/tools/mtd-utils/patches/110-portability.patch
blob: 4ef27d1f7e82cc89d5e982c16909d0d52c936f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- a/compr_lzo.c
+++ b/compr_lzo.c
@@ -24,7 +24,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <asm/types.h>
 #include <linux/jffs2.h>
 #include <lzo/lzo1x.h>
 #include "compr.h"
--- a/compr_zlib.c
+++ b/compr_zlib.c
@@ -35,7 +35,6 @@
 #include <stdint.h>
 #include <zlib.h>
 #include <stdio.h>
-#include <asm/types.h>
 #include <linux/jffs2.h>
 #include "compr.h"
 
--- a/rbtree.h
+++ b/rbtree.h
@@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa
 #ifndef	_LINUX_RBTREE_H
 #define	_LINUX_RBTREE_H
 
-#include <linux/kernel.h>
-#include <linux/stddef.h>
+#include <stddef.h>
 
 struct rb_node
 {
@@ -131,7 +130,9 @@ static inline void rb_set_color(struct r
 
 #define RB_ROOT	(struct rb_root) { NULL, }
 
+#ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
 
 #define container_of(ptr, type, member) ({                      \
         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
--- a/include/mtd/ubi-media.h
+++ b/include/mtd/ubi-media.h
@@ -30,7 +30,15 @@
 #ifndef __UBI_MEDIA_H__
 #define __UBI_MEDIA_H__
 
+#ifdef __linux__
 #include <asm/byteorder.h>
+#else
+#include <stdint.h>
+typedef uint8_t __u8;
+typedef uint16_t __be16;
+typedef uint32_t __be32;
+typedef uint64_t __be64;
+#endif
 
 /* The version of UBI images supported by this implementation */
 #define UBI_VERSION 1