Correctly distinguish mdraid flavours.

* grub-core/disk/raid.c (grub_raid_getname) [GRUB_UTIL]: New function.
	(insert_array): New argument raid.
	* include/grub/disk.h (grub_disk_dev) [GRUB_UTIL]: New member raidname.
	* include/grub/raid.h (grub_raid_array) [GRUB_UTIL]: New member driver.
	* util/grub-probe.c (probe): PRint raidname instead of plainly "mdraid".
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-10-08 23:27:27 +02:00
parent 74baff844e
commit 20c6bb7e9e
5 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,13 @@
2010-10-08 Vladimir Serbinenko <phcoder@gmail.com>
Correctly distinguish mdraid flavours.
* grub-core/disk/raid.c (grub_raid_getname) [GRUB_UTIL]: New function.
(insert_array): New argument raid.
* include/grub/disk.h (grub_disk_dev) [GRUB_UTIL]: New member raidname.
* include/grub/raid.h (grub_raid_array) [GRUB_UTIL]: New member driver.
* util/grub-probe.c (probe): PRint raidname instead of plainly "mdraid".
2010-10-09 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/i386/pc/startup.S (grub_console_getkey): Fix incorrect

View file

@ -107,6 +107,14 @@ grub_raid_memberlist (grub_disk_t disk)
return list;
}
static const char *
grub_raid_getname (struct grub_disk *disk)
{
struct grub_raid_array *array = disk->data;
return array->driver->name;
}
#endif
static grub_err_t
@ -476,7 +484,8 @@ grub_raid_write (grub_disk_t disk __attribute ((unused)),
static grub_err_t
insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
grub_disk_addr_t start_sector, const char *scanner_name)
grub_disk_addr_t start_sector, const char *scanner_name,
grub_raid_t raid __attribute__ ((unused)))
{
struct grub_raid_array *array = 0, *p;
@ -524,6 +533,9 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
*array = *new_array;
array->nr_devs = 0;
#ifdef GRUB_UTIL
array->driver = raid;
#endif
grub_memset (&array->device, 0, sizeof (array->device));
grub_memset (&array->start_sector, 0, sizeof (array->start_sector));
@ -662,7 +674,8 @@ grub_raid_register (grub_raid_t raid)
if ((disk->total_sectors != GRUB_ULONG_MAX) &&
(! grub_raid_list->detect (disk, &array, &start_sector)) &&
(! insert_array (disk, &array, start_sector, grub_raid_list->name)))
(! insert_array (disk, &array, start_sector, grub_raid_list->name,
grub_raid_list)))
return 0;
/* This error usually means it's not raid, no need to display
@ -706,6 +719,7 @@ static struct grub_disk_dev grub_raid_dev =
.write = grub_raid_write,
#ifdef GRUB_UTIL
.memberlist = grub_raid_memberlist,
.raidname = grub_raid_getname,
#endif
.next = 0
};

View file

@ -78,6 +78,7 @@ struct grub_disk_dev
#ifdef GRUB_UTIL
struct grub_disk_memberlist *(*memberlist) (struct grub_disk *disk);
const char * (*raidname) (struct grub_disk *disk);
#endif
/* The next disk device. */

View file

@ -54,6 +54,10 @@ struct grub_raid_array
grub_disk_addr_t start_sector[GRUB_RAID_MAX_DEVICES];
/* Start of each device, in 512 byte sectors. */
struct grub_raid_array *next;
#ifdef GRUB_UTIL
struct grub_raid *driver;
#endif
};
struct grub_raid

View file

@ -175,7 +175,8 @@ probe (const char *path, char *device_name)
printf ("raid5rec ");
if (is_raid6)
printf ("raid6rec ");
printf ("mdraid ");
if (dev->disk->dev->raidname)
printf ("%s ", dev->disk->dev->raidname (dev->disk));
}
if (is_lvm)