From a527b22f0a30d66d4674624d16f4bb0ffe2e94d0 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Mon, 12 Dec 2022 12:01:57 -0600 Subject: libmtd: Add function to get MTD info by device name This is a convenience function for end users. In some situations it's easier to reference MTD device's by their name then by MTD number, as the name may be more reliable if device partitioning is dynamic or for porting between systems. Signed-off-by: Brandon Maier Signed-off-by: David Oberhollenzer --- include/libmtd.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include/libmtd.h') diff --git a/include/libmtd.h b/include/libmtd.h index 6ab0de5..f909a16 100644 --- a/include/libmtd.h +++ b/include/libmtd.h @@ -130,7 +130,7 @@ int mtd_get_info(libmtd_t desc, struct mtd_info *info); /** * mtd_get_dev_info - get information about an MTD device. * @desc: MTD library descriptor - * @node: name of the MTD device node + * @node: path 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 @@ -151,6 +151,17 @@ int mtd_get_dev_info(libmtd_t desc, const char *node, struct mtd_dev_info *mtd); */ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd); +/** + * mtd_get_dev_info2 - get information about an MTD device. + * @desc: MTD library descriptor + * @name: name of the MTD device + * @mtd: the MTD device information is returned here + * + * This function is identical to 'mtd_get_dev_info()' except that it accepts + * MTD device's name, not MTD character device. + */ +int mtd_get_dev_info2(libmtd_t desc, const char *name, struct mtd_dev_info *mtd); + /** * mtd_lock - lock eraseblocks. * @desc: MTD library descriptor -- cgit v1.2.3