summaryrefslogtreecommitdiff
path: root/ubi-utils/include
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-04-18 13:54:44 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-04-18 15:28:03 +0300
commited951dfbfbbe4e75e2773a02855e2ee1545afd4f (patch)
tree35f2646a18a4b7e874fa7f4f4dd61f92e3a74f92 /ubi-utils/include
parent02b833db191d98be35da5d54c5fa98822823b4a6 (diff)
libmtd: move comments to headers
Just for the sake of being consistent with libubi, move the comments for API functions to the header file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/include')
-rw-r--r--ubi-utils/include/libmtd.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/ubi-utils/include/libmtd.h b/ubi-utils/include/libmtd.h
index 032dafb..c50059d 100644
--- a/ubi-utils/include/libmtd.h
+++ b/ubi-utils/include/libmtd.h
@@ -60,11 +60,73 @@ struct mtd_info
int fd;
};
+/**
+ * mtd_get_info - get information about an MTD device.
+ * @node: name of the MTD device node
+ * @mtd: the MTD device information is returned here
+ *
+ * This function gets information about MTD device defined by the @node device
+ * 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_info(const char *node, struct mtd_info *mtd);
+
+/**
+ * mtd_erase - erase an eraseblock.
+ * @mtd: MTD device description object
+ * @eb: eraseblock to erase
+ *
+ * This function erases the eraseblock and returns %0 in case of success and
+ * %-1 in case of failure.
+ */
int mtd_erase(const struct mtd_info *mtd, int eb);
+
+/**
+ * mtd_is_bad - check if eraseblock is bad.
+ * @mtd: MTD device description object
+ * @eb: eraseblock to check
+ *
+ * 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 eb);
+
+/**
+ * mtd_mark_bad - marks the block as bad.
+ * @mtd: MTD device description object
+ * @eb: eraseblock to mark bad
+ *
+ * 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 eb);
+
+/**
+ * mtd_read - read data from an MTD device.
+ * @mtd: MTD device description object
+ * @eb: eraseblock to read from
+ * @offs: offset withing the eraseblock to read from
+ * @buf: buffer to read data to
+ * @len: how many bytes to read
+ *
+ * This function reads @len bytes of data from eraseblock @eb and offset @offs
+ * 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 eb, int offs, void *buf, int len);
+
+/**
+ * mtd_write - write data to an MTD device.
+ * @mtd: MTD device description object
+ * @eb: eraseblock to write to
+ * @offs: offset withing the eraseblock to write to
+ * @buf: buffer to write
+ * @len: how many bytes to write
+ *
+ * This function writes @len bytes of data to eraseblock @eb and offset @offs
+ * 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 eb, int offs, void *buf, int len);
#ifdef __cplusplus