2018-04-15 17:25:17 +00:00
|
|
|
--- a/jffsX-utils/compr_lzo.c
|
|
|
|
+++ b/jffsX-utils/compr_lzo.c
|
2012-03-01 19:55:48 +00:00
|
|
|
@@ -26,7 +26,6 @@
|
2009-06-14 20:42:12 +00:00
|
|
|
#include <string.h>
|
2012-03-01 19:55:48 +00:00
|
|
|
|
|
|
|
#ifndef WITHOUT_LZO
|
2009-06-14 20:42:12 +00:00
|
|
|
-#include <asm/types.h>
|
|
|
|
#include <linux/jffs2.h>
|
|
|
|
#include <lzo/lzo1x.h>
|
|
|
|
#include "compr.h"
|
2018-04-15 17:25:17 +00:00
|
|
|
--- a/jffsX-utils/compr_zlib.c
|
|
|
|
+++ b/jffsX-utils/compr_zlib.c
|
2010-10-02 16:42:57 +00:00
|
|
|
@@ -39,7 +39,6 @@
|
2009-06-14 20:42:12 +00:00
|
|
|
#include <zlib.h>
|
2010-10-02 16:42:57 +00:00
|
|
|
#undef crc32
|
2009-06-14 20:42:12 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
-#include <asm/types.h>
|
|
|
|
#include <linux/jffs2.h>
|
2010-10-02 16:42:57 +00:00
|
|
|
#include "common.h"
|
2009-06-14 20:42:12 +00:00
|
|
|
#include "compr.h"
|
2018-04-15 17:25:17 +00:00
|
|
|
--- a/jffsX-utils/rbtree.h
|
|
|
|
+++ b/jffsX-utils/rbtree.h
|
2009-06-14 20:42:12 +00:00
|
|
|
@@ -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
|
|
|
|
{
|
2009-06-14 20:42:23 +00:00
|
|
|
--- a/include/mtd/ubi-media.h
|
|
|
|
+++ b/include/mtd/ubi-media.h
|
2010-09-15 23:50:31 +00:00
|
|
|
@@ -30,7 +30,15 @@
|
2009-06-14 20:42:23 +00:00
|
|
|
#ifndef __UBI_MEDIA_H__
|
|
|
|
#define __UBI_MEDIA_H__
|
|
|
|
|
2010-09-15 23:50:31 +00:00
|
|
|
+#ifdef __linux__
|
|
|
|
#include <asm/byteorder.h>
|
|
|
|
+#else
|
2009-06-14 20:42:23 +00:00
|
|
|
+#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
|
2018-04-15 17:25:17 +00:00
|
|
|
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
|
|
|
|
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
|
2015-05-26 09:25:30 +00:00
|
|
|
@@ -32,7 +32,17 @@
|
2010-01-16 00:11:43 +00:00
|
|
|
#include <endian.h>
|
|
|
|
#include <byteswap.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
+#ifdef __linux__
|
|
|
|
#include <linux/fs.h>
|
2014-10-25 16:57:16 +00:00
|
|
|
+# if defined(__x86_64__) && defined(__ILP32__)
|
|
|
|
+# define llseek lseek64
|
|
|
|
+# endif
|
2010-01-16 00:11:43 +00:00
|
|
|
+#else
|
|
|
|
+# ifndef O_LARGEFILE
|
|
|
|
+# define O_LARGEFILE 0
|
|
|
|
+# endif
|
|
|
|
+# define llseek lseek
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <sys/types.h>
|
2018-04-15 17:25:17 +00:00
|
|
|
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
|
|
|
|
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
|
|
|
|
@@ -1219,6 +1219,7 @@ static int add_inode(struct stat *st, in
|
2010-01-16 00:11:43 +00:00
|
|
|
|
|
|
|
if (c->default_compr != UBIFS_COMPR_NONE)
|
|
|
|
use_flags |= UBIFS_COMPR_FL;
|
2010-02-24 23:02:38 +00:00
|
|
|
+#ifndef NO_NATIVE_SUPPORT
|
2010-01-16 00:11:43 +00:00
|
|
|
if (flags & FS_COMPR_FL)
|
|
|
|
use_flags |= UBIFS_COMPR_FL;
|
|
|
|
if (flags & FS_SYNC_FL)
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -1229,6 +1230,7 @@ static int add_inode(struct stat *st, in
|
2010-01-16 00:11:43 +00:00
|
|
|
use_flags |= UBIFS_APPEND_FL;
|
|
|
|
if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode))
|
|
|
|
use_flags |= UBIFS_DIRSYNC_FL;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
memset(ino, 0, UBIFS_INO_NODE_SZ);
|
|
|
|
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -1293,7 +1295,9 @@ static int add_dir_inode(const char *pat
|
2010-01-16 00:11:43 +00:00
|
|
|
fd = dirfd(dir);
|
|
|
|
if (fd == -1)
|
|
|
|
return sys_err_msg("dirfd failed");
|
2010-02-24 23:02:38 +00:00
|
|
|
+#ifndef NO_NATIVE_SUPPORT
|
2010-01-16 00:11:43 +00:00
|
|
|
if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
|
|
|
|
+#endif
|
|
|
|
flags = 0;
|
|
|
|
}
|
|
|
|
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -1476,6 +1480,7 @@ static int add_file(const char *path_nam
|
2010-01-16 00:11:43 +00:00
|
|
|
key_write(&key, &dn->key);
|
|
|
|
dn->size = cpu_to_le32(bytes_read);
|
|
|
|
out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
|
2010-02-24 23:02:38 +00:00
|
|
|
+#ifndef NO_NATIVE_SUPPORT
|
2010-01-16 00:11:43 +00:00
|
|
|
if (c->default_compr == UBIFS_COMPR_NONE &&
|
|
|
|
(flags & FS_COMPR_FL))
|
2018-04-15 17:25:17 +00:00
|
|
|
#ifdef WITHOUT_LZO
|
|
|
|
@@ -1484,6 +1489,7 @@ static int add_file(const char *path_nam
|
2010-01-16 00:11:43 +00:00
|
|
|
use_compr = UBIFS_COMPR_LZO;
|
2018-04-15 17:25:17 +00:00
|
|
|
#endif
|
2010-01-16 00:11:43 +00:00
|
|
|
else
|
|
|
|
+#endif
|
|
|
|
use_compr = c->default_compr;
|
|
|
|
compr_type = compress_data(buf, bytes_read, &dn->data,
|
|
|
|
&out_len, use_compr);
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -1527,7 +1533,9 @@ static int add_non_dir(const char *path_
|
2010-01-16 00:11:43 +00:00
|
|
|
if (fd == -1)
|
|
|
|
return sys_err_msg("failed to open file '%s'",
|
|
|
|
path_name);
|
2010-02-24 23:02:38 +00:00
|
|
|
+#ifndef NO_NATIVE_SUPPORT
|
2010-01-16 00:11:43 +00:00
|
|
|
if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
|
|
|
|
+#endif
|
|
|
|
flags = 0;
|
|
|
|
if (close(fd) == -1)
|
|
|
|
return sys_err_msg("failed to close file '%s'",
|
2018-04-15 17:25:17 +00:00
|
|
|
--- a/ubifs-utils/mkfs.ubifs/devtable.c
|
|
|
|
+++ b/ubifs-utils/mkfs.ubifs/devtable.c
|
|
|
|
@@ -135,6 +135,7 @@ static int interpret_table_entry(const c
|
2010-01-16 00:11:43 +00:00
|
|
|
unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
|
|
|
|
unsigned int start = 0, increment = 0, count = 0;
|
|
|
|
|
|
|
|
+ buf[1023] = 0;
|
|
|
|
if (sscanf(line, "%1023s %c %o %u %u %u %u %u %u %u",
|
|
|
|
buf, &type, &mode, &uid, &gid, &major, &minor,
|
|
|
|
&start, &increment, &count) < 0)
|
2018-04-15 17:25:17 +00:00
|
|
|
@@ -145,10 +146,10 @@ static int interpret_table_entry(const c
|
2010-01-16 00:11:43 +00:00
|
|
|
buf, type, mode, uid, gid, major, minor, start,
|
|
|
|
increment, count);
|
|
|
|
|
|
|
|
- len = strnlen(buf, 1024);
|
|
|
|
+ len = strlen(buf);
|
2018-04-15 17:25:17 +00:00
|
|
|
if (len == 0)
|
|
|
|
return err_msg("empty path");
|
|
|
|
- if (len == 1024)
|
2010-01-16 00:11:43 +00:00
|
|
|
+ if (len == 1023)
|
|
|
|
return err_msg("too long path");
|
|
|
|
|
2018-04-15 17:25:17 +00:00
|
|
|
if (buf[0] != '/')
|
2015-05-26 09:25:30 +00:00
|
|
|
--- a/include/common.h
|
|
|
|
+++ b/include/common.h
|
|
|
|
@@ -26,7 +26,6 @@
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
-#include <features.h>
|
|
|
|
#include <inttypes.h>
|
2018-04-15 17:25:17 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/sysmacros.h>
|
2015-05-26 09:25:30 +00:00
|
|
|
--- a/include/mtd/ubifs-media.h
|
|
|
|
+++ b/include/mtd/ubifs-media.h
|
|
|
|
@@ -33,7 +33,15 @@
|
|
|
|
#ifndef __UBIFS_MEDIA_H__
|
|
|
|
#define __UBIFS_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
|
|
|
|
|
|
|
|
/* UBIFS node magic number (must not have the padding byte first or last) */
|
|
|
|
#define UBIFS_NODE_MAGIC 0x06101831
|