summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-11-11 16:17:49 -0800
committerElliott Hughes <enh@google.com>2013-11-11 16:17:49 -0800
commitb05a2e513023133a780f51530246c492ddd95b46 (patch)
tree5c02ebd984b00bd929c357f8268d153585852971
parente627929490dfb92ab51ec6feb259d793a4a9f394 (diff)
downloadsystem_core-b05a2e513023133a780f51530246c492ddd95b46.zip
system_core-b05a2e513023133a780f51530246c492ddd95b46.tar.gz
system_core-b05a2e513023133a780f51530246c492ddd95b46.tar.bz2
Fix nandread to build with old or uapi headers.
Bug: 11559337 Change-Id: I9795a16649dafdfe3df150170265157170cd5a79
-rw-r--r--toolbox/nandread.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toolbox/nandread.c b/toolbox/nandread.c
index b124731..4666f26 100644
--- a/toolbox/nandread.c
+++ b/toolbox/nandread.c
@@ -12,7 +12,7 @@
static int test_empty(const char *buf, size_t size)
{
while(size--) {
- if (*buf++ != 0xff)
+ if (*buf++ != (char) 0xff)
return 0;
}
return 1;
@@ -44,7 +44,7 @@ int nandread_main(int argc, char **argv)
struct mtd_info_user mtdinfo;
struct mtd_ecc_stats initial_ecc, last_ecc, ecc;
struct mtd_oob_buf oobbuf;
- struct nand_ecclayout ecclayout;
+ nand_ecclayout_t ecclayout;
do {
c = getopt(argc, argv, "d:f:s:S:L:Rhv");
@@ -177,7 +177,11 @@ int nandread_main(int argc, char **argv)
if (rawmode) {
rawmode = mtdinfo.oobsize;
+#if !defined(MTD_STUPID_LOCK) /* using uapi kernel headers */
+ ret = ioctl(fd, MTDFILEMODE, MTD_FILE_MODE_RAW);
+#else /* still using old kernel headers */
ret = ioctl(fd, MTDFILEMODE, MTD_MODE_RAW);
+#endif
if (ret) {
fprintf(stderr, "failed set raw mode for %s, %s\n",
devname, strerror(errno));