mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
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>
This commit is contained in:
@@ -167,7 +167,7 @@ bad:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ubi_create_vol(char *volume, int size, int dynamic)
|
static int ubi_create_vol(char *volume, int64_t size, int dynamic)
|
||||||
{
|
{
|
||||||
struct ubi_mkvol_req req;
|
struct ubi_mkvol_req req;
|
||||||
int err;
|
int err;
|
||||||
@@ -191,7 +191,7 @@ static int ubi_create_vol(char *volume, int size, int dynamic)
|
|||||||
printf("verify_mkvol_req failed %d\n", err);
|
printf("verify_mkvol_req failed %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
printf("Creating %s volume %s of size %d\n",
|
printf("Creating %s volume %s of size %lld\n",
|
||||||
dynamic ? "dynamic" : "static", volume, size);
|
dynamic ? "dynamic" : "static", volume, size);
|
||||||
/* Call real ubi create volume */
|
/* Call real ubi create volume */
|
||||||
return ubi_create_volume(ubi, &req);
|
return ubi_create_volume(ubi, &req);
|
||||||
@@ -498,7 +498,7 @@ int ubi_part(char *part_name, const char *vid_header_offset)
|
|||||||
|
|
||||||
static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
int64_t size = 0;
|
||||||
ulong addr = 0;
|
ulong addr = 0;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
@@ -558,13 +558,13 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
}
|
}
|
||||||
/* E.g., create volume size */
|
/* E.g., create volume size */
|
||||||
if (argc == 4) {
|
if (argc == 4) {
|
||||||
size = simple_strtoul(argv[3], NULL, 16);
|
size = simple_strtoull(argv[3], NULL, 16);
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
/* Use maximum available size */
|
/* Use maximum available size */
|
||||||
if (!size) {
|
if (!size) {
|
||||||
size = ubi->avail_pebs * ubi->leb_size;
|
size = (int64_t)ubi->avail_pebs * ubi->leb_size;
|
||||||
printf("No size specified -> Using max size (%u)\n", size);
|
printf("No size specified -> Using max size (%lld)\n", size);
|
||||||
}
|
}
|
||||||
/* E.g., create volume */
|
/* E.g., create volume */
|
||||||
if (argc == 3)
|
if (argc == 3)
|
||||||
@@ -590,7 +590,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
|
|
||||||
ret = ubi_volume_write(argv[3], (void *)addr, size);
|
ret = ubi_volume_write(argv[3], (void *)addr, size);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
printf("%d bytes written to volume %s\n", size,
|
printf("%lld bytes written to volume %s\n", size,
|
||||||
argv[3]);
|
argv[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,7 +613,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
printf("Read %d bytes from volume %s to %lx\n", size,
|
printf("Read %lld bytes from volume %s to %lx\n", size,
|
||||||
argv[3], addr);
|
argv[3], addr);
|
||||||
|
|
||||||
return ubi_volume_read(argv[3], (char *)addr, size);
|
return ubi_volume_read(argv[3], (char *)addr, size);
|
||||||
|
Reference in New Issue
Block a user