mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: ptxdist@pengutronix.de
Cc: Alexander Stein <alexander.stein@systec-electronic.com>
Subject: [ptxdist] [PATCH] mtd-utils: Add patch to fix flashcp progress output
Date: Mon,  9 Nov 2015 11:15:41 +0100	[thread overview]
Message-ID: <1447064141-1612-1-git-send-email-alexander.stein@systec-electronic.com> (raw)

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

                 reply	other threads:[~2015-11-09 10:15 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=1447064141-1612-1-git-send-email-alexander.stein@systec-electronic.com \
    --to=alexander.stein@systec-electronic.com \
    --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