aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--ubi-utils/include/libmtd.h62
-rw-r--r--ubi-utils/src/libmtd.c57
2 files changed, 62 insertions, 57 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
diff --git a/ubi-utils/src/libmtd.c b/ubi-utils/src/libmtd.c
index 32fdf57..4cc9bdb 100644
--- a/ubi-utils/src/libmtd.c
+++ b/ubi-utils/src/libmtd.c
@@ -33,15 +33,6 @@
#define PROGRAM_NAME "libmtd"
#define MTD_DEV_MAJOR 90
-/**
- * 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)
{
struct stat st;
@@ -149,14 +140,6 @@ out_close:
return -1;
}
-/**
- * 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)
{
struct erase_info_user ei;
@@ -166,14 +149,6 @@ int mtd_erase(const struct mtd_info *mtd, int eb)
return ioctl(mtd->fd, MEMERASE, &ei);
}
-/**
- * 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)
{
int ret;
@@ -197,14 +172,6 @@ int mtd_is_bad(const struct mtd_info *mtd, int eb)
return ret;
}
-/**
- * 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)
{
int ret;
@@ -230,18 +197,6 @@ int mtd_mark_bad(const struct mtd_info *mtd, int eb)
return 0;
}
-/**
- * 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)
{
int ret, rd = 0;
@@ -277,18 +232,6 @@ int mtd_read(const struct mtd_info *mtd, int eb, int offs, void *buf, int len)
return 0;
}
-/**
- * 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)
{
int ret;