am 01ad7710: Merge "Fix %llx to PRIx64 in nandread.c."

* commit '01ad77107bfdc641ad818fe452448f0887aef961':
  Fix %llx to PRIx64 in nandread.c.
This commit is contained in:
Elliott Hughes 2014-06-26 00:13:32 +00:00 committed by Android Git Automerger
commit fdd4ffd182

View file

@ -1,9 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <mtd/mtd-user.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) { for (pos = start, opos = 0; pos < end; pos += mtdinfo.writesize) {
bad_block = 0; bad_block = 0;
if (verbose > 3) if (verbose > 3)
printf("reading at %llx\n", pos); printf("reading at %" PRIx64 "\n", pos);
lseek64(fd, pos, SEEK_SET); lseek64(fd, pos, SEEK_SET);
ret = read(fd, buffer, mtdinfo.writesize + rawmode); ret = read(fd, buffer, mtdinfo.writesize + rawmode);
if (ret < (int)mtdinfo.writesize) { 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; bad_block = 2;
} }
if (!rawmode) { if (!rawmode) {
oobbuf.start = pos; oobbuf.start = pos;
ret = ioctl(fd, MEMREADOOB, &oobbuf); ret = ioctl(fd, MEMREADOOB, &oobbuf);
if (ret) { 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; bad_block = 2;
} }
} }
@ -213,17 +214,17 @@ int nandread_main(int argc, char **argv)
bpos = pos / mtdinfo.erasesize * mtdinfo.erasesize; bpos = pos / mtdinfo.erasesize * mtdinfo.erasesize;
ret = ioctl(fd, MEMGETBADBLOCK, &bpos); ret = ioctl(fd, MEMGETBADBLOCK, &bpos);
if (ret && errno != EOPNOTSUPP) { if (ret && errno != EOPNOTSUPP) {
printf("badblock at %llx\n", pos); printf("badblock at %" PRIx64 "\n", pos);
bad_block = 1; bad_block = 1;
} }
if (ecc.corrected != last_ecc.corrected) 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) 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) 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) 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) { if (!rawmode) {
oob_fixed = (uint8_t *)oob_data; oob_fixed = (uint8_t *)oob_data;
@ -241,18 +242,18 @@ int nandread_main(int argc, char **argv)
if (outfd >= 0) { if (outfd >= 0) {
ret = write(outfd, buffer, mtdinfo.writesize + spare_size); ret = write(outfd, buffer, mtdinfo.writesize + spare_size);
if (ret < (int)(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); close(outfd);
outfd = -1; outfd = -1;
} }
if (ecc.corrected != last_ecc.corrected) 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) 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) if (bad_block == 1)
fprintf(statusfile, "%08llx: badblock\n", opos); fprintf(statusfile, "%08" PRIx64 ": badblock\n", opos);
if (bad_block == 2) if (bad_block == 2)
fprintf(statusfile, "%08llx: read error\n", opos); fprintf(statusfile, "%08" PRIx64 ": read error\n", opos);
opos += mtdinfo.writesize + spare_size; 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)) if (test_empty(buffer, mtdinfo.writesize + mtdinfo.oobsize + spare_size))
empty_pages++; empty_pages++;
else if (verbose > 2 || (verbose > 1 && !(pos & (mtdinfo.erasesize - 1)))) 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, "%08x %08x %08x %08x\n", pos, oobbuf.start,
oob_data[0], oob_data[1], oob_data[2], oob_data[3], oob_data[0], oob_data[1], oob_data[2], oob_data[3],
oob_data[4], oob_data[5], oob_data[6], oob_data[7]); oob_data[4], oob_data[5], oob_data[6], oob_data[7]);