Merge "Fix %llx to PRIx64 in nandread.c."
This commit is contained in:
commit
01ad77107b
1 changed files with 18 additions and 17 deletions
|
@ -1,9 +1,10 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <mtd/mtd-user.h>
|
||||
|
@ -189,18 +190,18 @@ int nandread_main(int argc, char **argv)
|
|||
for (pos = start, opos = 0; pos < end; pos += mtdinfo.writesize) {
|
||||
bad_block = 0;
|
||||
if (verbose > 3)
|
||||
printf("reading at %llx\n", pos);
|
||||
printf("reading at %" PRIx64 "\n", pos);
|
||||
lseek64(fd, pos, SEEK_SET);
|
||||
ret = read(fd, buffer, mtdinfo.writesize + rawmode);
|
||||
if (ret < (int)mtdinfo.writesize) {
|
||||
fprintf(stderr, "short read at %llx, %d\n", pos, ret);
|
||||
fprintf(stderr, "short read at %" PRIx64 ", %d\n", pos, ret);
|
||||
bad_block = 2;
|
||||
}
|
||||
if (!rawmode) {
|
||||
oobbuf.start = pos;
|
||||
ret = ioctl(fd, MEMREADOOB, &oobbuf);
|
||||
if (ret) {
|
||||
fprintf(stderr, "failed to read oob data at %llx, %d\n", pos, ret);
|
||||
fprintf(stderr, "failed to read oob data at %" PRIx64 ", %d\n", pos, ret);
|
||||
bad_block = 2;
|
||||
}
|
||||
}
|
||||
|
@ -213,17 +214,17 @@ int nandread_main(int argc, char **argv)
|
|||
bpos = pos / mtdinfo.erasesize * mtdinfo.erasesize;
|
||||
ret = ioctl(fd, MEMGETBADBLOCK, &bpos);
|
||||
if (ret && errno != EOPNOTSUPP) {
|
||||
printf("badblock at %llx\n", pos);
|
||||
printf("badblock at %" PRIx64 "\n", pos);
|
||||
bad_block = 1;
|
||||
}
|
||||
if (ecc.corrected != last_ecc.corrected)
|
||||
printf("ecc corrected, %u, at %llx\n", ecc.corrected - last_ecc.corrected, pos);
|
||||
printf("ecc corrected, %u, at %" PRIx64 "\n", ecc.corrected - last_ecc.corrected, pos);
|
||||
if (ecc.failed != last_ecc.failed)
|
||||
printf("ecc failed, %u, at %llx\n", ecc.failed - last_ecc.failed, pos);
|
||||
printf("ecc failed, %u, at %" PRIx64 "\n", ecc.failed - last_ecc.failed, pos);
|
||||
if (ecc.badblocks != last_ecc.badblocks)
|
||||
printf("ecc badblocks, %u, at %llx\n", ecc.badblocks - last_ecc.badblocks, pos);
|
||||
printf("ecc badblocks, %u, at %" PRIx64 "\n", ecc.badblocks - last_ecc.badblocks, pos);
|
||||
if (ecc.bbtblocks != last_ecc.bbtblocks)
|
||||
printf("ecc bbtblocks, %u, at %llx\n", ecc.bbtblocks - last_ecc.bbtblocks, pos);
|
||||
printf("ecc bbtblocks, %u, at %" PRIx64 "\n", ecc.bbtblocks - last_ecc.bbtblocks, pos);
|
||||
|
||||
if (!rawmode) {
|
||||
oob_fixed = (uint8_t *)oob_data;
|
||||
|
@ -241,18 +242,18 @@ int nandread_main(int argc, char **argv)
|
|||
if (outfd >= 0) {
|
||||
ret = write(outfd, buffer, mtdinfo.writesize + spare_size);
|
||||
if (ret < (int)(mtdinfo.writesize + spare_size)) {
|
||||
fprintf(stderr, "short write at %llx, %d\n", pos, ret);
|
||||
fprintf(stderr, "short write at %" PRIx64 ", %d\n", pos, ret);
|
||||
close(outfd);
|
||||
outfd = -1;
|
||||
}
|
||||
if (ecc.corrected != last_ecc.corrected)
|
||||
fprintf(statusfile, "%08llx: ecc corrected\n", opos);
|
||||
fprintf(statusfile, "%08" PRIx64 ": ecc corrected\n", opos);
|
||||
if (ecc.failed != last_ecc.failed)
|
||||
fprintf(statusfile, "%08llx: ecc failed\n", opos);
|
||||
fprintf(statusfile, "%08" PRIx64 ": ecc failed\n", opos);
|
||||
if (bad_block == 1)
|
||||
fprintf(statusfile, "%08llx: badblock\n", opos);
|
||||
fprintf(statusfile, "%08" PRIx64 ": badblock\n", opos);
|
||||
if (bad_block == 2)
|
||||
fprintf(statusfile, "%08llx: read error\n", opos);
|
||||
fprintf(statusfile, "%08" PRIx64 ": read error\n", opos);
|
||||
opos += mtdinfo.writesize + spare_size;
|
||||
}
|
||||
|
||||
|
@ -261,7 +262,7 @@ int nandread_main(int argc, char **argv)
|
|||
if (test_empty(buffer, mtdinfo.writesize + mtdinfo.oobsize + spare_size))
|
||||
empty_pages++;
|
||||
else if (verbose > 2 || (verbose > 1 && !(pos & (mtdinfo.erasesize - 1))))
|
||||
printf("page at %llx (%d oobbytes): %08x %08x %08x %08x "
|
||||
printf("page at %" PRIx64 " (%d oobbytes): %08x %08x %08x %08x "
|
||||
"%08x %08x %08x %08x\n", pos, oobbuf.start,
|
||||
oob_data[0], oob_data[1], oob_data[2], oob_data[3],
|
||||
oob_data[4], oob_data[5], oob_data[6], oob_data[7]);
|
||||
|
|
Loading…
Reference in a new issue