]> www.infradead.org Git - mtd-utils.git/commitdiff
libmtd: rename rdonly field
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 26 Apr 2009 05:15:47 +0000 (08:15 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 8 May 2009 16:07:26 +0000 (19:07 +0300)
This is a preparation for the coming sysfs support.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/include/libmtd.h
ubi-utils/src/libmtd.c
ubi-utils/src/ubiformat.c

index 2d7d451e6682a070bf6356f9a472ad98c6de098d..242ecf5a56cd1fd701813eaf41eb0561c221472f 100644 (file)
@@ -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;
 };
 
index b61f97441beef115fc17d3b3083ccb4eb3f9e1ff..7675dcd73dfa080015f64c425162c75705dafcb2 100644 (file)
@@ -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;
index 686c4191d9d1e65e2b66ccdcc6b6a4dbf629c399..b64d187d8d82b32254d1cb79e8aceae8ce03a857 100644 (file)
@@ -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;
        }