X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fubi.c;h=9c3cabc262aaa692ca8fbe3b630d6810450e8db6;hb=68c7025d99dbac9ddf1a166a19efc3f9e98f1301;hp=222be5a3576cb7aa96121b449889766550d1885d;hpb=6f008a2e16ec3b618363800e414023569007cd89;p=u-boot diff --git a/cmd/ubi.c b/cmd/ubi.c index 222be5a357..9c3cabc262 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size) unsigned long long tmp; struct ubi_volume *vol; loff_t offp = 0; + size_t len_read; vol = ubi_find_volume(volume); if (vol == NULL) @@ -355,6 +356,8 @@ int ubi_volume_read(char *volume, char *buf, size_t size) size = vol->used_bytes; } + printf("Read %u bytes from volume %s to %p\n", size, volume, buf); + if (vol->corrupted) printf("read from corrupted volume %d", vol->vol_id); if (offp + size > vol->used_bytes) @@ -373,6 +376,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size) tmp = offp; off = do_div(tmp, vol->usable_leb_size); lnum = tmp; + len_read = size; do { if (off + len >= vol->usable_leb_size) len = vol->usable_leb_size - off; @@ -398,6 +402,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size) len = size > tbuf_size ? tbuf_size : size; } while (size); + if (!size) + env_set_hex("filesize", len_read); + free(tbuf); return err; } @@ -669,9 +676,6 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (argc == 3) { - printf("Read %lld bytes from volume %s to %lx\n", size, - argv[3], addr); - return ubi_volume_read(argv[3], (char *)addr, size); } }