* grub-core/disk/diskfilter.c (grub_diskfilter_print_partmap)

[GRUB_UTIL]: New function.
	(insert_array) [GRUB_UTIL]: Store partmaps.
	* include/grub/diskfilter.h (grub_diskfilter_pv) [GRUB_UTIL]: New member
	partmaps.
	(grub_diskfilter_print_partmap) [GRUB_UTIL]: New proto.
	* util/grub-probe.c (probe_partmap): Call grub_diskfilter_print_partmap.
	(probe_abstraction): Print diskfilter and not raid.
	Reported by: Lennart Sorensen
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-11 11:57:47 +01:00
parent 0b6225bd27
commit 4786a90fee
4 changed files with 52 additions and 1 deletions

View file

@ -1,3 +1,15 @@
2012-02-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/diskfilter.c (grub_diskfilter_print_partmap)
[GRUB_UTIL]: New function.
(insert_array) [GRUB_UTIL]: Store partmaps.
* include/grub/diskfilter.h (grub_diskfilter_pv) [GRUB_UTIL]: New member
partmaps.
(grub_diskfilter_print_partmap) [GRUB_UTIL]: New proto.
* util/grub-probe.c (probe_partmap): Call grub_diskfilter_print_partmap.
(probe_abstraction): Print diskfilter and not raid.
Reported by: Lennart Sorensen
2012-02-11 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-11 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkimage.c (generate_image): Explicitly init decompress_size. * util/grub-mkimage.c (generate_image): Explicitly init decompress_size.

View file

@ -260,6 +260,24 @@ grub_diskfilter_memberlist (grub_disk_t disk)
return list; return list;
} }
void
grub_diskfilter_print_partmap (grub_disk_t disk)
{
struct grub_diskfilter_lv *lv = disk->data;
struct grub_diskfilter_pv *pv;
if (lv->vg->pvs)
for (pv = lv->vg->pvs; pv; pv = pv->next)
{
grub_size_t s;
if (!pv->disk)
grub_util_error (_("Couldn't find physical volume `%s'."
" Check your device.map"), pv->name);
for (s = 0; pv->partmaps[s]; s++)
grub_printf ("%s ", pv->partmaps[s]);
}
}
static const char * static const char *
grub_diskfilter_getname (struct grub_disk *disk) grub_diskfilter_getname (struct grub_disk *disk)
{ {
@ -964,6 +982,19 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
pv->part_start = grub_partition_get_start (disk->partition); pv->part_start = grub_partition_get_start (disk->partition);
pv->part_size = grub_disk_get_size (disk); pv->part_size = grub_disk_get_size (disk);
#ifdef GRUB_UTIL
{
grub_size_t s = 1;
grub_partition_t p;
for (p = disk->partition; p; p = p->parent)
s++;
pv->partmaps = xmalloc (s * sizeof (pv->partmaps[0]));
s = 0;
for (p = disk->partition; p; p = p->parent)
pv->partmaps[s++] = xstrdup (p->partmap->name);
pv->partmaps[s++] = 0;
}
#endif
if (start_sector != (grub_uint64_t)-1) if (start_sector != (grub_uint64_t)-1)
pv->start_sector = start_sector; pv->start_sector = start_sector;
pv->start_sector += pv->part_start; pv->start_sector += pv->part_start;

View file

@ -72,6 +72,9 @@ struct grub_diskfilter_pv {
struct grub_diskfilter_pv *next; struct grub_diskfilter_pv *next;
/* Optional. */ /* Optional. */
grub_uint8_t *internal_id; grub_uint8_t *internal_id;
#ifdef GRUB_UTIL
char **partmaps;
#endif
}; };
struct grub_diskfilter_lv { struct grub_diskfilter_lv {
@ -186,6 +189,8 @@ grub_diskfilter_read_node (const struct grub_diskfilter_node *node,
struct grub_diskfilter_pv * struct grub_diskfilter_pv *
grub_diskfilter_get_pv_from_disk (grub_disk_t disk, grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
struct grub_diskfilter_vg **vg); struct grub_diskfilter_vg **vg);
void
grub_diskfilter_print_partmap (grub_disk_t disk);
#endif #endif
#endif /* ! GRUB_RAID_H */ #endif /* ! GRUB_RAID_H */

View file

@ -87,6 +87,9 @@ probe_partmap (grub_disk_t disk)
for (part = disk->partition; part; part = part->parent) for (part = disk->partition; part; part = part->parent)
printf ("%s ", part->partmap->name); printf ("%s ", part->partmap->name);
if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID)
grub_diskfilter_print_partmap (disk);
/* In case of LVM/RAID, check the member devices as well. */ /* In case of LVM/RAID, check the member devices as well. */
if (disk->dev->memberlist) if (disk->dev->memberlist)
{ {
@ -304,7 +307,7 @@ probe_abstraction (grub_disk_t disk)
raid_level = probe_raid_level (disk); raid_level = probe_raid_level (disk);
if (raid_level >= 0) if (raid_level >= 0)
{ {
printf ("raid "); printf ("diskfilter ");
if (disk->dev->raidname) if (disk->dev->raidname)
printf ("%s ", disk->dev->raidname (disk)); printf ("%s ", disk->dev->raidname (disk));
} }