7 -#include <asm/types.h>
8 #include <linux/jffs2.h>
17 -#include <asm/types.h>
18 #include <linux/jffs2.h>
23 @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa
24 #ifndef _LINUX_RBTREE_H
25 #define _LINUX_RBTREE_H
27 -#include <linux/kernel.h>
28 -#include <linux/stddef.h>
33 @@ -131,7 +130,9 @@ static inline void rb_set_color(struct r
35 #define RB_ROOT (struct rb_root) { NULL, }
38 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
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
46 #ifndef __UBI_MEDIA_H__
47 #define __UBI_MEDIA_H__
49 -#include <asm/byteorder.h>
50 +#if !defined(__u8) || !defined(__be16) || !defined(__be32) || !defined(__be64)
52 +typedef uint8_t __u8;
53 +typedef uint16_t __be16;
54 +typedef uint32_t __be32;
55 +typedef uint64_t __be64;
58 /* The version of UBI images supported by this implementation */
60 --- a/mkfs.ubifs/mkfs.ubifs.h
61 +++ b/mkfs.ubifs/mkfs.ubifs.h
65 #include <linux/types.h>
70 +# define O_LARGEFILE 0
72 +# define llseek lseek
76 #include <sys/types.h>
77 --- a/mkfs.ubifs/mkfs.ubifs.c
78 +++ b/mkfs.ubifs/mkfs.ubifs.c
79 @@ -773,8 +773,8 @@ int write_leb(int lnum, int len, void *b
80 if (ubi_leb_change_start(ubi, out_fd, lnum, c->leb_size, dtype))
81 return sys_err_msg("ubi_leb_change_start failed");
83 - if (lseek64(out_fd, pos, SEEK_SET) != pos)
84 - return sys_err_msg("lseek64 failed seeking %lld",
85 + if (llseek(out_fd, pos, SEEK_SET) != pos)
86 + return sys_err_msg("llseek failed seeking %lld",
89 if (write(out_fd, buf, c->leb_size) != c->leb_size)
90 @@ -1029,6 +1029,7 @@ static int add_inode_with_data(struct st
92 if (c->default_compr != UBIFS_COMPR_NONE)
93 use_flags |= UBIFS_COMPR_FL;
94 +#ifndef NO_NATIVE_SUPPORT
95 if (flags & FS_COMPR_FL)
96 use_flags |= UBIFS_COMPR_FL;
97 if (flags & FS_SYNC_FL)
98 @@ -1039,6 +1040,7 @@ static int add_inode_with_data(struct st
99 use_flags |= UBIFS_APPEND_FL;
100 if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode))
101 use_flags |= UBIFS_DIRSYNC_FL;
104 memset(ino, 0, UBIFS_INO_NODE_SZ);
106 @@ -1108,7 +1110,9 @@ static int add_dir_inode(DIR *dir, ino_t
109 return sys_err_msg("dirfd failed");
110 +#ifndef NO_NATIVE_SUPPORT
111 if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
116 @@ -1293,10 +1297,12 @@ static int add_file(const char *path_nam
117 key_write(&key, &dn->key);
118 dn->size = cpu_to_le32(bytes_read);
119 out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
120 +#ifndef NO_NATIVE_SUPPORT
121 if (c->default_compr == UBIFS_COMPR_NONE &&
122 (flags & FS_COMPR_FL))
123 use_compr = UBIFS_COMPR_LZO;
126 use_compr = c->default_compr;
127 compr_type = compress_data(buf, bytes_read, &dn->data,
128 &out_len, use_compr);
129 @@ -1338,7 +1344,9 @@ static int add_non_dir(const char *path_
131 return sys_err_msg("failed to open file '%s'",
133 +#ifndef NO_NATIVE_SUPPORT
134 if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
138 return sys_err_msg("failed to close file '%s'",
139 --- a/mkfs.ubifs/devtable.c
140 +++ b/mkfs.ubifs/devtable.c
141 @@ -134,6 +134,7 @@ static int interpret_table_entry(const c
142 unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
143 unsigned int start = 0, increment = 0, count = 0;
146 if (sscanf(line, "%1023s %c %o %u %u %u %u %u %u %u",
147 buf, &type, &mode, &uid, &gid, &major, &minor,
148 &start, &increment, &count) < 0)
149 @@ -144,8 +145,8 @@ static int interpret_table_entry(const c
150 buf, type, mode, uid, gid, major, minor, start,
153 - len = strnlen(buf, 1024);
157 return err_msg("too long path");
159 if (!strcmp(buf, "/"))