From 5e77e9d5a72d4f7bafc74373d5e44a106a369ceb Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Mon, 14 Jun 2010 13:25:07 +0300 Subject: libmtd: add mtd_write_img Add another helper interface which can be used to write an image to an mtd device. Signed-off-by: Artem Bityutskiy --- ubi-utils/include/libmtd.h | 15 +++++++++++++++ ubi-utils/include/libubi.h | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'ubi-utils/include') diff --git a/ubi-utils/include/libmtd.h b/ubi-utils/include/libmtd.h index c8b44e8..dd82b72 100644 --- a/ubi-utils/include/libmtd.h +++ b/ubi-utils/include/libmtd.h @@ -213,6 +213,21 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs, int mtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs, void *buf, int len); +/** + * mtd_write_img - write a file to MTD device. + * @mtd: MTD device description object + * @fd: MTD device node file descriptor + * @eb: eraseblock to write to + * @offs: offset withing the eraseblock to write to + * @img_name: the file to write + * + * This function writes an image @img_name the MTD device defined by @mtd. @eb + * and @offs are the starting eraseblock and offset on the MTD device. Returns + * %0 in case of success and %-1 in case of failure. + */ +int mtd_write_img(const struct mtd_dev_info *mtd, int fd, int eb, int offs, + const char *img_name); + /** * mtd_probe_node - test MTD node. * @desc: MTD library descriptor diff --git a/ubi-utils/include/libubi.h b/ubi-utils/include/libubi.h index f029a8d..ffc4be9 100644 --- a/ubi-utils/include/libubi.h +++ b/ubi-utils/include/libubi.h @@ -43,8 +43,8 @@ typedef void * libubi_t; * @dev_num: number to assign to the newly created UBI device * (%UBI_DEV_NUM_AUTO should be used to automatically assign the * number) - * @mtd_num: MTD device number to attach - * @dev: path to device node to attach + * @mtd_num: MTD device number to attach (used if @dev is %NULL) + * @dev: path to MTD device node to attach * @vid_hdr_offset: VID header offset (%0 means default offset and this is what * most of the users want) */ -- cgit v1.2.3