summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-11-11 16:36:53 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-11-11 10:32:45 +0100
commitd539a3951fc5eba852b1fd79e151e1879611a5df (patch)
tree5d822202ea3e5e6783cb789efe5f9f924946fd86 /include
parent008d2cad386862ce0f0abb20df291a3d29313b96 (diff)
libubi: Add new interface ubi_leb_map()
Add ubi_leb_map() implementation, it is used in UBIFS linux kernel libs. This is a preparation for replacing implementation of UBIFS utils with linux kernel libs. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/libubi.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/libubi.h b/include/libubi.h
index 9cb5037..b5b3d8f 100644
--- a/include/libubi.h
+++ b/include/libubi.h
@@ -487,6 +487,21 @@ int ubi_leb_unmap(int fd, int lnum);
*/
int ubi_is_mapped(int fd, int lnum);
+/**
+ * ubi_leb_map - map logical eraseblock to a physical eraseblock.
+ * @fd: volume character device file descriptor
+ * @lnum: logical eraseblock number
+ *
+ * This function maps an un-mapped logical eraseblock @lnum to a physical
+ * eraseblock. This means, that after a successful invocation of this
+ * function the logical eraseblock @lnum will be empty (contain only %0xFF
+ * bytes) and be mapped to a physical eraseblock, even if an unclean reboot
+ * happens.
+ *
+ * This function returns zero in case of success, %-1 in case of failures.
+ */
+int ubi_leb_map(int fd, int lnum);
+
#ifdef __cplusplus
}
#endif