summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2015-12-08 15:36:54 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2015-12-09 20:36:59 +0100
commit4146c12f76e99851d4e004119c9645b79cb47479 (patch)
treeb6146b3c77215ff4a7eb89367c4b51a97dbf7cde /patches
parent42918c68cc5df29b3af70c99b84c41482e622bca (diff)
downloadptxdist-4146c12f76e99851d4e004119c9645b79cb47479.tar.gz
ptxdist-4146c12f76e99851d4e004119c9645b79cb47479.tar.xz
mtd-utils: Add upstream patch to fix flashcp progress output
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'patches')
-rw-r--r--patches/mtd-utils-1.5.2/0008-flashcp-Use-llu-to-print-filestat.st_size.patch101
-rw-r--r--patches/mtd-utils-1.5.2/series3
2 files changed, 103 insertions, 1 deletions
diff --git a/patches/mtd-utils-1.5.2/0008-flashcp-Use-llu-to-print-filestat.st_size.patch b/patches/mtd-utils-1.5.2/0008-flashcp-Use-llu-to-print-filestat.st_size.patch
new file mode 100644
index 000000000..9ce0f9dd4
--- /dev/null
+++ b/patches/mtd-utils-1.5.2/0008-flashcp-Use-llu-to-print-filestat.st_size.patch
@@ -0,0 +1,101 @@
+From: Fabien Proriol <Fabien.Proriol@jdsu.com>
+Date: Fri, 7 Nov 2014 13:46:28 +0000
+Subject: [PATCH] flashcp: Use %llu to print filestat.st_size
+
+filestat.st_size type is off_t.
+For some paltforms, off_t can be 32 or 64bit but there is no C99 format specifier for off_t.
+The best way to print it with printf is to cast it to long long and print with %llu
+
+Signed-off-by: Fabien Proriol <fabien.proriol@jdsu.com>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ flashcp.c | 32 ++++++++++++++++----------------
+ 1 file changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/flashcp.c b/flashcp.c
+index 86334acf0e4d..3fddeb009ae3 100644
+--- a/flashcp.c
++++ b/flashcp.c
+@@ -296,7 +296,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/%lluk (0%%)",KB ((unsigned long long)filestat.st_size));
+ size = filestat.st_size;
+ i = BUFSIZE;
+ written = 0;
+@@ -304,10 +304,10 @@ 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/%lluk (%llu%%)",
+ KB (written + i),
+- KB (filestat.st_size),
+- PERCENTAGE (written + i,filestat.st_size));
++ KB ((unsigned long long)filestat.st_size),
++ PERCENTAGE (written + i,(unsigned long long)filestat.st_size));
+
+ /* read from filename */
+ safe_read (fil_fd,filename,src,i,flags & FLAG_VERBOSE);
+@@ -325,8 +325,8 @@ 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",
+- written,written + i,device,written + result,filestat.st_size);
++ "Short write count returned while writing to x%.8x-0x%.8x on %s: %d/%llu bytes written to flash\n",
++ written,written + i,device,written + result,(unsigned long long)filestat.st_size);
+ exit (EXIT_FAILURE);
+ }
+
+@@ -335,10 +335,10 @@ int main (int argc,char *argv[])
+ }
+ if (flags & FLAG_VERBOSE)
+ log_printf (LOG_NORMAL,
+- "\rWriting data: %luk/%luk (100%%)\n",
+- KB (filestat.st_size),
+- KB (filestat.st_size));
+- DEBUG("Wrote %d / %luk bytes\n",written,filestat.st_size);
++ "\rWriting data: %lluk/%lluk (100%%)\n",
++ KB ((unsigned long long)filestat.st_size),
++ KB ((unsigned long long)filestat.st_size));
++ DEBUG("Wrote %d / %lluk bytes\n",written,(unsigned long long)filestat.st_size);
+
+ /**********************************
+ * verify that flash == file data *
+@@ -349,16 +349,16 @@ 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/%lluk (0%%)",KB ((unsigned long long)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/%lluk (%lu%%)",
+ KB (written + i),
+- KB (filestat.st_size),
+- PERCENTAGE (written + i,filestat.st_size));
++ KB ((unsigned long long)filestat.st_size),
++ PERCENTAGE (written + i,(unsigned long long)filestat.st_size));
+
+ /* read from filename */
+ safe_read (fil_fd,filename,src,i,flags & FLAG_VERBOSE);
+@@ -380,10 +380,10 @@ int main (int argc,char *argv[])
+ }
+ if (flags & FLAG_VERBOSE)
+ log_printf (LOG_NORMAL,
+- "\rVerifying data: %luk/%luk (100%%)\n",
++ "\rVerifying data: %lluk/%lluk (100%%)\n",
+ KB (filestat.st_size),
+ KB (filestat.st_size));
+- DEBUG("Verified %d / %luk bytes\n",written,filestat.st_size);
++ DEBUG("Verified %d / %lluk bytes\n",written,(unsigned long long)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 981492260..028b04570 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-llu-to-print-filestat.st_size.patch
+# 8764f3d82b4d5ad37ce34647ab99cd01 - git-ptx-patches magic