9
0
Fork 0

make parse_area_spec arguments loff_t

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-10-18 17:21:18 +02:00
parent 76281a16fb
commit efa379f224
6 changed files with 14 additions and 14 deletions

View File

@ -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;

View File

@ -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++;
}

View File

@ -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)

View File

@ -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");

View File

@ -156,7 +156,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);

View File

@ -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;
}