mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] mtd-utils: Add patch to fix flashcp progress output
@ 2015-11-09 10:15 Alexander Stein
  0 siblings, 0 replies; only message in thread
From: Alexander Stein @ 2015-11-09 10:15 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Stein

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 ...shcp-Use-PRIdoff_t-to-fix-progress-output.patch | 107 +++++++++++++++++++++
 patches/mtd-utils-1.5.2/series                     |   3 +-
 2 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 patches/mtd-utils-1.5.2/0008-flashcp-Use-PRIdoff_t-to-fix-progress-output.patch

diff --git a/patches/mtd-utils-1.5.2/0008-flashcp-Use-PRIdoff_t-to-fix-progress-output.patch b/patches/mtd-utils-1.5.2/0008-flashcp-Use-PRIdoff_t-to-fix-progress-output.patch
new file mode 100644
index 0000000..16a553f
--- /dev/null
+++ b/patches/mtd-utils-1.5.2/0008-flashcp-Use-PRIdoff_t-to-fix-progress-output.patch
@@ -0,0 +1,107 @@
+From: Alexander Stein <alexander.stein@systec-electronic.com>
+Date: Mon, 9 Nov 2015 11:13:51 +0100
+Subject: [PATCH] flashcp: Use PRIdoff_t to fix progress output
+
+Currently the output is broken as following:
+Erasing blocks: 12/12 (100%)
+Writing data: 2968k/0k (100%))
+Verifying data: 2968k/0k (100%))
+
+With this patch it is shown correctly:
+Erasing blocks: 12/12 (100%)
+Writing data: 2968k/2968k (100%)
+Verifying data: 2968k/2968k (100%)
+
+Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
+Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
+---
+ flashcp.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/flashcp.c b/flashcp.c
+index 86334ac..0b22cda 100644
+--- a/flashcp.c
++++ b/flashcp.c
+@@ -42,10 +42,13 @@
+ #include <unistd.h>
+ #include <mtd/mtd-user.h>
+ #include <getopt.h>
++#include "common.h"
+ 
++#ifndef bool
+ typedef int bool;
+ #define true 1
+ #define false 0
++#endif
+ 
+ #define EXIT_FAILURE 1
+ #define EXIT_SUCCESS 0
+@@ -296,7 +299,7 @@ int main (int argc,char *argv[])
+ 	 * write the entire file to flash *
+ 	 **********************************/
+ 
+-	if (flags & FLAG_VERBOSE) log_printf (LOG_NORMAL,"Writing data: 0k/%luk (0%%)",KB (filestat.st_size));
++	if (flags & FLAG_VERBOSE) log_printf (LOG_NORMAL,"Writing data: 0k/%"PRIdoff_t"k (0%%)",KB (filestat.st_size));
+ 	size = filestat.st_size;
+ 	i = BUFSIZE;
+ 	written = 0;
+@@ -304,7 +307,7 @@ int main (int argc,char *argv[])
+ 	{
+ 		if (size < BUFSIZE) i = size;
+ 		if (flags & FLAG_VERBOSE)
+-			log_printf (LOG_NORMAL,"\rWriting data: %dk/%luk (%lu%%)",
++			log_printf (LOG_NORMAL,"\rWriting data: %dk/%"PRIdoff_t"k (%"PRIdoff_t"%%)",
+ 					KB (written + i),
+ 					KB (filestat.st_size),
+ 					PERCENTAGE (written + i,filestat.st_size));
+@@ -325,7 +328,7 @@ int main (int argc,char *argv[])
+ 				exit (EXIT_FAILURE);
+ 			}
+ 			log_printf (LOG_ERROR,
+-					"Short write count returned while writing to x%.8x-0x%.8x on %s: %d/%lu bytes written to flash\n",
++					"Short write count returned while writing to x%.8x-0x%.8x on %s: %d/%"PRIdoff_t" bytes written to flash\n",
+ 					written,written + i,device,written + result,filestat.st_size);
+ 			exit (EXIT_FAILURE);
+ 		}
+@@ -335,10 +338,10 @@ int main (int argc,char *argv[])
+ 	}
+ 	if (flags & FLAG_VERBOSE)
+ 		log_printf (LOG_NORMAL,
+-				"\rWriting data: %luk/%luk (100%%)\n",
++				"\rWriting data: %"PRIdoff_t"k/%"PRIdoff_t"k (100%%)\n",
+ 				KB (filestat.st_size),
+ 				KB (filestat.st_size));
+-	DEBUG("Wrote %d / %luk bytes\n",written,filestat.st_size);
++	DEBUG("Wrote %d / %"PRIdoff_t"k bytes\n",written,filestat.st_size);
+ 
+ 	/**********************************
+ 	 * verify that flash == file data *
+@@ -349,13 +352,13 @@ int main (int argc,char *argv[])
+ 	size = filestat.st_size;
+ 	i = BUFSIZE;
+ 	written = 0;
+-	if (flags & FLAG_VERBOSE) log_printf (LOG_NORMAL,"Verifying data: 0k/%luk (0%%)",KB (filestat.st_size));
++	if (flags & FLAG_VERBOSE) log_printf (LOG_NORMAL,"Verifying data: 0k/%"PRIdoff_t"k (0%%)",KB (filestat.st_size));
+ 	while (size)
+ 	{
+ 		if (size < BUFSIZE) i = size;
+ 		if (flags & FLAG_VERBOSE)
+ 			log_printf (LOG_NORMAL,
+-					"\rVerifying data: %dk/%luk (%lu%%)",
++					"\rVerifying data: %dk/%"PRIdoff_t"k (%"PRIdoff_t"%%)",
+ 					KB (written + i),
+ 					KB (filestat.st_size),
+ 					PERCENTAGE (written + i,filestat.st_size));
+@@ -380,10 +383,10 @@ int main (int argc,char *argv[])
+ 	}
+ 	if (flags & FLAG_VERBOSE)
+ 		log_printf (LOG_NORMAL,
+-				"\rVerifying data: %luk/%luk (100%%)\n",
++				"\rVerifying data: %"PRIdoff_t"k/%"PRIdoff_t"k (100%%)\n",
+ 				KB (filestat.st_size),
+ 				KB (filestat.st_size));
+-	DEBUG("Verified %d / %luk bytes\n",written,filestat.st_size);
++	DEBUG("Verified %d / %"PRIdoff_t"k bytes\n",written,filestat.st_size);
+ 
+ 	exit (EXIT_SUCCESS);
+ }
diff --git a/patches/mtd-utils-1.5.2/series b/patches/mtd-utils-1.5.2/series
index 9814922..cab7215 100644
--- a/patches/mtd-utils-1.5.2/series
+++ b/patches/mtd-utils-1.5.2/series
@@ -7,4 +7,5 @@
 0005-mkfs.ubifs-simplify-make_path-with-xasprintf.patch
 0006-mkfs.ubifs-Add-extended-attribute-support.patch
 0007-mkfs.ubifs-Optionally-create-extended-attribute-with.patch
-# 7f992a19fb7184dce60b52e08bb6e49d  - git-ptx-patches magic
+0008-flashcp-Use-PRIdoff_t-to-fix-progress-output.patch
+# e423ad4d734fe80b85014585f49a40ea  - git-ptx-patches magic
-- 
2.4.10


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-09 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 10:15 [ptxdist] [PATCH] mtd-utils: Add patch to fix flashcp progress output Alexander Stein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox