From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 05/10] make parse_area_spec arguments loff_t
Date: Tue, 26 Jun 2012 21:54:58 +0200 [thread overview]
Message-ID: <1340740503-7003-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1340740503-7003-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/crc.c | 4 ++--
commands/digest.c | 4 ++--
commands/flash.c | 4 ++--
commands/mem.c | 4 ++--
include/common.h | 2 +-
lib/misc.c | 10 +++++-----
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/commands/crc.c b/commands/crc.c
index df22941..09af6aa 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -84,8 +84,8 @@ out:
static int do_crc(int argc, char *argv[])
{
- ulong start = 0, size = ~0, total = 0;
- ulong crc = 0, vcrc = 0;
+ loff_t start = 0, size = ~0;
+ ulong crc = 0, vcrc = 0, total = 0;
char *filename = "/dev/mem";
#ifdef CONFIG_CMD_CRC_CMP
char *vfilename = NULL;
diff --git a/commands/digest.c b/commands/digest.c
index 8432914..07cbec9 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -51,7 +51,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
argv++;
while (*argv) {
char *filename = "/dev/mem";
- ulong start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
/* arguments are either file, file+area or area */
if (parse_area_spec(*argv, &start, &size)) {
@@ -66,7 +66,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
for (i = 0; i < d->length; i++)
printf("%02x", hash[i]);
- printf(" %s\t0x%08lx ... 0x%08lx\n", filename, start, start + size);
+ printf(" %s\t0x%08llx ... 0x%08llx\n", filename, start, start + size);
argv++;
}
diff --git a/commands/flash.c b/commands/flash.c
index 1fcb1cf..d71349a 100644
--- a/commands/flash.c
+++ b/commands/flash.c
@@ -41,7 +41,7 @@ static int do_flerase(int argc, char *argv[])
int fd;
char *filename = NULL;
struct stat s;
- unsigned long start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
int ret = 0;
if (argc == 1)
@@ -109,7 +109,7 @@ static int do_protect(int argc, char *argv[])
char *filename = NULL;
struct stat s;
int prot = 1;
- unsigned long start = 0, size = ~0;
+ loff_t start = 0, size = ~0;
int ret = 0, err;
if (argc == 1)
diff --git a/commands/mem.c b/commands/mem.c
index 649d5bf..0719700 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -163,7 +163,7 @@ static int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
static int do_mem_md(int argc, char *argv[])
{
- ulong start = 0, size = 0x100;
+ loff_t start = 0, size = 0x100;
int r, now;
int ret = 0;
int fd;
@@ -187,7 +187,7 @@ static int do_mem_md(int argc, char *argv[])
return 1;
do {
- now = min(size, RW_BUF_SIZE);
+ now = min(size, (loff_t)RW_BUF_SIZE);
r = read(fd, rw_buf, now);
if (r < 0) {
perror("read");
diff --git a/include/common.h b/include/common.h
index 328aa30..08ff0f3 100644
--- a/include/common.h
+++ b/include/common.h
@@ -138,7 +138,7 @@ struct memarea_info {
unsigned long flags;
};
-int parse_area_spec(const char *str, ulong *start, ulong *size);
+int parse_area_spec(const char *str, loff_t *start, loff_t *size);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
diff --git a/lib/misc.c b/lib/misc.c
index cdf0185..8a95396 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -75,15 +75,15 @@ EXPORT_SYMBOL(strtoul_suffix);
* 0x1000 -> start = 0x1000, size = ~0
* 1M+1k -> start = 0x100000, size = 0x400
*/
-int parse_area_spec(const char *str, ulong *start, ulong *size)
+int parse_area_spec(const char *str, loff_t *start, loff_t *size)
{
char *endp;
- ulong end;
+ loff_t end;
if (!isdigit(*str))
return -1;
- *start = strtoul_suffix(str, &endp, 0);
+ *start = strtoull_suffix(str, &endp, 0);
str = endp;
@@ -95,7 +95,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
if (*str == '-') {
/* beginning and end given */
- end = strtoul_suffix(str + 1, NULL, 0);
+ end = strtoull_suffix(str + 1, NULL, 0);
if (end < *start) {
printf("end < start\n");
return -1;
@@ -106,7 +106,7 @@ int parse_area_spec(const char *str, ulong *start, ulong *size)
if (*str == '+') {
/* beginning and size given */
- *size = strtoul_suffix(str + 1, NULL, 0);
+ *size = strtoull_suffix(str + 1, NULL, 0);
return 0;
}
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-06-26 19:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 19:54 [PATCH] 64bit file support Sascha Hauer
2012-06-26 19:54 ` [PATCH 01/10] mtd: fix arguments to bad block ioctls Sascha Hauer
2012-06-26 19:54 ` [PATCH 02/10] nand-bb: bb->offset may become a 64bit type Sascha Hauer
2012-06-26 19:54 ` [PATCH 03/10] use loff_t for file offsets Sascha Hauer
2012-06-26 19:54 ` [PATCH 04/10] introduce strtoull_suffix function Sascha Hauer
2012-06-26 19:54 ` Sascha Hauer [this message]
2012-06-26 19:54 ` [PATCH 06/10] make memory display 64bit capable Sascha Hauer
2012-06-26 19:55 ` [PATCH 07/10] make st_size in struct stat 64 bit Sascha Hauer
2012-06-26 19:55 ` [PATCH 08/10] make cdev 64bit capable Sascha Hauer
2012-06-26 19:55 ` [PATCH 09/10] memory commands: Make " Sascha Hauer
2012-06-26 19:55 ` [PATCH 10/10] partitions: " Sascha Hauer
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=1340740503-7003-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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