From f3f3a208048eac5f8b5752a17ebcd44db9230fd8 Mon Sep 17 00:00:00 2001 From: Richard Genoud Date: Wed, 12 Sep 2012 16:38:34 +0200 Subject: consistency between u_int32_t / off_t / off64_t We should use the off_t type instead of off64_t or u_int32_t as its length is controlled by the WITHOUT_LARGEFILE flag. Signed-off-by: Richard Genoud Signed-off-by: Artem Bityutskiy --- flash_erase.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'flash_erase.c') diff --git a/flash_erase.c b/flash_erase.c index fe2eaca..326a299 100644 --- a/flash_erase.c +++ b/flash_erase.c @@ -49,10 +49,10 @@ static int unlock; /* unlock sectors before erasing */ static struct jffs2_unknown_node cleanmarker; int target_endian = __BYTE_ORDER; -static void show_progress(struct mtd_dev_info *mtd, uint64_t start, int eb, +static void show_progress(struct mtd_dev_info *mtd, off_t start, int eb, int eb_start, int eb_cnt) { - bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIx64" -- %2i %% complete ", + bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ", mtd->eb_size / 1024, start, ((eb - eb_start) * 100) / eb_cnt); fflush(stdout); } @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) unsigned int eb, eb_start, eb_cnt; int isNAND; int error = 0; - uint64_t offset = 0; + off_t offset = 0; /* * Process user arguments @@ -235,12 +235,12 @@ int main(int argc, char *argv[]) eb_cnt = (mtd.size / mtd.eb_size) - eb_start; for (eb = eb_start; eb < eb_start + eb_cnt; eb++) { - offset = (uint64_t)eb * mtd.eb_size; + offset = (off_t)eb * mtd.eb_size; if (!noskipbad) { int ret = mtd_is_bad(&mtd, fd, eb); if (ret > 0) { - verbose(!quiet, "Skipping bad block at %08"PRIx64, offset); + verbose(!quiet, "Skipping bad block at %08"PRIxoff_t, offset); continue; } else if (ret < 0) { if (errno == EOPNOTSUPP) { @@ -272,12 +272,12 @@ int main(int argc, char *argv[]) /* write cleanmarker */ if (isNAND) { - if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, &cleanmarker) != 0) { + if (mtd_write_oob(mtd_desc, &mtd, fd, (uint64_t)offset + clmpos, clmlen, &cleanmarker) != 0) { sys_errmsg("%s: MTD writeoob failure", mtd_device); continue; } } else { - if (lseek(fd, (loff_t)offset, SEEK_SET) < 0) { + if (lseek(fd, offset, SEEK_SET) < 0) { sys_errmsg("%s: MTD lseek failure", mtd_device); continue; } @@ -286,7 +286,7 @@ int main(int argc, char *argv[]) continue; } } - verbose(!quiet, " Cleanmarker written at %"PRIx64, offset); + verbose(!quiet, " Cleanmarker written at %"PRIxoff_t, offset); } show_progress(&mtd, offset, eb, eb_start, eb_cnt); bareverbose(!quiet, "\n"); -- cgit v1.2.3