diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-08 22:29:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-10 19:07:33 +0200 |
commit | 4987f61ee22bd231aea7c23eb35942b9d1f18226 (patch) | |
tree | 59de6992397d344163916a6ffccce588afd30770 /commands | |
parent | 75821bdef50fa7f14111ac0e24da2fb5b2af5d30 (diff) | |
download | barebox-4987f61ee22bd231aea7c23eb35942b9d1f18226.tar.gz barebox-4987f61ee22bd231aea7c23eb35942b9d1f18226.tar.xz |
mtd: fix bad block ioctls
Since this commit we interpret the argument to the bad block ioctls
as a pointer to a 64bit number:
|commit e71c34366808bbe3ce0b166d8710749513af6d81
|Author: Sascha Hauer <s.hauer@pengutronix.de>
|Date: Fri Oct 14 11:57:55 2011 +0200
|
| mtd: fix arguments to bad block ioctls
|
| In the Kernel the mtd ioctls expect a pointer to the offset, whereas
| barebox interprets the pointer itself as an offset. Since we want
| to add 64bit support for file sizes a pointer may not be sufficient,
| so align with the kernel and convert it to a pointer to the offset.
|
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This missed some places, fix them aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/nand.c | 3 | ||||
-rw-r--r-- | commands/nandtest.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/commands/nand.c b/commands/nand.c index 34aa07ba1d..6124daea01 100644 --- a/commands/nand.c +++ b/commands/nand.c @@ -79,6 +79,7 @@ static int do_nand(int argc, char *argv[]) if (command & NAND_MARKBAD) { if (optind < argc) { int ret = 0, fd; + loff_t __badblock = badblock; printf("marking block at 0x%08x on %s as bad\n", badblock, argv[optind]); @@ -88,7 +89,7 @@ static int do_nand(int argc, char *argv[]) return 1; } - ret = ioctl(fd, MEMSETBADBLOCK, (void *)badblock); + ret = ioctl(fd, MEMSETBADBLOCK, &__badblock); if (ret) perror("ioctl"); diff --git a/commands/nandtest.c b/commands/nandtest.c index d923e42f88..06b7f94519 100644 --- a/commands/nandtest.c +++ b/commands/nandtest.c @@ -307,11 +307,11 @@ static int do_nandtest(int argc, char *argv[]) for (test_ofs = flash_offset; test_ofs < flash_offset+length; test_ofs += meminfo.erasesize) { - + loff_t __test_ofs = test_ofs; srand(seed); seed = rand(); - if (ioctl(fd, MEMGETBADBLOCK, (void *)test_ofs)) { + if (ioctl(fd, MEMGETBADBLOCK, &__test_ofs)) { printf("\rBad block at 0x%08x\n", (unsigned)(test_ofs + memregion.offset)); |