From c7298da85e0e249ba237dcf158ec3e158e54fd40 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Mon, 14 Jun 2010 07:55:14 +0300 Subject: libubi: provide mtd number in UBI device information Add an 'mtd_num' field to the UBI device information structure. Signed-off-by: Artem Bityutskiy --- ubi-utils/include/libubi.h | 3 +++ ubi-utils/src/libubi.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'ubi-utils') diff --git a/ubi-utils/include/libubi.h b/ubi-utils/include/libubi.h index b69d9ab..f029a8d 100644 --- a/ubi-utils/include/libubi.h +++ b/ubi-utils/include/libubi.h @@ -95,6 +95,8 @@ struct ubi_info /** * struct ubi_dev_info - UBI device information. + * @dev_num: UBI device number + * @mtd_num: MTD device number on top of which this UBI device is working * @vol_count: count of volumes on this UBI device * @lowest_vol_id: lowest volume ID * @highest_vol_id: highest volume ID @@ -116,6 +118,7 @@ struct ubi_info struct ubi_dev_info { int dev_num; + int mtd_num; int vol_count; int lowest_vol_id; int highest_vol_id; diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c index 100f557..3fe7956 100644 --- a/ubi-utils/src/libubi.c +++ b/ubi-utils/src/libubi.c @@ -1193,6 +1193,8 @@ int ubi_get_dev_info1(libubi_t desc, int dev_num, struct ubi_dev_info *info) if (dev_get_major(lib, dev_num, &info->major, &info->minor)) return -1; + if (dev_read_int(lib->dev_mtd_num, dev_num, &info->mtd_num)) + return -1; if (dev_read_int(lib->dev_avail_ebs, dev_num, &info->avail_lebs)) return -1; if (dev_read_int(lib->dev_total_ebs, dev_num, &info->total_lebs)) -- cgit v1.2.3