From ed951dfbfbbe4e75e2773a02855e2ee1545afd4f Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Sat, 18 Apr 2009 13:54:44 +0300 Subject: 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 --- ubi-utils/include/libmtd.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'ubi-utils/include') 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 -- cgit v1.2.3