mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] mtd-utils: update patches
Date: Mon, 11 Mar 2013 09:57:19 +0100	[thread overview]
Message-ID: <1362992239-15879-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)

Now the patches I sent upstram are applied or noticed to be obsolete.
Update the patches and their description accordingly. For the obsolete
patch ("flash_otp_write: fix format string warning") cherry-pick the
corresponding patches from upstream.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 ...ce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch |  51 +++
 ...nsistency-between-u_int32_t-off_t-off64_t.patch | 434 +++++++++++++++++++++
 ...flash_otp_write-fix-format-string-warning.patch |  30 --
 ...tional.patch => 0003-make-ubifs-optional.patch} |   4 +-
 ...004-Make-liblzo-optional-for-ubifs-tools.patch} |   6 +-
 ...ite-fix-writing-to-NAND-in-presence-of-p.patch} |  22 +-
 ...ite-fix-a-buffer-overflow-on-NAND-with-w.patch} |  18 +-
 ...o-build-and-install-flash_otp_lock-and-f.patch} |  14 +-
 patches/mtd-utils-1.5.0/series                     |  15 +-
 9 files changed, 531 insertions(+), 63 deletions(-)
 create mode 100644 patches/mtd-utils-1.5.0/0001-introduce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch
 create mode 100644 patches/mtd-utils-1.5.0/0002-consistency-between-u_int32_t-off_t-off64_t.patch
 delete mode 100644 patches/mtd-utils-1.5.0/0003-flash_otp_write-fix-format-string-warning.patch
 rename patches/mtd-utils-1.5.0/{0001-make-ubifs-optional.patch => 0003-make-ubifs-optional.patch} (88%)
 rename patches/mtd-utils-1.5.0/{0002-Make-liblzo-optional-for-ubifs-tools.patch => 0004-Make-liblzo-optional-for-ubifs-tools.patch} (92%)
 rename patches/mtd-utils-1.5.0/{0004-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch => 0005-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch} (74%)
 rename patches/mtd-utils-1.5.0/{0005-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch => 0006-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch} (65%)
 rename patches/mtd-utils-1.5.0/{0006-Makefile-also-build-and-install-flash_otp_lock-and-f.patch => 0007-Makefile-also-build-and-install-flash_otp_lock-and-f.patch} (76%)

diff --git a/patches/mtd-utils-1.5.0/0001-introduce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch b/patches/mtd-utils-1.5.0/0001-introduce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch
new file mode 100644
index 0000000..2476f64
--- /dev/null
+++ b/patches/mtd-utils-1.5.0/0001-introduce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch
@@ -0,0 +1,51 @@
+From: Richard Genoud <richard.genoud@gmail.com>
+Date: Wed, 12 Sep 2012 16:38:33 +0200
+Subject: [PATCH mtd-utils] introduce PRIxoff_t and PRIdoff_t printf helpers
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+They will be usefull when printing offsets.
+
+Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+---
+
+Notes:
+    Origin: upstream, commit:4f1b10827b81cd9acaa9e02b0da0dc447f1471ea
+
+    This patch is a dependency for the following patch.
+
+ include/common.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/include/common.h b/include/common.h
+index 88b67e5..d0c4146 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -25,6 +25,8 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#include <features.h>
++#include <inttypes.h>
+ #include "version.h"
+ 
+ #ifndef PROGRAM_NAME
+@@ -48,6 +50,15 @@ extern "C" {
+ #define O_CLOEXEC 0
+ #endif
+ 
++/* define a print format specifier for off_t */
++#ifdef __USE_FILE_OFFSET64
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++#else
++#define PRIxoff_t "l"PRIx32
++#define PRIdoff_t "l"PRId32
++#endif
++
+ /* Verbose messages */
+ #define bareverbose(verbose, fmt, ...) do {                        \
+ 	if (verbose)                                               \
diff --git a/patches/mtd-utils-1.5.0/0002-consistency-between-u_int32_t-off_t-off64_t.patch b/patches/mtd-utils-1.5.0/0002-consistency-between-u_int32_t-off_t-off64_t.patch
new file mode 100644
index 0000000..23c6d99
--- /dev/null
+++ b/patches/mtd-utils-1.5.0/0002-consistency-between-u_int32_t-off_t-off64_t.patch
@@ -0,0 +1,434 @@
+From: Richard Genoud <richard.genoud@gmail.com>
+Date: Wed, 12 Sep 2012 16:38:34 +0200
+Subject: [PATCH mtd-utils] consistency between u_int32_t / off_t / off64_t
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We should use the off_t type instead of off64_t or u_int32_t as its
+length is controlled by the WITHOUT_LARGEFILE flag.
+
+Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+---
+
+Notes:
+    Origin: upstream, commit:f3f3a208048eac5f8b5752a17ebcd44db9230fd8
+
+    This fixes
+	flash_otp_write.c: In function 'main':
+	flash_otp_write.c:61:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
+
+ flash_erase.c                      | 16 ++++++++--------
+ flash_otp_write.c                  |  5 +++--
+ ftl_check.c                        |  6 ++++--
+ ftl_format.c                       |  2 +-
+ lib/libmtd.c                       | 12 ++++++------
+ mkfs.ubifs/mkfs.ubifs.c            | 11 +++++------
+ mtd_debug.c                        | 14 +++++++-------
+ tests/fs-tests/integrity/integck.c |  4 ++--
+ tests/ubi-tests/integ.c            | 38 +++++++++++++++++++-------------------
+ 9 files changed, 55 insertions(+), 53 deletions(-)
+
+diff --git a/flash_erase.c b/flash_erase.c
+index fe2eaca..326a299 100644
+--- a/flash_erase.c
++++ b/flash_erase.c
+@@ -49,10 +49,10 @@ static int unlock;		/* unlock sectors before erasing */
+ static struct jffs2_unknown_node cleanmarker;
+ int target_endian = __BYTE_ORDER;
+ 
+-static void show_progress(struct mtd_dev_info *mtd, uint64_t start, int eb,
++static void show_progress(struct mtd_dev_info *mtd, off_t start, int eb,
+ 			  int eb_start, int eb_cnt)
+ {
+-	bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIx64" -- %2i %% complete ",
++	bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",
+ 		mtd->eb_size / 1024, start, ((eb - eb_start) * 100) / eb_cnt);
+ 	fflush(stdout);
+ }
+@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
+ 	unsigned int eb, eb_start, eb_cnt;
+ 	int isNAND;
+ 	int error = 0;
+-	uint64_t offset = 0;
++	off_t offset = 0;
+ 
+ 	/*
+ 	 * Process user arguments
+@@ -235,12 +235,12 @@ int main(int argc, char *argv[])
+ 		eb_cnt = (mtd.size / mtd.eb_size) - eb_start;
+ 
+ 	for (eb = eb_start; eb < eb_start + eb_cnt; eb++) {
+-		offset = (uint64_t)eb * mtd.eb_size;
++		offset = (off_t)eb * mtd.eb_size;
+ 
+ 		if (!noskipbad) {
+ 			int ret = mtd_is_bad(&mtd, fd, eb);
+ 			if (ret > 0) {
+-				verbose(!quiet, "Skipping bad block at %08"PRIx64, offset);
++				verbose(!quiet, "Skipping bad block at %08"PRIxoff_t, offset);
+ 				continue;
+ 			} else if (ret < 0) {
+ 				if (errno == EOPNOTSUPP) {
+@@ -272,12 +272,12 @@ int main(int argc, char *argv[])
+ 
+ 		/* write cleanmarker */
+ 		if (isNAND) {
+-			if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, &cleanmarker) != 0) {
++			if (mtd_write_oob(mtd_desc, &mtd, fd, (uint64_t)offset + clmpos, clmlen, &cleanmarker) != 0) {
+ 				sys_errmsg("%s: MTD writeoob failure", mtd_device);
+ 				continue;
+ 			}
+ 		} else {
+-			if (lseek(fd, (loff_t)offset, SEEK_SET) < 0) {
++			if (lseek(fd, offset, SEEK_SET) < 0) {
+ 				sys_errmsg("%s: MTD lseek failure", mtd_device);
+ 				continue;
+ 			}
+@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
+ 				continue;
+ 			}
+ 		}
+-		verbose(!quiet, " Cleanmarker written at %"PRIx64, offset);
++		verbose(!quiet, " Cleanmarker written at %"PRIxoff_t, offset);
+ 	}
+ 	show_progress(&mtd, offset, eb, eb_start, eb_cnt);
+ 	bareverbose(!quiet, "\n");
+diff --git a/flash_otp_write.c b/flash_otp_write.c
+index d407ebb..56769ec 100644
+--- a/flash_otp_write.c
++++ b/flash_otp_write.c
+@@ -13,6 +13,7 @@
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+ 
++#include <common.h>
+ #include <mtd/mtd-user.h>
+ 
+ int main(int argc,char *argv[])
+@@ -47,7 +48,7 @@ int main(int argc,char *argv[])
+ 		return errno;
+ 	}
+ 
+-	offset = strtoul(argv[3], &p, 0);
++	offset = (off_t)strtoull(argv[3], &p, 0);
+ 	if (argv[3][0] == 0 || *p != 0) {
+ 		fprintf(stderr, "%s: bad offset value\n", PROGRAM_NAME);
+ 		return ERANGE;
+@@ -58,7 +59,7 @@ int main(int argc,char *argv[])
+ 		return errno;
+ 	}
+ 
+-	printf("Writing OTP user data on %s at offset 0x%lx\n", argv[2], offset);
++	printf("Writing OTP user data on %s at offset 0x%"PRIxoff_t"\n", argv[2], offset);
+ 
+ 	if (mtdInfo.type == MTD_NANDFLASH)
+ 		len = mtdInfo.writesize;
+diff --git a/ftl_check.c b/ftl_check.c
+index 5e75e6a..6d84785 100644
+--- a/ftl_check.c
++++ b/ftl_check.c
+@@ -53,6 +53,7 @@
+ 
+ #include <byteswap.h>
+ #include <endian.h>
++#include "common.h"
+ 
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ # define TO_LE32(x) (x)
+@@ -85,7 +86,8 @@ static void check_partition(int fd)
+ {
+ 	mtd_info_t mtd;
+ 	erase_unit_header_t hdr, hdr2;
+-	u_int i, j, nbam, *bam;
++	off_t i;
++	u_int j, nbam, *bam;
+ 	int control, data, free, deleted;
+ 
+ 	/* Get partition size, block size */
+@@ -142,7 +144,7 @@ static void check_partition(int fd)
+ 			perror("read failed");
+ 			break;
+ 		}
+-		printf("\nErase unit %d:\n", i);
++		printf("\nErase unit %"PRIdoff_t":\n", i);
+ 		if ((hdr2.FormattedSize != hdr.FormattedSize) ||
+ 				(hdr2.NumEraseUnits != hdr.NumEraseUnits) ||
+ 				(hdr2.SerialNumber != hdr.SerialNumber))
+diff --git a/ftl_format.c b/ftl_format.c
+index bd4203b..0ce601b 100644
+--- a/ftl_format.c
++++ b/ftl_format.c
+@@ -240,7 +240,7 @@ static int format_partition(int fd, int quiet, int interrogate,
+ 	/* Distribute transfer units over the entire region */
+ 	step = (spare) ? (FROM_LE16(hdr.NumEraseUnits)/spare) : (FROM_LE16(hdr.NumEraseUnits)+1);
+ 	for (i = 0; i < FROM_LE16(hdr.NumEraseUnits); i++) {
+-		u_int ofs = (i + FROM_LE16(hdr.FirstPhysicalEUN)) << hdr.EraseUnitSize;
++		off_t ofs = (off_t) (i + FROM_LE16(hdr.FirstPhysicalEUN)) << hdr.EraseUnitSize;
+ 		if (lseek(fd, ofs, SEEK_SET) == -1) {
+ 			perror("seek failed");
+ 			break;
+diff --git a/lib/libmtd.c b/lib/libmtd.c
+index c4836df..654490e 100644
+--- a/lib/libmtd.c
++++ b/lib/libmtd.c
+@@ -1063,8 +1063,8 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+ 	/* Seek to the beginning of the eraseblock */
+ 	seek = (off_t)eb * mtd->eb_size + offs;
+ 	if (lseek(fd, seek, SEEK_SET) != seek)
+-		return sys_errmsg("cannot seek mtd%d to offset %llu",
+-				  mtd->mtd_num, (unsigned long long)seek);
++		return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
++				  mtd->mtd_num, seek);
+ 
+ 	while (rd < len) {
+ 		ret = read(fd, buf, len);
+@@ -1171,8 +1171,8 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb,
+ 	if (data) {
+ 		/* Seek to the beginning of the eraseblock */
+ 		if (lseek(fd, seek, SEEK_SET) != seek)
+-			return sys_errmsg("cannot seek mtd%d to offset %llu",
+-					mtd->mtd_num, (unsigned long long)seek);
++			return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
++					mtd->mtd_num, seek);
+ 		ret = write(fd, data, len);
+ 		if (ret != len)
+ 			return sys_errmsg("cannot write %d bytes to mtd%d "
+@@ -1329,8 +1329,8 @@ int mtd_write_img(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+ 	/* Seek to the beginning of the eraseblock */
+ 	seek = (off_t)eb * mtd->eb_size + offs;
+ 	if (lseek(fd, seek, SEEK_SET) != seek) {
+-		sys_errmsg("cannot seek mtd%d to offset %llu",
+-			    mtd->mtd_num, (unsigned long long)seek);
++		sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
++			    mtd->mtd_num, seek);
+ 		goto out_close;
+ 	}
+ 
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index bb25dc3..b7166ea 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -778,7 +778,7 @@ static void prepare_node(void *node, int len)
+  */
+ int write_leb(int lnum, int len, void *buf, int dtype)
+ {
+-	off64_t pos = (off64_t)lnum * c->leb_size;
++	off_t pos = (off_t)lnum * c->leb_size;
+ 
+ 	dbg_msg(3, "LEB %d len %d", lnum, len);
+ 	memset(buf + len, 0xff, c->leb_size - len);
+@@ -786,13 +786,12 @@ int write_leb(int lnum, int len, void *buf, int dtype)
+ 		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",
+-				   (long long)pos);
++	if (lseek(out_fd, pos, SEEK_SET) != pos)
++		return sys_err_msg("lseek failed seeking %"PRIdoff_t, pos);
+ 
+ 	if (write(out_fd, buf, c->leb_size) != c->leb_size)
+-		return sys_err_msg("write failed writing %d bytes at pos %lld",
+-				   c->leb_size, (long long)pos);
++		return sys_err_msg("write failed writing %d bytes at pos %"PRIdoff_t,
++				   c->leb_size, pos);
+ 
+ 	return 0;
+ }
+diff --git a/mtd_debug.c b/mtd_debug.c
+index 2d307a9..9110e9b 100644
+--- a/mtd_debug.c
++++ b/mtd_debug.c
+@@ -103,7 +103,7 @@ void printsize(u_int32_t x)
+ 		printf("(%u%c)", x, flags[i]);
+ }
+ 
+-int flash_to_file(int fd, u_int32_t offset, size_t len, const char *filename)
++int flash_to_file(int fd, off_t offset, size_t len, const char *filename)
+ {
+ 	u_int8_t *buf = NULL;
+ 	int outfd, err;
+@@ -157,7 +157,7 @@ retry:
+ 	if (buf != NULL)
+ 		free(buf);
+ 	close(outfd);
+-	printf("Copied %zu bytes from address 0x%.8x in flash to %s\n", len, offset, filename);
++	printf("Copied %zu bytes from address 0x%.8"PRIxoff_t" in flash to %s\n", len, offset, filename);
+ 	return 0;
+ 
+ err2:
+@@ -169,7 +169,7 @@ err0:
+ 	return 1;
+ }
+ 
+-int file_to_flash(int fd, u_int32_t offset, u_int32_t len, const char *filename)
++int file_to_flash(int fd, off_t offset, u_int32_t len, const char *filename)
+ {
+ 	u_int8_t *buf = NULL;
+ 	FILE *fp;
+@@ -221,7 +221,7 @@ retry:
+ 	if (buf != NULL)
+ 		free(buf);
+ 	fclose(fp);
+-	printf("Copied %d bytes from %s to address 0x%.8x in flash\n", len, filename, offset);
++	printf("Copied %d bytes from %s to address 0x%.8"PRIxoff_t" in flash\n", len, filename, offset);
+ 	return 0;
+ }
+ 
+@@ -376,13 +376,13 @@ int main(int argc, char *argv[])
+ 			showinfo(fd);
+ 			break;
+ 		case OPT_READ:
+-			err = flash_to_file(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0), argv[5]);
++			err = flash_to_file(fd, strtoll(argv[3], NULL, 0), strtoul(argv[4], NULL, 0), argv[5]);
+ 			break;
+ 		case OPT_WRITE:
+-			err = file_to_flash(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0), argv[5]);
++			err = file_to_flash(fd, strtoll(argv[3], NULL, 0), strtoul(argv[4], NULL, 0), argv[5]);
+ 			break;
+ 		case OPT_ERASE:
+-			err = erase_flash(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0));
++			err = erase_flash(fd, strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0));
+ 			break;
+ 	}
+ 
+diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
+index 30322cd..f6e77f6 100644
+--- a/tests/fs-tests/integrity/integck.c
++++ b/tests/fs-tests/integrity/integck.c
+@@ -899,8 +899,8 @@ static ssize_t file_write_data(struct file_info *file, int fd, off_t offset,
+ 	remains = size;
+ 	actual = 0;
+ 	written = IO_BUFFER_SIZE;
+-	v("write %zd bytes, offset %llu, file %s",
+-	  size, (unsigned long long)offset, get_file_name(file));
++	v("write %zd bytes, offset %"PRIdoff_t", file %s",
++	  size, offset, get_file_name(file));
+ 	while (remains) {
+ 		/* Fill up buffer with random data */
+ 		if (written < IO_BUFFER_SIZE) {
+diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
+index 4e13b73..e48f533 100644
+--- a/tests/ubi-tests/integ.c
++++ b/tests/ubi-tests/integ.c
+@@ -25,7 +25,7 @@ struct write_info
+ 	struct write_info *next;
+ 	struct erase_block_info *erase_block;
+ 	int offset_within_block; /* Offset within erase block */
+-	off64_t offset; /* Offset within volume */
++	off_t offset; /* Offset within volume */
+ 	int size;
+ 	int random_seed;
+ };
+@@ -34,8 +34,8 @@ struct erase_block_info
+ {
+ 	struct volume_info *volume;
+ 	int block_number;
+-	off64_t offset; /* Offset within volume */
+-	off64_t top_of_data;
++	off_t offset; /* Offset within volume */
++	off_t top_of_data;
+ 	int touched; /* Have we done anything at all with this erase block */
+ 	int erased; /* This erased block is currently erased */
+ 	struct write_info *writes;
+@@ -220,7 +220,7 @@ static void set_random_data(unsigned seed, unsigned char *buf, int size)
+ static void check_erase_block(struct erase_block_info *erase_block, int fd)
+ {
+ 	struct write_info *w;
+-	off64_t gap_end;
++	off_t gap_end;
+ 	int leb_size = erase_block->volume->info.leb_size;
+ 	ssize_t bytes_read;
+ 
+@@ -229,10 +229,10 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
+ 	while (w) {
+ 		if (w->offset + w->size < gap_end) {
+ 			/* There is a gap. Check all 0xff */
+-			off64_t gap_start = w->offset + w->size;
++			off_t gap_start = w->offset + w->size;
+ 			ssize_t size = gap_end - gap_start;
+-			if (lseek64(fd, gap_start, SEEK_SET) != gap_start)
+-				error_exit("lseek64 failed");
++			if (lseek(fd, gap_start, SEEK_SET) != gap_start)
++				error_exit("lseek failed");
+ 			memset(read_buffer, 0 , size);
+ 			errno = 0;
+ 			bytes_read = read(fd, read_buffer, size);
+@@ -241,18 +241,18 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
+ 			while (size)
+ 				if (read_buffer[--size] != 0xff) {
+ 					fprintf(stderr, "block no. = %d\n" , erase_block->block_number);
+-					fprintf(stderr, "offset = %lld\n" , (long long) gap_start);
++					fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start);
+ 					fprintf(stderr, "size = %ld\n" , (long) bytes_read);
+ 					error_exit("verify 0xff failed");
+ 				}
+ 		}
+-		if (lseek64(fd, w->offset, SEEK_SET) != w->offset)
+-			error_exit("lseek64 failed");
++		if (lseek(fd, w->offset, SEEK_SET) != w->offset)
++			error_exit("lseek failed");
+ 		memset(read_buffer, 0 , w->size);
+ 		errno = 0;
+ 		bytes_read = read(fd, read_buffer, w->size);
+ 		if (bytes_read != w->size) {
+-			fprintf(stderr, "offset = %lld\n" , (long long) w->offset);
++			fprintf(stderr, "offset = %"PRIdoff_t"\n" , w->offset);
+ 			fprintf(stderr, "size = %ld\n" , (long) w->size);
+ 			fprintf(stderr, "bytes_read = %ld\n" , (long) bytes_read);
+ 			error_exit("read failed");
+@@ -265,10 +265,10 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
+ 	}
+ 	if (gap_end > erase_block->offset) {
+ 		/* Check all 0xff */
+-		off64_t gap_start = erase_block->offset;
++		off_t gap_start = erase_block->offset;
+ 		ssize_t size = gap_end - gap_start;
+-		if (lseek64(fd, gap_start, SEEK_SET) != gap_start)
+-			error_exit("lseek64 failed");
++		if (lseek(fd, gap_start, SEEK_SET) != gap_start)
++			error_exit("lseek failed");
+ 		memset(read_buffer, 0 , size);
+ 		errno = 0;
+ 		bytes_read = read(fd, read_buffer, size);
+@@ -277,7 +277,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
+ 		while (size)
+ 			if (read_buffer[--size] != 0xff) {
+ 				fprintf(stderr, "block no. = %d\n" , erase_block->block_number);
+-				fprintf(stderr, "offset = %lld\n" , (long long) gap_start);
++				fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start);
+ 				fprintf(stderr, "size = %ld\n" , (long) bytes_read);
+ 				error_exit("verify 0xff failed!");
+ 			}
+@@ -290,7 +290,7 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
+ 	int leb_size = erase_block->volume->info.leb_size;
+ 	int next_offset = 0;
+ 	int space, size;
+-	off64_t offset;
++	off_t offset;
+ 	unsigned seed;
+ 	struct write_info *w;
+ 
+@@ -327,8 +327,8 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
+ 	offset = erase_block->offset + next_offset;
+ 	if (offset < erase_block->top_of_data)
+ 		error_exit("internal error!");
+-	if (lseek64(fd, offset, SEEK_SET) != offset)
+-		error_exit("lseek64 failed");
++	if (lseek(fd, offset, SEEK_SET) != offset)
++		error_exit("lseek failed");
+ 	/* Do write */
+ 	seed = get_next_seed();
+ 	if (!seed)
+@@ -480,7 +480,7 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
+ 		for (i = 0; i < n; ++i) {
+ 			s->erase_blocks[i].volume = s;
+ 			s->erase_blocks[i].block_number = i;
+-			s->erase_blocks[i].offset = i * (off64_t) s->info.leb_size;
++			s->erase_blocks[i].offset = i * (off_t) s->info.leb_size;
+ 			s->erase_blocks[i].top_of_data = s->erase_blocks[i].offset;
+ 		}
+ 		/* FIXME: Correctly get device file name */
diff --git a/patches/mtd-utils-1.5.0/0003-flash_otp_write-fix-format-string-warning.patch b/patches/mtd-utils-1.5.0/0003-flash_otp_write-fix-format-string-warning.patch
deleted file mode 100644
index ae49c4e..0000000
--- a/patches/mtd-utils-1.5.0/0003-flash_otp_write-fix-format-string-warning.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Wed, 20 Feb 2013 17:25:30 +0100
-Subject: [PATCH] flash_otp_write: fix format string warning
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This fixes
-	flash_otp_write.c: In function 'main':
-	flash_otp_write.c:61:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
-
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Forwarded: id:1361378469-18631-1-git-send-email-u.kleine-koenig@pengutronix.de
----
- flash_otp_write.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/flash_otp_write.c b/flash_otp_write.c
-index d407ebb..41cf1c5 100644
---- a/flash_otp_write.c
-+++ b/flash_otp_write.c
-@@ -58,7 +58,7 @@ int main(int argc,char *argv[])
- 		return errno;
- 	}
- 
--	printf("Writing OTP user data on %s at offset 0x%lx\n", argv[2], offset);
-+	printf("Writing OTP user data on %s at offset 0x%lx\n", argv[2], (unsigned long)offset);
- 
- 	if (mtdInfo.type == MTD_NANDFLASH)
- 		len = mtdInfo.writesize;
diff --git a/patches/mtd-utils-1.5.0/0001-make-ubifs-optional.patch b/patches/mtd-utils-1.5.0/0003-make-ubifs-optional.patch
similarity index 88%
rename from patches/mtd-utils-1.5.0/0001-make-ubifs-optional.patch
rename to patches/mtd-utils-1.5.0/0003-make-ubifs-optional.patch
index 2dec433..a71a8c9 100644
--- a/patches/mtd-utils-1.5.0/0001-make-ubifs-optional.patch
+++ b/patches/mtd-utils-1.5.0/0003-make-ubifs-optional.patch
@@ -1,10 +1,10 @@
 From: Bernhard Walle <bernhard@bwalle.de>
 Date: Sun, 11 Mar 2012 20:03:50 +0100
-Subject: [PATCH] make ubifs optional
+Subject: [PATCH mtd-utils] make ubifs optional
 
 Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
 ---
- Makefile |    2 ++
+ Makefile | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/Makefile b/Makefile
diff --git a/patches/mtd-utils-1.5.0/0002-Make-liblzo-optional-for-ubifs-tools.patch b/patches/mtd-utils-1.5.0/0004-Make-liblzo-optional-for-ubifs-tools.patch
similarity index 92%
rename from patches/mtd-utils-1.5.0/0002-Make-liblzo-optional-for-ubifs-tools.patch
rename to patches/mtd-utils-1.5.0/0004-Make-liblzo-optional-for-ubifs-tools.patch
index 01c3656..0664a2e 100644
--- a/patches/mtd-utils-1.5.0/0002-Make-liblzo-optional-for-ubifs-tools.patch
+++ b/patches/mtd-utils-1.5.0/0004-Make-liblzo-optional-for-ubifs-tools.patch
@@ -1,13 +1,13 @@
 From: Bernhard Walle <bernhard@bwalle.de>
 Date: Sun, 11 Mar 2012 20:11:14 +0100
-Subject: [PATCH] Make liblzo optional for ubifs tools
+Subject: [PATCH mtd-utils] Make liblzo optional for ubifs tools
 
 Based on patch from Marc Kleine-Budde <mkl@pengutronix.de>.
 
 Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
 ---
- Makefile           |    2 +-
- mkfs.ubifs/compr.c |   17 +++++++++++++++++
+ Makefile           |  2 +-
+ mkfs.ubifs/compr.c | 17 +++++++++++++++++
  2 files changed, 18 insertions(+), 1 deletion(-)
 
 diff --git a/Makefile b/Makefile
diff --git a/patches/mtd-utils-1.5.0/0004-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch b/patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
similarity index 74%
rename from patches/mtd-utils-1.5.0/0004-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
rename to patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
index f6c2aac..557c8dc 100644
--- a/patches/mtd-utils-1.5.0/0004-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
+++ b/patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
@@ -1,7 +1,7 @@
 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Wed, 27 Feb 2013 17:49:06 +0100
-Subject: [PATCH] flash_otp_write: fix writing to NAND in presence of partial
- reads
+Date: Thu, 28 Feb 2013 10:42:09 +0100
+Subject: [PATCH mtd-utils] flash_otp_write: fix writing to NAND in presence of
+ partial reads
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -17,17 +17,21 @@ reads the 2nd byte, pads and writes again. So the 2nd byte is written to
 offset $writesize instead of 1.
 
 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Forwarded: id:1362044529-511-1-git-send-email-u.kleine-koenig@pengutronix.de
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
 ---
- flash_otp_write.c |   19 ++++++++++++++++++-
+
+Notes:
+    Applied-Upstream: >1.5.0, commit:86cf5bd1e0633f16c722500bd9717d999a7e2473
+
+ flash_otp_write.c | 19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)
 
 diff --git a/flash_otp_write.c b/flash_otp_write.c
-index 41cf1c5..0aa872e 100644
+index 56769ec..3515eee 100644
 --- a/flash_otp_write.c
 +++ b/flash_otp_write.c
-@@ -15,6 +15,23 @@
- 
+@@ -16,6 +16,23 @@
+ #include <common.h>
  #include <mtd/mtd-user.h>
  
 +ssize_t xread(int fd, void *buf, size_t count)
@@ -50,7 +54,7 @@ index 41cf1c5..0aa872e 100644
  int main(int argc,char *argv[])
  {
  	int fd, val, ret, size, wrote, len;
-@@ -66,7 +83,7 @@ int main(int argc,char *argv[])
+@@ -67,7 +84,7 @@ int main(int argc,char *argv[])
  		len = 256;
  
  	wrote = 0;
diff --git a/patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch b/patches/mtd-utils-1.5.0/0006-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
similarity index 65%
rename from patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
rename to patches/mtd-utils-1.5.0/0006-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
index d1102c0..e8a1e00 100644
--- a/patches/mtd-utils-1.5.0/0005-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
+++ b/patches/mtd-utils-1.5.0/0006-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
@@ -1,7 +1,7 @@
 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Thu, 28 Feb 2013 10:28:29 +0100
-Subject: [PATCH] flash_otp_write: fix a buffer overflow on NAND with write
- size > 2048
+Date: Thu, 28 Feb 2013 10:42:26 +0100
+Subject: [PATCH mtd-utils] flash_otp_write: fix a buffer overflow on NAND with
+ write size > 2048
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -11,16 +11,20 @@ Still checking for that instead of a sleeping problem to bite us maybe
 in a few years is easy.
 
 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Forwarded: id:1362044546-559-1-git-send-email-u.kleine-koenig@pengutronix.de
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
 ---
- flash_otp_write.c |    6 ++++++
+
+Notes:
+    Applied-Upstream: >1.5.0, commit:1145ef7ee979dde2d611e09d00fc6ff0090dcc9d
+
+ flash_otp_write.c | 6 ++++++
  1 file changed, 6 insertions(+)
 
 diff --git a/flash_otp_write.c b/flash_otp_write.c
-index 0aa872e..5114e6b 100644
+index 3515eee..eaca5e1 100644
 --- a/flash_otp_write.c
 +++ b/flash_otp_write.c
-@@ -82,6 +82,12 @@ int main(int argc,char *argv[])
+@@ -83,6 +83,12 @@ int main(int argc,char *argv[])
  	else
  		len = 256;
  
diff --git a/patches/mtd-utils-1.5.0/0006-Makefile-also-build-and-install-flash_otp_lock-and-f.patch b/patches/mtd-utils-1.5.0/0007-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
similarity index 76%
rename from patches/mtd-utils-1.5.0/0006-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
rename to patches/mtd-utils-1.5.0/0007-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
index 9727290..4c0f76b 100644
--- a/patches/mtd-utils-1.5.0/0006-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
+++ b/patches/mtd-utils-1.5.0/0007-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
@@ -1,16 +1,20 @@
 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Wed, 20 Feb 2013 17:29:12 +0100
-Subject: [PATCH] Makefile: also build and install flash_otp_lock and
+Date: Wed, 20 Feb 2013 17:41:31 +0100
+Subject: [PATCH mtd-utils] Makefile: also build and install flash_otp_lock and
  flash_otp_write
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Forwarded: id:1361378491-18687-1-git-send-email-u.kleine-koenig@pengutronix.de
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
 ---
- .gitignore |    2 ++
- Makefile   |    3 ++-
+
+Notes:
+    Applied-Upstream: >1.5.0, commit:86cf5bd1e0633f16c722500bd9717d999a7e2473
+
+ .gitignore | 2 ++
+ Makefile   | 3 ++-
  2 files changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/.gitignore b/.gitignore
diff --git a/patches/mtd-utils-1.5.0/series b/patches/mtd-utils-1.5.0/series
index 5739202..0c7c5e3 100644
--- a/patches/mtd-utils-1.5.0/series
+++ b/patches/mtd-utils-1.5.0/series
@@ -1,9 +1,10 @@
 # generated by git-ptx-patches
 #tag:base --start-number 1
-0001-make-ubifs-optional.patch
-0002-Make-liblzo-optional-for-ubifs-tools.patch
-0003-flash_otp_write-fix-format-string-warning.patch
-0004-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
-0005-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
-0006-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
-# e4c91e5314fff3767797bd4aab24a7e3  - git-ptx-patches magic
+0001-introduce-PRIxoff_t-and-PRIdoff_t-printf-helpers.patch
+0002-consistency-between-u_int32_t-off_t-off64_t.patch
+0003-make-ubifs-optional.patch
+0004-Make-liblzo-optional-for-ubifs-tools.patch
+0005-flash_otp_write-fix-writing-to-NAND-in-presence-of-p.patch
+0006-flash_otp_write-fix-a-buffer-overflow-on-NAND-with-w.patch
+0007-Makefile-also-build-and-install-flash_otp_lock-and-f.patch
+# 112f6fe0726ab47e9cac0f60228dd1cc  - git-ptx-patches magic
-- 
1.8.2.rc2


-- 
ptxdist mailing list
ptxdist@pengutronix.de

                 reply	other threads:[~2013-03-11  8:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362992239-15879-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox