ieee1275: split up grub_machine_get_bootlocation

Split up some of the functionality in grub_machine_get_bootlocation into
grub_ieee1275_get_boot_dev.  This will allow for code reuse in a follow on
patch.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Eric Snowberg 2018-03-08 20:42:22 -08:00 committed by Daniel Kiper
parent c225298038
commit e2faabacff
3 changed files with 31 additions and 18 deletions

View file

@ -94,28 +94,12 @@ void
grub_machine_get_bootlocation (char **device, char **path)
{
char *bootpath;
grub_ssize_t bootpath_size;
char *filename;
char *type;
if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
&bootpath_size)
|| bootpath_size <= 0)
{
/* Should never happen. */
grub_printf ("/chosen/bootpath property missing!\n");
return;
}
bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
bootpath = grub_ieee1275_get_boot_dev ();
if (! bootpath)
{
grub_print_error ();
return;
}
grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
(grub_size_t) bootpath_size + 1, 0);
bootpath[bootpath_size] = '\0';
return;
/* Transform an OF device path to a GRUB path. */