summaryrefslogtreecommitdiff
path: root/flash_erase.c
diff options
context:
space:
mode:
Diffstat (limited to 'flash_erase.c')
-rw-r--r--flash_erase.c16
1 files changed, 8 insertions, 8 deletions
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");