summaryrefslogtreecommitdiff
path: root/tools/mtd-utils/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-01-16 00:11:43 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-01-16 00:11:43 +0000
commit5c8bfc0c17302ea58de7f83fdffe81a2327526f3 (patch)
treeb1a4f1ac1c477b58e7e3f45e59cc012acec3d81a /tools/mtd-utils/patches
parentf7c4735a19cd848d9e5e51da8f68443fdf113b34 (diff)
downloadmtk-20170518-5c8bfc0c17302ea58de7f83fdffe81a2327526f3.zip
mtk-20170518-5c8bfc0c17302ea58de7f83fdffe81a2327526f3.tar.gz
mtk-20170518-5c8bfc0c17302ea58de7f83fdffe81a2327526f3.tar.bz2
mtd-utils: fix compile on mac os x
SVN-Revision: 19158
Diffstat (limited to 'tools/mtd-utils/patches')
-rw-r--r--tools/mtd-utils/patches/110-portability.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch
index 4ef27d1..3d0037c 100644
--- a/tools/mtd-utils/patches/110-portability.patch
+++ b/tools/mtd-utils/patches/110-portability.patch
@@ -58,3 +58,103 @@
/* The version of UBI images supported by this implementation */
#define UBI_VERSION 1
+--- a/mkfs.ubifs/mkfs.ubifs.h
++++ b/mkfs.ubifs/mkfs.ubifs.h
+@@ -34,7 +34,14 @@
+ #include <endian.h>
+ #include <byteswap.h>
+ #include <linux/types.h>
++#ifdef __linux__
+ #include <linux/fs.h>
++#else
++# ifndef O_LARGEFILE
++# define O_LARGEFILE 0
++# endif
++# define llseek lseek
++#endif
+
+ #include <getopt.h>
+ #include <sys/types.h>
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -773,8 +773,8 @@ int write_leb(int lnum, int len, void *b
+ if (ubi_leb_change_start(ubi, out_fd, lnum, c->leb_size, dtype))
+ return sys_err_msg("ubi_leb_change_start failed");
+
+- if (lseek64(out_fd, pos, SEEK_SET) != pos)
+- return sys_err_msg("lseek64 failed seeking %lld",
++ if (llseek(out_fd, pos, SEEK_SET) != pos)
++ return sys_err_msg("llseek failed seeking %lld",
+ (long long)pos);
+
+ if (write(out_fd, buf, c->leb_size) != c->leb_size)
+@@ -1029,6 +1029,7 @@ static int add_inode_with_data(struct st
+
+ if (c->default_compr != UBIFS_COMPR_NONE)
+ use_flags |= UBIFS_COMPR_FL;
++#ifdef __linux__
+ if (flags & FS_COMPR_FL)
+ use_flags |= UBIFS_COMPR_FL;
+ if (flags & FS_SYNC_FL)
+@@ -1039,6 +1040,7 @@ static int add_inode_with_data(struct st
+ 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);
+
+@@ -1108,7 +1110,9 @@ static int add_dir_inode(DIR *dir, ino_t
+ fd = dirfd(dir);
+ if (fd == -1)
+ return sys_err_msg("dirfd failed");
++#ifdef __linux__
+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
++#endif
+ flags = 0;
+ }
+
+@@ -1293,10 +1297,12 @@ static int add_file(const char *path_nam
+ key_write(&key, &dn->key);
+ dn->size = cpu_to_le32(bytes_read);
+ out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
++#ifdef __linux__
+ if (c->default_compr == UBIFS_COMPR_NONE &&
+ (flags & FS_COMPR_FL))
+ use_compr = UBIFS_COMPR_LZO;
+ else
++#endif
+ use_compr = c->default_compr;
+ compr_type = compress_data(buf, bytes_read, &dn->data,
+ &out_len, use_compr);
+@@ -1338,7 +1344,9 @@ static int add_non_dir(const char *path_
+ if (fd == -1)
+ return sys_err_msg("failed to open file '%s'",
+ path_name);
++#ifdef __linux__
+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1)
++#endif
+ flags = 0;
+ if (close(fd) == -1)
+ return sys_err_msg("failed to close file '%s'",
+--- a/mkfs.ubifs/devtable.c
++++ b/mkfs.ubifs/devtable.c
+@@ -134,6 +134,7 @@ static int interpret_table_entry(const c
+ 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)
+@@ -144,8 +145,8 @@ static int interpret_table_entry(const c
+ buf, type, mode, uid, gid, major, minor, start,
+ increment, count);
+
+- len = strnlen(buf, 1024);
+- if (len == 1024)
++ len = strlen(buf);
++ if (len == 1023)
+ return err_msg("too long path");
+
+ if (!strcmp(buf, "/"))