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