All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] devmem2: fix output when _FILE_OFFSET_BITS=64
Date: Thu, 19 Jun 2014 18:13:37 +0200	[thread overview]
Message-ID: <1403194417-19986-2-git-send-email-maxime.hadjinlian@gmail.com> (raw)
In-Reply-To: <1403194417-19986-1-git-send-email-maxime.hadjinlian@gmail.com>

From: Colin Didier <colin.didier@devialet.com>

When built with _FILE_OFFSET_BITS=64, off_t becomes an long long int
and was printed as an unsigned int which lead to a garbled output.

Signed-off-by: Colin Didier <colin.didier@devialet.com>
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@devialet.com>
---
 .../devmem2-0001-be-coherent-in-type-usage.patch   | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 package/devmem2/devmem2-0001-be-coherent-in-type-usage.patch

diff --git a/package/devmem2/devmem2-0001-be-coherent-in-type-usage.patch b/package/devmem2/devmem2-0001-be-coherent-in-type-usage.patch
new file mode 100644
index 0000000..14c99a2
--- /dev/null
+++ b/package/devmem2/devmem2-0001-be-coherent-in-type-usage.patch
@@ -0,0 +1,49 @@
+From 15eae3dbb3d6824a0fd478e2ce0fe879496bb72c Mon Sep 17 00:00:00 2001
+From: Colin Didier <colin.didier@devialet.com>
+Date: Thu, 19 Jun 2014 16:58:19 +0200
+Subject: [PATCH] be coherent in type usage
+
+- no need to use off_t because it is read from strtoul()
+- print unsigned int type correctly
+
+When built with _FILE_OFFSET_BITS=64, off_t becomes an long long int
+and was printed as an unsigned int which lead to a garbled output.
+
+Signed-off-by: Colin Didier <colin.didier@devialet.com>
+---
+ devmem2.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/devmem2.c b/devmem2.c
+index 7732ecb..1ae06ef 100644
+--- a/devmem2.c
++++ b/devmem2.c
+@@ -58,8 +58,7 @@
+ int main(int argc, char **argv) {
+     int fd;
+     void *map_base, *virt_addr;
+-	unsigned long read_result, writeval;
+-	off_t target;
++	unsigned long target, read_result, writeval;
+ 	int access_type = 'w';
+
+ 	if(argc < 2) {
+@@ -101,7 +100,7 @@ int main(int argc, char **argv) {
+ 			fprintf(stderr, "Illegal data type '%c'.\n", access_type);
+ 			exit(2);
+ 	}
+-    printf("Value at address 0x%X (%p): 0x%X\n", target, virt_addr, read_result);
++    printf("Value@address 0x%lX (%p): 0x%lX\n", target, virt_addr, read_result);
+     fflush(stdout);
+
+ 	if(argc > 3) {
+@@ -120,7 +119,7 @@ int main(int argc, char **argv) {
+ 				read_result = *((unsigned long *) virt_addr);
+ 				break;
+ 		}
+-		printf("Written 0x%X; readback 0x%X\n", writeval, read_result);
++		printf("Written 0x%lX; readback 0x%lX\n", writeval, read_result);
+ 		fflush(stdout);
+ 	}
+
+--
+2.0.0
+
--
2.0.0

  reply	other threads:[~2014-06-19 16:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 16:13 [Buildroot] [PATCH 1/2] icu: Delete inapropriate flag at link Maxime Hadjinlian
2014-06-19 16:13 ` Maxime Hadjinlian [this message]
2014-06-29 10:43   ` [Buildroot] [PATCH 2/2] devmem2: fix output when _FILE_OFFSET_BITS=64 Thomas Petazzoni
2014-06-29 14:31     ` Thomas Petazzoni
2014-06-20 21:27 ` [Buildroot] [PATCH 1/2] icu: Delete inapropriate flag at link Arnout Vandecappelle
2014-06-21 10:51   ` Maxime Hadjinlian
2014-06-21 17:14   ` Thomas Petazzoni
2014-06-24 18:06     ` Arnout Vandecappelle
2014-06-29 10:48 ` Thomas Petazzoni

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=1403194417-19986-2-git-send-email-maxime.hadjinlian@gmail.com \
    --to=maxime.hadjinlian@gmail.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.