aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/include
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 15:40:32 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 15:40:32 +0300
commit6624ef2ba2e9687929c53fe838910786270cd5c9 (patch)
tree28514674f90840ab2614c728b1d51699db2fdb8d /ubi-utils/include
parent5cf9d3cf66dd32bd5a348e0e9805c5d7a3c34573 (diff)
ubiformat: torture eraseblocks on write errors
When fail to write to PEBs, and the error is EIO, torture the PEB before marking it as bad. Basically, the code is copied from the kernel UBI. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/include')
-rw-r--r--ubi-utils/include/libmtd.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/ubi-utils/include/libmtd.h b/ubi-utils/include/libmtd.h
index 8d5bc4f..c8b44e8 100644
--- a/ubi-utils/include/libmtd.h
+++ b/ubi-utils/include/libmtd.h
@@ -149,6 +149,17 @@ int mtd_get_dev_info1(libmtd_t desc, int dev_num, struct mtd_dev_info *mtd);
int mtd_erase(const struct mtd_dev_info *mtd, int fd, int eb);
/**
+ * mtd_torture - torture an eraseblock.
+ * @mtd: MTD device description object
+ * @fd: MTD device node file descriptor
+ * @eb: eraseblock to torture
+ *
+ * This function tortures eraseblock @eb. Returns %0 in case of success and %-1
+ * in case of failure.
+ */
+int mtd_torture(const struct mtd_dev_info *mtd, int fd, int eb);
+
+/**
* mtd_is_bad - check if eraseblock is bad.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
@@ -160,13 +171,13 @@ int mtd_erase(const struct mtd_dev_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.
+ * mtd_mark_bad - mark an eraseblock as bad.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
- * @eb: eraseblock to mark bad
+ * @eb: eraseblock to mark as bad
*
- * This function marks the eraseblock @eb as bad. Returns %0 if success
- * %-1 if failure
+ * This function marks eraseblock @eb as bad. Returns %0 in case of success and
+ * %-1 in case of failure.
*/
int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb);