diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-04-21 19:13:58 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-04-21 19:13:58 +0300 |
commit | 898b17afb2611359467b1585578758cb633c4b9a (patch) | |
tree | d921d5a6a9f4560feef25d82897f9e15bf436926 /ubi-utils/new-utils | |
parent | 5f636233d8f92729ea1265f9bde5f9afc7b46ee4 (diff) |
ubi-utils: fix percent output in ubiformat
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils')
-rw-r--r-- | ubi-utils/new-utils/src/ubiformat.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ubi-utils/new-utils/src/ubiformat.c b/ubi-utils/new-utils/src/ubiformat.c index 98f2d5f..dfae415 100644 --- a/ubi-utils/new-utils/src/ubiformat.c +++ b/ubi-utils/new-utils/src/ubiformat.c @@ -296,7 +296,7 @@ static int drop_ffs(const struct mtd_info *mtd, const void *buf, int len) static int flash_image(const struct mtd_info *mtd, const struct ubigen_info *ui, struct ubi_scan_info *si) { - int fd, img_ebs, eb, written_ebs = 0; + int fd, img_ebs, eb, written_ebs = 0, divisor; struct stat st; if (stat(args.image, &st)) @@ -316,6 +316,7 @@ static int flash_image(const struct mtd_info *mtd, const struct ubigen_info *ui, return sys_errmsg("cannot open \"%s\"", args.image); verbose(args.verbose, "will write %d eraseblocks", img_ebs); + divisor = img_ebs; for (eb = 0; eb < mtd->eb_cnt; eb++) { int err, new_len; char buf[mtd->eb_size]; @@ -323,12 +324,14 @@ static int flash_image(const struct mtd_info *mtd, const struct ubigen_info *ui, if (!args.quiet && !args.verbose) { printf("\r" PROGRAM_NAME ": flashing eraseblock %d -- %2lld %% complete ", - eb, (long long)(eb + 1) * 100 / img_ebs); + eb, (long long)(eb + 1) * 100 / divisor); fflush(stdout); } - if (si->ec[eb] == EB_BAD) + if (si->ec[eb] == EB_BAD) { + divisor += 1; continue; + } if (args.verbose) { normsg_cont("eraseblock %d: erase", eb); |