Support RAID on virtio devices, and others.
* grub-core/kern/emu/getroot.c [__MINGW32__] (find_root_device): Rename to ... [__MINGW32__] (grub_find_device): ... this. [! __MINGW32__ && ! __CYGWIN__] (find_root_device): Rename to ... [! __MINGW32__ && ! __CYGWIN__] (grub_find_device): ... this. Use a reasonable default if dir is NULL. [! __MINGW32__ && __CYGWIN__] (find_cygwin_root_device): Rename to ... [! __MINGW32__ && __CYGWIN__] (grub_find_device): ... this. (grub_guess_root_device): Update callers. * include/grub/emu/getroot.h (grub_find_device): Add prototype. * util/raid.c (grub_util_getdiskname): Remove. (grub_util_raid_getmembers): Use grub_find_device rather than grub_util_getdiskname.
This commit is contained in:
parent
e5bfc130a4
commit
108538d8ff
4 changed files with 46 additions and 34 deletions
28
util/raid.c
28
util/raid.c
|
@ -22,40 +22,19 @@
|
|||
#include <grub/emu/misc.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/util/raid.h>
|
||||
#include <grub/emu/getroot.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/raid/md_p.h>
|
||||
#include <linux/raid/md_u.h>
|
||||
|
||||
static char *
|
||||
grub_util_getdiskname (int major, int minor)
|
||||
{
|
||||
char *name = xmalloc (15);
|
||||
|
||||
if (major == LOOP_MAJOR)
|
||||
sprintf (name, "/dev/loop%d", minor);
|
||||
else if (major == IDE0_MAJOR)
|
||||
sprintf (name, "/dev/hd%c", 'a' + minor / 64);
|
||||
else if (major == IDE1_MAJOR)
|
||||
sprintf (name, "/dev/hd%c", 'c' + minor / 64);
|
||||
else if (major == IDE2_MAJOR)
|
||||
sprintf (name, "/dev/hd%c", 'e' + minor / 64);
|
||||
else if (major == IDE3_MAJOR)
|
||||
sprintf (name, "/dev/hd%c", 'g' + minor / 64);
|
||||
else if (major == SCSI_DISK0_MAJOR)
|
||||
sprintf (name, "/dev/sd%c", 'a' + minor / 16);
|
||||
else
|
||||
grub_util_error ("unknown device number: %d, %d", major, minor);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
char **
|
||||
grub_util_raid_getmembers (char *name)
|
||||
{
|
||||
|
@ -100,7 +79,8 @@ grub_util_raid_getmembers (char *name)
|
|||
|
||||
if (disk.state & (1 << MD_DISK_ACTIVE))
|
||||
{
|
||||
devicelist[j] = grub_util_getdiskname (disk.major, disk.minor);
|
||||
devicelist[j] = grub_find_device (NULL,
|
||||
makedev (disk.major, disk.minor));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue