]> www.infradead.org Git - mtd-utils.git/commitdiff
libmtd: rename mtd_info
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 20 Apr 2009 11:46:33 +0000 (14:46 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 20 Apr 2009 13:29:43 +0000 (16:29 +0300)
Rename 'struct mtd_info' to 'struct mtd_dev_info' to reflect the
fact that it provides information about a specific MTD device.
Also, this is more consistent with libubi.

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

index f2f4da25aa6c8209390ff2e3b3e43d7958973d5b..bcc2de24d0cb2a3008f6c1653368bbeb2f6c31e6 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
 #endif
 
 /**
- * struct mtd_info - information about an MTD device.
+ * struct mtd_dev_info - information about an MTD device.
  * @num: MTD device number
  * @major: major number of corresponding character device
  * @minor: minor number of corresponding character device
@@ -42,7 +42,7 @@ extern "C" {
  * @rdonly: non-zero if the device is read-only
  * @allows_bb: non-zero if the MTD device may have bad eraseblocks
  */
-struct mtd_info
+struct mtd_dev_info
 {
        int num;
        int major;
@@ -67,7 +67,7 @@ struct mtd_info
  * node file and saves this information in the @mtd object. Returns %0 in case
  * of success and %-1 in case of failure.
  */
-int mtd_get_dev_info(const char *node, struct mtd_info *mtd);
+int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd);
 
 /**
  * mtd_erase - erase an eraseblock.
@@ -78,7 +78,7 @@ int mtd_get_dev_info(const char *node, struct mtd_info *mtd);
  * This function erases eraseblock @eb of MTD device decribed by @fd. Returns
  * %0 in case of success and %-1 in case of failure.
  */
-int mtd_erase(const struct mtd_info *mtd, int fd, int eb);
+int mtd_erase(const struct mtd_dev_info *mtd, int fd, int eb);
 
 /**
  * mtd_is_bad - check if eraseblock is bad.
@@ -89,7 +89,7 @@ int mtd_erase(const struct mtd_info *mtd, int fd, int eb);
  * This function checks if eraseblock @eb is bad. Returns %0 if not, %1 if yes,
  * and %-1 in case of failure.
  */
-int mtd_is_bad(const struct mtd_info *mtd, int fd, int eb);
+int mtd_is_bad(const struct mtd_dev_info *mtd, int fd, int eb);
 
 /**
  * mtd_mark_bad - marks the block as bad.
@@ -100,7 +100,7 @@ int mtd_is_bad(const struct mtd_info *mtd, int fd, int eb);
  * This function marks the eraseblock @eb as bad. Returns %0 if success
  * %-1 if failure
  */
-int mtd_mark_bad(const struct mtd_info *mtd, int fd, int eb);
+int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb);
 
 /**
  * mtd_read - read data from an MTD device.
@@ -115,8 +115,8 @@ int mtd_mark_bad(const struct mtd_info *mtd, int fd, int eb);
  * of the MTD device defined by @mtd and stores the read data at buffer @buf.
  * Returns %0 in case of success and %-1 in case of failure.
  */
-int mtd_read(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
-            int len);
+int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+            void *buf, int len);
 
 /**
  * mtd_write - write data to an MTD device.
@@ -131,8 +131,8 @@ int mtd_read(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
  * of the MTD device defined by @mtd. Returns %0 in case of success and %-1 in
  * case of failure.
  */
-int mtd_write(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
-             int len);
+int mtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+             void *buf, int len);
 
 #ifdef __cplusplus
 }
index 8597b98d25d7440db7d7bbe826493ae894b31b01..3ba291fa1e748eb348a224b80760979807d3cf11 100644 (file)
@@ -87,7 +87,7 @@ struct ubi_scan_info
        int data_offs;
 };
 
-struct mtd_info;
+struct mtd_dev_info;
 
 /**
  * ubi_scan - scan an MTD device.
@@ -97,7 +97,7 @@ struct mtd_info;
  * @verbose: verbose mode: %0 - be silent, %1 - output progress information,
  *           2 - debugging output mode
  */
-int ubi_scan(struct mtd_info *mtd, int fd, struct ubi_scan_info **info,
+int ubi_scan(struct mtd_dev_info *mtd, int fd, struct ubi_scan_info **info,
             int verbose);
 
 /**
index 8403c37eb33bc4fe24a4c05f356eb3f2994498b6..dc9287a50def016d75c68f771d76f96e120d06a1 100644 (file)
@@ -33,7 +33,7 @@
 #define PROGRAM_NAME "libmtd"
 #define MTD_DEV_MAJOR 90
 
-int mtd_get_dev_info(const char *node, struct mtd_info *mtd)
+int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd)
 {
        struct stat st;
        struct mtd_info_user ui;
@@ -141,7 +141,7 @@ out_close:
        return -1;
 }
 
-int mtd_erase(const struct mtd_info *mtd, int fd, int eb)
+int mtd_erase(const struct mtd_dev_info *mtd, int fd, int eb)
 {
        struct erase_info_user ei;
 
@@ -150,7 +150,7 @@ int mtd_erase(const struct mtd_info *mtd, int fd, int eb)
        return ioctl(fd, MEMERASE, &ei);
 }
 
-int mtd_is_bad(const struct mtd_info *mtd, int fd, int eb)
+int mtd_is_bad(const struct mtd_dev_info *mtd, int fd, int eb)
 {
        int ret;
        loff_t seek;
@@ -173,7 +173,7 @@ int mtd_is_bad(const struct mtd_info *mtd, int fd, int eb)
        return ret;
 }
 
-int mtd_mark_bad(const struct mtd_info *mtd, int fd, int eb)
+int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb)
 {
        int ret;
        loff_t seek;
@@ -198,8 +198,8 @@ int mtd_mark_bad(const struct mtd_info *mtd, int fd, int eb)
        return 0;
 }
 
-int mtd_read(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
-            int len)
+int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+            void *buf, int len)
 {
        int ret, rd = 0;
        off_t seek;
@@ -234,8 +234,8 @@ int mtd_read(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
        return 0;
 }
 
-int mtd_write(const struct mtd_info *mtd, int fd, int eb, int offs, void *buf,
-             int len)
+int mtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+             void *buf, int len)
 {
        int ret;
        off_t seek;
index 4d64bca8683e665d759f46738f191fa3ac41ea72..25b565831c029dfd43231c687a6e58f45c2a92ed 100644 (file)
@@ -48,7 +48,8 @@ static int all_ff(const void *buf, int len)
        return 1;
 }
 
-int ubi_scan(struct mtd_info *mtd, int fd, struct ubi_scan_info **info, int verbose)
+int ubi_scan(struct mtd_dev_info *mtd, int fd, struct ubi_scan_info **info,
+            int verbose)
 {
        int eb, v = (verbose == 2), pr = (verbose == 1);
        struct ubi_scan_info *si;
index 511591a79e70d45a09fd68970c43846bcccbeca9..1a564d183ad907644d050c3f86574aad5d72b240 100644 (file)
@@ -260,7 +260,7 @@ static int answer_is_yes(void)
        }
 }
 
-static void print_bad_eraseblocks(const struct mtd_info *mtd,
+static void print_bad_eraseblocks(const struct mtd_dev_info *mtd,
                                  const struct ubi_scan_info *si)
 {
        int first = 1, eb;
@@ -302,7 +302,7 @@ static int change_ec(struct ubi_ec_hdr *hdr, long long ec)
        return 0;
 }
 
-static int drop_ffs(const struct mtd_info *mtd, const void *buf, int len)
+static int drop_ffs(const struct mtd_dev_info *mtd, const void *buf, int len)
 {
        int i;
 
@@ -391,7 +391,7 @@ static int consecutive_bad_check(int eb)
        return 0;
 }
 
-static int mark_bad(const struct mtd_info *mtd, struct ubi_scan_info *si, int eb)
+static int mark_bad(const struct mtd_dev_info *mtd, struct ubi_scan_info *si, int eb)
 {
        int err;
 
@@ -423,7 +423,7 @@ static int mark_bad(const struct mtd_info *mtd, struct ubi_scan_info *si, int eb
        return consecutive_bad_check(eb);
 }
 
-static int flash_image(const struct mtd_info *mtd, struct ubi_scan_info *si)
+static int flash_image(const struct mtd_dev_info *mtd, struct ubi_scan_info *si)
 {
        int fd, img_ebs, eb, written_ebs = 0, divisor;
        off_t st_size;
@@ -551,7 +551,7 @@ out_close:
        return -1;
 }
 
-static int format(const struct mtd_info *mtd, const struct ubigen_info *ui,
+static int format(const struct mtd_dev_info *mtd, const struct ubigen_info *ui,
                  struct ubi_scan_info *si, int start_eb, int novtbl)
 {
        int eb, err, write_size;
@@ -682,7 +682,7 @@ out_free:
 int main(int argc, char * const argv[])
 {
        int err, verbose;
-       struct mtd_info mtd;
+       struct mtd_dev_info mtd;
        libubi_t libubi;
        struct ubigen_info ui;
        struct ubi_scan_info *si;