summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ubi-utils/include/libmtd.h4
-rw-r--r--ubi-utils/src/libmtd.c6
-rw-r--r--ubi-utils/src/ubiformat.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/ubi-utils/include/libmtd.h b/ubi-utils/include/libmtd.h
index 2d7d451..242ecf5 100644
--- a/ubi-utils/include/libmtd.h
+++ b/ubi-utils/include/libmtd.h
@@ -39,7 +39,7 @@ extern "C" {
* @eb_size: eraseblock size
* @min_io_size: minimum input/output unit size
* @subpage_size: sub-page size
- * @rdonly: non-zero if the device is read-only
+ * @writable: zero if the device is read-only
* @bb_allowed: non-zero if the MTD device may have bad eraseblocks
*/
struct mtd_dev_info
@@ -54,7 +54,7 @@ struct mtd_dev_info
int eb_size;
int min_io_size;
int subpage_size;
- unsigned int rdonly:1;
+ unsigned int writable:1;
unsigned int bb_allowed:1;
};
diff --git a/ubi-utils/src/libmtd.c b/ubi-utils/src/libmtd.c
index b61f974..7675dcd 100644
--- a/ubi-utils/src/libmtd.c
+++ b/ubi-utils/src/libmtd.c
@@ -58,7 +58,7 @@ int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd)
}
mtd->num = mtd->minor / 2;
- mtd->rdonly = mtd->minor & 1;
+ mtd->writable = !(mtd->minor & 1);
fd = open(node, O_RDWR);
if (fd == -1)
@@ -130,8 +130,8 @@ int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd)
break;
}
- if (!(ui.flags & MTD_WRITEABLE))
- mtd->rdonly = 1;
+ if (ui.flags & MTD_WRITEABLE)
+ mtd->writable = 1;
close(fd);
return 0;
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 686c419..b64d187 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -732,7 +732,7 @@ int main(int argc, char * const argv[])
*/
mtd.subpage_size = args.subpage_size;
- if (mtd.rdonly) {
+ if (!mtd.writable) {
errmsg("mtd%d (%s) is a read-only device", mtd.num, args.node);
goto out;
}