2008-02-06 Robert Millan <rmh@aybabtu.com>

* util/grub-probe.c (probe): Simplify partmap probing (with the
        assumption that the first word up to the underscore equals to
        the module name).
This commit is contained in:
robertmh 2008-02-06 21:06:34 +00:00
parent b0dfd29ab2
commit 9216e0e742
2 changed files with 20 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2008-02-06 Robert Millan <rmh@aybabtu.com>
* util/grub-probe.c (probe): Simplify partmap probing (with the
assumption that the first word up to the underscore equals to
the module name).
2008-02-06 Christian Franke <franke@computer.org>
* fs/cpio.c (grub_cpio_find_file): Return GRUB_ERR_NONE

View file

@ -133,21 +133,23 @@ probe (const char *path)
if (print == PRINT_PARTMAP)
{
char *name;
char *underscore;
if (dev->disk->partition == NULL)
grub_util_error ("Cannot detect partition map for %s", drive_name);
if (strcmp (dev->disk->partition->partmap->name, "amiga_partition_map") == 0)
printf ("amiga\n");
else if (strcmp (dev->disk->partition->partmap->name, "apple_partition_map") == 0)
printf ("apple\n");
else if (strcmp (dev->disk->partition->partmap->name, "gpt_partition_map") == 0)
printf ("gpt\n");
else if (strcmp (dev->disk->partition->partmap->name, "pc_partition_map") == 0)
printf ("pc\n");
else if (strcmp (dev->disk->partition->partmap->name, "sun_partition_map") == 0)
printf ("sun\n");
else
grub_util_error ("Unknown partition map %s", dev->disk->partition->partmap->name);
name = strdup (dev->disk->partition->partmap->name);
if (! name)
grub_util_error ("not enough memory");
underscore = strchr (name, '_');
if (! underscore)
grub_util_error ("Invalid partition map %s", name);
*underscore = '\0';
printf ("%s\n", name);
free (name);
goto end;
}