part: Allow setting the partition-table type
Some devices have multiple partition types available on the same media. It is sometimes useful to see these to check that everything is working correctly. Provide a way to manually set the partition-table type, avoiding the auto-detection process. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
16
disk/part.c
16
disk/part.c
@@ -54,6 +54,22 @@ static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int part_get_type_by_name(const char *name)
|
||||
{
|
||||
struct part_driver *drv =
|
||||
ll_entry_start(struct part_driver, part_driver);
|
||||
const int n_ents = ll_entry_count(struct part_driver, part_driver);
|
||||
struct part_driver *entry;
|
||||
|
||||
for (entry = drv; entry != drv + n_ents; entry++) {
|
||||
if (!strcasecmp(name, entry->name))
|
||||
return entry->part_type;
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
return PART_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
|
||||
{
|
||||
struct blk_desc *dev_desc;
|
||||
|
||||
Reference in New Issue
Block a user