diff options
Diffstat (limited to 'disk/part.c')
-rw-r--r-- | disk/part.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/disk/part.c b/disk/part.c index 6a1c02d..8317e80 100644 --- a/disk/part.c +++ b/disk/part.c @@ -615,3 +615,29 @@ cleanup: free(dup_str); return ret; } + +int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, + disk_partition_t *info) +{ + struct part_driver *first_drv = + ll_entry_start(struct part_driver, part_driver); + const int n_drvs = ll_entry_count(struct part_driver, part_driver); + struct part_driver *part_drv; + + for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) { + int ret; + int i; + for (i = 1; i < part_drv->max_entries; i++) { + ret = part_drv->get_info(dev_desc, i, info); + if (ret != 0) { + /* no more entries in table */ + break; + } + if (strcmp(name, (const char *)info->name) == 0) { + /* matched */ + return 0; + } + } + } + return -1; +} |