summaryrefslogtreecommitdiff
path: root/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff')
-rw-r--r--sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff158
1 files changed, 158 insertions, 0 deletions
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
new file mode 100644
index 00000000..3b060ba0
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
@@ -0,0 +1,158 @@
+diff -Nur -x '*.orig' -x '*~' grub2/include/grub/util/getroot.h grub2.new/include/grub/util/getroot.h
+--- grub2/include/grub/util/getroot.h 2009-11-29 18:42:14.000000000 -0800
++++ grub2.new/include/grub/util/getroot.h 2010-02-03 14:38:02.000000000 -0800
+@@ -19,12 +19,15 @@
+ #ifndef GRUB_UTIL_GETROOT_HEADER
+ #define GRUB_UTIL_GETROOT_HEADER 1
+
++#include <sys/types.h>
++
+ enum grub_dev_abstraction_types {
+ GRUB_DEV_ABSTRACTION_NONE,
+ GRUB_DEV_ABSTRACTION_LVM,
+ GRUB_DEV_ABSTRACTION_RAID,
+ };
+
++char *grub_find_device (const char *dir, dev_t dev);
+ char *grub_guess_root_device (const char *dir);
+ char *grub_get_prefix (const char *dir);
+ int grub_util_get_dev_abstraction (const char *os_dev);
+diff -Nur -x '*.orig' -x '*~' grub2/util/getroot.c grub2.new/util/getroot.c
+--- grub2/util/getroot.c 2010-02-01 14:33:16.000000000 -0800
++++ grub2.new/util/getroot.c 2010-02-03 14:38:02.000000000 -0800
+@@ -178,8 +178,8 @@
+
+ #ifdef __MINGW32__
+
+-static char *
+-find_root_device (const char *dir __attribute__ ((unused)),
++char *
++grub_find_device (const char *dir __attribute__ ((unused)),
+ dev_t dev __attribute__ ((unused)))
+ {
+ return 0;
+@@ -187,13 +187,22 @@
+
+ #elif ! defined(__CYGWIN__)
+
+-static char *
+-find_root_device (const char *dir, dev_t dev)
++char *
++grub_find_device (const char *dir, dev_t dev)
+ {
+ DIR *dp;
+ char *saved_cwd;
+ struct dirent *ent;
+
++ if (! dir)
++ {
++#ifdef __CYGWIN__
++ return NULL;
++#else
++ dir = "/dev";
++#endif
++ }
++
+ dp = opendir (dir);
+ if (! dp)
+ return 0;
+@@ -231,7 +240,7 @@
+ /* Find it recursively. */
+ char *res;
+
+- res = find_root_device (ent->d_name, dev);
++ res = grub_find_device (ent->d_name, dev);
+
+ if (res)
+ {
+@@ -334,8 +343,8 @@
+ return serial;
+ }
+
+-static char *
+-find_cygwin_root_device (const char *path, dev_t dev)
++char *
++grub_find_device (const char *path, dev_t dev)
+ {
+ /* No root device for /cygdrive. */
+ if (dev == (DEV_CYGDRIVE_MAJOR << 16))
+@@ -356,7 +365,7 @@
+
+ /* Cygwin returns the partition serial number in stat.st_dev.
+ This is never identical to the device number of the emulated
+- /dev/sdXN device, so above find_root_device () does not work.
++ /dev/sdXN device, so above grub_find_device () does not work.
+ Search the partition with the same serial in boot sector instead. */
+ char devpath[sizeof ("/dev/sda15") + 13]; /* Size + Paranoia. */
+ int d;
+@@ -449,12 +458,12 @@
+
+ #ifdef __CYGWIN__
+ /* Cygwin specific function. */
+- os_dev = find_cygwin_root_device (dir, st.st_dev);
++ os_dev = grub_find_device (dir, st.st_dev);
+
+ #else
+
+ /* This might be truly slow, but is there any better way? */
+- os_dev = find_root_device ("/dev", st.st_dev);
++ os_dev = grub_find_device ("/dev", st.st_dev);
+ #endif
+ #endif /* !__GNU__ */
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/raid.c grub2.new/util/raid.c
+--- grub2/util/raid.c 2010-02-01 14:33:15.000000000 -0800
++++ grub2.new/util/raid.c 2010-02-03 14:39:38.000000000 -0800
+@@ -21,40 +21,19 @@
+ #ifdef __linux__
+ #include <grub/util/misc.h>
+ #include <grub/util/raid.h>
++#include <grub/util/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)
+ {
+@@ -99,7 +78,8 @@
+
+ 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++;
+ }
+ }