Commit dd7185f1764fb8ed93940c2ac44cd6c400ebae7e
Committed by
Scott Wood
1 parent
39ac34473f
Exists in
master
and in
53 other branches
cmd_ubi: use int64_t volume size for 'ubi create'
int64_t matches the bytes field in struct ubi_mkvol_req to which the size is assigned. With the prior signed 32 bit integer, volumes were restricted to being less than 2GiB in size. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Stefan Roese <sr@denx.de>
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
common/cmd_ubi.c
... | ... | @@ -167,7 +167,7 @@ |
167 | 167 | return err; |
168 | 168 | } |
169 | 169 | |
170 | -static int ubi_create_vol(char *volume, int size, int dynamic) | |
170 | +static int ubi_create_vol(char *volume, int64_t size, int dynamic) | |
171 | 171 | { |
172 | 172 | struct ubi_mkvol_req req; |
173 | 173 | int err; |
... | ... | @@ -191,7 +191,7 @@ |
191 | 191 | printf("verify_mkvol_req failed %d\n", err); |
192 | 192 | return err; |
193 | 193 | } |
194 | - printf("Creating %s volume %s of size %d\n", | |
194 | + printf("Creating %s volume %s of size %lld\n", | |
195 | 195 | dynamic ? "dynamic" : "static", volume, size); |
196 | 196 | /* Call real ubi create volume */ |
197 | 197 | return ubi_create_volume(ubi, &req); |
... | ... | @@ -498,7 +498,7 @@ |
498 | 498 | |
499 | 499 | static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
500 | 500 | { |
501 | - size_t size = 0; | |
501 | + int64_t size = 0; | |
502 | 502 | ulong addr = 0; |
503 | 503 | |
504 | 504 | if (argc < 2) |
505 | 505 | |
... | ... | @@ -558,13 +558,13 @@ |
558 | 558 | } |
559 | 559 | /* E.g., create volume size */ |
560 | 560 | if (argc == 4) { |
561 | - size = simple_strtoul(argv[3], NULL, 16); | |
561 | + size = simple_strtoull(argv[3], NULL, 16); | |
562 | 562 | argc--; |
563 | 563 | } |
564 | 564 | /* Use maximum available size */ |
565 | 565 | if (!size) { |
566 | - size = ubi->avail_pebs * ubi->leb_size; | |
567 | - printf("No size specified -> Using max size (%u)\n", size); | |
566 | + size = (int64_t)ubi->avail_pebs * ubi->leb_size; | |
567 | + printf("No size specified -> Using max size (%lld)\n", size); | |
568 | 568 | } |
569 | 569 | /* E.g., create volume */ |
570 | 570 | if (argc == 3) |
... | ... | @@ -590,7 +590,7 @@ |
590 | 590 | |
591 | 591 | ret = ubi_volume_write(argv[3], (void *)addr, size); |
592 | 592 | if (!ret) { |
593 | - printf("%d bytes written to volume %s\n", size, | |
593 | + printf("%lld bytes written to volume %s\n", size, | |
594 | 594 | argv[3]); |
595 | 595 | } |
596 | 596 | |
... | ... | @@ -613,7 +613,7 @@ |
613 | 613 | } |
614 | 614 | |
615 | 615 | if (argc == 3) { |
616 | - printf("Read %d bytes from volume %s to %lx\n", size, | |
616 | + printf("Read %lld bytes from volume %s to %lx\n", size, | |
617 | 617 | argv[3], addr); |
618 | 618 | |
619 | 619 | return ubi_volume_read(argv[3], (char *)addr, size); |