X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=tools%2Fmtd-utils%2Fpatches%2F110-portability.patch;h=067526171a29039a6ce0b8a03e5d144e0509428e;hb=08e274da9d7b1e4864885921dfa73454bc23b3f9;hp=727c0e6c59514420511a06b578616bc8b7baf11e;hpb=dd86bc73fb894a259bf8eca38c074128ad2eb40f;p=openwrt%2Fopenwrt.git diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index 727c0e6c59..067526171a 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -1,5 +1,5 @@ ---- a/compr_lzo.c -+++ b/compr_lzo.c +--- a/jffsX-utils/compr_lzo.c ++++ b/jffsX-utils/compr_lzo.c @@ -26,7 +26,6 @@ #include @@ -8,8 +8,8 @@ #include #include #include "compr.h" ---- a/compr_zlib.c -+++ b/compr_zlib.c +--- a/jffsX-utils/compr_zlib.c ++++ b/jffsX-utils/compr_zlib.c @@ -39,7 +39,6 @@ #include #undef crc32 @@ -18,8 +18,8 @@ #include #include "common.h" #include "compr.h" ---- a/rbtree.h -+++ b/rbtree.h +--- a/jffsX-utils/rbtree.h ++++ b/jffsX-utils/rbtree.h @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H @@ -48,9 +48,9 @@ /* 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,17 @@ +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h +@@ -32,7 +32,17 @@ #include #include #include @@ -68,20 +68,9 @@ #include #include ---- a/mkfs.ubifs/mkfs.ubifs.c -+++ b/mkfs.ubifs/mkfs.ubifs.c -@@ -821,8 +821,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) -@@ -1079,6 +1079,7 @@ static int add_inode_with_data(struct st +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +@@ -1503,6 +1503,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -89,15 +78,15 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1089,6 +1090,7 @@ static int add_inode_with_data(struct st - use_flags |= UBIFS_APPEND_FL; - if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode)) +@@ -1515,6 +1516,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_DIRSYNC_FL; + if (fctx) + use_flags |= UBIFS_CRYPT_FL; +#endif - memset(ino, 0, UBIFS_INO_NODE_SZ); -@@ -1158,7 +1160,9 @@ static int add_dir_inode(DIR *dir, ino_t + ino_key_init(&key, inum); +@@ -1600,7 +1602,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -107,20 +96,23 @@ flags = 0; } -@@ -1343,10 +1347,12 @@ static int add_file(const char *path_nam +@@ -1811,6 +1815,7 @@ static int add_file(const char *path_nam + dn->ch.node_type = UBIFS_DATA_NODE; key_write(&key, &dn->key); - dn->size = cpu_to_le32(bytes_read); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; +#ifndef NO_NATIVE_SUPPORT if (c->default_compr == UBIFS_COMPR_NONE && - (flags & FS_COMPR_FL)) + !c->encrypted && (flags & FS_COMPR_FL)) + #ifdef WITHOUT_LZO +@@ -1819,6 +1824,7 @@ static int add_file(const char *path_nam use_compr = UBIFS_COMPR_LZO; + #endif else +#endif use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1388,7 +1394,9 @@ static int add_non_dir(const char *path_ +@@ -1876,7 +1882,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); @@ -130,9 +122,9 @@ 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 +--- 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 unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; unsigned int start = 0, increment = 0, count = 0; @@ -140,14 +132,44 @@ 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 +@@ -145,10 +146,10 @@ 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 == 0) + return err_msg("empty path"); +- if (len == 1024) + if (len == 1023) return err_msg("too long path"); - if (!strcmp(buf, "/")) + if (buf[0] != '/') +--- a/include/common.h ++++ b/include/common.h +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + #include + #include +--- 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 ++#else ++#include ++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